Skip to content

Commit d5f443a

Browse files
Merge pull request #2962 from RedisInsight/feature/RI-5310_cover_new_tutorials
#RI-5310 - cover new tutorials
2 parents 1b18e02 + 2e03e37 commit d5f443a

File tree

48 files changed

+270
-641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+270
-641
lines changed

redisinsight/api/config/default.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ export default {
2929
pluginsAssets: join(staticDir, 'resources', 'plugins'),
3030
commands: join(homedir, 'commands'),
3131
defaultCommandsDir: join(defaultsDir, 'commands'),
32-
guides: process.env.RI_GUIDES_PATH || join(homedir, 'guides'),
33-
defaultGuides: join(defaultsDir, 'guides'),
3432
tutorials: process.env.RI_TUTORIALS_PATH || join(homedir, 'tutorials'),
3533
defaultTutorials: join(defaultsDir, 'tutorials'),
3634
content: process.env.RI_CONTENT_PATH || join(homedir, 'content'),
@@ -47,7 +45,6 @@ export default {
4745
globalPrefix: 'api',
4846
customPluginsUri: '/plugins',
4947
staticUri: '/static',
50-
guidesUri: '/static/guides',
5148
tutorialsUri: '/static/tutorials',
5249
customTutorialsUri: '/static/custom-tutorials',
5350
contentUri: '/static/content',
@@ -110,23 +107,16 @@ export default {
110107
plugins: {
111108
stateMaxSize: parseInt(process.env.RI_PLUGIN_STATE_MAX_SIZE, 10) || 1024 * 1024,
112109
},
113-
guides: {
114-
updateUrl: process.env.RI_GUIDES_UPDATE_URL
115-
|| 'https://github.com/RedisInsight/Guides/releases/download/2.x.x',
116-
zip: process.env.RI_GUIDES_ZIP || dataZipFileName,
117-
buildInfo: process.env.RI_GUIDES_INFO || buildInfoFileName,
118-
devMode: !!process.env.RI_GUIDES_PATH,
119-
},
120110
tutorials: {
121111
updateUrl: process.env.RI_TUTORIALS_UPDATE_URL
122-
|| 'https://github.com/RedisInsight/Tutorials/releases/download/2.x.x',
112+
|| 'https://github.com/RedisInsight/Tutorials/releases/download/2.42',
123113
zip: process.env.RI_TUTORIALS_ZIP || dataZipFileName,
124114
buildInfo: process.env.RI_TUTORIALS_INFO || buildInfoFileName,
125115
devMode: !!process.env.RI_TUTORIALS_PATH,
126116
},
127117
content: {
128118
updateUrl: process.env.RI_CONTENT_UPDATE_URL
129-
|| 'https://github.com/RedisInsight/Statics/releases/download/latest',
119+
|| 'https://github.com/RedisInsight/Statics/releases/download/2.42',
130120
zip: process.env.RI_CONTENT_ZIP || dataZipFileName,
131121
buildInfo: process.env.RI_CONTENT_INFO || buildInfoFileName,
132122
devMode: !!process.env.RI_CONTENT_PATH,

redisinsight/api/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
},
1111
"scripts": {
1212
"build:defaults:commands": "ts-node ./scripts/default-commands.ts",
13-
"build:defaults:guides": "ts-node ./scripts/default-guides.ts",
1413
"build:defaults:tutorials": "ts-node ./scripts/default-tutorials.ts",
1514
"build:defaults:content": "ts-node ./scripts/default-content.ts",
16-
"build:defaults": "yarn build:defaults:guides && yarn build:defaults:commands && yarn build:defaults:content && yarn build:defaults:tutorials",
15+
"build:defaults": "yarn build:defaults:commands && yarn build:defaults:content && yarn build:defaults:tutorials",
1716
"prebuild": "rimraf dist",
1817
"build": "nest build",
1918
"build:prod": "rimraf dist && nest build -p ./tsconfig.build.prod.json && cross-env NODE_ENV=production",

redisinsight/api/scripts/default-guides.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

redisinsight/api/src/init-helper.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,16 @@ export const migrateHomeFolder = async () => {
3838
// continue initialization even without migration
3939
}
4040
};
41+
42+
/**
43+
* Remove old guides folder
44+
*/
45+
export const removeGuidesFolder = async () => {
46+
try {
47+
if (await fs.pathExists(PATH_CONFIG.guides)) {
48+
await fs.rm(PATH_CONFIG.guides, { recursive: true, force: true });
49+
}
50+
} catch (e) {
51+
// continue initialization even without migration
52+
}
53+
};

redisinsight/api/src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as bodyParser from 'body-parser';
77
import { WinstonModule } from 'nest-winston';
88
import { GlobalExceptionFilter } from 'src/exceptions/global-exception.filter';
99
import { get, Config } from 'src/utils';
10-
import { migrateHomeFolder } from 'src/init-helper';
10+
import { migrateHomeFolder, removeGuidesFolder } from 'src/init-helper';
1111
import { LogFileProvider } from 'src/modules/profiler/providers/log-file.provider';
1212
import { WindowsAuthAdapter } from 'src/modules/auth/window-auth/adapters/window-auth.adapter';
1313
import { AppModule } from './app.module';
@@ -24,6 +24,7 @@ interface IApp {
2424

2525
export default async function bootstrap(apiPort?: number): Promise<IApp> {
2626
await migrateHomeFolder();
27+
await removeGuidesFolder();
2728

2829
const { port, host } = serverConfig;
2930
const logger = WinstonModule.createLogger(LOGGER_CONFIG);

redisinsight/api/src/modules/statics-management/providers/auto-updated-statics.provider.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import config from 'src/utils/config';
44
import { AutoUpdatedStaticsProvider } from './auto-updated-statics.provider';
55

66
const PATH_CONFIG = config.get('dir_path');
7-
const GUIDES = config.get('guides');
7+
const TUTORIALS = config.get('tutorials');
88

99
jest.mock('axios');
1010
const mockedAxios = axios as jest.Mocked<typeof axios>;
@@ -26,13 +26,13 @@ describe('AutoUpdatedStaticsProvider', () => {
2626
jest.mock('adm-zip', () => jest.fn().mockImplementation(() => mockedAdmZip));
2727

2828
service = new AutoUpdatedStaticsProvider({
29-
name: 'GuidesProvider',
30-
destinationPath: PATH_CONFIG.guides,
31-
defaultSourcePath: PATH_CONFIG.defaultGuides,
32-
updateUrl: GUIDES.updateUrl,
33-
buildInfo: GUIDES.buildInfo,
34-
zip: GUIDES.zip,
35-
devMode: GUIDES.devMode,
29+
name: 'TutorialsProvider',
30+
destinationPath: PATH_CONFIG.tutorials,
31+
defaultSourcePath: PATH_CONFIG.defaultTutorials,
32+
updateUrl: TUTORIALS.updateUrl,
33+
buildInfo: TUTORIALS.buildInfo,
34+
zip: TUTORIALS.zip,
35+
devMode: TUTORIALS.devMode,
3636
});
3737
});
3838

redisinsight/api/src/modules/statics-management/statics-management.module.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,12 @@ import { AutoUpdatedStaticsProvider } from './providers/auto-updated-statics.pro
66

77
const SERVER_CONFIG = config.get('server') as Config['server'];
88
const PATH_CONFIG = config.get('dir_path') as Config['dir_path'];
9-
const GUIDES_CONFIG = config.get('guides') as Config['guides'];
109
const TUTORIALS_CONFIG = config.get('tutorials') as Config['tutorials'];
1110

1211
const CONTENT_CONFIG = config.get('content');
1312

1413
@Module({
1514
imports: [
16-
ServeStaticModule.forRoot({
17-
serveRoot: SERVER_CONFIG.guidesUri,
18-
rootPath: join(PATH_CONFIG.guides),
19-
serveStaticOptions: {
20-
fallthrough: false,
21-
},
22-
}),
2315
ServeStaticModule.forRoot({
2416
serveRoot: SERVER_CONFIG.tutorialsUri,
2517
rootPath: join(PATH_CONFIG.tutorials),
@@ -64,15 +56,6 @@ const CONTENT_CONFIG = config.get('content');
6456
}),
6557
],
6658
providers: [
67-
{
68-
provide: 'GuidesProvider',
69-
useFactory: () => new AutoUpdatedStaticsProvider({
70-
name: 'GuidesProvider',
71-
destinationPath: PATH_CONFIG.guides,
72-
defaultSourcePath: PATH_CONFIG.defaultGuides,
73-
...GUIDES_CONFIG,
74-
}),
75-
},
7659
{
7760
provide: 'TutorialsProvider',
7861
useFactory: () => new AutoUpdatedStaticsProvider({

redisinsight/ui/src/components/config/Config.spec.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { appServerInfoSelector, getServerInfo } from 'uiSrc/slices/app/info'
1515
import { processCliClient } from 'uiSrc/slices/cli/cli-settings'
1616
import { getRedisCommands } from 'uiSrc/slices/app/redis-commands'
1717
import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features'
18-
import { getWBGuides } from 'uiSrc/slices/workbench/wb-guides'
1918
import { getWBTutorials } from 'uiSrc/slices/workbench/wb-tutorials'
2019
import { getContentRecommendations } from 'uiSrc/slices/recommendations/recommendations'
2120
import { getGuideLinks } from 'uiSrc/slices/content/guide-links'
@@ -68,7 +67,6 @@ describe('Config', () => {
6867
getNotifications(),
6968
getContentRecommendations(),
7069
getGuideLinks(),
71-
getWBGuides(),
7270
getWBTutorials(),
7371
getWBCustomTutorials(),
7472
getFeatureFlags(),
@@ -106,7 +104,6 @@ describe('Config', () => {
106104
getNotifications(),
107105
getContentRecommendations(),
108106
getGuideLinks(),
109-
getWBGuides(),
110107
getWBTutorials(),
111108
getWBCustomTutorials(),
112109
getFeatureFlags(),

redisinsight/ui/src/components/config/Config.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
import { setFavicon, isDifferentConsentsExists } from 'uiSrc/utils'
2424
import { fetchUnsupportedCliCommandsAction } from 'uiSrc/slices/cli/cli-settings'
2525
import { fetchRedisCommandsInfo } from 'uiSrc/slices/app/redis-commands'
26-
import { fetchGuides } from 'uiSrc/slices/workbench/wb-guides'
2726
import { fetchTutorials } from 'uiSrc/slices/workbench/wb-tutorials'
2827
import { fetchCustomTutorials } from 'uiSrc/slices/workbench/wb-custom-tutorials'
2928
import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features'
@@ -52,8 +51,7 @@ const Config = () => {
5251
dispatch(fetchContentRecommendations())
5352
dispatch(fetchGuideLinksAction())
5453

55-
// get guides & tutorials
56-
dispatch(fetchGuides())
54+
// get tutorials
5755
dispatch(fetchTutorials())
5856
dispatch(fetchCustomTutorials())
5957

redisinsight/ui/src/components/database-side-panels/DatabaseSidePanels.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jest.mock('uiSrc/telemetry', () => ({
7676

7777
jest.mock('uiSrc/utils', () => ({
7878
...jest.requireActual('uiSrc/utils'),
79-
getTutorialCapability: jest.fn().mockReturnValue({ tutorialPage: { id: 'id' }, telemetryName: 'searchAndQuery' }),
79+
getTutorialCapability: jest.fn().mockReturnValue({ path: 'path', telemetryName: 'searchAndQuery' }),
8080
}))
8181

8282
jest.mock('uiSrc/services', () => ({
@@ -243,6 +243,8 @@ describe('DatabaseSidePanels', () => {
243243
render(<DatabaseSidePanels />)
244244

245245
const expectedActions = [
246+
resetExplorePanelSearch(),
247+
setExplorePanelIsPageOpen(false),
246248
changeSelectedTab(InsightsPanelTabs.Explore),
247249
toggleInsightsPanel(true),
248250
]

0 commit comments

Comments
 (0)