@rancher/shell 3.0.5 → 3.0.7

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 (92) hide show
  1. package/assets/images/pl/dark/rancher-logo.svg +131 -44
  2. package/assets/images/pl/rancher-logo.svg +120 -44
  3. package/assets/styles/base/_basic.scss +2 -2
  4. package/assets/styles/base/_color-classic.scss +51 -0
  5. package/assets/styles/base/_color.scss +3 -3
  6. package/assets/styles/base/_mixins.scss +1 -1
  7. package/assets/styles/base/_variables-classic.scss +47 -0
  8. package/assets/styles/global/_button.scss +49 -17
  9. package/assets/styles/global/_form.scss +1 -1
  10. package/assets/styles/themes/_dark.scss +4 -0
  11. package/assets/styles/themes/_light.scss +3 -69
  12. package/assets/styles/themes/_modern.scss +194 -50
  13. package/assets/styles/vendor/vue-select.scss +1 -2
  14. package/assets/translations/en-us.yaml +33 -21
  15. package/components/ClusterIconMenu.vue +1 -1
  16. package/components/ClusterProviderIcon.vue +1 -1
  17. package/components/CodeMirror.vue +1 -1
  18. package/components/FilterPanel.vue +8 -1
  19. package/components/IconOrSvg.vue +40 -29
  20. package/components/PaginatedResourceTable.vue +7 -2
  21. package/components/PromptRemove.vue +5 -0
  22. package/components/ResourceDetail/index.vue +1 -0
  23. package/components/ResourceTable.vue +30 -20
  24. package/components/SortableTable/sorting.js +3 -1
  25. package/components/Tabbed/index.vue +5 -5
  26. package/components/form/ResourceTabs/index.vue +37 -18
  27. package/components/form/SecretSelector.vue +6 -2
  28. package/components/nav/Group.vue +29 -9
  29. package/components/nav/Header.vue +6 -8
  30. package/components/nav/NamespaceFilter.vue +1 -1
  31. package/components/nav/TopLevelMenu.helper.ts +47 -20
  32. package/components/nav/TopLevelMenu.vue +44 -14
  33. package/components/nav/Type.vue +0 -5
  34. package/components/nav/__tests__/TopLevelMenu.test.ts +2 -0
  35. package/config/pagination-table-headers.js +10 -2
  36. package/config/product/explorer.js +9 -8
  37. package/config/table-headers.js +9 -0
  38. package/config/uiplugins.js +1 -1
  39. package/core/plugin.ts +33 -9
  40. package/core/types.ts +37 -6
  41. package/detail/provisioning.cattle.io.cluster.vue +1 -0
  42. package/dialog/InstallExtensionDialog.vue +71 -45
  43. package/dialog/UninstallExtensionDialog.vue +2 -1
  44. package/dialog/__tests__/InstallExtensionDialog.test.ts +111 -0
  45. package/edit/auth/oidc.vue +86 -16
  46. package/list/catalog.cattle.io.clusterrepo.vue +2 -2
  47. package/mixins/__tests__/chart.test.ts +1 -1
  48. package/mixins/chart.js +1 -1
  49. package/models/event.js +7 -0
  50. package/models/provisioning.cattle.io.cluster.js +9 -0
  51. package/package.json +2 -2
  52. package/pages/c/_cluster/apps/charts/AppChartCardFooter.vue +6 -0
  53. package/pages/c/_cluster/apps/charts/StatusLabel.vue +4 -3
  54. package/pages/c/_cluster/apps/charts/index.vue +12 -11
  55. package/pages/c/_cluster/explorer/EventsTable.vue +3 -6
  56. package/pages/c/_cluster/settings/performance.vue +1 -1
  57. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +159 -62
  58. package/pages/c/_cluster/uiplugins/__tests__/PluginInfoPanel.test.ts +102 -0
  59. package/pages/c/_cluster/uiplugins/__tests__/{index.spec.ts → index.test.ts} +121 -55
  60. package/pages/c/_cluster/uiplugins/index.vue +110 -94
  61. package/plugins/__tests__/subscribe.events.test.ts +194 -0
  62. package/plugins/dashboard-store/actions.js +3 -0
  63. package/plugins/dashboard-store/getters.js +1 -1
  64. package/plugins/dashboard-store/resource-class.js +15 -4
  65. package/plugins/steve/__tests__/subscribe.spec.ts +27 -24
  66. package/plugins/steve/index.js +18 -10
  67. package/plugins/steve/mutations.js +2 -2
  68. package/plugins/steve/resourceWatcher.js +2 -2
  69. package/plugins/steve/steve-pagination-utils.ts +26 -31
  70. package/plugins/steve/subscribe.js +113 -85
  71. package/plugins/subscribe-events.ts +211 -0
  72. package/rancher-components/BadgeState/BadgeState.vue +8 -6
  73. package/rancher-components/Banner/Banner.vue +2 -1
  74. package/rancher-components/Form/Checkbox/Checkbox.vue +3 -3
  75. package/rancher-components/Form/Radio/RadioButton.vue +3 -3
  76. package/scripts/test-plugins-build.sh +4 -5
  77. package/scripts/typegen.sh +2 -0
  78. package/store/auth.js +2 -2
  79. package/store/index.js +12 -22
  80. package/types/extension-manager.ts +8 -1
  81. package/types/resources/settings.d.ts +24 -17
  82. package/types/shell/index.d.ts +534 -336
  83. package/types/store/subscribe-events.types.ts +70 -0
  84. package/types/store/subscribe.types.ts +6 -22
  85. package/types/store/vuex.d.ts +2 -1
  86. package/types/vue-shim.d.ts +2 -5
  87. package/utils/pagination-utils.ts +98 -30
  88. package/utils/pagination-wrapper.ts +6 -8
  89. package/utils/sort.js +5 -0
  90. package/utils/unit-tests/pagination-utils.spec.ts +283 -0
  91. package/utils/validators/formRules/__tests__/index.test.ts +7 -0
  92. package/utils/validators/formRules/index.ts +2 -2
