@rancher/shell 0.3.15 → 0.3.17

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 (155) hide show
  1. package/assets/images/wechat-qr-code.jpg +0 -0
  2. package/assets/translations/en-us.yaml +70 -15
  3. package/assets/translations/zh-hans.yaml +155 -33
  4. package/chart/__tests__/S3.test.ts +50 -0
  5. package/chart/rancher-backup/S3.vue +21 -0
  6. package/chart/rancher-backup/index.vue +4 -0
  7. package/cloud-credential/generic.vue +1 -1
  8. package/components/BannerGraphic.vue +1 -0
  9. package/components/CommunityLinks.vue +1 -0
  10. package/components/CruResource.vue +1 -1
  11. package/components/EmberPage.vue +1 -0
  12. package/components/FileDiff.vue +92 -85
  13. package/components/GrafanaDashboard.vue +7 -1
  14. package/components/ResourceDetail/index.vue +4 -12
  15. package/components/ResourceList/index.vue +1 -1
  16. package/components/ResourceTable.vue +50 -2
  17. package/components/SimpleBox.vue +1 -0
  18. package/components/SortableTable/index.vue +5 -1
  19. package/components/YamlEditor.vue +1 -0
  20. package/components/auth/RoleDetailEdit.vue +1 -0
  21. package/components/form/GitPicker.vue +1 -1
  22. package/components/form/NameNsDescription.vue +28 -12
  23. package/components/form/NodeAffinity.vue +2 -2
  24. package/components/form/PodAffinity.vue +8 -3
  25. package/components/form/ResourceTabs/index.vue +8 -2
  26. package/components/form/Select.vue +16 -0
  27. package/components/form/__tests__/NodeAffinity.test.ts +38 -0
  28. package/components/form/__tests__/PodAffinity.test.ts +46 -0
  29. package/components/formatter/ClusterLink.vue +8 -4
  30. package/components/formatter/ImageName.vue +23 -0
  31. package/components/formatter/PodImages.vue +7 -1
  32. package/components/formatter/__tests__/ClusterLink.test.ts +101 -0
  33. package/components/nav/Header.vue +2 -2
  34. package/config/__test__/home-links.test.ts +62 -0
  35. package/config/home-links.js +15 -3
  36. package/config/labels-annotations.js +5 -1
  37. package/config/product/auth.js +1 -1
  38. package/config/router.js +0 -9
  39. package/config/settings.ts +4 -0
  40. package/config/table-headers.js +6 -5
  41. package/config/uiplugins.js +50 -5
  42. package/core/plugin-helpers.js +20 -12
  43. package/core/plugin.ts +9 -0
  44. package/core/plugins.js +1 -1
  45. package/core/types-provisioning.ts +253 -0
  46. package/core/types.ts +17 -3
  47. package/detail/autoscaling.horizontalpodautoscaler/index.vue +50 -1
  48. package/detail/catalog.cattle.io.clusterrepo.vue +8 -1
  49. package/detail/node.vue +6 -6
  50. package/detail/pod.vue +2 -6
  51. package/detail/provisioning.cattle.io.cluster.vue +46 -7
  52. package/detail/workload/index.vue +9 -9
  53. package/edit/__tests__/fleet.cattle.io.gitrepo.test.ts +62 -0
  54. package/edit/__tests__/monitoring.coreos.com.prometheusrule.test.ts +56 -0
  55. package/edit/auth/github.vue +1 -0
  56. package/edit/autoscaling.horizontalpodautoscaler/hpa-scaling-rule.vue +130 -0
  57. package/edit/autoscaling.horizontalpodautoscaler/index.vue +79 -0
  58. package/edit/fleet.cattle.io.gitrepo.vue +18 -1
  59. package/edit/monitoring.coreos.com.prometheusrule/index.vue +8 -3
  60. package/edit/namespace.vue +9 -1
  61. package/edit/networking.k8s.io.ingress/RulePath.vue +0 -2
  62. package/edit/provisioning.cattle.io.cluster/AgentConfiguration.vue +1 -30
  63. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +79 -1
  64. package/edit/provisioning.cattle.io.cluster/index.vue +52 -0
  65. package/edit/provisioning.cattle.io.cluster/rke2.vue +330 -150
  66. package/edit/ui.cattle.io.navlink.vue +2 -1
  67. package/initialize/App.js +3 -13
  68. package/initialize/layouts.ts +26 -0
  69. package/list/provisioning.cattle.io.cluster.vue +8 -1
  70. package/middleware/authenticated.js +93 -5
  71. package/mixins/brand.js +39 -3
  72. package/mixins/child-hook.js +2 -2
  73. package/mixins/create-edit-view/impl.js +2 -2
  74. package/models/fleet.cattle.io.gitrepo.js +1 -0
  75. package/models/provisioning.cattle.io.cluster.js +9 -1
  76. package/package.json +3 -3
  77. package/pages/about.vue +8 -2
  78. package/pages/auth/login.vue +10 -0
  79. package/pages/auth/logout.vue +11 -3
  80. package/pages/auth/setup.vue +4 -0
  81. package/pages/c/_cluster/apps/charts/index.vue +5 -2
  82. package/pages/c/_cluster/apps/charts/install.vue +5 -0
  83. package/pages/c/_cluster/auth/roles/index.vue +1 -1
  84. package/pages/c/_cluster/explorer/index.vue +1 -10
  85. package/pages/c/_cluster/uiplugins/AddExtensionRepos.vue +177 -0
  86. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +19 -3
  87. package/pages/c/_cluster/uiplugins/RemoveUIPlugins.vue +90 -21
  88. package/pages/c/_cluster/uiplugins/SetupUIPlugins.vue +107 -37
  89. package/pages/c/_cluster/uiplugins/index.vue +155 -44
  90. package/pages/docs/_doc.vue +9 -3
  91. package/pages/home.vue +10 -5
  92. package/pages/support/index.vue +10 -4
  93. package/pkg/auto-import.js +1 -1
  94. package/plugins/clean-tooltip-directive.js +1 -1
  95. package/plugins/dashboard-store/resource-class.js +35 -2
  96. package/plugins/plugin.js +9 -1
  97. package/plugins/steve/actions.js +22 -0
  98. package/rancher-components/BadgeState/BadgeState.vue +5 -1
  99. package/rancher-components/Banner/Banner.test.ts +51 -1
  100. package/rancher-components/Banner/Banner.vue +134 -53
  101. package/rancher-components/Card/Card.vue +24 -7
  102. package/rancher-components/Form/Checkbox/Checkbox.test.ts +20 -29
  103. package/rancher-components/Form/Checkbox/Checkbox.vue +45 -20
  104. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +2 -8
  105. package/rancher-components/Form/LabeledInput/LabeledInput.vue +22 -10
  106. package/rancher-components/Form/Radio/RadioButton.vue +30 -13
  107. package/rancher-components/Form/Radio/RadioGroup.vue +26 -7
  108. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +7 -6
  109. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.test.ts +25 -38
  110. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +23 -11
  111. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +19 -5
  112. package/rancher-components/StringList/StringList.test.ts +453 -49
  113. package/rancher-components/StringList/StringList.vue +92 -58
  114. package/scripts/extension/publish +2 -2
  115. package/scripts/typegen.sh +1 -0
  116. package/server/server-middleware.js +4 -12
  117. package/store/index.js +13 -0
  118. package/store/prefs.js +0 -3
  119. package/store/type-map.js +17 -29
  120. package/types/shell/index.d.ts +243 -90
  121. package/utils/kube.js +9 -0
  122. package/utils/object.js +27 -0
  123. package/utils/settings.ts +2 -2
  124. package/vue.config.js +3 -2
  125. package/pages/safeMode.vue +0 -17
  126. package/rancher-components/components/BadgeState/BadgeState.spec.ts +0 -12
  127. package/rancher-components/components/BadgeState/BadgeState.vue +0 -111
  128. package/rancher-components/components/BadgeState/index.ts +0 -1
  129. package/rancher-components/components/Banner/Banner.test.ts +0 -63
  130. package/rancher-components/components/Banner/Banner.vue +0 -244
  131. package/rancher-components/components/Banner/index.ts +0 -1
  132. package/rancher-components/components/Card/Card.vue +0 -167
  133. package/rancher-components/components/Card/index.ts +0 -1
  134. package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +0 -68
  135. package/rancher-components/components/Form/Checkbox/Checkbox.vue +0 -420
  136. package/rancher-components/components/Form/Checkbox/index.ts +0 -1
  137. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +0 -23
  138. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +0 -355
  139. package/rancher-components/components/Form/LabeledInput/index.ts +0 -1
  140. package/rancher-components/components/Form/Radio/RadioButton.vue +0 -287
  141. package/rancher-components/components/Form/Radio/RadioGroup.vue +0 -254
  142. package/rancher-components/components/Form/Radio/index.ts +0 -2
  143. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +0 -170
  144. package/rancher-components/components/Form/TextArea/index.ts +0 -1
  145. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +0 -94
  146. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +0 -149
  147. package/rancher-components/components/Form/ToggleSwitch/index.ts +0 -1
  148. package/rancher-components/components/Form/index.ts +0 -5
  149. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +0 -151
  150. package/rancher-components/components/LabeledTooltip/index.ts +0 -1
  151. package/rancher-components/components/StringList/StringList.test.ts +0 -484
  152. package/rancher-components/components/StringList/StringList.vue +0 -611
  153. package/rancher-components/components/StringList/index.ts +0 -1
  154. /package/rancher-components/{components/Card → Card}/Card.test.ts +0 -0
  155. /package/rancher-components/{components/Form → Form}/Radio/RadioButton.test.ts +0 -0
