@rancher/shell 0.3.24 → 0.3.26

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 (115) hide show
  1. package/assets/styles/themes/_light.scss +1 -1
  2. package/assets/translations/en-us.yaml +36 -7
  3. package/assets/translations/zh-hans.yaml +1 -1
  4. package/components/ClusterIconMenu.vue +143 -0
  5. package/components/CruResource.vue +10 -1
  6. package/components/ExplorerProjectsNamespaces.vue +11 -1
  7. package/components/FixedBanner.vue +17 -1
  8. package/components/Markdown.vue +1 -1
  9. package/components/Questions/__tests__/Yaml.test.ts +3 -2
  10. package/components/SortableTable/index.vue +3 -2
  11. package/components/__tests__/ProjectRow.test.ts +63 -0
  12. package/components/auth/RoleDetailEdit.vue +19 -2
  13. package/components/auth/__tests__/RoleDetailEdit.test.ts +41 -0
  14. package/components/auth/login/saml.vue +12 -1
  15. package/components/form/LabeledSelect.vue +12 -5
  16. package/components/form/Members/ClusterPermissionsEditor.vue +1 -1
  17. package/components/form/Members/MembershipEditor.vue +6 -1
  18. package/components/form/ResourceQuota/ProjectRow.vue +6 -2
  19. package/components/form/__tests__/KeyValue.test.ts +6 -3
  20. package/components/form/__tests__/LabeledSelect.test.ts +18 -0
  21. package/components/formatter/PodsUsage.vue +11 -36
  22. package/components/formatter/PrincipalGroupBindings.vue +8 -5
  23. package/components/formatter/__tests__/PodsUsage.test.ts +36 -19
  24. package/components/nav/Group.vue +25 -27
  25. package/components/nav/Header.vue +12 -5
  26. package/components/nav/Pinned.vue +47 -0
  27. package/components/nav/TopLevelMenu.vue +233 -60
  28. package/components/nav/Type.vue +57 -3
  29. package/config/home-links.js +1 -1
  30. package/config/product/istio.js +15 -5
  31. package/config/router.js +3 -9
  32. package/config/table-headers.js +5 -6
  33. package/config/uiplugins.js +1 -0
  34. package/core/plugin-helpers.js +3 -0
  35. package/core/types.ts +6 -1
  36. package/creators/app/files/.vscode/settings.json +0 -1
  37. package/detail/__tests__/autoscaling.horizontalpodautoscaler.test.ts +118 -0
  38. package/detail/autoscaling.horizontalpodautoscaler/index.vue +4 -4
  39. package/detail/provisioning.cattle.io.cluster.vue +7 -5
  40. package/edit/__tests__/management.cattle.io.clusterroletemplatebinding.test.ts +58 -0
  41. package/edit/__tests__/namespace.test.ts +5 -3
  42. package/edit/management.cattle.io.clusterroletemplatebinding.vue +3 -11
  43. package/edit/namespace.vue +8 -4
  44. package/edit/provisioning.cattle.io.cluster/Basics.vue +662 -0
  45. package/edit/provisioning.cattle.io.cluster/CustomCommand.vue +6 -0
  46. package/edit/provisioning.cattle.io.cluster/DrainOptions.vue +13 -8
  47. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +11 -2
  48. package/edit/provisioning.cattle.io.cluster/MemberRoles.vue +40 -0
  49. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts +237 -0
  50. package/edit/provisioning.cattle.io.cluster/__tests__/CustomCommand.tests.ts +71 -23
  51. package/edit/provisioning.cattle.io.cluster/__tests__/DrainOptions.test.ts +52 -0
  52. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +65 -142
  53. package/edit/provisioning.cattle.io.cluster/rke2.vue +211 -599
  54. package/edit/workload/storage/__tests__/Storage.test.ts +2 -2
  55. package/edit/workload/storage/persistentVolumeClaim/__tests__/persistentvolumeclaim.test.ts +36 -0
  56. package/edit/workload/storage/persistentVolumeClaim/persistentvolumeclaim.vue +15 -7
  57. package/initialize/index.js +5 -5
  58. package/layouts/default.vue +6 -6
  59. package/layouts/home.vue +6 -2
  60. package/layouts/plain.vue +9 -2
  61. package/list/fleet.cattle.io.cluster.vue +2 -2
  62. package/list/management.cattle.io.feature.vue +1 -1
  63. package/machine-config/vmwarevsphere.vue +48 -7
  64. package/mixins/brand.js +0 -8
  65. package/mixins/child-hook.js +2 -2
  66. package/mixins/create-edit-view/impl.js +3 -3
  67. package/models/__tests__/management.cattle.io.node.ts +96 -0
  68. package/models/__tests__/node.ts +74 -0
  69. package/models/cluster/node.js +6 -5
  70. package/models/cluster.x-k8s.io.machinedeployment.js +2 -2
  71. package/models/management.cattle.io.cluster.js +22 -1
  72. package/models/management.cattle.io.clusterroletemplatebinding.js +3 -3
  73. package/models/management.cattle.io.globalrole.js +17 -2
  74. package/models/management.cattle.io.node.js +6 -4
  75. package/models/management.cattle.io.projectroletemplatebinding.js +3 -3
  76. package/models/management.cattle.io.roletemplate.js +17 -2
  77. package/package.json +2 -6
  78. package/pages/about.vue +2 -0
  79. package/pages/auth/setup.vue +5 -4
  80. package/pages/c/_cluster/monitoring/index.vue +8 -3
  81. package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +9 -66
  82. package/pages/c/_cluster/uiplugins/CatalogList/CatalogUninstallDialog.vue +182 -0
  83. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +15 -32
  84. package/pages/c/_cluster/uiplugins/UninstallDialog.vue +8 -46
  85. package/pages/c/_cluster/uiplugins/index.vue +64 -64
  86. package/pages/diagnostic.vue +0 -39
  87. package/pages/home.vue +1 -1
  88. package/plugins/dashboard-store/normalize.js +4 -4
  89. package/plugins/int-number.js +5 -2
  90. package/plugins/positive-int-number.js +19 -0
  91. package/plugins/steve/__tests__/getters.spec.ts +15 -0
  92. package/plugins/steve/getters.js +22 -10
  93. package/rancher-components/Form/LabeledInput/LabeledInput.vue +0 -8
  94. package/rancher-components/Form/Radio/RadioButton.test.ts +3 -7
  95. package/scripts/extension/helm/charts/ui-plugin-server/Chart.yaml +2 -2
  96. package/store/index.js +4 -0
  97. package/store/prefs.js +1 -0
  98. package/types/shell/index.d.ts +13 -4
  99. package/utils/__tests__/cluster.test.ts +55 -0
  100. package/utils/__tests__/object.test.ts +21 -2
  101. package/utils/cluster.js +47 -1
  102. package/utils/object.js +12 -5
  103. package/utils/validators/formRules/__tests__/index.test.ts +13 -1
  104. package/utils/validators/formRules/index.ts +4 -0
  105. package/utils/validators/role-template.js +9 -1
  106. package/utils/version.js +1 -1
  107. package/yarn-error.log +16 -16
  108. package/components/ClusterProviderIconMenu.vue +0 -161
  109. package/content/docs/en-us/getting-started.md +0 -224
  110. package/content/docs/en-us/whats-new.md +0 -29
  111. package/content/docs/zh-hans/getting-started.md +0 -224
  112. package/content/docs/zh-hans/whats-new.md +0 -28
  113. package/pages/docs/_doc.vue +0 -345
  114. package/pages/docs/toc.js +0 -27
  115. package/plugins/console.js +0 -34