@@ -39,6 +39,8 @@ ${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/plugins/steve/hybrid-class.js --d
39
39
  # # mixins
40
40
  ${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/mixins/create-edit-view/index.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/mixins/create-edit-view > /dev/null
41
41
  ${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/mixins/resource-fetch.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/mixins > /dev/null
42
+ ${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/mixins/resource-fetch-namespaced.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/mixins > /dev/null
43
+ ${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/mixins/resource-fetch-api-pagination.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/mixins > /dev/null
42
44
 
43
45
  # # models
44
46
  ${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/models/namespace.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/models/ > /dev/null
package/store/auth.js CHANGED
@@ -207,7 +207,7 @@ export const actions = {
207
207
 
208
208
  commit('cookies/set', {
209
209
  key: KEY, value: strung, options
210
- });
210
+ }, { root: true });
211
211
 
212
212
  return strung;
213
213
  },
@@ -371,7 +371,7 @@ export const actions = {
371
371
  loggedInAs({ commit }, principalId) {
372
372
  commit('loggedInAs', principalId);
373
373
 
374
- commit('cookies/remove', { key: KEY });
374
+ commit('cookies/remove', { key: KEY }, { root: true });
375
375
  },
376
376
 
377
377
  uiLogout({ commit, dispatch }) {
package/store/index.js CHANGED
@@ -40,6 +40,7 @@ import { isDevBuild } from '@shell/utils/version';
40
40
  import { markRaw } from 'vue';
41
41
  import paginationUtils from '@shell/utils/pagination-utils';
42
42
  import { addReleaseNotesNotification } from '@shell/utils/release-notes';
43
+ import sideNavService from '@shell/components/nav/TopLevelMenu.helper';
43
44
 
44
45
  // Disables strict mode for all store instances to prevent warning about changing state outside of mutations
45
46
  // because it's more efficient to do that sometimes.
@@ -230,8 +231,8 @@ const updateActiveNamespaceCache = (state, activeNamespaceCache) => {
230
231
  /**
231
232
  * Are we in the vai enabled world where mgmt clusters are paginated?
232
233
  */
233
- const paginateClusters = (rootGetters) => {
234
- return paginationUtils.isEnabled({ rootGetters }, { store: 'management', resource: { id: MANAGEMENT.CLUSTER, context: 'side-bar' } });
234
+ const paginateClusters = ({ rootGetters, state }) => {
235
+ return paginationUtils.isEnabled({ rootGetters, $plugin: state.$plugin }, { store: 'management', resource: { id: MANAGEMENT.CLUSTER, context: 'side-bar' } });
235
236
  };
236
237
 
237
238
  export const state = () => {
@@ -260,11 +261,8 @@ export const state = () => {
260
261
  $router: markRaw({}),
261
262
  $route: markRaw({}),
262
263
  $plugin: markRaw({}),
263
- /**
264
- * Cache state of side nav clusters. This avoids flickering when the user changes pages and the side nav component re-renders
265
- */
266
- sideNavCache: undefined,
267
264
  showWorkspaceSwitcher: true,
265
+
268
266
  };
269
267
  };
270
268
 
@@ -629,10 +627,6 @@ export const getters = {
629
627
  return `${ base }/latest`;
630
628
  },
631
629
 
632
- sideNavCache(state) {
633
- return state.sideNavCache;
634
- },
635
-
636
630
  ...gcGetters
637
631
  };
638
632
 
@@ -773,10 +767,6 @@ export const mutations = {
773
767
  state.$plugin = markRaw(pluginDefinition || {});
774
768
  },
775
769
 
776
- setSideNavCache(state, sideNavCache) {
777
- state.sideNavCache = sideNavCache;
778
- },
779
-
780
770
  showWorkspaceSwitcher(state, value) {
781
771
  state.showWorkspaceSwitcher = value;
782
772
  },
@@ -855,7 +845,7 @@ export const actions = {
855
845
 
856
846
  res = await allHash(promises);
857
847
 
858
- if (!res[MANAGEMENT.SETTING] || !paginateClusters(rootGetters)) {
848
+ if (!res[MANAGEMENT.SETTING] || !paginateClusters({ rootGetters, state })) {
859
849
  // This introduces a synchronous request, however we need settings to determine if SSP is enabled
860
850
  // Eventually it will be removed when SSP is always on
861
851
  res[MANAGEMENT.CLUSTER] = await dispatch('management/findAll', { type: MANAGEMENT.CLUSTER, opt: { watch: false } });
@@ -1033,7 +1023,7 @@ export const actions = {
1033
1023
  await dispatch('management/waitForSchema', { type: MANAGEMENT.CLUSTER });
1034
1024
 
1035
1025
  // If SSP is on we won't have requested all clusters
1036
- if (!paginateClusters(rootGetters)) {
1026
+ if (!paginateClusters({ rootGetters, state })) {
1037
1027
  await dispatch('management/waitForHaveAll', { type: MANAGEMENT.CLUSTER });
1038
1028
  }
1039
1029
 
@@ -1132,8 +1122,10 @@ export const actions = {
1132
1122
  commit('updateNamespaces', { filters: ids, getters });
1133
1123
  },
1134
1124
 
1135
- async cleanNamespaces({ getters, dispatch, rootGetters }) {
1136
- if (paginateClusters(rootGetters)) {
1125
+ async cleanNamespaces({
1126
+ getters, dispatch, rootGetters, state
1127
+ }) {
1128
+ if (paginateClusters({ rootGetters, state })) {
1137
1129
  // See https://github.com/rancher/dashboard/issues/12864
1138
1130
  // old world...
1139
1131
  // - loadManagement makes a request to fetch all mgmt clusters
@@ -1187,6 +1179,8 @@ export const actions = {
1187
1179
  }
1188
1180
  });
1189
1181
 
1182
+ sideNavService.reset();
1183
+
1190
1184
  await dispatch('management/unsubscribe');
1191
1185
  commit('managementChanged', { ready: false });
1192
1186
  commit('management/reset');
@@ -1308,10 +1302,6 @@ export const actions = {
1308
1302
  });
1309
1303
  },
1310
1304
 
1311
- setSideNavCache({ commit }, sideNavCache) {
1312
- commit('setSideNavCache', sideNavCache);
1313
- },
1314
-
1315
1305
  showWorkspaceSwitcher({ commit }, value) {
1316
1306
  commit('showWorkspaceSwitcher', value);
1317
1307
  },
@@ -1,4 +1,11 @@
1
+ import { EXT_IDS_VALUES } from '@shell/core/plugin';
1
2
  import { ClusterProvisionerContext } from '@shell/core/types';
3
+
4
+ type ExtensionManagerType = { [name: string]: Function, }
5
+ export type ExtensionManagerTypes =
6
+ { [type in EXT_IDS_VALUES]?: ExtensionManagerType } & // eslint-disable-line no-unused-vars
7
+ { [name: string]: ExtensionManagerType }
8
+
2
9
  export type ExtensionManager = {
3
10
  internal(): any;
4
11
  loadPluginAsync(plugin: any): Promise<void>;
@@ -12,7 +19,7 @@ export type ExtensionManager = {
12
19
  applyPlugin(plugin: any): void;
13
20
  register(type: string, name: string, fn: Function): void;
14
21
  unregister(type: string, name: string, fn: Function): void;
15
- getAll(): any;
22
+ getAll(): ExtensionManagerTypes;
16
23
  getPlugins(): any;
17
24
  getDynamic(typeName: string, name: string): any;
18
25
  getValidator(name: string): any;
@@ -1,25 +1,32 @@
1
-
2
1
  export interface PaginationSettingsStore {
3
- [name: string]: {
4
- resources: {
2
+ resources: {
3
+ /**
4
+ * Enable for all resources in this store
5
+ */
6
+ enableAll?: boolean,
7
+ /**
8
+ * Enable for only some resources in this store
9
+ */
10
+ enableSome?: {
5
11
  /**
6
- * Enable for all resources in this store
12
+ * Specific resource type to enable
7
13
  */
8
- enableAll: boolean,
9
- enableSome: {
10
- /**
11
- * Specific resource type to enable
12
- */
13
- enabled: (string | { resource: string, context: string[]})[],
14
- /**
15
- * There's no hardcoded headers or custom list for the resource type, headers will be generated from schema attributes.columns
16
- */
17
- generic: boolean,
18
- },
19
- }
14
+ enabled?: (string | { resource: string, context: string[]})[],
15
+ /**
16
+ * Additional resource types that do not have any custom pagination settings (headers, lists, etc) but can be generated automatically (headers from CRD additionalPrinterColumns) can be enabled
17
+ */
18
+ generic?: boolean,
19
+ },
20
20
  }
21
21
  }
22
22
 
23
+ /**
24
+ * Determine which resources can utilise server-side pagination
25
+ */
26
+ export interface PaginationSettingsStores {
27
+ [store: string]: PaginationSettingsStore
28
+ }
29
+
23
30
  export type PaginationFeature = 'listAutoRefreshToggle' | 'listManualRefresh'
24
31
 
25
32
  /**
@@ -33,7 +40,7 @@ export interface PaginationSettings {
33
40
  /**
34
41
  * Should pagination be enabled for resources in a store
35
42
  */
36
- stores?: PaginationSettingsStore,
43
+ stores?: PaginationSettingsStores,
37
44
 
38
45
  /**
39
46
  * List of specific features that can be enabled / disabled