@grafana/create-plugin 3.2.0-canary.710.bf8a22d.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/bin/run.js +1 -1
- package/dist/commands/generate.command.js +0 -3
- package/dist/commands/update.command.js +22 -2
- package/dist/utils/utils.config.js +0 -1
- package/dist/utils/utils.console.js +16 -0
- package/dist/utils/utils.git.js +23 -0
- package/dist/utils/utils.templates.js +1 -4
- package/package.json +3 -2
- package/src/bin/run.ts +1 -1
- package/src/commands/generate.command.ts +0 -3
- package/src/commands/types.ts +0 -3
- package/src/commands/update.command.ts +27 -2
- package/src/utils/utils.config.ts +0 -5
- package/src/utils/utils.console.ts +30 -1
- package/src/utils/utils.git.ts +29 -0
- package/src/utils/utils.templates.ts +1 -4
- package/templates/app/src/components/App/App.tsx +8 -7
- package/templates/common/.config/webpack/webpack.config.ts +2 -2
- package/templates/common/.cprc.json +0 -2
- package/templates/common/_package.json +3 -3
- package/templates/scenes-app/src/components/Routes/Routes.tsx +10 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v3.2.0 (Thu Feb 01 2024)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- Create-plugin: Check for a clean working tree [#705](https://github.com/grafana/plugin-tools/pull/705) ([@leventebalogh](https://github.com/leventebalogh))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Levente Balogh ([@leventebalogh](https://github.com/leventebalogh))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v3.1.3 (Mon Jan 29 2024)
|
|
2
14
|
|
|
3
15
|
#### 🐛 Bug Fix
|
package/dist/bin/run.js
CHANGED
|
@@ -57,9 +57,6 @@ function getTemplateData(answers) {
|
|
|
57
57
|
isNPM: packageManagerName === 'npm',
|
|
58
58
|
version: currentVersion,
|
|
59
59
|
bundleGrafanaUI: features.bundleGrafanaUI,
|
|
60
|
-
useReactRouterV6: features.useReactRouterV6,
|
|
61
|
-
useReactRouterTypes: !features.useReactRouterV6 && isAppType,
|
|
62
|
-
reactRouterVersion: features.useReactRouterV6 ? '6.10.0' : '5.2.0',
|
|
63
60
|
};
|
|
64
61
|
return templateData;
|
|
65
62
|
}
|
|
@@ -1,10 +1,30 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
1
2
|
import { TEXT, UDPATE_CONFIG } from '../constants.js';
|
|
2
3
|
import { compileTemplateFiles, getTemplateData } from '../utils/utils.templates.js';
|
|
3
|
-
import { confirmPrompt, selectPrompt, printMessage, printSuccessMessage } from '../utils/utils.console.js';
|
|
4
|
+
import { confirmPrompt, selectPrompt, printMessage, printSuccessMessage, printRedBox } from '../utils/utils.console.js';
|
|
4
5
|
import { updatePackageJson, hasNpmDependenciesToUpdate, getPackageJsonUpdatesAsText, updateNpmScripts, writePackageManagerInPackageJson, } from '../utils/utils.npm.js';
|
|
5
6
|
import { getPackageManagerWithFallback } from '../utils/utils.packageManager.js';
|
|
6
|
-
|
|
7
|
+
import { isGitDirectory, isGitDirectoryClean } from '../utils/utils.git.js';
|
|
8
|
+
export const update = async (argv) => {
|
|
7
9
|
try {
|
|
10
|
+
if (!(await isGitDirectory()) && !argv.force) {
|
|
11
|
+
printRedBox({
|
|
12
|
+
title: 'You are not inside a git directory',
|
|
13
|
+
content: `In order to proceed please run "git init" in the root of your project and commit your changes.\n
|
|
14
|
+
(This check is necessary to make sure that the updates are easy to revert and don't mess with any changes you currently have.
|
|
15
|
+
In case you want to proceed as is please use the ${chalk.bold('--force')} flag.)`,
|
|
16
|
+
});
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
if (!(await isGitDirectoryClean()) && !argv.force) {
|
|
20
|
+
printRedBox({
|
|
21
|
+
title: 'Please clean your repository working tree before updating.',
|
|
22
|
+
subtitle: '(Commit your changes or stash them.)',
|
|
23
|
+
content: `(This check is necessary to make sure that the updates are easy to revert and don't mess with any changes you currently have.
|
|
24
|
+
In case you want to proceed as is please use the ${chalk.bold('--force')} flag.)`,
|
|
25
|
+
});
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
8
28
|
printMessage(TEXT.updateCommandWarning);
|
|
9
29
|
if (await confirmPrompt(TEXT.updateConfigPrompt)) {
|
|
10
30
|
compileTemplateFiles(UDPATE_CONFIG.filesToOverride, getTemplateData());
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { marked } from 'marked';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
+
import boxen from 'boxen';
|
|
3
4
|
import TerminalRenderer from 'marked-terminal';
|
|
4
5
|
import Enquirer from 'enquirer';
|
|
5
6
|
const { prompt } = Enquirer;
|
|
@@ -40,3 +41,18 @@ export async function selectPrompt(message, choices) {
|
|
|
40
41
|
});
|
|
41
42
|
return question['selectPrompt'];
|
|
42
43
|
}
|
|
44
|
+
export function printRedBox({ title, subtitle, content }) {
|
|
45
|
+
printBox({ title, subtitle, content, color: 'red' });
|
|
46
|
+
}
|
|
47
|
+
export function printBlueBox({ title, subtitle, content }) {
|
|
48
|
+
printBox({ title, subtitle, content, color: 'blue' });
|
|
49
|
+
}
|
|
50
|
+
export function printGreenBox({ title, subtitle, content }) {
|
|
51
|
+
printBox({ title, subtitle, content, color: 'green' });
|
|
52
|
+
}
|
|
53
|
+
export function printBox({ title, subtitle, content, color = 'gray' }) {
|
|
54
|
+
console.log(boxen(chalk[color](`${chalk.bold(title)}${subtitle ? ` ${subtitle}` : ''}\n\n${content}`), {
|
|
55
|
+
padding: 1,
|
|
56
|
+
borderColor: color,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { exec as nodeExec } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
const exec = promisify(nodeExec);
|
|
4
|
+
export async function isGitDirectory() {
|
|
5
|
+
let command = 'git rev-parse --is-inside-work-tree';
|
|
6
|
+
try {
|
|
7
|
+
const response = await exec(command);
|
|
8
|
+
return response.stdout.trim() === 'true';
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export async function isGitDirectoryClean() {
|
|
15
|
+
try {
|
|
16
|
+
let command = 'git status --porcelain';
|
|
17
|
+
const response = await exec(command);
|
|
18
|
+
return response.stdout.trim() === '';
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -5,7 +5,7 @@ import mkdirp from 'mkdirp';
|
|
|
5
5
|
import { filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
|
|
6
6
|
import { renderHandlebarsTemplate } from './utils.handlebars.js';
|
|
7
7
|
import { getPluginJson } from './utils.plugin.js';
|
|
8
|
-
import { TEMPLATE_PATHS, EXPORT_PATH_PREFIX, EXTRA_TEMPLATE_VARIABLES
|
|
8
|
+
import { TEMPLATE_PATHS, EXPORT_PATH_PREFIX, EXTRA_TEMPLATE_VARIABLES } from '../constants.js';
|
|
9
9
|
import { getPackageManagerWithFallback } from './utils.packageManager.js';
|
|
10
10
|
import { getExportFileName } from '../utils/utils.files.js';
|
|
11
11
|
import { getVersion } from './utils.version.js';
|
|
@@ -69,8 +69,5 @@ export function getTemplateData() {
|
|
|
69
69
|
packageManagerVersion,
|
|
70
70
|
version: currentVersion,
|
|
71
71
|
bundleGrafanaUI: features.bundleGrafanaUI,
|
|
72
|
-
useReactRouterV6: features.useReactRouterV6,
|
|
73
|
-
useReactRouterTypes: !features.useReactRouterV6 && pluginJson.type === PLUGIN_TYPES.app,
|
|
74
|
-
reactRouterVersion: features.useReactRouterV6 ? '6.10.0' : '5.2.0',
|
|
75
72
|
};
|
|
76
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "3.2.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/create-plugin",
|
|
6
6
|
"url": "https://github.com/grafana/plugin-tools"
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@types/mkdirp": "^1.0.2",
|
|
46
46
|
"@types/semver": "^7.3.9",
|
|
47
47
|
"@types/which": "^2.0.2",
|
|
48
|
+
"boxen": "^7.1.1",
|
|
48
49
|
"chalk": "^5.3.0",
|
|
49
50
|
"change-case": "^5.4.0",
|
|
50
51
|
"enquirer": "^2.4.1",
|
|
@@ -85,5 +86,5 @@
|
|
|
85
86
|
"engines": {
|
|
86
87
|
"node": ">=20"
|
|
87
88
|
},
|
|
88
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "96e111bfcc9615a97c3085f16646d1bb76f5ddb4"
|
|
89
90
|
}
|
package/src/bin/run.ts
CHANGED
|
@@ -13,7 +13,7 @@ if (isUnsupportedPlatform()) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const args = process.argv.slice(2);
|
|
16
|
-
const argv = minimist(args);
|
|
16
|
+
const argv = minimist(args, { alias: { f: 'force' } });
|
|
17
17
|
const commands: Record<string, (argv: minimist.ParsedArgs) => void> = {
|
|
18
18
|
migrate,
|
|
19
19
|
generate,
|
|
@@ -69,9 +69,6 @@ function getTemplateData(answers: CliArgs) {
|
|
|
69
69
|
isNPM: packageManagerName === 'npm',
|
|
70
70
|
version: currentVersion,
|
|
71
71
|
bundleGrafanaUI: features.bundleGrafanaUI,
|
|
72
|
-
useReactRouterV6: features.useReactRouterV6,
|
|
73
|
-
useReactRouterTypes: !features.useReactRouterV6 && isAppType, // v6 is written in typescript, so it's only needed for <v6
|
|
74
|
-
reactRouterVersion: features.useReactRouterV6 ? '6.10.0' : '5.2.0',
|
|
75
72
|
};
|
|
76
73
|
|
|
77
74
|
return templateData;
|
package/src/commands/types.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import minimist from 'minimist';
|
|
2
|
+
import chalk from 'chalk';
|
|
1
3
|
import { TEXT, UDPATE_CONFIG } from '../constants.js';
|
|
2
4
|
import { compileTemplateFiles, getTemplateData } from '../utils/utils.templates.js';
|
|
3
|
-
import { confirmPrompt, selectPrompt, printMessage, printSuccessMessage } from '../utils/utils.console.js';
|
|
5
|
+
import { confirmPrompt, selectPrompt, printMessage, printSuccessMessage, printRedBox } from '../utils/utils.console.js';
|
|
4
6
|
import {
|
|
5
7
|
updatePackageJson,
|
|
6
8
|
hasNpmDependenciesToUpdate,
|
|
@@ -9,9 +11,32 @@ import {
|
|
|
9
11
|
writePackageManagerInPackageJson,
|
|
10
12
|
} from '../utils/utils.npm.js';
|
|
11
13
|
import { getPackageManagerWithFallback } from '../utils/utils.packageManager.js';
|
|
14
|
+
import { isGitDirectory, isGitDirectoryClean } from '../utils/utils.git.js';
|
|
12
15
|
|
|
13
|
-
export const update = async () => {
|
|
16
|
+
export const update = async (argv: minimist.ParsedArgs) => {
|
|
14
17
|
try {
|
|
18
|
+
if (!(await isGitDirectory()) && !argv.force) {
|
|
19
|
+
printRedBox({
|
|
20
|
+
title: 'You are not inside a git directory',
|
|
21
|
+
content: `In order to proceed please run "git init" in the root of your project and commit your changes.\n
|
|
22
|
+
(This check is necessary to make sure that the updates are easy to revert and don't mess with any changes you currently have.
|
|
23
|
+
In case you want to proceed as is please use the ${chalk.bold('--force')} flag.)`,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!(await isGitDirectoryClean()) && !argv.force) {
|
|
30
|
+
printRedBox({
|
|
31
|
+
title: 'Please clean your repository working tree before updating.',
|
|
32
|
+
subtitle: '(Commit your changes or stash them.)',
|
|
33
|
+
content: `(This check is necessary to make sure that the updates are easy to revert and don't mess with any changes you currently have.
|
|
34
|
+
In case you want to proceed as is please use the ${chalk.bold('--force')} flag.)`,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
15
40
|
// 0. Warning
|
|
16
41
|
// ----------
|
|
17
42
|
printMessage(TEXT.updateCommandWarning);
|
|
@@ -4,10 +4,6 @@ import { getVersion } from './utils.version.js';
|
|
|
4
4
|
|
|
5
5
|
type FeatureFlags = {
|
|
6
6
|
bundleGrafanaUI: boolean;
|
|
7
|
-
|
|
8
|
-
// If set to true, the plugin will be scaffolded with React Router v6. Defaults to true.
|
|
9
|
-
// (Attention! We always scaffold new projects with React Router v6, so if you are changing this to `false` manually you will need to make changes to the React code as well.)
|
|
10
|
-
useReactRouterV6: boolean;
|
|
11
7
|
};
|
|
12
8
|
|
|
13
9
|
type CreatePluginConfig = UserConfig & {
|
|
@@ -70,7 +66,6 @@ function readRCFileSync(path: string): CreatePluginConfig | undefined {
|
|
|
70
66
|
|
|
71
67
|
function createFeatureFlags(flags?: FeatureFlags): FeatureFlags {
|
|
72
68
|
return {
|
|
73
|
-
useReactRouterV6: true,
|
|
74
69
|
bundleGrafanaUI: false,
|
|
75
70
|
...flags,
|
|
76
71
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { marked } from 'marked';
|
|
2
|
-
import chalk from 'chalk';
|
|
2
|
+
import chalk, { type ForegroundColorName } from 'chalk';
|
|
3
|
+
import boxen from 'boxen';
|
|
3
4
|
import TerminalRenderer from 'marked-terminal';
|
|
4
5
|
import Enquirer from 'enquirer';
|
|
5
6
|
|
|
@@ -51,3 +52,31 @@ export async function selectPrompt(message: string, choices: string[]): Promise<
|
|
|
51
52
|
|
|
52
53
|
return question['selectPrompt'];
|
|
53
54
|
}
|
|
55
|
+
|
|
56
|
+
type PrintBoxArgs = {
|
|
57
|
+
title: string;
|
|
58
|
+
content: string;
|
|
59
|
+
subtitle?: string;
|
|
60
|
+
color?: ForegroundColorName;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export function printRedBox({ title, subtitle, content }: PrintBoxArgs) {
|
|
64
|
+
printBox({ title, subtitle, content, color: 'red' });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function printBlueBox({ title, subtitle, content }: PrintBoxArgs) {
|
|
68
|
+
printBox({ title, subtitle, content, color: 'blue' });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function printGreenBox({ title, subtitle, content }: PrintBoxArgs) {
|
|
72
|
+
printBox({ title, subtitle, content, color: 'green' });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function printBox({ title, subtitle, content, color = 'gray' }: PrintBoxArgs) {
|
|
76
|
+
console.log(
|
|
77
|
+
boxen(chalk[color](`${chalk.bold(title)}${subtitle ? ` ${subtitle}` : ''}\n\n${content}`), {
|
|
78
|
+
padding: 1,
|
|
79
|
+
borderColor: color,
|
|
80
|
+
})
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { exec as nodeExec } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
|
|
4
|
+
const exec = promisify(nodeExec);
|
|
5
|
+
|
|
6
|
+
export async function isGitDirectory() {
|
|
7
|
+
let command = 'git rev-parse --is-inside-work-tree';
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
const response = await exec(command);
|
|
11
|
+
|
|
12
|
+
return response.stdout.trim() === 'true';
|
|
13
|
+
} catch (error) {
|
|
14
|
+
// We also return `false` if the command fails (e.g. if the user doesn't have git installed)
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function isGitDirectoryClean() {
|
|
20
|
+
try {
|
|
21
|
+
let command = 'git status --porcelain';
|
|
22
|
+
const response = await exec(command);
|
|
23
|
+
|
|
24
|
+
return response.stdout.trim() === '';
|
|
25
|
+
} catch (error) {
|
|
26
|
+
// We also return `false` if the command fails (e.g. if the user doesn't have git installed)
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -5,7 +5,7 @@ import mkdirp from 'mkdirp';
|
|
|
5
5
|
import { filterOutCommonFiles, isFile, isFileStartingWith } from './utils.files.js';
|
|
6
6
|
import { renderHandlebarsTemplate } from './utils.handlebars.js';
|
|
7
7
|
import { getPluginJson } from './utils.plugin.js';
|
|
8
|
-
import { TEMPLATE_PATHS, EXPORT_PATH_PREFIX, EXTRA_TEMPLATE_VARIABLES
|
|
8
|
+
import { TEMPLATE_PATHS, EXPORT_PATH_PREFIX, EXTRA_TEMPLATE_VARIABLES } from '../constants.js';
|
|
9
9
|
import { getPackageManagerWithFallback } from './utils.packageManager.js';
|
|
10
10
|
import { getExportFileName } from '../utils/utils.files.js';
|
|
11
11
|
import { getVersion } from './utils.version.js';
|
|
@@ -97,8 +97,5 @@ export function getTemplateData() {
|
|
|
97
97
|
packageManagerVersion,
|
|
98
98
|
version: currentVersion,
|
|
99
99
|
bundleGrafanaUI: features.bundleGrafanaUI,
|
|
100
|
-
useReactRouterV6: features.useReactRouterV6,
|
|
101
|
-
useReactRouterTypes: !features.useReactRouterV6 && pluginJson.type === PLUGIN_TYPES.app, // v6 is written in typescript, so it's only needed for <v6
|
|
102
|
-
reactRouterVersion: features.useReactRouterV6 ? '6.10.0' : '5.2.0',
|
|
103
100
|
};
|
|
104
101
|
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Route,
|
|
2
|
+
import { Route, Switch } from 'react-router-dom';
|
|
3
3
|
import { AppRootProps } from '@grafana/data';
|
|
4
4
|
import { ROUTES } from '../../constants';
|
|
5
5
|
import { PageFour, PageOne, PageThree, PageTwo } from '../../pages';
|
|
6
|
+
import { prefixRoute } from '../../utils/utils.routing';
|
|
6
7
|
|
|
7
8
|
export function App(props: AppRootProps) {
|
|
8
9
|
return (
|
|
9
|
-
<
|
|
10
|
-
<Route path={ROUTES.Two}
|
|
11
|
-
<Route path={`${ROUTES.Three}/:id?`}
|
|
10
|
+
<Switch>
|
|
11
|
+
<Route exact path={prefixRoute(ROUTES.Two)} component={PageTwo} />
|
|
12
|
+
<Route exact path={prefixRoute(`${ROUTES.Three}/:id?`)} component={PageThree} />
|
|
12
13
|
|
|
13
14
|
{/* Full-width page (this page will have no side navigation) */}
|
|
14
|
-
<Route path={ROUTES.Four}
|
|
15
|
+
<Route exact path={prefixRoute(ROUTES.Four)} component={PageFour} />
|
|
15
16
|
|
|
16
17
|
{/* Default page */}
|
|
17
|
-
<Route
|
|
18
|
-
</
|
|
18
|
+
<Route component={PageOne} />
|
|
19
|
+
</Switch>
|
|
19
20
|
);
|
|
20
21
|
}
|
|
@@ -49,8 +49,8 @@ const config = async (env): Promise<Configuration> => {
|
|
|
49
49
|
'react-redux',
|
|
50
50
|
'redux',
|
|
51
51
|
'rxjs',
|
|
52
|
-
'react-router',
|
|
53
|
-
'react-router-dom',
|
|
52
|
+
'react-router',
|
|
53
|
+
'react-router-dom',
|
|
54
54
|
'd3',
|
|
55
55
|
'angular',{{#unless bundleGrafanaUI}}
|
|
56
56
|
'@grafana/ui',{{/unless}}
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@testing-library/react": "14.0.0",
|
|
31
31
|
"@types/jest": "^29.5.0",
|
|
32
32
|
"@types/lodash": "^4.14.194",
|
|
33
|
-
"@types/node": "^20.8.7",{{#if
|
|
34
|
-
"@types/react-router-dom": "^
|
|
33
|
+
"@types/node": "^20.8.7",{{#if isAppType}}
|
|
34
|
+
"@types/react-router-dom": "^5.3.3",{{/if}}
|
|
35
35
|
"@types/testing-library__jest-dom": "5.14.8",
|
|
36
36
|
"copy-webpack-plugin": "^11.0.0",
|
|
37
37
|
"css-loader": "^6.7.3",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@grafana/scenes": "^1.28.0",{{/if_eq}}
|
|
68
68
|
"react": "18.2.0",
|
|
69
69
|
"react-dom": "18.2.0",{{#if isAppType}}
|
|
70
|
-
"react-router-dom": "
|
|
70
|
+
"react-router-dom": "5.3.3",
|
|
71
71
|
"rxjs": "7.8.0",{{/if}}
|
|
72
72
|
"tslib": "2.5.3"
|
|
73
73
|
},
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Route,
|
|
2
|
+
import { Redirect, Route, Switch } from 'react-router-dom';
|
|
3
3
|
import { HomePage } from '../../pages/Home';
|
|
4
4
|
import { PageWithTabs } from '../../pages/WithTabs';
|
|
5
5
|
import { WithDrilldown } from '../../pages/WithDrilldown';
|
|
6
|
+
import { prefixRoute } from '../../utils/utils.routing';
|
|
6
7
|
import { ROUTES } from '../../constants';
|
|
7
8
|
import { HelloWorldPluginPage } from '../../pages/HelloWorld';
|
|
8
|
-
|
|
9
|
+
|
|
9
10
|
export const Routes = () => {
|
|
10
11
|
return (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{
|
|
14
|
-
<Route path={ROUTES.
|
|
15
|
-
<Route path={ROUTES.
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<Route path="*" element={<HomePage />} />
|
|
20
|
-
</ReactRoutes>
|
|
12
|
+
<Switch>
|
|
13
|
+
<Route path={prefixRoute(`${ROUTES.WithTabs}`)} component={PageWithTabs} />
|
|
14
|
+
<Route path={prefixRoute(`${ROUTES.WithDrilldown}`)} component={WithDrilldown} />
|
|
15
|
+
<Route path={prefixRoute(`${ROUTES.Home}`)} component={HomePage} />
|
|
16
|
+
<Route path={prefixRoute(`${ROUTES.HelloWorld}`)} component={HelloWorldPluginPage} />
|
|
17
|
+
<Redirect to={prefixRoute(ROUTES.Home)} />
|
|
18
|
+
</Switch>
|
|
21
19
|
);
|
|
22
20
|
};
|