dashboard-shell-shell 1.0.1000000082 → 1.0.1000000086
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/ExplorerProjectsNamespaces.vue +1 -0
- package/components/ResourceDetail/Masthead.vue +2 -3
- package/components/ResourceDetail/index.vue +2 -3
- package/components/ResourceList/Masthead.vue +4 -22
- package/components/ResourceList/index.vue +3 -4
- package/components/SideNav.vue +2 -3
- package/components/SortableTable/index.vue +2 -5
- package/components/nav/NamespaceFilter.vue +0 -4
- package/components/rancherResourceDetail/Masthead.vue +2 -3
- package/components/rancherResourceDetail/index.vue +2 -3
- package/components/rancherResourceList/Masthead-btn.vue +3 -4
- package/components/rancherResourceList/Masthead.vue +4 -5
- package/components/rancherResourceList/index.vue +3 -4
- package/components/rancherSortableTable/index.vue +1 -2
- package/config/router/navigation-guards/index.js +98 -5
- package/edit/workload/mixins/workload.js +1 -2
- package/list/workload.vue +6 -7
- package/mixins/resource-fetch.js +1 -2
- package/models/management.cattle.io.setting.js +1 -2
- package/package.json +1 -1
- package/pages/auth/login.vue +1 -2
- package/pages/auth copy/login.vue +1 -2
- package/pages/prefs.vue +1 -2
- package/plugins/dashboard-store/normalize.js +1 -3
- package/plugins/dashboard-store/resource-class.js +2 -3
- package/store/type-map.js +1 -8
- package/types/cloud-shell/index.d.ts +0 -6
|
@@ -17,7 +17,6 @@ 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'
|
|
21
20
|
|
|
22
21
|
// i18n-uses resourceDetail.header.*
|
|
23
22
|
|
|
@@ -256,7 +255,7 @@ export default {
|
|
|
256
255
|
const defaultLocation = {
|
|
257
256
|
name: 'c-cluster-product-resource',
|
|
258
257
|
params: {
|
|
259
|
-
resource:
|
|
258
|
+
resource: this.resource,
|
|
260
259
|
product,
|
|
261
260
|
}
|
|
262
261
|
};
|
|
@@ -425,7 +424,7 @@ export default {
|
|
|
425
424
|
|
|
426
425
|
const resources = this.location?.params?.resource || ''
|
|
427
426
|
|
|
428
|
-
return this.$store.getters['type-map/groupsForVirTypes'](product,
|
|
427
|
+
return this.$store.getters['type-map/groupsForVirTypes'](product, resources);
|
|
429
428
|
},
|
|
430
429
|
|
|
431
430
|
location() {
|
|
@@ -16,7 +16,6 @@ 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'
|
|
20
19
|
|
|
21
20
|
function modeFor(route) {
|
|
22
21
|
if ( route.query?.mode === _IMPORT ) {
|
|
@@ -96,7 +95,7 @@ export default {
|
|
|
96
95
|
const route = this.$route;
|
|
97
96
|
const params = route.params;
|
|
98
97
|
const cloneParams = clone(params)
|
|
99
|
-
let resourceType = this.resourceOverride ||
|
|
98
|
+
let resourceType = this.resourceOverride || cloneParams.resource;
|
|
100
99
|
|
|
101
100
|
const inStore = this.storeOverride || store.getters['currentStore'](resourceType);
|
|
102
101
|
const realMode = this.realMode;
|
|
@@ -422,7 +421,7 @@ export default {
|
|
|
422
421
|
const id = userId || this.$route.params.id;
|
|
423
422
|
// const paramsResource = this.$route.params.resource
|
|
424
423
|
const routerResource = clone(this.$route.params.resource)
|
|
425
|
-
const resource = resourceOverride || this.resourceOverride ||
|
|
424
|
+
const resource = resourceOverride || this.resourceOverride || routerResource;
|
|
426
425
|
const options = this.$store.getters[`type-map/optionsFor`](resource);
|
|
427
426
|
|
|
428
427
|
const detailResource = options.resourceDetail || options.resource || resource;
|
|
@@ -6,7 +6,6 @@ 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'
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Resource List Masthead component.
|
|
@@ -86,14 +85,14 @@ export default {
|
|
|
86
85
|
data() {
|
|
87
86
|
const params = { ...this.$route.params };
|
|
88
87
|
|
|
89
|
-
params.resource =
|
|
88
|
+
params.resource = params.resource
|
|
90
89
|
|
|
91
|
-
const formRoute = { name: `${
|
|
90
|
+
const formRoute = { name: `${ this.$route.name }-create`, params };
|
|
92
91
|
|
|
93
92
|
const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
|
|
94
93
|
|
|
95
94
|
const yamlRoute = {
|
|
96
|
-
name: `${
|
|
95
|
+
name: `${ this.$route.name }-create`,
|
|
97
96
|
params,
|
|
98
97
|
query: { [AS]: _YAML },
|
|
99
98
|
};
|
|
@@ -131,7 +130,7 @@ export default {
|
|
|
131
130
|
return this.$store.getters['type-map/labelFor'](this.schema, 99);
|
|
132
131
|
},
|
|
133
132
|
_descriptionDisplay() {
|
|
134
|
-
const key =
|
|
133
|
+
const key = this.$route.path.split('/').pop();
|
|
135
134
|
|
|
136
135
|
return this.$store.getters['i18n/t'](`typeDescription."${ key.toLowerCase() }"`);
|
|
137
136
|
},
|
|
@@ -186,23 +185,6 @@ export default {
|
|
|
186
185
|
_createButtonlabel() {
|
|
187
186
|
return this.createButtonLabel || this.t('resourceList.head.create');
|
|
188
187
|
},
|
|
189
|
-
|
|
190
|
-
canCreateCustom() {
|
|
191
|
-
return this.hasEditComponent && this._isCreatable;
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
watch: {
|
|
196
|
-
canCreateCustom: {
|
|
197
|
-
immediate: true,
|
|
198
|
-
handler(newVal) {
|
|
199
|
-
|
|
200
|
-
console.log(newVal, ' newVal---------------------------');
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
this.$store.commit('type-map/setMastheadCreatable', newVal);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
188
|
}
|
|
207
189
|
};
|
|
208
190
|
</script>
|
|
@@ -9,7 +9,6 @@ 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'
|
|
13
12
|
|
|
14
13
|
export default {
|
|
15
14
|
name: ResourceListComponentName,
|
|
@@ -41,7 +40,7 @@ export default {
|
|
|
41
40
|
|
|
42
41
|
async fetch() {
|
|
43
42
|
const store = this.$store;
|
|
44
|
-
const resource =
|
|
43
|
+
const resource = this.resource;
|
|
45
44
|
|
|
46
45
|
const schema = this.schema;
|
|
47
46
|
|
|
@@ -89,7 +88,7 @@ export default {
|
|
|
89
88
|
data() {
|
|
90
89
|
const getters = this.$store.getters;
|
|
91
90
|
const params = { ...this.$route.params };
|
|
92
|
-
const resource =
|
|
91
|
+
const resource = params.resource;
|
|
93
92
|
|
|
94
93
|
const hasListComponent = getters['type-map/hasCustomList'](resource);
|
|
95
94
|
|
|
@@ -201,7 +200,7 @@ export default {
|
|
|
201
200
|
created() {
|
|
202
201
|
let listComponent = false;
|
|
203
202
|
|
|
204
|
-
const resource =
|
|
203
|
+
const resource = this.$route.params.resource;
|
|
205
204
|
const hasListComponent = this.$store.getters['type-map/hasCustomList'](resource);
|
|
206
205
|
|
|
207
206
|
if ( hasListComponent ) {
|
package/components/SideNav.vue
CHANGED
|
@@ -20,7 +20,6 @@ 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';
|
|
24
23
|
|
|
25
24
|
export default {
|
|
26
25
|
name: 'SideNav',
|
|
@@ -155,7 +154,7 @@ export default {
|
|
|
155
154
|
},
|
|
156
155
|
|
|
157
156
|
isVirtualProduct() {
|
|
158
|
-
return this.rootProduct.name ===
|
|
157
|
+
return this.rootProduct.name === HARVESTER;
|
|
159
158
|
},
|
|
160
159
|
|
|
161
160
|
allNavLinks() {
|
|
@@ -237,7 +236,7 @@ export default {
|
|
|
237
236
|
|
|
238
237
|
getProductsGroups(out, loadProducts, namespaceMode, productMap) {
|
|
239
238
|
const clusterId = this.$store.getters['clusterId'];
|
|
240
|
-
const currentType =
|
|
239
|
+
const currentType = this.$route.params.resource || '';
|
|
241
240
|
|
|
242
241
|
for ( const productId of loadProducts ) {
|
|
243
242
|
const modes = [TYPE_MODES.BASIC];
|
|
@@ -27,7 +27,6 @@ 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'
|
|
31
30
|
|
|
32
31
|
// Uncomment for table performance debugging
|
|
33
32
|
// import tableDebug from './debug';
|
|
@@ -416,7 +415,7 @@ export default {
|
|
|
416
415
|
const isLoading = this.loading || false;
|
|
417
416
|
|
|
418
417
|
let isCreatable = false;
|
|
419
|
-
const lastPath =
|
|
418
|
+
const lastPath = this.$route.path.split('/').pop();
|
|
420
419
|
|
|
421
420
|
if (lastPath.includes('.')) {
|
|
422
421
|
isCreatable = this.$store.getters['type-map/optionsFor'](lastPath).isCreatable;
|
|
@@ -637,7 +636,6 @@ export default {
|
|
|
637
636
|
computed: {
|
|
638
637
|
...mapGetters({ isTooManyItemsToAutoUpdate: 'resource-fetch/isTooManyItemsToAutoUpdate' }),
|
|
639
638
|
...mapGetters({ isManualRefreshLoading: 'resource-fetch/manualRefreshIsLoading' }),
|
|
640
|
-
...mapGetters('type-map', ['mastheadCreatable']),
|
|
641
639
|
namespaces() {
|
|
642
640
|
return this.$store.getters['activeNamespaceCache'];
|
|
643
641
|
},
|
|
@@ -1225,11 +1223,10 @@ export default {
|
|
|
1225
1223
|
ref="container"
|
|
1226
1224
|
:data-testid="componentTestid + '-list-container'"
|
|
1227
1225
|
>
|
|
1228
|
-
{{ mastheadCreatable }}
|
|
1229
1226
|
<div
|
|
1230
1227
|
:class="{'titled': $slots.title && $slots.title.length, 'mb-40': isFilterLabel, 'mb-20': search || isCreatable}"
|
|
1231
1228
|
class="sortable-table-header "
|
|
1232
|
-
:style="{marginTop: search&& !isBanner ? marginTopValue + 'px' : '0px',marginLeft: isCreatable
|
|
1229
|
+
:style="{marginTop: search&& !isBanner ? marginTopValue + 'px' : '0px',marginLeft: isCreatable ? '100px' : '-10px',maxHeight: '32px'}"
|
|
1233
1230
|
>
|
|
1234
1231
|
<slot name="title" />
|
|
1235
1232
|
<div
|
|
@@ -20,7 +20,6 @@ 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'
|
|
24
23
|
|
|
25
24
|
const forcedNamespaceValidTypes = [NAMESPACE_FILTER_KINDS.DIVIDER, NAMESPACE_FILTER_KINDS.PROJECT, NAMESPACE_FILTER_KINDS.NAMESPACE];
|
|
26
25
|
|
|
@@ -145,9 +144,6 @@ export default {
|
|
|
145
144
|
|
|
146
145
|
const params = { ...this.$route.params };
|
|
147
146
|
let resource = params.resource;
|
|
148
|
-
if (params.resource) {
|
|
149
|
-
resource = cloud2harvesterhci(resource)
|
|
150
|
-
}
|
|
151
147
|
|
|
152
148
|
// Sometimes, different pages may have different namespaces to filter
|
|
153
149
|
const notFilterNamespaces = this.$store.getters[`type-map/optionsFor`](resource).notFilterNamespace || [];
|
|
@@ -17,7 +17,6 @@ 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'
|
|
21
20
|
|
|
22
21
|
// i18n-uses resourceDetail.header.*
|
|
23
22
|
|
|
@@ -256,7 +255,7 @@ export default {
|
|
|
256
255
|
const defaultLocation = {
|
|
257
256
|
name: 'c-cluster-product-resource',
|
|
258
257
|
params: {
|
|
259
|
-
resource:
|
|
258
|
+
resource: this.resource,
|
|
260
259
|
product,
|
|
261
260
|
}
|
|
262
261
|
};
|
|
@@ -423,7 +422,7 @@ export default {
|
|
|
423
422
|
|
|
424
423
|
const resources = this.location?.params?.resource || ''
|
|
425
424
|
|
|
426
|
-
return this.$store.getters['type-map/groupsForVirTypes'](product,
|
|
425
|
+
return this.$store.getters['type-map/groupsForVirTypes'](product, resources);
|
|
427
426
|
},
|
|
428
427
|
|
|
429
428
|
location() {
|
|
@@ -16,7 +16,6 @@ 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'
|
|
20
19
|
|
|
21
20
|
function modeFor(route) {
|
|
22
21
|
if ( route.query?.mode === _IMPORT ) {
|
|
@@ -96,7 +95,7 @@ export default {
|
|
|
96
95
|
const route = this.$route;
|
|
97
96
|
const params = route.params;
|
|
98
97
|
const cloneParams = clone(params)
|
|
99
|
-
let resourceType = this.resourceOverride ||
|
|
98
|
+
let resourceType = this.resourceOverride || cloneParams.resource;
|
|
100
99
|
|
|
101
100
|
const inStore = this.storeOverride || store.getters['currentStore'](resourceType);
|
|
102
101
|
const realMode = this.realMode;
|
|
@@ -422,7 +421,7 @@ export default {
|
|
|
422
421
|
const id = userId || this.$route.params.id;
|
|
423
422
|
// const paramsResource = this.$route.params.resource
|
|
424
423
|
const routerResource = clone(this.$route.params.resource)
|
|
425
|
-
const resource = resourceOverride || this.resourceOverride ||
|
|
424
|
+
const resource = resourceOverride || this.resourceOverride || routerResource;
|
|
426
425
|
const options = this.$store.getters[`type-map/optionsFor`](resource);
|
|
427
426
|
|
|
428
427
|
const detailResource = options.resourceDetail || options.resource || resource;
|
|
@@ -6,7 +6,6 @@ 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'
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Resource List Masthead component.
|
|
@@ -70,14 +69,14 @@ export default {
|
|
|
70
69
|
data() {
|
|
71
70
|
const params = { ...this.$route.params };
|
|
72
71
|
|
|
73
|
-
params.resource =
|
|
72
|
+
params.resource = params.resource
|
|
74
73
|
|
|
75
|
-
const formRoute = { name: `${
|
|
74
|
+
const formRoute = { name: `${ this.$route.name }-create`, params };
|
|
76
75
|
|
|
77
76
|
const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
|
|
78
77
|
|
|
79
78
|
const yamlRoute = {
|
|
80
|
-
name: `${
|
|
79
|
+
name: `${ this.$route.name }-create`,
|
|
81
80
|
params,
|
|
82
81
|
query: { [AS]: _YAML },
|
|
83
82
|
};
|
|
@@ -6,7 +6,6 @@ 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'
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Resource List Masthead component.
|
|
@@ -91,14 +90,14 @@ export default {
|
|
|
91
90
|
data() {
|
|
92
91
|
const params = { ...this.$route.params };
|
|
93
92
|
|
|
94
|
-
params.resource =
|
|
93
|
+
params.resource = params.resource
|
|
95
94
|
|
|
96
|
-
const formRoute = { name: `${
|
|
95
|
+
const formRoute = { name: `${ this.$route.name }-create`, params };
|
|
97
96
|
|
|
98
97
|
const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
|
|
99
98
|
|
|
100
99
|
const yamlRoute = {
|
|
101
|
-
name: `${
|
|
100
|
+
name: `${ this.$route.name }-create`,
|
|
102
101
|
params,
|
|
103
102
|
query: { [AS]: _YAML },
|
|
104
103
|
};
|
|
@@ -139,7 +138,7 @@ export default {
|
|
|
139
138
|
return this.$store.getters['type-map/labelFor'](this.schema, 99);
|
|
140
139
|
},
|
|
141
140
|
_descriptionDisplay() {
|
|
142
|
-
const key =
|
|
141
|
+
const key = this.$route.path.split('/').pop();
|
|
143
142
|
|
|
144
143
|
return this.$store.getters['i18n/t'](`typeDescription."${ key.toLowerCase() }"`);
|
|
145
144
|
},
|
|
@@ -9,7 +9,6 @@ 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'
|
|
13
12
|
|
|
14
13
|
export default {
|
|
15
14
|
name: ResourceListComponentName,
|
|
@@ -41,7 +40,7 @@ export default {
|
|
|
41
40
|
|
|
42
41
|
async fetch() {
|
|
43
42
|
const store = this.$store;
|
|
44
|
-
const resource =
|
|
43
|
+
const resource = this.resource;
|
|
45
44
|
|
|
46
45
|
const schema = this.schema;
|
|
47
46
|
|
|
@@ -89,7 +88,7 @@ export default {
|
|
|
89
88
|
data() {
|
|
90
89
|
const getters = this.$store.getters;
|
|
91
90
|
const params = { ...this.$route.params };
|
|
92
|
-
const resource =
|
|
91
|
+
const resource = params.resource;
|
|
93
92
|
|
|
94
93
|
const hasListComponent = getters['type-map/hasCustomList'](resource);
|
|
95
94
|
|
|
@@ -201,7 +200,7 @@ export default {
|
|
|
201
200
|
created() {
|
|
202
201
|
let listComponent = false;
|
|
203
202
|
|
|
204
|
-
const resource =
|
|
203
|
+
const resource = this.$route.params.resource;
|
|
205
204
|
const hasListComponent = this.$store.getters['type-map/hasCustomList'](resource);
|
|
206
205
|
|
|
207
206
|
if ( hasListComponent ) {
|
|
@@ -27,7 +27,6 @@ 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'
|
|
31
30
|
|
|
32
31
|
// Uncomment for table performance debugging
|
|
33
32
|
// import tableDebug from './debug';
|
|
@@ -416,7 +415,7 @@ export default {
|
|
|
416
415
|
const isLoading = this.loading || false;
|
|
417
416
|
|
|
418
417
|
let isCreatable = false;
|
|
419
|
-
const lastPath =
|
|
418
|
+
const lastPath = this.$route.path.split('/').pop();
|
|
420
419
|
|
|
421
420
|
if (lastPath.includes('.')) {
|
|
422
421
|
isCreatable = this.$store.getters['type-map/optionsFor'](lastPath).isCreatable;
|
|
@@ -10,14 +10,107 @@ import { install as installHandleInstallRedirect } from '@shell/config/router/na
|
|
|
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
|
|
|
13
|
+
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* 获取内部 product/resource,始终是 harvester 形式
|
|
15
16
|
*/
|
|
16
|
-
export function
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
export function getInternalProduct(route) {
|
|
18
|
+
return route.params?.product;
|
|
19
|
+
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
export function getInternalResource(route) {
|
|
22
|
+
return route.params?.resource;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Install our router navigation guards with cloud/harvester mapping.
|
|
27
|
+
*/
|
|
28
|
+
export function installNavigationGuards(router, context) {
|
|
29
|
+
// ---------------------------
|
|
30
|
+
// 1. 安装原有导航守卫
|
|
31
|
+
// ---------------------------
|
|
32
|
+
const navigationGuardInstallers = [
|
|
33
|
+
installLoadInitialSettings,
|
|
34
|
+
installAttemptFirstLogin,
|
|
35
|
+
installAuthentication,
|
|
36
|
+
installProducts,
|
|
37
|
+
installClusters,
|
|
38
|
+
installRuntimeExtensionRoute,
|
|
39
|
+
installI18N,
|
|
40
|
+
installHandleInstallRedirect,
|
|
41
|
+
installPageTitle,
|
|
42
|
+
installRecordLastRoute,
|
|
43
|
+
installServerUpgradeGrowl
|
|
44
|
+
];
|
|
21
45
|
|
|
22
46
|
navigationGuardInstallers.forEach((installer) => installer(router, context));
|
|
47
|
+
|
|
48
|
+
// ---------------------------
|
|
49
|
+
// 2. 入口层 beforeEach: cloud -> harvester
|
|
50
|
+
// ---------------------------
|
|
51
|
+
router.beforeEach((to, from, next) => {
|
|
52
|
+
const newParams = { ...to.params };
|
|
53
|
+
let changed = false;
|
|
54
|
+
|
|
55
|
+
if (newParams.product) {
|
|
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
|
+
// ---------------------------
|
|
105
|
+
router.afterEach((to) => {
|
|
106
|
+
let cloudPath = to.fullPath;
|
|
107
|
+
|
|
108
|
+
// 使用正则替换所有 harvester → cloud
|
|
109
|
+
cloudPath = cloudPath.replace(/harvesterManager/g, 'cloudManager');
|
|
110
|
+
cloudPath = cloudPath.replace(/harvesterhci\.io\.management\.cluster/g, 'cloudhci.io.management.cluster');
|
|
111
|
+
|
|
112
|
+
if (cloudPath !== to.fullPath) {
|
|
113
|
+
window.history.replaceState({}, '', cloudPath);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
23
116
|
}
|
|
@@ -52,7 +52,6 @@ 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'
|
|
56
55
|
|
|
57
56
|
const TAB_WEIGHT_MAP = {
|
|
58
57
|
general: 99,
|
|
@@ -171,7 +170,7 @@ export default {
|
|
|
171
170
|
data() {
|
|
172
171
|
serialMaker.setPrefix('container-');
|
|
173
172
|
serialMaker.setSeq(0);
|
|
174
|
-
let type =
|
|
173
|
+
let type = this.$route.params.resource;
|
|
175
174
|
const createSidecar = !!this.$route.query.sidecar;
|
|
176
175
|
|
|
177
176
|
if (type === 'workload') {
|
package/list/workload.vue
CHANGED
|
@@ -5,7 +5,6 @@ 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'
|
|
9
8
|
|
|
10
9
|
const workloadSchema = {
|
|
11
10
|
id: 'workload',
|
|
@@ -27,10 +26,10 @@ const $loadingResources = ($route, $store) => {
|
|
|
27
26
|
}
|
|
28
27
|
});
|
|
29
28
|
|
|
30
|
-
const allTypes =
|
|
29
|
+
const allTypes = $route.params.resource === workloadSchema.id;
|
|
31
30
|
|
|
32
31
|
return {
|
|
33
|
-
loadResources: allTypes ? allowedResources : [
|
|
32
|
+
loadResources: allTypes ? allowedResources : [$route.params.resource],
|
|
34
33
|
loadIndeterminate: allTypes,
|
|
35
34
|
};
|
|
36
35
|
};
|
|
@@ -55,7 +54,7 @@ export default {
|
|
|
55
54
|
if (this.allTypes && this.loadResources.length) {
|
|
56
55
|
this.$initializeFetchData(this.loadResources[0], this.loadResources);
|
|
57
56
|
} else {
|
|
58
|
-
this.$initializeFetchData(
|
|
57
|
+
this.$initializeFetchData(this.$route.params.resource);
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
try {
|
|
@@ -74,7 +73,7 @@ export default {
|
|
|
74
73
|
return this.$fetchType(allowed, this.loadResources);
|
|
75
74
|
}));
|
|
76
75
|
} else {
|
|
77
|
-
const type =
|
|
76
|
+
const type = this.$route.params.resource;
|
|
78
77
|
|
|
79
78
|
if ( this.$store.getters['cluster/schemaFor'](type) ) {
|
|
80
79
|
const resource = await this.$fetchType(type);
|
|
@@ -89,7 +88,7 @@ export default {
|
|
|
89
88
|
const { loadResources, loadIndeterminate } = $loadingResources(this.$route, this.$store);
|
|
90
89
|
|
|
91
90
|
const { params:{ resource: type } } = this.$route;
|
|
92
|
-
const allTypes =
|
|
91
|
+
const allTypes = this.$route.params.resource === workloadSchema.id;
|
|
93
92
|
const schema = type !== workloadSchema.id ? this.$store.getters['cluster/schemaFor'](type) : workloadSchema;
|
|
94
93
|
const paginationEnabled = !allTypes && this.$store.getters[`cluster/paginationEnabled`]?.({ id: type });
|
|
95
94
|
|
|
@@ -144,7 +143,7 @@ export default {
|
|
|
144
143
|
this.$fetchType(POD);
|
|
145
144
|
this.$fetchType(WORKLOAD_TYPES.JOB);
|
|
146
145
|
} else {
|
|
147
|
-
const type =
|
|
146
|
+
const type = this.$route.params.resource;
|
|
148
147
|
|
|
149
148
|
if (type === WORKLOAD_TYPES.JOB || type === POD) {
|
|
150
149
|
// Ignore job and pods (we're fetching this anyway, plus they contain their own state)
|
package/mixins/resource-fetch.js
CHANGED
|
@@ -3,7 +3,6 @@ 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'
|
|
7
6
|
|
|
8
7
|
// Number of pages to fetch when loading incrementally
|
|
9
8
|
const PAGES = 4;
|
|
@@ -35,7 +34,7 @@ export default {
|
|
|
35
34
|
// Normally owner components supply `resource` and `inStore` as part of their data, however these are needed here before parent data runs
|
|
36
35
|
// So set up both here
|
|
37
36
|
const params = { ...this.$route.params };
|
|
38
|
-
const resource =
|
|
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
|
|
39
38
|
const inStore = this.$store.getters['currentStore'](resource);
|
|
40
39
|
|
|
41
40
|
return {
|
|
@@ -2,7 +2,6 @@ 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'
|
|
6
5
|
import {
|
|
7
6
|
_EDIT,
|
|
8
7
|
_UNFLAG,
|
|
@@ -55,7 +54,7 @@ export default class Setting extends HybridModel {
|
|
|
55
54
|
goToEdit(moreQuery = {}) {
|
|
56
55
|
if (this.$rootGetters['currentProduct'].inStore === HARVESTER) {
|
|
57
56
|
location.name = `${ HARVESTER }-c-cluster-brand`;
|
|
58
|
-
location.params = { cluster: this.$rootGetters['currentCluster'].id, product:
|
|
57
|
+
location.params = { cluster: this.$rootGetters['currentCluster'].id, product: HARVESTER };
|
|
59
58
|
|
|
60
59
|
location.query = {
|
|
61
60
|
...location.query,
|
package/package.json
CHANGED
package/pages/auth/login.vue
CHANGED
|
@@ -32,7 +32,6 @@ 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'
|
|
36
35
|
|
|
37
36
|
export default {
|
|
38
37
|
name: 'Login',
|
|
@@ -79,7 +78,7 @@ export default {
|
|
|
79
78
|
},
|
|
80
79
|
|
|
81
80
|
isHarvester() {
|
|
82
|
-
return this.isSingleProduct?.productName ===
|
|
81
|
+
return this.isSingleProduct?.productName === HARVESTER;
|
|
83
82
|
},
|
|
84
83
|
|
|
85
84
|
singleProvider() {
|
|
@@ -32,7 +32,6 @@ 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'
|
|
36
35
|
|
|
37
36
|
export default {
|
|
38
37
|
name: 'Login',
|
|
@@ -78,7 +77,7 @@ export default {
|
|
|
78
77
|
},
|
|
79
78
|
|
|
80
79
|
isHarvester() {
|
|
81
|
-
return this.isSingleProduct?.productName ===
|
|
80
|
+
return this.isSingleProduct?.productName === HARVESTER;
|
|
82
81
|
},
|
|
83
82
|
|
|
84
83
|
singleProvider() {
|
package/pages/prefs.vue
CHANGED
|
@@ -18,7 +18,6 @@ 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'
|
|
22
21
|
|
|
23
22
|
export default {
|
|
24
23
|
components: {
|
|
@@ -45,7 +44,7 @@ export default {
|
|
|
45
44
|
...mapGetters({ hasMultipleLocales: 'i18n/hasMultipleLocales' }),
|
|
46
45
|
|
|
47
46
|
isHarvester() {
|
|
48
|
-
return this.isSingleProduct?.productName ===
|
|
47
|
+
return this.isSingleProduct?.productName === HARVESTER;
|
|
49
48
|
},
|
|
50
49
|
|
|
51
50
|
theme: {
|
|
@@ -2,8 +2,6 @@ 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
|
-
|
|
7
5
|
export const KEY_FIELD_FOR = {
|
|
8
6
|
[SCHEMA]: '_id',
|
|
9
7
|
default: 'id',
|
|
@@ -16,7 +14,7 @@ export function keyFieldFor(type) {
|
|
|
16
14
|
export function normalizeType(type) {
|
|
17
15
|
type = (type?.type || type || '').toLowerCase();
|
|
18
16
|
|
|
19
|
-
return
|
|
17
|
+
return type;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
// Detect and resolve conflicts from a 409 response.
|
|
@@ -34,7 +34,6 @@ 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'
|
|
38
37
|
|
|
39
38
|
export const DNS_LIKE_TYPES = ['dnsLabel', 'dnsLabelRestricted', 'hostname'];
|
|
40
39
|
|
|
@@ -1270,7 +1269,7 @@ export default class Resource {
|
|
|
1270
1269
|
params: {
|
|
1271
1270
|
product: this.$rootGetters['productId'],
|
|
1272
1271
|
cluster: this.$rootGetters['clusterId'],
|
|
1273
|
-
resource:
|
|
1272
|
+
resource: this.type,
|
|
1274
1273
|
}
|
|
1275
1274
|
};
|
|
1276
1275
|
}
|
|
@@ -1285,7 +1284,7 @@ export default class Resource {
|
|
|
1285
1284
|
params: {
|
|
1286
1285
|
product: this.$rootGetters['productId'],
|
|
1287
1286
|
cluster: this.$rootGetters['clusterId'],
|
|
1288
|
-
resource:
|
|
1287
|
+
resource: this.type,
|
|
1289
1288
|
namespace: this.metadata?.namespace,
|
|
1290
1289
|
id,
|
|
1291
1290
|
}
|
package/store/type-map.js
CHANGED
|
@@ -432,13 +432,10 @@ export const state = function() {
|
|
|
432
432
|
'cloud-credential': {}
|
|
433
433
|
|
|
434
434
|
},
|
|
435
|
-
mastheadCreatable: true,
|
|
436
435
|
};
|
|
437
436
|
};
|
|
438
437
|
|
|
439
438
|
export const getters = {
|
|
440
|
-
mastheadCreatable: (state) => state.mastheadCreatable,
|
|
441
|
-
|
|
442
439
|
// ----------------------------------------------------------------------------
|
|
443
440
|
// 1 ) Getting info
|
|
444
441
|
// ----------------------------------------------------------------------------
|
|
@@ -510,7 +507,7 @@ export const getters = {
|
|
|
510
507
|
|
|
511
508
|
groupForBasicType(state) {
|
|
512
509
|
return (product, schemaId) => {
|
|
513
|
-
return state.basicTypes?.[product]?.[
|
|
510
|
+
return state.basicTypes?.[product]?.[schemaId];
|
|
514
511
|
};
|
|
515
512
|
},
|
|
516
513
|
|
|
@@ -1487,10 +1484,6 @@ export const getters = {
|
|
|
1487
1484
|
};
|
|
1488
1485
|
|
|
1489
1486
|
export const mutations = {
|
|
1490
|
-
setMastheadCreatable(state, value) {
|
|
1491
|
-
state.mastheadCreatable = value;
|
|
1492
|
-
},
|
|
1493
|
-
|
|
1494
1487
|
schemaChanged(state) {
|
|
1495
1488
|
state.schemaGeneration = state.schemaGeneration + 1;
|
|
1496
1489
|
},
|
|
@@ -3858,10 +3858,8 @@ export function state(): {
|
|
|
3858
3858
|
'machine-config': {};
|
|
3859
3859
|
'cloud-credential': {};
|
|
3860
3860
|
};
|
|
3861
|
-
mastheadCreatable: boolean;
|
|
3862
3861
|
};
|
|
3863
3862
|
export namespace getters {
|
|
3864
|
-
function mastheadCreatable(state: any): any;
|
|
3865
3863
|
function labelFor(state: any, getters: any, rootState: any, rootGetters: any): (schema: any, count?: number, language?: any) => any;
|
|
3866
3864
|
function groupLabelFor(state: any): (schemaOrName: any) => any;
|
|
3867
3865
|
function groupForBasicType(state: any): (product: any, schemaId: any) => any;
|
|
@@ -3924,7 +3922,6 @@ export namespace getters {
|
|
|
3924
3922
|
function productByName(state: any): (productName: any) => any;
|
|
3925
3923
|
}
|
|
3926
3924
|
export namespace mutations {
|
|
3927
|
-
function setMastheadCreatable(state: any, value: any): void;
|
|
3928
3925
|
function schemaChanged(state: any): void;
|
|
3929
3926
|
function remove(state: any, { product, plugin }: {
|
|
3930
3927
|
product: any;
|
|
@@ -9410,10 +9407,8 @@ export function state(): {
|
|
|
9410
9407
|
'machine-config': {};
|
|
9411
9408
|
'cloud-credential': {};
|
|
9412
9409
|
};
|
|
9413
|
-
mastheadCreatable: boolean;
|
|
9414
9410
|
};
|
|
9415
9411
|
export namespace getters {
|
|
9416
|
-
function mastheadCreatable(state: any): any;
|
|
9417
9412
|
function labelFor(state: any, getters: any, rootState: any, rootGetters: any): (schema: any, count?: number, language?: any) => any;
|
|
9418
9413
|
function groupLabelFor(state: any): (schemaOrName: any) => any;
|
|
9419
9414
|
function groupForBasicType(state: any): (product: any, schemaId: any) => any;
|
|
@@ -9476,7 +9471,6 @@ export namespace getters {
|
|
|
9476
9471
|
function productByName(state: any): (productName: any) => any;
|
|
9477
9472
|
}
|
|
9478
9473
|
export namespace mutations {
|
|
9479
|
-
function setMastheadCreatable(state: any, value: any): void;
|
|
9480
9474
|
function schemaChanged(state: any): void;
|
|
9481
9475
|
function remove(state: any, { product, plugin }: {
|
|
9482
9476
|
product: any;
|