dashboard-shell-shell 1.0.1000000086 → 1.0.1000000090
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/components/ResourceDetail/Masthead.vue +2 -1
- package/components/ResourceDetail/index.vue +3 -2
- package/components/ResourceList/Masthead.vue +4 -3
- package/components/ResourceList/index.vue +4 -3
- package/components/SideNav.vue +2 -1
- package/components/SortableTable/index.vue +2 -1
- package/components/nav/NamespaceFilter.vue +4 -0
- package/components/rancherResourceDetail/Masthead.vue +2 -1
- package/components/rancherResourceDetail/index.vue +3 -2
- package/components/rancherResourceList/Masthead-btn.vue +3 -2
- package/components/rancherResourceList/Masthead.vue +4 -3
- package/components/rancherResourceList/index.vue +4 -3
- package/components/rancherSortableTable/index.vue +2 -1
- package/config/product/auth.js +1 -1
- package/config/router/navigation-guards/index.js +22 -78
- package/edit/workload/mixins/workload.js +2 -1
- package/list/workload.vue +7 -6
- package/mixins/resource-fetch.js +2 -1
- package/models/management.cattle.io.setting.js +1 -0
- package/package.json +1 -1
- package/pages/auth/login.vue +1 -0
- package/pages/auth copy/login.vue +1 -0
- package/pages/prefs.vue +1 -0
- package/plugins/dashboard-store/normalize.js +3 -1
- package/plugins/dashboard-store/resource-class.js +1 -0
- package/store/type-map.js +1 -1
- package/types/shell/index.d.ts +2 -2
|
@@ -17,6 +17,7 @@ import TabTitle from '@shell/components/TabTitle';
|
|
|
17
17
|
import ActionMenu from '@shell/components/ActionMenuShell.vue';
|
|
18
18
|
import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
|
|
19
19
|
import { useStore } from 'vuex';
|
|
20
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
20
21
|
|
|
21
22
|
// i18n-uses resourceDetail.header.*
|
|
22
23
|
|
|
@@ -424,7 +425,7 @@ export default {
|
|
|
424
425
|
|
|
425
426
|
const resources = this.location?.params?.resource || ''
|
|
426
427
|
|
|
427
|
-
return this.$store.getters['type-map/groupsForVirTypes'](product, resources);
|
|
428
|
+
return this.$store.getters['type-map/groupsForVirTypes'](product, cloud2harvesterhci(resources));
|
|
428
429
|
},
|
|
429
430
|
|
|
430
431
|
location() {
|
|
@@ -16,6 +16,7 @@ import ForceDirectedTreeChart from '@shell/components/fleet/ForceDirectedTreeCha
|
|
|
16
16
|
import { checkSchemasForFindAllHash } from '@shell/utils/auth';
|
|
17
17
|
import { stringify } from '@shell/utils/error';
|
|
18
18
|
import { Banner } from '@components/Banner';
|
|
19
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
19
20
|
|
|
20
21
|
function modeFor(route) {
|
|
21
22
|
if ( route.query?.mode === _IMPORT ) {
|
|
@@ -95,7 +96,7 @@ export default {
|
|
|
95
96
|
const route = this.$route;
|
|
96
97
|
const params = route.params;
|
|
97
98
|
const cloneParams = clone(params)
|
|
98
|
-
let resourceType = this.resourceOverride || cloneParams.resource;
|
|
99
|
+
let resourceType = this.resourceOverride || cloud2harvesterhci(cloneParams.resource);
|
|
99
100
|
|
|
100
101
|
const inStore = this.storeOverride || store.getters['currentStore'](resourceType);
|
|
101
102
|
const realMode = this.realMode;
|
|
@@ -421,7 +422,7 @@ export default {
|
|
|
421
422
|
const id = userId || this.$route.params.id;
|
|
422
423
|
// const paramsResource = this.$route.params.resource
|
|
423
424
|
const routerResource = clone(this.$route.params.resource)
|
|
424
|
-
const resource = resourceOverride || this.resourceOverride || routerResource;
|
|
425
|
+
const resource = resourceOverride || this.resourceOverride || cloud2harvesterhci(routerResource);
|
|
425
426
|
const options = this.$store.getters[`type-map/optionsFor`](resource);
|
|
426
427
|
|
|
427
428
|
const detailResource = options.resourceDetail || options.resource || resource;
|
|
@@ -6,6 +6,7 @@ import { get } from '@shell/utils/object';
|
|
|
6
6
|
import { AS, _YAML } from '@shell/config/query-params';
|
|
7
7
|
import ResourceLoadingIndicator from './ResourceLoadingIndicator';
|
|
8
8
|
import TabTitle from '@shell/components/TabTitle';
|
|
9
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Resource List Masthead component.
|
|
@@ -87,12 +88,12 @@ export default {
|
|
|
87
88
|
|
|
88
89
|
params.resource = params.resource
|
|
89
90
|
|
|
90
|
-
const formRoute = { name: `${ this.$route.name }-create`, params };
|
|
91
|
+
const formRoute = { name: `${ cloud2harvesterhci(this.$route.name) }-create`, params };
|
|
91
92
|
|
|
92
93
|
const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
|
|
93
94
|
|
|
94
95
|
const yamlRoute = {
|
|
95
|
-
name: `${ this.$route.name }-create`,
|
|
96
|
+
name: `${ cloud2harvesterhci(this.$route.name) }-create`,
|
|
96
97
|
params,
|
|
97
98
|
query: { [AS]: _YAML },
|
|
98
99
|
};
|
|
@@ -130,7 +131,7 @@ export default {
|
|
|
130
131
|
return this.$store.getters['type-map/labelFor'](this.schema, 99);
|
|
131
132
|
},
|
|
132
133
|
_descriptionDisplay() {
|
|
133
|
-
const key = this.$route.path.split('/').pop();
|
|
134
|
+
const key = cloud2harvesterhci(this.$route.path.split('/').pop());
|
|
134
135
|
|
|
135
136
|
return this.$store.getters['i18n/t'](`typeDescription."${ key.toLowerCase() }"`);
|
|
136
137
|
},
|
|
@@ -9,6 +9,7 @@ import { ResourceListComponentName } from './resource-list.config';
|
|
|
9
9
|
import { PanelLocation, ExtensionPoint } from '@shell/core/types';
|
|
10
10
|
import ExtensionPanel from '@shell/components/ExtensionPanel';
|
|
11
11
|
import { sameContents } from '@shell/utils/array';
|
|
12
|
+
import { cloud2harvesterhci } from '@shell/utils/router'
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
name: ResourceListComponentName,
|
|
@@ -40,7 +41,7 @@ export default {
|
|
|
40
41
|
|
|
41
42
|
async fetch() {
|
|
42
43
|
const store = this.$store;
|
|
43
|
-
const resource = this.resource;
|
|
44
|
+
const resource = cloud2harvesterhci(this.resource);
|
|
44
45
|
|
|
45
46
|
const schema = this.schema;
|
|
46
47
|
|
|
@@ -88,7 +89,7 @@ export default {
|
|
|
88
89
|
data() {
|
|
89
90
|
const getters = this.$store.getters;
|
|
90
91
|
const params = { ...this.$route.params };
|
|
91
|
-
const resource = params.resource;
|
|
92
|
+
const resource = cloud2harvesterhci(params.resource);
|
|
92
93
|
|
|
93
94
|
const hasListComponent = getters['type-map/hasCustomList'](resource);
|
|
94
95
|
|
|
@@ -200,7 +201,7 @@ export default {
|
|
|
200
201
|
created() {
|
|
201
202
|
let listComponent = false;
|
|
202
203
|
|
|
203
|
-
const resource = this.$route.params.resource;
|
|
204
|
+
const resource = cloud2harvesterhci(this.$route.params.resource);
|
|
204
205
|
const hasListComponent = this.$store.getters['type-map/hasCustomList'](resource);
|
|
205
206
|
|
|
206
207
|
if ( hasListComponent ) {
|
package/components/SideNav.vue
CHANGED
|
@@ -20,6 +20,7 @@ import { TYPE_MODES } from '@shell/store/type-map';
|
|
|
20
20
|
import { NAME as NAVLINKS } from '@shell/config/product/navlinks';
|
|
21
21
|
import Group from '@shell/components/nav/Group';
|
|
22
22
|
import LocaleSelector from '@shell/components/LocaleSelector';
|
|
23
|
+
import { cloud2harvesterhci, harvester2cloud } from '@shell/utils/router';
|
|
23
24
|
|
|
24
25
|
export default {
|
|
25
26
|
name: 'SideNav',
|
|
@@ -236,7 +237,7 @@ export default {
|
|
|
236
237
|
|
|
237
238
|
getProductsGroups(out, loadProducts, namespaceMode, productMap) {
|
|
238
239
|
const clusterId = this.$store.getters['clusterId'];
|
|
239
|
-
const currentType = this.$route.params.resource || '';
|
|
240
|
+
const currentType = cloud2harvesterhci(this.$route.params.resource) || '';
|
|
240
241
|
|
|
241
242
|
for ( const productId of loadProducts ) {
|
|
242
243
|
const modes = [TYPE_MODES.BASIC];
|
|
@@ -27,6 +27,7 @@ import ButtonMultiAction from '@shell/components/ButtonMultiAction.vue';
|
|
|
27
27
|
import ActionMenu from '@shell/components/ActionMenuShell.vue';
|
|
28
28
|
import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
|
|
29
29
|
import ActionDropdownShell from '@shell/components/ActionDropdownShell.vue';
|
|
30
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
30
31
|
|
|
31
32
|
// Uncomment for table performance debugging
|
|
32
33
|
// import tableDebug from './debug';
|
|
@@ -415,7 +416,7 @@ export default {
|
|
|
415
416
|
const isLoading = this.loading || false;
|
|
416
417
|
|
|
417
418
|
let isCreatable = false;
|
|
418
|
-
const lastPath = this.$route.path.split('/').pop();
|
|
419
|
+
const lastPath = cloud2harvesterhci(this.$route.path.split('/').pop());
|
|
419
420
|
|
|
420
421
|
if (lastPath.includes('.')) {
|
|
421
422
|
isCreatable = this.$store.getters['type-map/optionsFor'](lastPath).isCreatable;
|
|
@@ -20,6 +20,7 @@ import { KEY } from '@shell/utils/platform';
|
|
|
20
20
|
import pAndNFiltering from '@shell/plugins/steve/projectAndNamespaceFiltering.utils';
|
|
21
21
|
import { SETTING } from '@shell/config/settings';
|
|
22
22
|
import paginationUtils from '@shell/utils/pagination-utils';
|
|
23
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
23
24
|
|
|
24
25
|
const forcedNamespaceValidTypes = [NAMESPACE_FILTER_KINDS.DIVIDER, NAMESPACE_FILTER_KINDS.PROJECT, NAMESPACE_FILTER_KINDS.NAMESPACE];
|
|
25
26
|
|
|
@@ -144,6 +145,9 @@ export default {
|
|
|
144
145
|
|
|
145
146
|
const params = { ...this.$route.params };
|
|
146
147
|
let resource = params.resource;
|
|
148
|
+
if (params.resource) {
|
|
149
|
+
resource = cloud2harvesterhci(resource)
|
|
150
|
+
}
|
|
147
151
|
|
|
148
152
|
// Sometimes, different pages may have different namespaces to filter
|
|
149
153
|
const notFilterNamespaces = this.$store.getters[`type-map/optionsFor`](resource).notFilterNamespace || [];
|
|
@@ -17,6 +17,7 @@ import TabTitle from '@shell/components/TabTitle';
|
|
|
17
17
|
import ActionMenu from '@shell/components/ActionMenuShell.vue';
|
|
18
18
|
import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
|
|
19
19
|
import { useStore } from 'vuex';
|
|
20
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
20
21
|
|
|
21
22
|
// i18n-uses resourceDetail.header.*
|
|
22
23
|
|
|
@@ -422,7 +423,7 @@ export default {
|
|
|
422
423
|
|
|
423
424
|
const resources = this.location?.params?.resource || ''
|
|
424
425
|
|
|
425
|
-
return this.$store.getters['type-map/groupsForVirTypes'](product, resources);
|
|
426
|
+
return this.$store.getters['type-map/groupsForVirTypes'](product, cloud2harvesterhci(resources));
|
|
426
427
|
},
|
|
427
428
|
|
|
428
429
|
location() {
|
|
@@ -16,6 +16,7 @@ import ForceDirectedTreeChart from '@shell/components/fleet/ForceDirectedTreeCha
|
|
|
16
16
|
import { checkSchemasForFindAllHash } from '@shell/utils/auth';
|
|
17
17
|
import { stringify } from '@shell/utils/error';
|
|
18
18
|
import { Banner } from '@components/Banner';
|
|
19
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
19
20
|
|
|
20
21
|
function modeFor(route) {
|
|
21
22
|
if ( route.query?.mode === _IMPORT ) {
|
|
@@ -95,7 +96,7 @@ export default {
|
|
|
95
96
|
const route = this.$route;
|
|
96
97
|
const params = route.params;
|
|
97
98
|
const cloneParams = clone(params)
|
|
98
|
-
let resourceType = this.resourceOverride || cloneParams.resource;
|
|
99
|
+
let resourceType = this.resourceOverride || cloud2harvesterhci(cloneParams.resource);
|
|
99
100
|
|
|
100
101
|
const inStore = this.storeOverride || store.getters['currentStore'](resourceType);
|
|
101
102
|
const realMode = this.realMode;
|
|
@@ -421,7 +422,7 @@ export default {
|
|
|
421
422
|
const id = userId || this.$route.params.id;
|
|
422
423
|
// const paramsResource = this.$route.params.resource
|
|
423
424
|
const routerResource = clone(this.$route.params.resource)
|
|
424
|
-
const resource = resourceOverride || this.resourceOverride || routerResource;
|
|
425
|
+
const resource = resourceOverride || this.resourceOverride || cloud2harvesterhci(routerResource);
|
|
425
426
|
const options = this.$store.getters[`type-map/optionsFor`](resource);
|
|
426
427
|
|
|
427
428
|
const detailResource = options.resourceDetail || options.resource || resource;
|
|
@@ -6,6 +6,7 @@ import { get } from '@shell/utils/object';
|
|
|
6
6
|
import { AS, _YAML } from '@shell/config/query-params';
|
|
7
7
|
import ResourceLoadingIndicator from './ResourceLoadingIndicator';
|
|
8
8
|
import TabTitle from '@shell/components/TabTitle';
|
|
9
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Resource List Masthead component.
|
|
@@ -71,12 +72,12 @@ export default {
|
|
|
71
72
|
|
|
72
73
|
params.resource = params.resource
|
|
73
74
|
|
|
74
|
-
const formRoute = { name: `${ this.$route.name }-create`, params };
|
|
75
|
+
const formRoute = { name: `${ cloud2harvesterhci(this.$route.name) }-create`, params };
|
|
75
76
|
|
|
76
77
|
const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
|
|
77
78
|
|
|
78
79
|
const yamlRoute = {
|
|
79
|
-
name: `${ this.$route.name }-create`,
|
|
80
|
+
name: `${ cloud2harvesterhci(this.$route.name) }-create`,
|
|
80
81
|
params,
|
|
81
82
|
query: { [AS]: _YAML },
|
|
82
83
|
};
|
|
@@ -6,6 +6,7 @@ import { get } from '@shell/utils/object';
|
|
|
6
6
|
import { AS, _YAML } from '@shell/config/query-params';
|
|
7
7
|
import ResourceLoadingIndicator from './ResourceLoadingIndicator';
|
|
8
8
|
import TabTitle from '@shell/components/TabTitle';
|
|
9
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Resource List Masthead component.
|
|
@@ -92,12 +93,12 @@ export default {
|
|
|
92
93
|
|
|
93
94
|
params.resource = params.resource
|
|
94
95
|
|
|
95
|
-
const formRoute = { name: `${ this.$route.name }-create`, params };
|
|
96
|
+
const formRoute = { name: `${ cloud2harvesterhci(this.$route.name) }-create`, params };
|
|
96
97
|
|
|
97
98
|
const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
|
|
98
99
|
|
|
99
100
|
const yamlRoute = {
|
|
100
|
-
name: `${ this.$route.name }-create`,
|
|
101
|
+
name: `${ cloud2harvesterhci(this.$route.name) }-create`,
|
|
101
102
|
params,
|
|
102
103
|
query: { [AS]: _YAML },
|
|
103
104
|
};
|
|
@@ -138,7 +139,7 @@ export default {
|
|
|
138
139
|
return this.$store.getters['type-map/labelFor'](this.schema, 99);
|
|
139
140
|
},
|
|
140
141
|
_descriptionDisplay() {
|
|
141
|
-
const key = this.$route.path.split('/').pop();
|
|
142
|
+
const key = cloud2harvesterhci(this.$route.path.split('/').pop());
|
|
142
143
|
|
|
143
144
|
return this.$store.getters['i18n/t'](`typeDescription."${ key.toLowerCase() }"`);
|
|
144
145
|
},
|
|
@@ -9,6 +9,7 @@ import { ResourceListComponentName } from './resource-list.config';
|
|
|
9
9
|
import { PanelLocation, ExtensionPoint } from '@shell/core/types';
|
|
10
10
|
import ExtensionPanel from '@shell/components/ExtensionPanel';
|
|
11
11
|
import { sameContents } from '@shell/utils/array';
|
|
12
|
+
import { cloud2harvesterhci } from '@shell/utils/router'
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
name: ResourceListComponentName,
|
|
@@ -40,7 +41,7 @@ export default {
|
|
|
40
41
|
|
|
41
42
|
async fetch() {
|
|
42
43
|
const store = this.$store;
|
|
43
|
-
const resource = this.resource;
|
|
44
|
+
const resource = cloud2harvesterhci(this.resource);
|
|
44
45
|
|
|
45
46
|
const schema = this.schema;
|
|
46
47
|
|
|
@@ -88,7 +89,7 @@ export default {
|
|
|
88
89
|
data() {
|
|
89
90
|
const getters = this.$store.getters;
|
|
90
91
|
const params = { ...this.$route.params };
|
|
91
|
-
const resource = params.resource;
|
|
92
|
+
const resource = cloud2harvesterhci(params.resource);
|
|
92
93
|
|
|
93
94
|
const hasListComponent = getters['type-map/hasCustomList'](resource);
|
|
94
95
|
|
|
@@ -200,7 +201,7 @@ export default {
|
|
|
200
201
|
created() {
|
|
201
202
|
let listComponent = false;
|
|
202
203
|
|
|
203
|
-
const resource = this.$route.params.resource;
|
|
204
|
+
const resource = cloud2harvesterhci(this.$route.params.resource);
|
|
204
205
|
const hasListComponent = this.$store.getters['type-map/hasCustomList'](resource);
|
|
205
206
|
|
|
206
207
|
if ( hasListComponent ) {
|
|
@@ -27,6 +27,7 @@ import ButtonMultiAction from '@shell/components/ButtonMultiAction.vue';
|
|
|
27
27
|
import ActionMenu from '@shell/components/ActionMenuShell.vue';
|
|
28
28
|
import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
|
|
29
29
|
import ActionDropdownShell from '@shell/components/ActionDropdownShell.vue';
|
|
30
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
30
31
|
|
|
31
32
|
// Uncomment for table performance debugging
|
|
32
33
|
// import tableDebug from './debug';
|
|
@@ -415,7 +416,7 @@ export default {
|
|
|
415
416
|
const isLoading = this.loading || false;
|
|
416
417
|
|
|
417
418
|
let isCreatable = false;
|
|
418
|
-
const lastPath = this.$route.path.split('/').pop();
|
|
419
|
+
const lastPath = cloud2harvesterhci(this.$route.path.split('/').pop());
|
|
419
420
|
|
|
420
421
|
if (lastPath.includes('.')) {
|
|
421
422
|
isCreatable = this.$store.getters['type-map/optionsFor'](lastPath).isCreatable;
|
package/config/product/auth.js
CHANGED
|
@@ -24,7 +24,7 @@ export function init(store) {
|
|
|
24
24
|
spoofedType,
|
|
25
25
|
virtualType,
|
|
26
26
|
} = DSL(store, NAME);
|
|
27
|
-
|
|
27
|
+
console.log('------------------------------------------------2')
|
|
28
28
|
product({
|
|
29
29
|
ifHaveType: new RegExp(`${ MANAGEMENT.USER }|${ MANAGEMENT.AUTH_CONFIG }`, 'i'),
|
|
30
30
|
ifHaveVerb: 'GET',
|
|
@@ -9,26 +9,28 @@ import { install as installClusters } from '@shell/config/router/navigation-guar
|
|
|
9
9
|
import { install as installHandleInstallRedirect } from '@shell/config/router/navigation-guards/install-redirect';
|
|
10
10
|
import { install as installPageTitle } from '@shell/config/router/navigation-guards/page-title';
|
|
11
11
|
import { install as installServerUpgradeGrowl } from '@shell/config/router/navigation-guards/server-upgrade-growl';
|
|
12
|
-
|
|
12
|
+
import { harvester2cloud } from '@shell/utils/router';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Install router navigation guards
|
|
16
|
+
* 1. 保留原有导航守卫顺序
|
|
17
|
+
* 2. 不在 beforeEach 改 params,只在 push/replace & afterEach 改 URL
|
|
16
18
|
*/
|
|
17
|
-
export function
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
export function installNavigationGuards(router, context) {
|
|
20
|
+
// 最早执行:保证进入逻辑时 params 始终是 harvester
|
|
21
|
+
router.beforeEach((to, from, next) => {
|
|
22
|
+
// 内部逻辑统一用 harvesterManager
|
|
23
|
+
if (to?.params?.product) {
|
|
24
|
+
to.params.product = to.params.product.replace(/cloud/g, 'harvester')
|
|
25
|
+
}
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
27
|
+
if (to?.params?.cluster) {
|
|
28
|
+
to.params.cluster = to.params.cluster.replace(/cloud/g, 'harvester')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
next();
|
|
32
|
+
});
|
|
24
33
|
|
|
25
|
-
/**
|
|
26
|
-
* Install our router navigation guards with cloud/harvester mapping.
|
|
27
|
-
*/
|
|
28
|
-
export function installNavigationGuards(router, context) {
|
|
29
|
-
// ---------------------------
|
|
30
|
-
// 1. 安装原有导航守卫
|
|
31
|
-
// ---------------------------
|
|
32
34
|
const navigationGuardInstallers = [
|
|
33
35
|
installLoadInitialSettings,
|
|
34
36
|
installAttemptFirstLogin,
|
|
@@ -43,74 +45,16 @@ export function installNavigationGuards(router, context) {
|
|
|
43
45
|
installServerUpgradeGrowl
|
|
44
46
|
];
|
|
45
47
|
|
|
46
|
-
navigationGuardInstallers.forEach(
|
|
47
|
-
|
|
48
|
-
// ---------------------------
|
|
49
|
-
// 2. 入口层 beforeEach: cloud -> harvester
|
|
50
|
-
// ---------------------------
|
|
51
|
-
router.beforeEach((to, from, next) => {
|
|
52
|
-
const newParams = { ...to.params };
|
|
53
|
-
let changed = false;
|
|
48
|
+
navigationGuardInstallers.forEach(installer => installer(router, context));
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
const newProduct = newParams.product;
|
|
57
|
-
if (newProduct !== newParams.product) {
|
|
58
|
-
newParams.product = newProduct;
|
|
59
|
-
changed = true;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (newParams.resource) {
|
|
64
|
-
const newResource = newParams.resource;
|
|
65
|
-
if (newResource !== newParams.resource) {
|
|
66
|
-
newParams.resource = newResource;
|
|
67
|
-
changed = true;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// 只有实际修改才 redirect,避免无限循环
|
|
72
|
-
if (changed) {
|
|
73
|
-
next({ ...to, params: newParams, replace: true });
|
|
74
|
-
} else {
|
|
75
|
-
next();
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// ---------------------------
|
|
80
|
-
// 3. 出口层 wrapNav: harvester -> cloud
|
|
81
|
-
// ---------------------------
|
|
82
|
-
const wrapNav = (fn) => function(location, ...args) {
|
|
83
|
-
if (typeof location === 'string') {
|
|
84
|
-
location = location;
|
|
85
|
-
} else if (location?.params) {
|
|
86
|
-
Object.keys(location.params).forEach(key => {
|
|
87
|
-
const val = location.params[key];
|
|
88
|
-
if (typeof val === 'string') {
|
|
89
|
-
location.params[key] = val;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
} else if (location?.path) {
|
|
93
|
-
location.path = location.path;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return fn.call(this, location, ...args);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
router.push = wrapNav(router.push.bind(router));
|
|
100
|
-
router.replace = wrapNav(router.replace.bind(router));
|
|
101
|
-
|
|
102
|
-
// ---------------------------
|
|
103
|
-
// 4. afterEach: 确保用户看到的 URL 是 cloud
|
|
104
|
-
// ---------------------------
|
|
50
|
+
// 🔹 最后执行:只改地址栏,不改内部
|
|
105
51
|
router.afterEach((to) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// 使用正则替换所有 harvester → cloud
|
|
109
|
-
cloudPath = cloudPath.replace(/harvesterManager/g, 'cloudManager');
|
|
110
|
-
cloudPath = cloudPath.replace(/harvesterhci\.io\.management\.cluster/g, 'cloudhci.io.management.cluster');
|
|
52
|
+
const cloudPath = to.fullPath
|
|
53
|
+
.replace(/harvester/g, 'cloud')
|
|
111
54
|
|
|
112
55
|
if (cloudPath !== to.fullPath) {
|
|
113
56
|
window.history.replaceState({}, '', cloudPath);
|
|
114
57
|
}
|
|
115
58
|
});
|
|
116
59
|
}
|
|
60
|
+
|
|
@@ -52,6 +52,7 @@ import { TYPES as SECRET_TYPES } from '@shell/models/secret';
|
|
|
52
52
|
import { defaultContainer } from '@shell/models/workload';
|
|
53
53
|
import { allHash } from '@shell/utils/promise';
|
|
54
54
|
|
|
55
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
55
56
|
|
|
56
57
|
const TAB_WEIGHT_MAP = {
|
|
57
58
|
general: 99,
|
|
@@ -170,7 +171,7 @@ export default {
|
|
|
170
171
|
data() {
|
|
171
172
|
serialMaker.setPrefix('container-');
|
|
172
173
|
serialMaker.setSeq(0);
|
|
173
|
-
let type = this.$route.params.resource;
|
|
174
|
+
let type = cloud2harvesterhci(this.$route.params.resource);
|
|
174
175
|
const createSidecar = !!this.$route.query.sidecar;
|
|
175
176
|
|
|
176
177
|
if (type === 'workload') {
|
package/list/workload.vue
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from '@shell/config/types';
|
|
6
6
|
import ResourceFetch from '@shell/mixins/resource-fetch';
|
|
7
7
|
import PaginatedResourceTable from '@shell/components/PaginatedResourceTable';
|
|
8
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
8
9
|
|
|
9
10
|
const workloadSchema = {
|
|
10
11
|
id: 'workload',
|
|
@@ -26,10 +27,10 @@ const $loadingResources = ($route, $store) => {
|
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
29
|
|
|
29
|
-
const allTypes = $route.params.resource === workloadSchema.id;
|
|
30
|
+
const allTypes = cloud2harvesterhci($route.params.resource) === workloadSchema.id;
|
|
30
31
|
|
|
31
32
|
return {
|
|
32
|
-
loadResources: allTypes ? allowedResources : [$route.params.resource],
|
|
33
|
+
loadResources: allTypes ? allowedResources : [cloud2harvesterhci($route.params.resource)],
|
|
33
34
|
loadIndeterminate: allTypes,
|
|
34
35
|
};
|
|
35
36
|
};
|
|
@@ -54,7 +55,7 @@ export default {
|
|
|
54
55
|
if (this.allTypes && this.loadResources.length) {
|
|
55
56
|
this.$initializeFetchData(this.loadResources[0], this.loadResources);
|
|
56
57
|
} else {
|
|
57
|
-
this.$initializeFetchData(this.$route.params.resource);
|
|
58
|
+
this.$initializeFetchData(cloud2harvesterhci(this.$route.params.resource));
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
try {
|
|
@@ -73,7 +74,7 @@ export default {
|
|
|
73
74
|
return this.$fetchType(allowed, this.loadResources);
|
|
74
75
|
}));
|
|
75
76
|
} else {
|
|
76
|
-
const type = this.$route.params.resource;
|
|
77
|
+
const type = cloud2harvesterhci(this.$route.params.resource);
|
|
77
78
|
|
|
78
79
|
if ( this.$store.getters['cluster/schemaFor'](type) ) {
|
|
79
80
|
const resource = await this.$fetchType(type);
|
|
@@ -88,7 +89,7 @@ export default {
|
|
|
88
89
|
const { loadResources, loadIndeterminate } = $loadingResources(this.$route, this.$store);
|
|
89
90
|
|
|
90
91
|
const { params:{ resource: type } } = this.$route;
|
|
91
|
-
const allTypes = this.$route.params.resource === workloadSchema.id;
|
|
92
|
+
const allTypes = cloud2harvesterhci(this.$route.params.resource) === workloadSchema.id;
|
|
92
93
|
const schema = type !== workloadSchema.id ? this.$store.getters['cluster/schemaFor'](type) : workloadSchema;
|
|
93
94
|
const paginationEnabled = !allTypes && this.$store.getters[`cluster/paginationEnabled`]?.({ id: type });
|
|
94
95
|
|
|
@@ -143,7 +144,7 @@ export default {
|
|
|
143
144
|
this.$fetchType(POD);
|
|
144
145
|
this.$fetchType(WORKLOAD_TYPES.JOB);
|
|
145
146
|
} else {
|
|
146
|
-
const type = this.$route.params.resource;
|
|
147
|
+
const type = cloud2harvesterhci(this.$route.params.resource);
|
|
147
148
|
|
|
148
149
|
if (type === WORKLOAD_TYPES.JOB || type === POD) {
|
|
149
150
|
// Ignore job and pods (we're fetching this anyway, plus they contain their own state)
|
package/mixins/resource-fetch.js
CHANGED
|
@@ -3,6 +3,7 @@ import { COUNT, MANAGEMENT } from '@shell/config/types';
|
|
|
3
3
|
import { SETTING, DEFAULT_PERF_SETTING } from '@shell/config/settings';
|
|
4
4
|
import ResourceFetchNamespaced from '@shell/mixins/resource-fetch-namespaced';
|
|
5
5
|
import ResourceFetchApiPagination from '@shell/mixins/resource-fetch-api-pagination';
|
|
6
|
+
import { cloud2harvesterhci } from '@shell/utils/router'
|
|
6
7
|
|
|
7
8
|
// Number of pages to fetch when loading incrementally
|
|
8
9
|
const PAGES = 4;
|
|
@@ -34,7 +35,7 @@ export default {
|
|
|
34
35
|
// Normally owner components supply `resource` and `inStore` as part of their data, however these are needed here before parent data runs
|
|
35
36
|
// So set up both here
|
|
36
37
|
const params = { ...this.$route.params };
|
|
37
|
-
const resource = params.resource || this.schema?.id; // Resource can either be on a page showing single list, or a page of a resource showing a list of another resource
|
|
38
|
+
const resource = cloud2harvesterhci(params.resource) || this.schema?.id; // Resource can either be on a page showing single list, or a page of a resource showing a list of another resource
|
|
38
39
|
const inStore = this.$store.getters['currentStore'](resource);
|
|
39
40
|
|
|
40
41
|
return {
|
|
@@ -2,6 +2,7 @@ import { ALLOWED_SETTINGS } from '@shell/config/settings';
|
|
|
2
2
|
import HybridModel from '@shell/plugins/steve/hybrid-class';
|
|
3
3
|
import { isServerUrl } from '@shell/utils/validators/setting';
|
|
4
4
|
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
|
|
5
|
+
import { harvester2cloud } from '@shell/utils/router'
|
|
5
6
|
import {
|
|
6
7
|
_EDIT,
|
|
7
8
|
_UNFLAG,
|
package/package.json
CHANGED
package/pages/auth/login.vue
CHANGED
|
@@ -32,6 +32,7 @@ import loadPlugins from '@shell/plugins/plugin';
|
|
|
32
32
|
import Loading from '@shell/components/Loading';
|
|
33
33
|
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
|
|
34
34
|
import TabTitle from '@shell/components/TabTitle.vue';
|
|
35
|
+
import { harvester2cloud } from '@shell/utils/router'
|
|
35
36
|
|
|
36
37
|
export default {
|
|
37
38
|
name: 'Login',
|
|
@@ -32,6 +32,7 @@ import loadPlugins from '@shell/plugins/plugin';
|
|
|
32
32
|
import Loading from '@shell/components/Loading';
|
|
33
33
|
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
|
|
34
34
|
import TabTitle from '@shell/components/TabTitle.vue';
|
|
35
|
+
import { harvester2cloud } from '@shell/utils/router'
|
|
35
36
|
|
|
36
37
|
export default {
|
|
37
38
|
name: 'Login',
|
package/pages/prefs.vue
CHANGED
|
@@ -18,6 +18,7 @@ import { addObject } from '@shell/utils/array';
|
|
|
18
18
|
import LocaleSelector from '@shell/components/LocaleSelector';
|
|
19
19
|
import TabTitle from '@shell/components/TabTitle';
|
|
20
20
|
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
|
|
21
|
+
import { harvester2cloud } from '@shell/utils/router'
|
|
21
22
|
|
|
22
23
|
export default {
|
|
23
24
|
components: {
|
|
@@ -2,6 +2,8 @@ import { SCHEMA } from '@shell/config/types';
|
|
|
2
2
|
|
|
3
3
|
import { applyChangeset, changeset, changesetConflicts } from '@shell/utils/object';
|
|
4
4
|
|
|
5
|
+
import { cloud2harvesterhci } from '@shell/utils/router'
|
|
6
|
+
|
|
5
7
|
export const KEY_FIELD_FOR = {
|
|
6
8
|
[SCHEMA]: '_id',
|
|
7
9
|
default: 'id',
|
|
@@ -14,7 +16,7 @@ export function keyFieldFor(type) {
|
|
|
14
16
|
export function normalizeType(type) {
|
|
15
17
|
type = (type?.type || type || '').toLowerCase();
|
|
16
18
|
|
|
17
|
-
return type;
|
|
19
|
+
return cloud2harvesterhci(type);
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
// Detect and resolve conflicts from a 409 response.
|
|
@@ -34,6 +34,7 @@ import { markRaw } from 'vue';
|
|
|
34
34
|
|
|
35
35
|
import { ExtensionPoint, ActionLocation } from '@shell/core/types';
|
|
36
36
|
import { getApplicableExtensionEnhancements } from '@shell/core/plugin-helpers';
|
|
37
|
+
import { harvesterhci2cloud, cloud2harvesterhci } from '@shell/utils/router'
|
|
37
38
|
|
|
38
39
|
export const DNS_LIKE_TYPES = ['dnsLabel', 'dnsLabelRestricted', 'hostname'];
|
|
39
40
|
|
package/store/type-map.js
CHANGED
package/types/shell/index.d.ts
CHANGED
|
@@ -4161,9 +4161,9 @@ export function setPromiseResult(promise: any, obj: any, key: any, label: any):
|
|
|
4161
4161
|
// @shell/utils/router
|
|
4162
4162
|
|
|
4163
4163
|
declare module '@shell/utils/router' {
|
|
4164
|
-
export function
|
|
4164
|
+
export function str: any: any;
|
|
4165
4165
|
export function cloud2harvesterhci(str: any): any;
|
|
4166
|
-
export function
|
|
4166
|
+
export function str: any: any;
|
|
4167
4167
|
export function cloud2harvester(str: any): any;
|
|
4168
4168
|
export function queryParamsFor(current: any, qp: any, defaults?: {}): any;
|
|
4169
4169
|
export function getClusterFromRoute(to: any): any;
|