@@ -9,35 +9,6 @@ import { cleanUp } from '@shell/utils/object';
9
9
  import { fetchSetting } from '@shell/utils/settings';
10
10
  import { RadioGroup } from '@components/Form/Radio';
11
11
 
12
- export function cleanAgentConfiguration(model, key) {
13
- if (!model || !model[key]) {
14
- return;
15
- }
16
-
17
- const v = model[key];
18
-
19
- if (Array.isArray(v) && v.length === 0) {
20
- delete model[key];
21
- } else if (v && typeof v === 'object') {
22
- Object.keys(v).forEach((k) => {
23
- // delete these auxiliary props used in podAffinity and nodeAffinity that shouldn't be sent to the server
24
- if (k === '_namespaceOption' || k === '_namespaces' || k === '_anti' || k === '_id') {
25
- delete v[k];
26
- }
27
-
28
- // prevent cleanup of "namespaceSelector" when an empty object because it represents all namespaces in pod/node affinity
29
- // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#podaffinityterm-v1-core
30
- if (k !== 'namespaceSelector') {
31
- cleanAgentConfiguration(v, k);
32
- }
33
- });
34
-
35
- if (Object.keys(v).length === 0) {
36
- delete model[key];
37
- }
38
- }
39
- }
40
-
41
12
  // Affinity radio button choices