@@ -38,23 +38,44 @@ const defaultStubs = {
38
38
  Tabbed: true,
39
39
  UnitInput: true,
40
40
  YamlEditor: true,
41
+ MemberRoles: true,
42
+ Basics: true
41
43
  };
42
44
 
45
+ const mockAgentArgs = { 'cloud-provider-name': { options: [], profile: { options: [{ anything: 'yes' }] } } };
46
+
43
47
  const defaultComputed = {
44
48
  showForm() {
45
49
  return true;
46
50
  },
47
- showk8s21LegacyWarning() {
48
- return false;
49
- },
51
+ versionOptions() {
52
+ return [
53
+ {
54
+ id: 'v1.25.0+rke2r1', value: 'v1.25.0+rke2r1', serverArgs: {}, agentArgs: mockAgentArgs, charts: {}
55
+ },
56
+ {
57
+ id: 'v1.24.0+rke2r1', value: 'v1.24.0+rke2r1', serverArgs: {}, agentArgs: mockAgentArgs, charts: {}
58
+ },
59
+ {
60
+ id: 'v1.23.0+rke2r1', value: 'v1.23.0+rke2r1', serverArgs: {}, agentArgs: mockAgentArgs, charts: {}
61
+ },
62
+ {
63
+ id: 'v1.25.0+k3s1', value: 'v1.25.0+k3s1', serverArgs: {}, agentArgs: mockAgentArgs, charts: {}
64
+ },
65
+ {
66
+ id: 'v1.24.0+k3s1', value: 'v1.24.0+k3s1', serverArgs: {}, agentArgs: mockAgentArgs, charts: {}
67
+ }
68
+ ];
69
+ }
50
70
  };
