dashboard-shell-shell 1.0.1000000099 → 1.0.1000000112

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,7 +416,6 @@ export default {
416
416
  </script>
417
417
 
418
418
  <template>
419
- 测试111111111111111111111111
420
419
  <div class="project-namespaces outlet">
421
420
  <Masthead
422
421
  :schema="projectSchema"
@@ -425,7 +425,7 @@ export default {
425
425
 
426
426
  const resources = this.location?.params?.resource || ''
427
427
 
428
- return this.$store.getters['type-map/groupsForVirTypes'](product, cloud2harvesterhci(resources));
428
+ return this.$store.getters['type-map/groupsForVirTypes'](product, resources);
429
429
  },
430
430
 
431
431
  location() {
@@ -96,7 +96,7 @@ export default {
96
96
  const route = this.$route;
97
97
  const params = route.params;
98
98
  const cloneParams = clone(params)
99
- let resourceType = this.resourceOverride || cloud2harvesterhci(cloneParams.resource);
99
+ let resourceType = this.resourceOverride || cloneParams.resource;
100
100
 
101
101
  const inStore = this.storeOverride || store.getters['currentStore'](resourceType);
102
102
  const realMode = this.realMode;
@@ -422,7 +422,7 @@ export default {
422
422
  const id = userId || this.$route.params.id;
423
423
  // const paramsResource = this.$route.params.resource
424
424
  const routerResource = clone(this.$route.params.resource)
425
- const resource = resourceOverride || this.resourceOverride || cloud2harvesterhci(routerResource);
425
+ const resource = resourceOverride || this.resourceOverride || routerResource;
426
426
  const options = this.$store.getters[`type-map/optionsFor`](resource);
427
427
 
428
428
  const detailResource = options.resourceDetail || options.resource || resource;
@@ -88,12 +88,12 @@ export default {
88
88
 
89
89
  params.resource = params.resource
90
90
 
91
- const formRoute = { name: `${ cloud2harvesterhci(this.$route.name) }-create`, params };
91
+ const formRoute = { name: `${ this.$route.name }-create`, params };
92
92
 
93
93
  const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
94
94
 
95
95
  const yamlRoute = {
96
- name: `${ cloud2harvesterhci(this.$route.name) }-create`,
96
+ name: `${ this.$route.name }-create`,
97
97
  params,
98
98
  query: { [AS]: _YAML },
99
99
  };
@@ -133,7 +133,7 @@ export default {
133
133
  return this.$store.getters['type-map/labelFor'](this.schema, 99);
134
134
  },
135
135
  _descriptionDisplay() {
136
- const key = cloud2harvesterhci(this.$route.path.split('/').pop());
136
+ const key = this.$route.path.split('/'.pop());
137
137
 
138
138
  return this.$store.getters['i18n/t'](`typeDescription."${ key.toLowerCase() }"`);
139
139
  },
@@ -41,7 +41,7 @@ export default {
41
41
 
42
42
  async fetch() {
43
43
  const store = this.$store;
44
- const resource = cloud2harvesterhci(this.resource);
44
+ const resource = this.resource;
45
45
 
46
46
  const schema = this.schema;
47
47
 
@@ -89,7 +89,7 @@ export default {
89
89
  data() {
90
90
  const getters = this.$store.getters;
91
91
  const params = { ...this.$route.params };
92
- const resource = cloud2harvesterhci(params.resource);
92
+ const resource = params.resource;
93
93
 
94
94
  const hasListComponent = getters['type-map/hasCustomList'](resource);
95
95
 
@@ -201,7 +201,7 @@ export default {
201
201
  created() {
202
202
  let listComponent = false;
203
203
 
204
- const resource = cloud2harvesterhci(this.$route.params.resource);
204
+ const resource = this.$route.params.resource;
205
205
  const hasListComponent = this.$store.getters['type-map/hasCustomList'](resource);
206
206
 
207
207
  if ( hasListComponent ) {
@@ -237,7 +237,7 @@ export default {
237
237
 
238
238
  getProductsGroups(out, loadProducts, namespaceMode, productMap) {
239
239
  const clusterId = this.$store.getters['clusterId'];
240
- const currentType = cloud2harvesterhci(this.$route.params.resource) || '';
240
+ const currentType = this.$route.params.resource || '';
241
241
 
242
242
  for ( const productId of loadProducts ) {
243
243
  const modes = [TYPE_MODES.BASIC];
@@ -416,15 +416,28 @@ export default {
416
416
  const isLoading = this.loading || false;
417
417
 
418
418
  let isCreatable = false;
419
- const lastPath = cloud2harvesterhci(this.$route.path.split('/').pop());
419
+ const lastPath = 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 = 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
+
427
439
  return {
440
+ hasEditComponent,
428
441
  refreshButtonPhase: isLoading ? ASYNC_BUTTON_STATES.WAITING : ASYNC_BUTTON_STATES.ACTION,
429
442
  expanded: {},
430
443
  searchQuery,
@@ -1227,7 +1240,7 @@ export default {
1227
1240
  <div
1228
1241
  :class="{'titled': $slots.title && $slots.title.length, 'mb-40': isFilterLabel, 'mb-20': search || isCreatable}"
1229
1242
  class="sortable-table-header "
1230
- :style="{marginTop: search&& !isBanner ? marginTopValue + 'px' : '0px',marginLeft: isCreatable ? '100px' : '-10px',maxHeight: '32px'}"
1243
+ :style="{marginTop: search&& !isBanner ? marginTopValue + 'px' : '0px',marginLeft: isCreatable && hasEditComponent ? '100px' : '-10px',maxHeight: '32px'}"
1231
1244
  >
1232
1245
  <slot name="title" />
1233
1246
  <div
@@ -737,7 +737,7 @@ export default {
737
737
  <Tab
738
738
  v-if="isRancherRoleTemplate"
739
739
  name="inherit-from"
740
- label="Inherit From"
740
+ label="继承表单"
741
741
  :weight="0"
742
742
  >
743
743
  <ArrayList
@@ -146,7 +146,7 @@ export default {
146
146
  const params = { ...this.$route.params };
147
147
  let resource = params.resource;
148
148
  if (params.resource) {
149
- resource = cloud2harvesterhci(resource)
149
+ resource = resource
150
150
  }
151
151
 
152
152
  // Sometimes, different pages may have different namespaces to filter
@@ -423,7 +423,7 @@ export default {
423
423
 
424
424
  const resources = this.location?.params?.resource || ''
425
425
 
426
- return this.$store.getters['type-map/groupsForVirTypes'](product, cloud2harvesterhci(resources));
426
+ return this.$store.getters['type-map/groupsForVirTypes'](product, resources);
427
427
  },
428
428
 
429
429
  location() {
@@ -96,7 +96,7 @@ export default {
96
96
  const route = this.$route;
97
97
  const params = route.params;
98
98
  const cloneParams = clone(params)
99
- let resourceType = this.resourceOverride || cloud2harvesterhci(cloneParams.resource);
99
+ let resourceType = this.resourceOverride || cloneParams.resource;
100
100
 
101
101
  const inStore = this.storeOverride || store.getters['currentStore'](resourceType);
102
102
  const realMode = this.realMode;
@@ -422,7 +422,7 @@ export default {
422
422
  const id = userId || this.$route.params.id;
423
423
  // const paramsResource = this.$route.params.resource
424
424
  const routerResource = clone(this.$route.params.resource)
425
- const resource = resourceOverride || this.resourceOverride || cloud2harvesterhci(routerResource);
425
+ const resource = resourceOverride || this.resourceOverride || routerResource;
426
426
  const options = this.$store.getters[`type-map/optionsFor`](resource);
427
427
 
428
428
  const detailResource = options.resourceDetail || options.resource || resource;
@@ -72,12 +72,12 @@ export default {
72
72
 
73
73
  params.resource = params.resource
74
74
 
75
- const formRoute = { name: `${ cloud2harvesterhci(this.$route.name) }-create`, params };
75
+ const formRoute = { name: `${ this.$route.name }-create`, params };
76
76
 
77
77
  const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
78
78
 
79
79
  const yamlRoute = {
80
- name: `${ cloud2harvesterhci(this.$route.name) }-create`,
80
+ name: `${ this.$route.name }-create`,
81
81
  params,
82
82
  query: { [AS]: _YAML },
83
83
  };
@@ -93,12 +93,12 @@ export default {
93
93
 
94
94
  params.resource = params.resource
95
95
 
96
- const formRoute = { name: `${ cloud2harvesterhci(this.$route.name) }-create`, params };
96
+ const formRoute = { name: `${ this.$route.name }-create`, params };
97
97
 
98
98
  const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
99
99
 
100
100
  const yamlRoute = {
101
- name: `${ cloud2harvesterhci(this.$route.name) }-create`,
101
+ name: `${ this.$route.name }-create`,
102
102
  params,
103
103
  query: { [AS]: _YAML },
104
104
  };
@@ -139,7 +139,7 @@ export default {
139
139
  return this.$store.getters['type-map/labelFor'](this.schema, 99);
140
140
  },
141
141
  _descriptionDisplay() {
142
- const key = cloud2harvesterhci(this.$route.path.split('/').pop());
142
+ const key = this.$route.path.split('/'.pop());
143
143
 
144
144
  return this.$store.getters['i18n/t'](`typeDescription."${ key.toLowerCase() }"`);
145
145
  },
@@ -41,7 +41,7 @@ export default {
41
41
 
42
42
  async fetch() {
43
43
  const store = this.$store;
44
- const resource = cloud2harvesterhci(this.resource);
44
+ const resource = this.resource;
45
45
 
46
46
  const schema = this.schema;
47
47
 
@@ -89,7 +89,7 @@ export default {
89
89
  data() {
90
90
  const getters = this.$store.getters;
91
91
  const params = { ...this.$route.params };
92
- const resource = cloud2harvesterhci(params.resource);
92
+ const resource = params.resource;
93
93
 
94
94
  const hasListComponent = getters['type-map/hasCustomList'](resource);
95
95
 
@@ -201,7 +201,7 @@ export default {
201
201
  created() {
202
202
  let listComponent = false;
203
203
 
204
- const resource = cloud2harvesterhci(this.$route.params.resource);
204
+ const resource = this.$route.params.resource;
205
205
  const hasListComponent = this.$store.getters['type-map/hasCustomList'](resource);
206
206
 
207
207
  if ( hasListComponent ) {
@@ -416,7 +416,7 @@ export default {
416
416
  const isLoading = this.loading || false;
417
417
 
418
418
  let isCreatable = false;
419
- const lastPath = cloud2harvesterhci(this.$route.path.split('/').pop());
419
+ const lastPath = this.$route.path.split('/'.pop());
420
420
 
421
421
  if (lastPath.includes('.')) {
422
422
  isCreatable = this.$store.getters['type-map/optionsFor'](lastPath).isCreatable;
@@ -19,22 +19,33 @@ import { harvester2cloud } from '@shell/utils/router';
19
19
  export function installNavigationGuards(router, context) {
20
20
  // 最早执行:保证进入逻辑时 params 始终是 harvester
21
21
  router.beforeEach((to, from, next) => {
22
+ let changed = false;
23
+ const params = { ...to.params };
22
24
 
23
- console.log(to.params.product, 'to.params.product-----------------------------------------------------1');
24
- console.log(to.params.cluster, 'to.params.cluster-----------------------------------------------------1');
25
+ if (params?.product?.includes('cloud')) {
26
+ params.product = params.product.replace(/cloud/g, 'harvester');
27
+ changed = true;
28
+ }
29
+
30
+ if (params?.cluster?.includes('cloud')) {
31
+ params.cluster = params.cluster.replace(/cloud/g, 'harvester');
32
+ changed = true;
33
+ }
25
34
 
26
- // 内部逻辑统一用 harvesterManager
27
- if (to?.params?.product) {
28
- to.params.product = to.params.product.replace(/cloud/g, 'harvester')
35
+ if (params?.resource?.includes('cloud')) {
36
+ params.resource = params.resource.replace(/cloud/g, 'harvester');
37
+ changed = true;
29
38
  }
30
39
 
31
- if (to?.params?.cluster) {
32
- to.params.cluster = to.params.cluster.replace(/cloud/g, 'harvester')
40
+ if (changed) {
41
+ // 触发路由重定向
42
+ return next({ ...to, params });
33
43
  }
34
44
 
35
45
  next();
36
46
  });
37
47
 
48
+
38
49
  const navigationGuardInstallers = [
39
50
  installLoadInitialSettings,
40
51
  installAttemptFirstLogin,
@@ -54,15 +65,13 @@ export function installNavigationGuards(router, context) {
54
65
  // 🔹 最后执行:只改地址栏,不改内部
55
66
  router.afterEach((to) => {
56
67
 
57
- console.log(to.params.product, 'to.params.product-----------------------------------------------------3');
58
- console.log(to.params.cluster, 'to.params.cluster-----------------------------------------------------3');
59
-
60
68
  const cloudPath = to.fullPath
61
69
  .replace(/harvester/g, 'cloud')
62
70
 
63
71
  if (cloudPath !== to.fullPath) {
64
72
  window.history.replaceState({}, '', cloudPath);
65
73
  }
74
+
66
75
  });
67
76
  }
68
77
 
@@ -171,7 +171,7 @@ export default {
171
171
  data() {
172
172
  serialMaker.setPrefix('container-');
173
173
  serialMaker.setSeq(0);
174
- let type = cloud2harvesterhci(this.$route.params.resource);
174
+ let type = this.$route.params.resource;
175
175
  const createSidecar = !!this.$route.query.sidecar;
176
176
 
177
177
  if (type === 'workload') {
package/list/workload.vue CHANGED
@@ -27,10 +27,10 @@ const $loadingResources = ($route, $store) => {
27
27
  }
28
28
  });
29
29
 
30
- const allTypes = cloud2harvesterhci($route.params.resource) === workloadSchema.id;
30
+ const allTypes = $route.params.resource === workloadSchema.id;
31
31
 
32
32
  return {
33
- loadResources: allTypes ? allowedResources : [cloud2harvesterhci($route.params.resource)],
33
+ loadResources: allTypes ? allowedResources : [$route.params.resource],
34
34
  loadIndeterminate: allTypes,
35
35
  };
36
36
  };
@@ -55,7 +55,7 @@ export default {
55
55
  if (this.allTypes && this.loadResources.length) {
56
56
  this.$initializeFetchData(this.loadResources[0], this.loadResources);
57
57
  } else {
58
- this.$initializeFetchData(cloud2harvesterhci(this.$route.params.resource));
58
+ this.$initializeFetchData(this.$route.params.resource);
59
59
  }
60
60
 
61
61
  try {
@@ -74,7 +74,7 @@ export default {
74
74
  return this.$fetchType(allowed, this.loadResources);
75
75
  }));
76
76
  } else {
77
- const type = cloud2harvesterhci(this.$route.params.resource);
77
+ const type = this.$route.params.resource;
78
78
 
79
79
  if ( this.$store.getters['cluster/schemaFor'](type) ) {
80
80
  const resource = await this.$fetchType(type);
@@ -89,7 +89,7 @@ export default {
89
89
  const { loadResources, loadIndeterminate } = $loadingResources(this.$route, this.$store);
90
90
 
91
91
  const { params:{ resource: type } } = this.$route;
92
- const allTypes = cloud2harvesterhci(this.$route.params.resource) === workloadSchema.id;
92
+ const allTypes = this.$route.params.resource === workloadSchema.id;
93
93
  const schema = type !== workloadSchema.id ? this.$store.getters['cluster/schemaFor'](type) : workloadSchema;
94
94
  const paginationEnabled = !allTypes && this.$store.getters[`cluster/paginationEnabled`]?.({ id: type });
95
95
 
@@ -144,7 +144,7 @@ export default {
144
144
  this.$fetchType(POD);
145
145
  this.$fetchType(WORKLOAD_TYPES.JOB);
146
146
  } else {
147
- const type = cloud2harvesterhci(this.$route.params.resource);
147
+ const type = this.$route.params.resource;
148
148
 
149
149
  if (type === WORKLOAD_TYPES.JOB || type === POD) {
150
150
  // Ignore job and pods (we're fetching this anyway, plus they contain their own state)
@@ -35,7 +35,7 @@ export default {
35
35
  // Normally owner components supply `resource` and `inStore` as part of their data, however these are needed here before parent data runs
36
36
  // So set up both here
37
37
  const params = { ...this.$route.params };
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
+ 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
39
  const inStore = this.$store.getters['currentStore'](resource);
40
40
 
41
41
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashboard-shell-shell",
3
- "version": "1.0.1000000099",
3
+ "version": "1.0.1000000112",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancherlabs/dashboard",
6
6
  "license": "Apache-2.0",
@@ -16,7 +16,7 @@ export function keyFieldFor(type) {
16
16
  export function normalizeType(type) {
17
17
  type = (type?.type || type || '').toLowerCase();
18
18
 
19
- return cloud2harvesterhci(type);
19
+ return type;
20
20
  }
21
21
 
22
22
  // Detect and resolve conflicts from a 409 response.
package/store/type-map.js CHANGED
@@ -507,7 +507,7 @@ export const getters = {
507
507
 
508
508
  groupForBasicType(state) {
509
509
  return (product, schemaId) => {
510
- return state.basicTypes?.[product]?.[cloud2harvesterhci(schemaId)];
510
+ return state.basicTypes?.[product]?.[schemaId];
511
511
  };
512
512
  },
513
513
 
@@ -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
4165
  export function str: any: any;
4165
- export function cloud2harvesterhci(str: any): any;
4166
- export function str: any: any;
4166
+ export function harvester2cloud(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;
package/utils/router.js CHANGED
@@ -89,7 +89,7 @@ export const getPackageFromRoute = (route) => {
89
89
  };
90
90
 
91
91
  export const getResourceFromRoute = (to) => {
92
- let resource = cloud2harvesterhci(to.params?.resource);
92
+ let resource = to.params?.resource;
93
93
 
94
94
  if (!resource) {
95
95
  resource = findMeta(to, 'resource');