42
13
  const DEFAULT = 'default';
43
14
  const CUSTOM = 'custom';
@@ -215,7 +186,7 @@ export default {
215
186
  </script>
216
187
 
217
188
  <template>
218
- <div v-if="value && Object.keys(value).length">
189
+ <div>
219
190
  <Banner
220
191
  :closable="false"
221
192
  color="info"
@@ -1,4 +1,4 @@
1
- import { mount } from '@vue/test-utils';
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
2
  import rke2 from '@shell/edit/provisioning.cattle.io.cluster/rke2.vue';
3
3
 
4
4
  /**
@@ -14,6 +14,7 @@ const defaultStubs = {
14
14
  LabeledSelect: true,
15
15
  ACE: true,
16
16
  AgentEnv: true,
17
+ AgentConfiguration: true,
17
18
  ArrayList: true,
18
19
  ArrayListGrouped: true,
19
20
  BadgeState: true,
@@ -267,4 +268,81 @@ describe('component: rke2', () => {
267
268
 
268
269
  expect((wrapper.vm as any).validationPassed).toBe(true);
269
270
  });
271
+
272
+ // TODO: Complete test after implementing fetch https://github.com/rancher/dashboard/issues/9322
273
+ // eslint-disable-next-line jest/no-disabled-tests
274
+ describe.skip('should initialize agent configuration values', () => {
275
+ it('adding default values if none', async() => {
276
+ const wrapper = shallowMount(rke2, {
277
+ propsData: {
278
+ mode: 'create',
279
+ value: { spec: { ...defaultSpec } },
280
+ provider: 'custom'
281
+ },
282
+ computed: defaultComputed,
283
+ mocks: {
284
+ ...defaultMocks,
285
+ $store: {
286
+ getters: defaultGetters,
287
+ dispatch: {
288
+ 'management/request': jest.fn(),
289
+ 'management/find': jest.fn(),
290
+ 'management/findAll': () => ([]),
291
+ }
292
+ },
293
+ },
294
+ stubs: defaultStubs
295
+ });
296
+ const defaultAgentConfig = {
297
+ clusterAgentDeploymentCustomization: {
298
+ overrideAffinity: {},
299
+ appendTolerations: [],
300
+ overrideResourceRequirements: {}
301
+ },
302
+ fleetAgentDeploymentCustomization: {
303
+ overrideAffinity: {},
304
+ appendTolerations: [],
305
+ overrideResourceRequirements: {}
306
+ }
307
+ };
308
+
309
+ // Setting RKE to avoid calls
310
+ wrapper.setData({ rke2Versions: [] });
311
+
312
+ // await rke2.fetch.call(wrapper.vm);
313
+
314
+ expect(wrapper.props().value.spec).toContain(defaultAgentConfig);
315
+ });
316
+
317
+ it('should display agent configuration tab', async() => {
318
+ const wrapper = shallowMount(rke2, {
319
+ propsData: {
320
+ mode: 'create',
321
+ value: { spec: { ...defaultSpec } },
322
+ provider: 'custom'
323
+ },
324
+ computed: defaultComputed,
325
+ mocks: {
326
+ ...defaultMocks,
327
+ $store: {
328
+ getters: defaultGetters,
329
+ dispatch: {
330
+ 'management/request': jest.fn(),
331
+ 'management/find': jest.fn(),
332
+ 'management/findAll': () => ([]),
333
+ }
334
+ },
335
+ },
336
+ stubs: defaultStubs
337
+ });
338
+ const agent = wrapper.find('[data-testid="rke2-cluster-agent-config"]');
339
+
340
+ // Setting RKE to avoid calls
341
+ wrapper.setData({ rke2Versions: [] });
342
+
343
+ await rke2.fetch.call(wrapper.vm);
344
+
345
+ expect(agent.element).toBeDefined();
346
+ });
347
+ });
270
348
  });
@@ -138,6 +138,27 @@ export default {
138
138
  this.iconClasses[name] = `machine-driver ${ name }`;
139
139
  }
140
140
  });
141
+
142
+ // Custom Providers from extensions - initialize each with the store and the i18n service
143
+ // Wrap in try ... catch, to prevent errors in an extension breaking the page
144
+ try {
145
+ const extensionClasses = this.$plugin.listDynamic('provisioner').map((name) => this.$plugin.getDynamic('provisioner', name));
146
+
147
+ // We can't pass in this.$store as this leads to a circular-reference that causes Vue to freeze,
148
+ // so pass in specific services that the provisioner extension may need
149
+ this.extensions = extensionClasses.map((c) => new c({
150
+ dispatch: this.$store.dispatch,
151
+ getters: this.$store.getters,
152
+ axios: this.$store.$axios,
153
+ $plugin: this.$store.app.$plugin,
154
+ t: (...args) => this.t.apply(this, args),
155
+ isCreate: this.isCreate,
156
+ isEdit: this.isEdit,
157
+ isView: this.isView,
158
+ }));
159
+ } catch (e) {
160
+ console.error('Error loading provisioner(s) from extensions', e); // eslint-disable-line no-console
161
+ }
141
162
  },
142
163
 
143
164
  data() {
@@ -148,6 +169,7 @@ export default {
148
169
  return {
149
170
  nodeDrivers: [],
150
171
  kontainerDrivers: [],
172
+ extensions: [],
151
173
  subType,
152
174
  chart,
153
175
  isImport,
@@ -285,6 +307,11 @@ export default {
285
307
  addType(id, 'rke2', false);
286
308
  });
287
309
 
310
+ // Add from extensions
311
+ this.extensions.forEach((ext) => {
312
+ addExtensionType(ext, getters);
313
+ });
314
+
288
315
  addType('custom', 'custom2', false);
289
316
 
290
317
  if (isElementalActive) {
@@ -295,6 +322,31 @@ export default {
295
322
 
296
323
  return out;
297
324
 
325
+ function addExtensionType(ext, getters) {
326
+ let iconClass = ext.iconClass;
327
+ let icon = ext.icon;
328
+
329
+ if (icon) {
330
+ iconClass = undefined;
331
+ } else if (!iconClass) {
332
+ icon = require('~shell/assets/images/generic-driver.svg');
333
+ }
334
+
335
+ const subtype = {
336
+ id: ext.id,
337
+ label: ext.label || getters['i18n/t'](`cluster.provider.${ ext.id }`),
338
+ description: ext.description,
339
+ icon,
340
+ iconClass,
341
+ group: ext.group || 'rke2',
342
+ disabled: ext.disabled || false,
343
+ link: ext.link,
344
+ tag: ext.tag
345
+ };
346
+
347
+ out.push(subtype);
348
+ }
349
+
298
350
  function addType(id, group, disabled = false, link = null, iconClass = undefined) {
299
351
  const label = getters['i18n/withFallback'](`cluster.provider."${ id }"`, null, id);
300
352
  const description = getters['i18n/withFallback'](`cluster.providerDescription."${ id }"`, null, '');