@rancher/shell 3.0.8-rc.12 → 3.0.8-rc.13

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.
Files changed (58) hide show
  1. package/apis/impl/apis.ts +61 -0
  2. package/apis/index.ts +40 -0
  3. package/apis/intf/modal.ts +90 -0
  4. package/apis/intf/shell.ts +36 -0
  5. package/apis/intf/slide-in.ts +98 -0
  6. package/apis/intf/system.ts +34 -0
  7. package/apis/shell/__tests__/modal.test.ts +80 -0
  8. package/apis/shell/__tests__/notifications.test.ts +71 -0
  9. package/apis/shell/__tests__/slide-in.test.ts +54 -0
  10. package/apis/shell/__tests__/system.test.ts +129 -0
  11. package/apis/shell/index.ts +38 -0
  12. package/apis/shell/modal.ts +41 -0
  13. package/apis/shell/notifications.ts +65 -0
  14. package/apis/shell/slide-in.ts +33 -0
  15. package/apis/shell/system.ts +65 -0
  16. package/apis/vue-shim.d.ts +11 -0
  17. package/components/CruResource.vue +8 -1
  18. package/components/Drawer/ResourceDetailDrawer/__tests__/composables.test.ts +50 -1
  19. package/components/Drawer/ResourceDetailDrawer/composables.ts +19 -0
  20. package/components/Drawer/ResourceDetailDrawer/index.vue +3 -1
  21. package/components/ModalManager.vue +11 -1
  22. package/components/ResourceDetail/index.vue +3 -0
  23. package/components/ResourceTable.vue +53 -20
  24. package/components/SlideInPanelManager.vue +16 -11
  25. package/components/SortableTable/index.vue +19 -1
  26. package/components/Tabbed/index.vue +37 -2
  27. package/components/form/ResourceTabs/composable.ts +2 -2
  28. package/composables/cruResource.ts +27 -0
  29. package/composables/focusTrap.ts +3 -1
  30. package/composables/resourceDetail.ts +15 -0
  31. package/core/__tests__/extension-manager-impl.test.js +437 -0
  32. package/core/extension-manager-impl.js +1 -22
  33. package/core/plugin.ts +9 -1
  34. package/core/types.ts +35 -0
  35. package/detail/provisioning.cattle.io.cluster.vue +2 -0
  36. package/edit/workload/index.vue +1 -1
  37. package/initialize/install-plugins.js +4 -5
  38. package/package.json +1 -1
  39. package/pages/c/_cluster/apps/charts/install.vue +33 -0
  40. package/pages/c/_cluster/fleet/index.vue +4 -7
  41. package/plugins/steve/__tests__/steve-pagination-utils.test.ts +301 -128
  42. package/plugins/steve/steve-pagination-utils.ts +108 -43
  43. package/scripts/publish-shell.sh +25 -0
  44. package/store/__tests__/type-map.test.ts +164 -2
  45. package/store/notifications.ts +2 -0
  46. package/store/type-map.js +10 -1
  47. package/types/internal-api/shell/modal.d.ts +6 -6
  48. package/types/notifications/index.ts +126 -15
  49. package/types/rancher/index.d.ts +9 -0
  50. package/types/vue-shim.d.ts +5 -4
  51. package/composables/useExtensionManager.ts +0 -17
  52. package/core/__test__/extension-manager-impl.test.js +0 -236
  53. package/core/plugins.js +0 -38
  54. package/plugins/internal-api/index.ts +0 -37
  55. package/plugins/internal-api/shared/base-api.ts +0 -13
  56. package/plugins/internal-api/shell/shell.api.ts +0 -108
  57. package/types/internal-api/shell/growl.d.ts +0 -25
  58. package/types/internal-api/shell/slideIn.d.ts +0 -15
package/core/types.ts CHANGED
@@ -60,6 +60,7 @@ export enum ExtensionPoint {
60
60
  PANEL = 'Panel', // eslint-disable-line no-unused-vars
61
61
  CARD = 'Card', // eslint-disable-line no-unused-vars
62
62
  TABLE_COL = 'TableColumn', // eslint-disable-line no-unused-vars
63
+ TABLE = 'Table', // eslint-disable-line no-unused-vars
63
64
  }
64
65
 
65
66
  /** Enum regarding action locations that are extensible in the UI */
