dashboard-shell-shell 1.0.1000000081 → 1.0.1000000083

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"
@@ -92,6 +92,9 @@ export default {
92
92
 
93
93
  const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
94
94
 
95
+ console.log(hasEditComponent, ' hasEditComponent------------------------------------1');
96
+
97
+
95
98
  const yamlRoute = {
96
99
  name: `${ cloud2harvesterhci(this.$route.name) }-create`,
97
100
  params,
@@ -186,6 +189,23 @@ export default {
186
189
  _createButtonlabel() {
187
190
  return this.createButtonLabel || this.t('resourceList.head.create');
188
191
  },
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
+ }
189
209
  }
190
210
  };
191
211
  </script>
@@ -418,13 +418,28 @@ 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
+
427
441
  return {
442
+ hasEditComponent,
428
443
  refreshButtonPhase: isLoading ? ASYNC_BUTTON_STATES.WAITING : ASYNC_BUTTON_STATES.ACTION,
429
444
  expanded: {},
430
445
  searchQuery,
@@ -1227,7 +1242,7 @@ export default {
1227
1242
  <div
1228
1243
  :class="{'titled': $slots.title && $slots.title.length, 'mb-40': isFilterLabel, 'mb-20': search || isCreatable}"
1229
1244
  class="sortable-table-header "
1230
- :style="{marginTop: search&& !isBanner ? marginTopValue + 'px' : '0px',marginLeft: isCreatable ? '100px' : '-10px',maxHeight: '32px'}"
1245
+ :style="{marginTop: search&& !isBanner ? marginTopValue + 'px' : '0px',marginLeft: isCreatable && hasEditComponent ? '100px' : '-10px',maxHeight: '32px'}"
1231
1246
  >
1232
1247
  <slot name="title" />
1233
1248
  <div
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashboard-shell-shell",
3
- "version": "1.0.1000000081",
3
+ "version": "1.0.1000000083",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancherlabs/dashboard",
6
6
  "license": "Apache-2.0",
package/store/type-map.js CHANGED
@@ -432,10 +432,13 @@ export const state = function() {
432
432
  'cloud-credential': {}
433
433
 
434
434
  },
435
+ mastheadCreatable: true,
435
436
  };
436
437
  };
437
438
 
438
439
  export const getters = {
440
+ mastheadCreatable: (state) => state.mastheadCreatable,
441
+
439
442
  // ----------------------------------------------------------------------------
440
443
  // 1 ) Getting info
441
444
  // ----------------------------------------------------------------------------
@@ -1484,6 +1487,10 @@ export const getters = {
1484
1487
  };
1485
1488
 
1486
1489
  export const mutations = {
1490
+ setMastheadCreatable(state, value) {
1491
+ state.mastheadCreatable = value;
1492
+ },
1493
+
1487
1494
  schemaChanged(state) {
1488
1495
  state.schemaGeneration = state.schemaGeneration + 1;
1489
1496
  },
@@ -3858,8 +3858,10 @@ export function state(): {
3858
3858
  'machine-config': {};
3859
3859
  'cloud-credential': {};
3860
3860
  };
3861
+ mastheadCreatable: boolean;
3861
3862
  };
3862
3863
  export namespace getters {
3864
+ function mastheadCreatable(state: any): any;
3863
3865
  function labelFor(state: any, getters: any, rootState: any, rootGetters: any): (schema: any, count?: number, language?: any) => any;
3864
3866
  function groupLabelFor(state: any): (schemaOrName: any) => any;
3865
3867
  function groupForBasicType(state: any): (product: any, schemaId: any) => any;
@@ -3922,6 +3924,7 @@ export namespace getters {
3922
3924
  function productByName(state: any): (productName: any) => any;
3923
3925
  }
3924
3926
  export namespace mutations {
3927
+ function setMastheadCreatable(state: any, value: any): void;
3925
3928
  function schemaChanged(state: any): void;
3926
3929
  function remove(state: any, { product, plugin }: {
3927
3930
  product: any;
@@ -9407,8 +9410,10 @@ export function state(): {
9407
9410
  'machine-config': {};
9408
9411
  'cloud-credential': {};
9409
9412
  };
9413
+ mastheadCreatable: boolean;
9410
9414
  };
9411
9415
  export namespace getters {
9416
+ function mastheadCreatable(state: any): any;
9412
9417
  function labelFor(state: any, getters: any, rootState: any, rootGetters: any): (schema: any, count?: number, language?: any) => any;
9413
9418
  function groupLabelFor(state: any): (schemaOrName: any) => any;
9414
9419
  function groupForBasicType(state: any): (product: any, schemaId: any) => any;
@@ -9471,6 +9476,7 @@ export namespace getters {
9471
9476
  function productByName(state: any): (productName: any) => any;
9472
9477
  }
9473
9478
  export namespace mutations {
9479
+ function setMastheadCreatable(state: any, value: any): void;
9474
9480
  function schemaChanged(state: any): void;
9475
9481
  function remove(state: any, { product, plugin }: {
9476
9482
  product: any;