51
71
 
52
72
  const defaultGetters = {
53
- currentStore: () => 'current_store',
54
- 'management/schemaFor': jest.fn(),
55
- 'current_store/all': jest.fn(),
56
- 'i18n/t': jest.fn(),
57
- 'i18n/withFallback': jest.fn(),
73
+ currentStore: () => 'current_store',
74
+ 'management/schemaFor': jest.fn(),
75
+ 'current_store/all': jest.fn(),
76
+ 'i18n/t': jest.fn(),
77
+ 'i18n/withFallback': jest.fn(),
78
+ 'plugins/cloudProviderForDriver': jest.fn()
58
79
  };
59
80
 
60
81
  const defaultMocks = {
@@ -78,161 +99,54 @@ describe('component: rke2', () => {
78
99
  */
79
100
  // eslint-disable-next-line jest/no-hooks
80
101
  beforeEach(() => {
81
- jest.spyOn(console, 'log').mockImplementation(() => {});
102
+ jest.spyOn(console, 'log').mockImplementation(() => { });
82
103
  });
83
104
 
84
105
  it.each([
85
- 'v1.25.0+rke2r1',
86
- 'v1.24.0+rke2r1',
87
- 'v1.23.0+rke2r1',
88
- 'v1.25.0+k3s1',
89
- 'v1.24.0+k3s1',
90
- 'v1.23.0+k3s1',
91
- ])('should display PSA option', (k8s) => {
92
- const label = 'whatever';
93
- const option = { label, value: label };
106
+ ['custom', true],
107
+ ['anything else', false] // without proper data, machine pool is always not present
108
+ ])('should allow creation of RKE2 cluster with provider %p if pool machines are missing (%p)', (provider, result) => {
109
+ const k8s = 'v1.25.0+rke2r1';
94
110
  const wrapper = mount(rke2, {
95
111
  propsData: {
96
112
  mode: 'create',
97
113
  value: {
98
114
  spec: {
99
115
  ...defaultSpec,
100
- defaultPodSecurityAdmissionConfigurationTemplateName: label,
101
- kubernetesVersion: k8s
102
- }
103
- },
104
- provider: 'whatever',
105
- },
106
- computed: defaultComputed,
107
- mocks: {
108
- ...defaultMocks,
109
- $store: {
110
- getters: defaultGetters,
111
- dispatch: {
112
- 'management/find': jest.fn(),
113
- 'management/findAll': () => ([option]),
114
- }
115
- },
116
- },
117
- stubs: defaultStubs
118
- });
119
-
120
- const select = wrapper.find('[data-testid="rke2-custom-edit-psa"]');
121
-
122
- expect((select.vm as unknown as any).options[0].label).toBe(`${ label } (Current)`);
123
- });
116
+ kubernetesVersion: k8s,
124
117
 
125
- it.each([
126
- ['v1.25.0+rke2r1', 'none'],
127
- ['v1.24.0+rke2r1', 'default'],
128
- ['v1.23.0+rke2r1', 'default'],
129
- ['v1.25.0+k3s1', 'none'],
130
- ['v1.24.0+k3s1', 'default'],
131
- ['v1.23.0+k3s1', 'default'],
132
- ])('should display for version %p PSA option label %p', (k8s, partialLabel) => {
133
- const label = `cluster.rke2.defaultPodSecurityAdmissionConfigurationTemplateName.option.${ partialLabel }`;
134
- const option = { label, value: label };
135
- const wrapper = mount(rke2, {
136
- propsData: {
137
- mode: 'create',
138
- value: {
139
- spec: {
140
- ...defaultSpec,
141
- defaultPodSecurityAdmissionConfigurationTemplateName: label,
142
- kubernetesVersion: k8s
143
- }
118
+ },
119
+ agentConfig: { 'cloud-provider-name': 'any' }
144
120
  },
145
- provider: 'whatever',
121
+ selectedVersion: { agentArgs: mockAgentArgs },
122
+ provider,
146
123
  },
147
124
  computed: defaultComputed,
148
125
  mocks: {
149
126
  ...defaultMocks,
150
- $store: {
151
- getters: defaultGetters,
152
- dispatch: {
153
- 'management/find': jest.fn(),
154
- 'management/findAll': () => ([option]),
155
- }
156
- },
157
- },
158
- stubs: defaultStubs
159
- });
160
-
161
- const select = wrapper.find('[data-testid="rke2-custom-edit-psa"]');
162
-
163
- expect((select.vm as unknown as any).options[0].label).toStrictEqual(`${ label } (Current)`);
164
- });
165
-
166
- it.each([
167
- ['anything', false, true],
168
- ['', false, false],
169
- ['', true, false],
170
- ])('given CIS value as %p and its override as %p, it should set PSA dropdown as disabled %p', (cis, override, disabled) => {
171
- const label = 'whatever';
172
- const k8s = 'v1.25.0+rke2r1';
173
- const option = { label, value: label };
174
- const wrapper = mount(rke2, {
175
- propsData: {
176
- mode: 'create',
177
- value: {
178
- agentConfig: { profile: cis },
179
- spec: {
180
- ...defaultSpec,
181
- defaultPodSecurityAdmissionConfigurationTemplateName: label,
182
- kubernetesVersion: k8s
183
- }
184
- },
185
- provider: 'custom',
186
- },
187
- computed: {
188
- ...defaultComputed,
189
- agentArgs: () => ({ profile: { options: [cis] } }),
190
- versionOptions: () => [
191
- {
192
- value: k8s,
193
- agentArgs: { profile: { options: [cis] } },
194
- charts: {},
195
- profile: { options: [cis] }
196
- }
197
- ]
198
- },
199
- mocks: {
200
- ...defaultMocks,
201
- $store: {
202
- getters: defaultGetters,
203
- dispatch: {
204
- 'management/find': jest.fn(),
205
- 'management/findAll': () => ([option]),
206
- }
207
- },
127
+ $store: { getters: defaultGetters },
208
128
  },
209
129
  stubs: defaultStubs
210
130
  });
211
131
 
212
- wrapper.setData({ cisOverride: override });
213
-
214
- const select = wrapper.find('[data-testid="rke2-custom-edit-psa"]');
215
-
216
- expect((select.vm as unknown as any).disabled).toBe(disabled);
132
+ expect((wrapper.vm as any).validationPassed).toBe(result);
217
133
  });
218
134
 
219
- it.each([
220
- ['custom', true],
221
- ['anything else', false] // without proper data, machine pool is always not present
222
- ])('should allow creation of RKE2 cluster with provider %p if pool machines are missing (%p)', (provider, result) => {
223
- const k8s = 'v1.25.0+rke2r1';
135
+ it('should allow creation of K3 clusters if pool machines are missing', () => {
136
+ const k8s = 'v1.25.0+k3s1';
224
137
  const wrapper = mount(rke2, {
225
138
  propsData: {
226
139
  mode: 'create',
227
140
  value: {
228
141
  spec: {
229
142
  ...defaultSpec,
230
- kubernetesVersion: k8s,
231
-
232
- }
143
+ kubernetesVersion: k8s
144
+ },
145
+ agentConfig: { 'cloud-provider-name': 'any' }
233
146
  },
234
- provider,
147
+ provider: 'custom'
235
148
  },
149
+ data: () => ({ credentialId: 'I am authenticated' }),
236
150
  computed: defaultComputed,
237
151
  mocks: {
238
152
  ...defaultMocks,
@@ -241,10 +155,10 @@ describe('component: rke2', () => {
241
155
  stubs: defaultStubs
242
156
  });
243
157
 
244
- expect((wrapper.vm as any).validationPassed).toBe(result);
158
+ expect((wrapper.vm as any).validationPassed).toBe(true);
245
159
  });
246
160
 
247
- it('should allow creation of K3 clusters if pool machines are missing', () => {
161
+ it('should initialize machine pools with drain before delete true', async() => {
248
162
  const k8s = 'v1.25.0+k3s1';
249
163
  const wrapper = mount(rke2, {
250
164
  propsData: {
@@ -253,7 +167,8 @@ describe('component: rke2', () => {
253
167
  spec: {
254
168
  ...defaultSpec,
255
169
  kubernetesVersion: k8s
256
- }
170
+ },
171
+ agentConfig: { 'cloud-provider-name': 'any' }
257
172
  },
258
173
  provider: 'custom'
259
174
  },
@@ -266,7 +181,9 @@ describe('component: rke2', () => {
266
181
  stubs: defaultStubs
267
182
  });
268
183
 
269
- expect((wrapper.vm as any).validationPassed).toBe(true);
184
+ await wrapper.vm.initSpecs();
185
+
186
+ wrapper.vm.machinePools.forEach((p: any) => expect(p.drainBeforeDelete).toBe(true));
270
187
  });
271
188
 
272
189
  // TODO: Complete test after implementing fetch https://github.com/rancher/dashboard/issues/9322
@@ -275,8 +192,11 @@ describe('component: rke2', () => {
275
192
  it('adding default values if none', async() => {
276
193
  const wrapper = shallowMount(rke2, {
277
194
  propsData: {
278
- mode: 'create',
279
- value: { spec: { ...defaultSpec } },
195
+ mode: 'create',
196
+ value: {
197
+ spec: { ...defaultSpec },
198
+ agentConfig: { 'cloud-provider-name': 'any' }
199
+ },
280
200
  provider: 'custom'
281
201
  },
282
202
  computed: defaultComputed,
@@ -317,8 +237,11 @@ describe('component: rke2', () => {
317
237
  it('should display agent configuration tab', async() => {
318
238
  const wrapper = shallowMount(rke2, {
319
239
  propsData: {
320
- mode: 'create',
321
- value: { spec: { ...defaultSpec } },
240
+ mode: 'create',
241
+ value: {
242
+ spec: { ...defaultSpec },
243
+ agentConfig: { 'cloud-provider-name': 'any' }
244
+ },
322
245
  provider: 'custom'
323
246
  },
324
247
  computed: defaultComputed,