@@ -79,6 +80,11 @@ export enum PanelLocation {
79
80
  /** Enum regarding tab locations that are extensible in the UI */
80
81
  export enum TabLocation {
81
82
  RESOURCE_DETAIL = 'tab', // eslint-disable-line no-unused-vars
83
+ ALL = 'tab-all-pages', // eslint-disable-line no-unused-vars
84
+ RESOURCE_DETAIL_PAGE = 'resource-detail-page', // eslint-disable-line no-unused-vars
85
+ RESOURCE_CREATE_PAGE = 'resource-create-page', // eslint-disable-line no-unused-vars
86
+ RESOURCE_EDIT_PAGE = 'resource-edit-page', // eslint-disable-line no-unused-vars
87
+ RESOURCE_SHOW_CONFIGURATION = 'resource-show-configuration', // eslint-disable-line no-unused-vars
82
88
  CLUSTER_CREATE_RKE2 = 'cluster-create-rke2', // eslint-disable-line no-unused-vars
83
89
  }
84
90
 
@@ -92,6 +98,16 @@ export enum TableColumnLocation {
92
98
  RESOURCE = 'resource-list', // eslint-disable-line no-unused-vars
93
99
  }
94
100
 
101
+ /** Enum regarding table locations that are extensible in the UI */
102
+ export enum TableLocation {
103
+ RESOURCE = 'resource-list', // eslint-disable-line no-unused-vars
104
+ }
105
+
106
+ /** Definition of a Table extension hook */
107
+ export type TableAction = {
108
+ tableHook: Function
109
+ };
110
+
95
111
  /** Definition of the shortcut object (keyboard shortcuts) */
96
112
  export type ShortCutKey = {
97
113
  windows?: string[];
@@ -234,6 +250,11 @@ export interface ProductOptions {
234
250
  */
235
251
  ifHaveType?: string | RegExp;
236
252
 
253
+ /**
254
+ * Hide the product if the type is present (opposite of ifHaveType)
255
+ */
256
+ ifNotHaveType?: string | RegExp;
257
+
237
258
  /**
238
259
  * The vuex store that this product should use by default i.e. 'management'
239
260
  */
@@ -283,6 +304,11 @@ export interface ProductOptions {
283
304
  * Configuration required to show a header in a ResourceTable
284
305
  */
285
306
  export interface HeaderOptions {
307
+ /**
308
+ * Order/position of the table column added by an extension
309
+ */
310
+ weight?: number;
311
+
286
312
  /**
287
313
  * Name of the header. This should be unique.
288
314
  */
@@ -654,6 +680,15 @@ export interface IPlugin {
654
680
  */
655
681
  addTableColumn(where: TableColumnLocation | string, when: LocationConfig | string, column: TableColumn, paginationColumn?: TableColumn): void;
656
682
 
683
+ /**
684
+ * Adds to Table events hook on ResourceTable
685
+ *
686
+ * @param where
687
+ * @param when
688
+ * @param action
689
+ */
690
+ addTableHook(where: TableLocation | string, when: LocationConfig | string, action: TableAction): void;
691
+
657
692
  /**
658
693
  * Set the component to use for the landing home page
659
694
  * @param component Home page component
@@ -893,6 +893,7 @@ export default {
893
893
  :disabled="!group.ref.canScaleDownPool()"
894
894
  type="button"
895
895
  class="btn btn-sm role-secondary"
896
+ data-testid="scale-down-button"
896
897
  @click="toggleScaleDownModal($event, group.ref)"
897
898
  >
898
899
  <i class="icon icon-sm icon-minus" />
@@ -902,6 +903,7 @@ export default {
902
903
  :disabled="!group.ref.canScaleUpPool()"
903
904
  type="button"
904
905
  class="btn btn-sm role-secondary ml-10"
906
+ data-testid="scale-up-button"
905
907
  @click="group.ref.scalePool(1)"
906
908
  >
907
909
  <i class="icon icon-sm icon-plus" />
@@ -155,7 +155,7 @@ export default {
155
155
  :default-tab="defaultTab || defaultWorkloadTab"
156
156
  :flat="true"
157
157
  :use-hash="useTabbedHash"
158
-
158
+ :showExtensionTabs="false"
159
159
  data-testid="workload-horizontal-tabs"
160
160
  @changed="changed"
161
161
  >
@@ -19,13 +19,12 @@ import { InstallCodeMirror } from 'codemirror-editor-vue3';
19
19
  import * as intNumber from '@shell/directives/int-number';
20
20
  import dashboardClientInit from '@shell/plugins/dashboard-client-init';
21
21
  import plugin from '@shell/plugins/plugin';
22
- import plugins from '@shell/core/plugins.js';
23
22
  import pluginsLoader from '@shell/core/plugins-loader.js';
24
23
  import replaceAll from '@shell/plugins/replaceall';
25
24
  import steveCreateWorker from '@shell/plugins/steve-create-worker';
26
25
  import emberCookie from '@shell/plugins/ember-cookie';
27
26
  import ShortKey from '@shell/plugins/shortkey';
28
- import internalApiPlugin from '@shell/plugins/internal-api';
27
+ import { initUiApis } from '@shell/apis/impl/apis';
29
28
 
30
29
  import 'floating-vue/dist/style.css';
31
30
  import { floatingVueOptions } from '@shell/plugins/floating-vue';
@@ -51,7 +50,7 @@ export async function installInjectedPlugins(app, vueApp) {
51
50
  const pluginDefinitions = [
52
51
  config,
53
52
  axios,
54
- plugins,
53
+ initUiApis,
55
54
  pluginsLoader,
56
55
  axiosShell,
57
56
  intNumber,
@@ -61,7 +60,6 @@ export async function installInjectedPlugins(app, vueApp) {
61
60
  plugin,
62
61
  steveCreateWorker,
63
62
  emberCookie,
64
- internalApiPlugin,
65
63
  dynamicContent,
66
64
  ];
67
65
 
@@ -69,7 +67,8 @@ export async function installInjectedPlugins(app, vueApp) {
69
67
  if (typeof pluginDefinition === 'function') {
70
68
  await pluginDefinition(
71
69
  app.context,
72
- (key, value) => inject(key, value, app.context, vueApp)
70
+ (key, value) => inject(key, value, app.context, vueApp),
71
+ vueApp
73
72
  );
74
73
  }
75
74
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rancher/shell",
3
- "version": "3.0.8-rc.12",
3
+ "version": "3.0.8-rc.13",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancher/dashboard",
6
6
  "license": "Apache-2.0",
@@ -310,6 +310,7 @@ export default {
310
310
  two different Helm chart versions is a "user value," or
311
311
  a user-selected customization.
312
312
  */
313
+ this.preserveCustomRegistryValue();
313
314
  userValues = diff(this.loadedVersionValues, this.chartValues);
314
315
  } else if ( this.existing ) {
315
316
  await this.existing.fetchValues(); // In theory this has already been called, but do again to be safe
@@ -824,6 +825,35 @@ export default {
824
825
  },
825
826
 
826
827
  methods: {
828
+ /**
829
+ * The custom registry UI fields (checkbox and input) are not directly bound to chartValues.
830
+ * Before calculating the diff to carry over user customizations, we must
831
+ * first synchronize the state of these UI fields with chartValues. This
832
+ * ensures any user changes to the custom registry settings are
833
+ * included in the diff and preserved when changing versions.
834
+ */
835
+ preserveCustomRegistryValue() {
836
+ if (!this.showCustomRegistry) {
837
+ return;
838
+ }
839
+
840
+ if (this.showCustomRegistryInput) {
841
+ set(this.chartValues, 'global.systemDefaultRegistry', this.customRegistrySetting);
842
+ set(this.chartValues, 'global.cattle.systemDefaultRegistry', this.customRegistrySetting);
843
+ } else {
844
+ // Note: Using `delete` here is safe because this is not a reactive property update
845
+ // that the UI needs to track. This is a one-time mutation before a diff.
846
+ if (get(this.chartValues, 'global.systemDefaultRegistry')) {
847
+ delete this.chartValues.global.systemDefaultRegistry;
848
+ }
849
+ if (get(this.chartValues, 'global.cattle.systemDefaultRegistry')) {
850
+ // It's possible `this.chartValues.global.cattle` doesn't exist,
851
+ // but `get` ensures we only proceed if the full path exists.
852
+ delete this.chartValues.global.cattle.systemDefaultRegistry;
853
+ }
854
+ }
855
+ },
856
+
827
857
  async getClusterRegistry() {
828
858
  const hasPermissionToSeeProvCluster = this.$store.getters[`management/schemaFor`](CAPI.RANCHER_CLUSTER);
829
859
 
@@ -1367,6 +1397,7 @@ export default {
1367
1397
  <!-- We have a chart for the app, let the user select a new version -->
1368
1398
  <LabeledSelect
1369
1399
  v-if="chart"
1400
+ data-testid="chart-version-selector"
1370
1401
  :label="t('catalog.install.version')"
1371
1402
  :value="query.versionName"
1372
1403
  :options="filteredVersions"
@@ -1435,6 +1466,7 @@ export default {
1435
1466
  v-if="showCustomRegistry"
1436
1467
  v-model:value="showCustomRegistryInput"
1437
1468
  class="mb-20"
1469
+ data-testid="custom-registry-checkbox"
1438
1470
  :label="t('catalog.chart.registry.custom.checkBoxLabel')"
1439
1471
  :tooltip="t('catalog.chart.registry.tooltip')"
1440
1472
  />
@@ -1443,6 +1475,7 @@ export default {
1443
1475
  <LabeledInput
1444
1476
  v-if="showCustomRegistryInput"
1445
1477
  v-model:value="customRegistrySetting"
1478
+ data-testid="custom-registry-input"
1446
1479
  label-key="catalog.chart.registry.custom.inputLabel"
1447
1480
  placeholder-key="catalog.chart.registry.custom.placeholder"
1448
1481
  :min-height="30"
@@ -321,16 +321,13 @@ export default {
321
321
 
322
322
  this.selectedCard = selected;
323
323
 
324
- this.$shell.slideInPanel({
325
- component: ResourceDetails,
324
+ this.$shell.slideIn.open(ResourceDetails, {
326
325
  componentProps: {
326
+ showHeader: false,
327
+ width: window.innerWidth / 3 > 530 ? `${ window.innerWidth / 3 }px` : '530px',
327
328
  value,
328
329
  statePanel,
329
- workspace,
330
- showHeader: false,
331
- width: window.innerWidth / 3 > 530 ? `${ window.innerWidth / 3 }px` : '530px',
332
- triggerFocusTrap: true,
333
- returnFocusSelector: `[data-testid="resource-card-${ value.id }"]`
330
+ workspace
334
331
  }
335
332
  });
336
333
  },