dashboard-shell-shell 1.0.1000000083 → 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.
@@ -416,6 +416,7 @@ export default {
416
416
  </script>
417
417
 
418
418
  <template>
419
+ 测试111111111111111111111111
419
420
  <div class="project-namespaces outlet">
420
421
  <Masthead
421
422
  :schema="projectSchema"
@@ -256,7 +256,7 @@ export default {
256
256
  const defaultLocation = {
257
257
  name: 'c-cluster-product-resource',
258
258
  params: {
259
- resource: harvesterhci2cloud(this.resource),
259
+ resource: this.resource,
260
260
  product,
261
261
  }
262
262
  };
@@ -86,15 +86,12 @@ export default {
86
86
  data() {
87
87
  const params = { ...this.$route.params };
88
88
 
89
- params.resource = harvesterhci2cloud(params.resource)
89
+ params.resource = params.resource
90
90
 
91
91
  const formRoute = { name: `${ cloud2harvesterhci(this.$route.name) }-create`, params };
92
92
 
93
93
  const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
94
94
 
95
- console.log(hasEditComponent, ' hasEditComponent------------------------------------1');
96
-
97
-
98
95
  const yamlRoute = {
99
96
  name: `${ cloud2harvesterhci(this.$route.name) }-create`,
100
97
  params,
@@ -189,23 +186,6 @@ export default {
189
186
  _createButtonlabel() {
190
187
  return this.createButtonLabel || this.t('resourceList.head.create');
191
188
  },
192
-
193
- canCreateCustom() {
194
- return this.hasEditComponent && this._isCreatable;
195
- },
196
- },
197
-
198
- watch: {
199
- canCreateCustom: {
200
- immediate: true,
201
- handler(newVal) {
202
-
203
- console.log(newVal, ' newVal---------------------------');
204
-
205
-
206
- this.$store.commit('type-map/setMastheadCreatable', newVal);
207
- }
208
- }
209
189
  }
210
190
  };
211
191
  </script>
@@ -155,7 +155,7 @@ export default {
155
155
  },
156
156
 
157
157
  isVirtualProduct() {
158
- return this.rootProduct.name === harvester2cloud(HARVESTER);
158
+ return this.rootProduct.name === HARVESTER;
159
159
  },
160
160
 
161
161
  allNavLinks() {
@@ -418,28 +418,13 @@ export default {
418
418
  let isCreatable = false;
419
419
  const lastPath = cloud2harvesterhci(this.$route.path.split('/').pop());
420
420
 
421
- if (lastPath?.includes('.')) {
421
+ if (lastPath.includes('.')) {
422
422
  isCreatable = this.$store.getters['type-map/optionsFor'](lastPath).isCreatable;
423
423
  } else if (lastPath === 'namespace') {
424
424
  isCreatable = this.$store.getters['type-map/optionsFor'](this.$route.name).isCreatable;
425
425
  }
426
426
 
427
- const resource = cloud2harvesterhci(this.$route.params.resource);
428
-
429
- let hasEditComponent = false
430
-
431
- if (lastPath?.includes('.')) {
432
- hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](lastPath);
433
- } else if (lastPath === 'namespace') {
434
- hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.$route.name);
435
- } else {
436
- hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](resource);
437
- }
438
-
439
- console.log(hasEditComponent, ' hasEditComponent------------------------------------2');
440
-
441
427
  return {
442
- hasEditComponent,
443
428
  refreshButtonPhase: isLoading ? ASYNC_BUTTON_STATES.WAITING : ASYNC_BUTTON_STATES.ACTION,
444
429
  expanded: {},
445
430
  searchQuery,
@@ -1242,7 +1227,7 @@ export default {
1242
1227
  <div
1243
1228
  :class="{'titled': $slots.title && $slots.title.length, 'mb-40': isFilterLabel, 'mb-20': search || isCreatable}"
1244
1229
  class="sortable-table-header "
1245
- :style="{marginTop: search&& !isBanner ? marginTopValue + 'px' : '0px',marginLeft: isCreatable && hasEditComponent ? '100px' : '-10px',maxHeight: '32px'}"
1230
+ :style="{marginTop: search&& !isBanner ? marginTopValue + 'px' : '0px',marginLeft: isCreatable ? '100px' : '-10px',maxHeight: '32px'}"
1246
1231
  >
1247
1232
  <slot name="title" />
1248
1233
  <div
@@ -256,7 +256,7 @@ export default {
256
256
  const defaultLocation = {
257
257
  name: 'c-cluster-product-resource',
258
258
  params: {
259
- resource: harvesterhci2cloud(this.resource),
259
+ resource: this.resource,
260
260
  product,
261
261
  }
262
262
  };
@@ -70,7 +70,7 @@ export default {
70
70
  data() {
71
71
  const params = { ...this.$route.params };
72
72
 
73
- params.resource = harvesterhci2cloud(params.resource)
73
+ params.resource = params.resource
74
74
 
75
75
  const formRoute = { name: `${ cloud2harvesterhci(this.$route.name) }-create`, params };
76
76
 
@@ -91,7 +91,7 @@ export default {
91
91
  data() {
92
92
  const params = { ...this.$route.params };
93
93
 
94
- params.resource = harvesterhci2cloud(params.resource)
94
+ params.resource = params.resource
95
95
 
96
96
  const formRoute = { name: `${ cloud2harvesterhci(this.$route.name) }-create`, params };
97
97
 
@@ -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,15 +9,52 @@ 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
+ import { harvester2cloud } from '@shell/utils/router';
12
13
 
13
14
  /**
14
- * Install our router navigation guards. i.e. router.beforeEach(), router.afterEach()
15
+ * Install router navigation guards
16
+ * 1. 保留原有导航守卫顺序
17
+ * 2. 不在 beforeEach 改 params,只在 push/replace & afterEach 改 URL
15
18
  */
16
19
  export function installNavigationGuards(router, context) {
17
- // NOTE: the order of the installation matters.
18
- // Be intentional when adding, removing or modifying the guards that are installed.
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
+ }
19
26
 
20
- const navigationGuardInstallers = [installLoadInitialSettings, installAttemptFirstLogin, installAuthentication, installProducts, installClusters, installRuntimeExtensionRoute, installI18N, installHandleInstallRedirect, installPageTitle, installRecordLastRoute, installServerUpgradeGrowl];
27
+ if (to?.params?.cluster) {
28
+ to.params.cluster = to.params.cluster.replace(/cloud/g, 'harvester')
29
+ }
21
30
 
22
- navigationGuardInstallers.forEach((installer) => installer(router, context));
31
+ next();
32
+ });
33
+
34
+ const navigationGuardInstallers = [
35
+ installLoadInitialSettings,
36
+ installAttemptFirstLogin,
37
+ installAuthentication,
38
+ installProducts,
39
+ installClusters,
40
+ installRuntimeExtensionRoute,
41
+ installI18N,
42
+ installHandleInstallRedirect,
43
+ installPageTitle,
44
+ installRecordLastRoute,
45
+ installServerUpgradeGrowl
46
+ ];
47
+
48
+ navigationGuardInstallers.forEach(installer => installer(router, context));
49
+
50
+ // 🔹 最后执行:只改地址栏,不改内部
51
+ router.afterEach((to) => {
52
+ const cloudPath = to.fullPath
53
+ .replace(/harvester/g, 'cloud')
54
+
55
+ if (cloudPath !== to.fullPath) {
56
+ window.history.replaceState({}, '', cloudPath);
57
+ }
58
+ });
23
59
  }
60
+
@@ -55,7 +55,7 @@ export default class Setting extends HybridModel {
55
55
  goToEdit(moreQuery = {}) {
56
56
  if (this.$rootGetters['currentProduct'].inStore === HARVESTER) {
57
57
  location.name = `${ HARVESTER }-c-cluster-brand`;
58
- location.params = { cluster: this.$rootGetters['currentCluster'].id, product: harvester2cloud(HARVESTER) };
58
+ location.params = { cluster: this.$rootGetters['currentCluster'].id, product: HARVESTER };
59
59
 
60
60
  location.query = {
61
61
  ...location.query,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashboard-shell-shell",
3
- "version": "1.0.1000000083",
3
+ "version": "1.0.1000000090",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancherlabs/dashboard",
6
6
  "license": "Apache-2.0",
@@ -79,7 +79,7 @@ export default {
79
79
  },
80
80
 
81
81
  isHarvester() {
82
- return this.isSingleProduct?.productName === harvester2cloud(HARVESTER);
82
+ return this.isSingleProduct?.productName === HARVESTER;
83
83
  },
84
84
 
85
85
  singleProvider() {
@@ -78,7 +78,7 @@ export default {
78
78
  },
79
79
 
80
80
  isHarvester() {
81
- return this.isSingleProduct?.productName === harvester2cloud(HARVESTER);
81
+ return this.isSingleProduct?.productName === HARVESTER;
82
82
  },
83
83
 
84
84
  singleProvider() {
package/pages/prefs.vue CHANGED
@@ -45,7 +45,7 @@ export default {
45
45
  ...mapGetters({ hasMultipleLocales: 'i18n/hasMultipleLocales' }),
46
46
 
47
47
  isHarvester() {
48
- return this.isSingleProduct?.productName === harvester2cloud(HARVESTER);
48
+ return this.isSingleProduct?.productName === HARVESTER;
49
49
  },
50
50
 
51
51
  theme: {
@@ -1270,7 +1270,7 @@ export default class Resource {
1270
1270
  params: {
1271
1271
  product: this.$rootGetters['productId'],
1272
1272
  cluster: this.$rootGetters['clusterId'],
1273
- resource: harvesterhci2cloud(this.type),
1273
+ resource: this.type,
1274
1274
  }
1275
1275
  };
1276
1276
  }
@@ -1285,7 +1285,7 @@ export default class Resource {
1285
1285
  params: {
1286
1286
  product: this.$rootGetters['productId'],
1287
1287
  cluster: this.$rootGetters['clusterId'],
1288
- resource: harvesterhci2cloud(this.type),
1288
+ resource: this.type,
1289
1289
  namespace: this.metadata?.namespace,
1290
1290
  id,
1291
1291
  }
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
  // ----------------------------------------------------------------------------
@@ -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;
@@ -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 harvesterhci2cloud(str: any): any;
4164
+ export function str: any: any;
4165
4165
  export function cloud2harvesterhci(str: any): any;
4166
- export function harvester2cloud(str: any): any;
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;