Skip to content

Commit a7ac51a

Browse files
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight into feature/RI-4075_livetime_recommendations
2 parents 869189a + c66bf77 commit a7ac51a

File tree

14 files changed

+52
-14
lines changed

14 files changed

+52
-14
lines changed

redisinsight/api/src/modules/custom-tutorial/providers/custom-tutorial.manifest.provider.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
mockCustomTutorial,
88
mockCustomTutorialManifest, mockCustomTutorialManifestJson,
99
} from 'src/__mocks__';
10+
import * as Utils from 'src/utils/path';
1011

1112
jest.mock('fs-extra');
1213
const mFs = fs as jest.Mocked<typeof fs>;
@@ -61,6 +62,8 @@ describe('CustomTutorialManifestProvider', () => {
6162
expect(result).toEqual([]);
6263
});
6364
it('should return empty array for empty folder', async () => {
65+
const spy = jest.spyOn(Utils as any, 'winPathToNormalPath');
66+
6467
// root level entries
6568
const mockRootLevelEntries = [
6669
'intro.md',
@@ -160,6 +163,7 @@ describe('CustomTutorialManifestProvider', () => {
160163
type: 'group',
161164
},
162165
]);
166+
expect(spy).toBeCalledTimes(5); // Should call util to fix win path
163167
});
164168
});
165169

redisinsight/api/src/modules/custom-tutorial/providers/custom-tutorial.manifest.provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
RootCustomTutorialManifest,
1010
} from 'src/modules/custom-tutorial/models/custom-tutorial.manifest';
1111
import { plainToClass } from 'class-transformer';
12+
import { winPathToNormalPath } from 'src/utils';
1213

1314
const MANIFEST_FILE = 'manifest.json';
1415
const SYS_MANIFEST_FILE = '_manifest.json';
@@ -75,7 +76,7 @@ export class CustomTutorialManifestProvider {
7576
label: name,
7677
type: CustomTutorialManifestType.InternalLink,
7778
args: {
78-
path: join(relativePath, entry),
79+
path: winPathToNormalPath(join(relativePath, entry)),
7980
},
8081
});
8182
}

redisinsight/api/src/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ export * from './redis-connection-helper';
99
export * from './class-transformer';
1010
export * from './file-helper';
1111
export * from './recommendation-helper';
12+
export * from './path';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { winPathToNormalPath } from 'src/utils';
2+
3+
const winPathToNormalPathTests: Record<string, any>[] = [
4+
{ input: '\\dir/file.js', output: '/dir/file.js' },
5+
{ input: '/dir/file.js', output: '/dir/file.js' },
6+
{ input: 'file.js', output: 'file.js' },
7+
{ input: '\\file.js', output: '/file.js' },
8+
{ input: '\\dir\\file.js', output: '/dir/file.js' },
9+
{ input: 'dir/file.js', output: 'dir/file.js' },
10+
];
11+
12+
describe('winPathToNormalPath', () => {
13+
winPathToNormalPathTests.forEach((test) => {
14+
it(`should be output: ${test.output} for input: ${JSON.stringify(test.input)}`, () => {
15+
const result = winPathToNormalPath(test.input);
16+
17+
expect(result).toEqual(test.output);
18+
});
19+
});
20+
});

redisinsight/api/src/utils/path.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const winPathToNormalPath = (path: string) => path.replace(/\\/g, '/');

redisinsight/ui/src/components/navigation-menu/components/help-menu/HelpMenu.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ const HelpMenu = () => {
4343
}
4444

4545
const onClickReleaseNotes = async () => {
46-
dispatch(addMessageNotification(
47-
successMessages.INSTALLED_NEW_UPDATE('2.2.1', () => dispatch(setReleaseNotesViewed(true)))
48-
))
4946
sendEventTelemetry({
5047
event: TelemetryEvent.RELEASE_NOTES_LINK_CLICKED,
5148
eventData: {

redisinsight/ui/src/constants/mocks/mock-guides.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ export const MOCK_GUIDES_ITEMS: IEnablementAreaItem[] = [
3030
args: {
3131
path: 'quick-guides/working-with-hash.html',
3232
},
33+
},
34+
{
35+
type: EnablementAreaComponent.InternalLink,
36+
id: 'working-with-hash-2',
37+
label: 'Working with HASH',
38+
args: {
39+
path: '\\quick-guides\\working-with-hash.html',
40+
},
3341
}
3442
]
3543
},

redisinsight/ui/src/pages/browser/components/bulk-actions/BulkActions.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ describe('BulkActions', () => {
158158
action: BulkActionsType.Delete,
159159
filter: {
160160
match: '*',
161-
filterType: 'hash'
161+
type: 'hash'
162162
}
163163
}
164164
})

redisinsight/ui/src/pages/browser/components/bulk-actions/BulkActionsTabs/BulkActionsTabs.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('BulkActionsTabs', () => {
6262
action: BulkActionsType.Delete,
6363
filter: {
6464
match: 'PATTERN',
65-
filter: 'set'
65+
type: 'set'
6666
}
6767
}
6868
});

redisinsight/ui/src/pages/workbench/components/enablement-area/EnablementArea/utils/getFileInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const getMarkdownPathByManifest = (
9696
if (!manifestPath || !manifest) return pathPrefix
9797
const path = removeManifestPrefix(manifestPath)
9898
const pathToMarkDown = path.replaceAll('/', '.children.')
99-
const markDownPath = get(manifest, pathToMarkDown)?.args?.path
99+
const markDownPath = get(manifest, pathToMarkDown)?.args?.path?.replaceAll('\\', '/')
100100

101101
if (!markDownPath) return ''
102102

@@ -115,7 +115,7 @@ export const getMarkdownPathByManifest = (
115115
return undefined
116116
})
117117

118-
return pathPrefix + folderPath + (markDownPath.match(/^(\/|\\)/) ? markDownPath : '/'.concat(markDownPath))
118+
return pathPrefix + folderPath + (markDownPath.match(/^(\/)/) ? markDownPath : '/'.concat(markDownPath))
119119
}
120120

121121
export const removeManifestPrefix = (path?: string): string => path

0 commit comments

Comments
 (0)