@rancher/shell 2.0.1 → 2.0.2

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 (112) hide show
  1. package/assets/translations/en-us.yaml +73 -34
  2. package/assets/translations/zh-hans.yaml +1 -0
  3. package/components/AssignTo.vue +2 -0
  4. package/components/PromptRemove.vue +8 -3
  5. package/components/Questions/index.vue +2 -2
  6. package/components/ResourceDetail/Masthead.vue +1 -0
  7. package/components/auth/RoleDetailEdit.vue +5 -4
  8. package/components/fleet/FleetClusters.vue +0 -3
  9. package/components/form/Members/ClusterPermissionsEditor.vue +1 -1
  10. package/components/form/ProjectMemberEditor.vue +1 -1
  11. package/components/form/ResourceLabeledSelect.vue +11 -3
  12. package/components/form/labeled-select-utils/labeled-select.utils.ts +1 -1
  13. package/components/formatter/CloudCredExpired.vue +69 -0
  14. package/components/formatter/Date.vue +1 -1
  15. package/components/nav/Header.vue +9 -5
  16. package/components/nav/TopLevelMenu.vue +115 -51
  17. package/components/nav/__tests__/TopLevelMenu.test.ts +53 -27
  18. package/config/labels-annotations.js +2 -0
  19. package/config/pagination-table-headers.js +5 -4
  20. package/config/roles.ts +34 -19
  21. package/config/router/navigation-guards/attempt-first-login.js +1 -1
  22. package/config/router/navigation-guards/authentication.js +1 -1
  23. package/config/router/navigation-guards/i18n.js +1 -1
  24. package/config/router/navigation-guards/index.js +2 -1
  25. package/config/router/navigation-guards/load-initial-settings.js +1 -1
  26. package/config/router/navigation-guards/runtime-extension-route.js +31 -0
  27. package/config/router/routes.js +10 -1
  28. package/config/uiplugins.js +130 -61
  29. package/core/plugin.ts +5 -0
  30. package/core/plugins.js +7 -1
  31. package/detail/catalog.cattle.io.app.vue +17 -4
  32. package/detail/fleet.cattle.io.cluster.vue +11 -9
  33. package/detail/fleet.cattle.io.gitrepo.vue +1 -1
  34. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +86 -13
  35. package/edit/provisioning.cattle.io.cluster/__tests__/DirectoryConfig.test.ts +3 -134
  36. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +209 -0
  37. package/edit/provisioning.cattle.io.cluster/index.vue +8 -4
  38. package/edit/provisioning.cattle.io.cluster/rke2.vue +128 -17
  39. package/edit/provisioning.cattle.io.cluster/tabs/AddOnAdditionalManifest.vue +50 -0
  40. package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +29 -64
  41. package/edit/provisioning.cattle.io.cluster/tabs/Basics.vue +42 -3
  42. package/edit/provisioning.cattle.io.cluster/tabs/DirectoryConfig.vue +22 -86
  43. package/edit/provisioning.cattle.io.cluster/tabs/registries/RegistryConfigs.vue +8 -2
  44. package/edit/provisioning.cattle.io.cluster/tabs/registries/__tests__/RegistryConfigs.test.ts +61 -0
  45. package/initialize/entry-helpers.js +4 -21
  46. package/list/provisioning.cattle.io.cluster.vue +56 -5
  47. package/mixins/__tests__/chart.test.ts +4 -1
  48. package/mixins/chart.js +36 -16
  49. package/models/__tests__/apps.deployment.test.ts +93 -0
  50. package/models/apps.deployment.js +18 -4
  51. package/models/catalog.cattle.io.app.js +108 -21
  52. package/models/cloudcredential.js +159 -2
  53. package/models/fleet.cattle.io.gitrepo.js +4 -13
  54. package/models/management.cattle.io.cluster.js +15 -4
  55. package/models/management.cattle.io.user.js +3 -3
  56. package/models/nodedriver.js +5 -0
  57. package/models/provisioning.cattle.io.cluster.js +41 -3
  58. package/package.json +1 -1
  59. package/pages/404.vue +15 -0
  60. package/pages/auth/login.vue +4 -1
  61. package/pages/auth/setup.vue +4 -1
  62. package/pages/c/_cluster/apps/charts/install.vue +2 -1
  63. package/pages/c/_cluster/explorer/__tests__/index.test.ts +1 -1
  64. package/pages/c/_cluster/explorer/index.vue +6 -2
  65. package/pages/c/_cluster/fleet/index.vue +11 -5
  66. package/pages/c/_cluster/manager/cloudCredential/index.vue +68 -4
  67. package/pages/c/_cluster/manager/jwt.authentication/index.vue +10 -4
  68. package/pages/c/_cluster/settings/performance.vue +2 -2
  69. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +7 -10
  70. package/pages/c/_cluster/uiplugins/index.vue +28 -18
  71. package/pages/home.vue +2 -13
  72. package/plugins/dashboard-store/actions.js +1 -1
  73. package/plugins/dashboard-store/getters.js +1 -1
  74. package/plugins/steve/__tests__/getters.test.ts +5 -5
  75. package/plugins/steve/getters.js +6 -4
  76. package/plugins/steve/hybrid-class.js +1 -5
  77. package/scripts/extension/bundle +1 -1
  78. package/scripts/extension/helm/charts/ui-plugin-server/Chart.yaml +1 -1
  79. package/scripts/publish-shell.sh +56 -59
  80. package/scripts/test-plugins-build.sh +45 -39
  81. package/scripts/typegen.sh +26 -23
  82. package/store/type-map.js +4 -2
  83. package/types/shell/index.d.ts +10 -0
  84. package/types/store/pagination.types.ts +1 -1
  85. package/utils/cluster.js +9 -0
  86. package/utils/settings.ts +3 -1
  87. package/utils/string.js +9 -0
  88. package/utils/v-sphere.ts +251 -0
  89. package/creators/app/app.package.json +0 -14
  90. package/creators/app/files/.eslintignore +0 -16
  91. package/creators/app/files/.eslintrc.js +0 -173
  92. package/creators/app/files/.gitignore +0 -70
  93. package/creators/app/files/.gitlab-ci.yml +0 -14
  94. package/creators/app/files/.vscode/settings.json +0 -21
  95. package/creators/app/files/babel.config.js +0 -1
  96. package/creators/app/files/tsconfig.json +0 -42
  97. package/creators/app/files/vue.config.js +0 -6
  98. package/creators/app/init +0 -120
  99. package/creators/app/package.json +0 -25
  100. package/creators/pkg/files/.github/workflows/build-extension-catalog.yml +0 -24
  101. package/creators/pkg/files/.github/workflows/build-extension-charts.yml +0 -22
  102. package/creators/pkg/files/babel.config.js +0 -1
  103. package/creators/pkg/files/index.ts +0 -14
  104. package/creators/pkg/files/tsconfig.json +0 -53
  105. package/creators/pkg/files/vue.config.js +0 -1
  106. package/creators/pkg/init +0 -286
  107. package/creators/pkg/package.json +0 -19
  108. package/creators/pkg/pkg.package.json +0 -21
  109. package/creators/pkg/vue-shim.ts +0 -4
  110. package/creators/update/init +0 -56
  111. package/creators/update/package.json +0 -20
  112. package/creators/update/upgrade +0 -56
@@ -33,39 +33,15 @@ describe('component: DirectoryConfig', () => {
33
33
  );
34
34
 
35
35
  const title = wrapper.find('h3');
36
- const checkbox = wrapper.find('[data-testid="rke2-directory-config-individual-config-checkbox"]');
37
- const commonInput = wrapper.find('[data-testid="rke2-directory-config-common-data-dir"]');
38
36
  const systemAgentInput = wrapper.find('[data-testid="rke2-directory-config-systemAgent-data-dir"]');
39
37
  const provisioningInput = wrapper.find('[data-testid="rke2-directory-config-provisioning-data-dir"]');
40
38
  const k8sDistroInput = wrapper.find('[data-testid="rke2-directory-config-k8sDistro-data-dir"]');
41
39
 
42
40
  expect(title.exists()).toBe(true);
43
- expect(checkbox.exists()).toBe(true);
44
- // for the default config, checkbox should be checked
45
- expect(wrapper.vm.isSettingCommonConfig).toBe(true);
46
- expect(commonInput.exists()).toBe(true);
47
-
48
- // since we have all of the vars empty, then the individual inputs should not be there
49
- expect(systemAgentInput.exists()).toBe(false);
50
- expect(provisioningInput.exists()).toBe(false);
51
- expect(k8sDistroInput.exists()).toBe(false);
52
- });
53
-
54
- it('updating common config path should set the correct values on each data dir variable', async() => {
55
- wrapper = mount(
56
- DirectoryConfig,
57
- mountOptions
58
- );
59
41
 
60
- const inputPath = 'some-data-dir';
61
- const commonInput = wrapper.find('[data-testid="rke2-directory-config-common-data-dir"]');
62
-
63
- commonInput.setValue(inputPath);
64
- await wrapper.vm.$nextTick();
65
-
66
- expect(wrapper.vm.value.systemAgent).toStrictEqual(inputPath);
67
- expect(wrapper.vm.value.provisioning).toStrictEqual(inputPath);
68
- expect(wrapper.vm.value.k8sDistro).toStrictEqual(inputPath);
42
+ expect(systemAgentInput.exists()).toBe(true);
43
+ expect(provisioningInput.exists()).toBe(true);
44
+ expect(k8sDistroInput.exists()).toBe(true);
69
45
  });
70
46
 
71
47
  it('updating each individual data dir should set the correct values on each data dir variable', async() => {
@@ -75,13 +51,6 @@ describe('component: DirectoryConfig', () => {
75
51
  );
76
52
 
77
53
  const inputPath = 'some-data-dir';
78
- const checkbox = wrapper.find('[data-testid="rke2-directory-config-individual-config-checkbox"]');
79
-
80
- await checkbox.find('label').trigger('click');
81
- await checkbox.vm.$nextTick();
82
- await wrapper.vm.$nextTick();
83
-
84
- expect(wrapper.vm.isSettingCommonConfig).toBe(false);
85
54
 
86
55
  const systemAgentInput = wrapper.find('[data-testid="rke2-directory-config-systemAgent-data-dir"]');
87
56
  const provisioningInput = wrapper.find('[data-testid="rke2-directory-config-provisioning-data-dir"]');
@@ -97,101 +66,6 @@ describe('component: DirectoryConfig', () => {
97
66
  expect(wrapper.vm.value.k8sDistro).toStrictEqual(inputPath);
98
67
  });
99
68
 
100
- it('checkbox should be checked if all data dir values are the same (with all data dir values filled)', () => {
101
- const newMountOptions = clone(mountOptions);
102
- const inputPath = 'some-data-dir';
103
-
104
- newMountOptions.propsData.value.systemAgent = inputPath;
105
- newMountOptions.propsData.value.provisioning = inputPath;
106
- newMountOptions.propsData.value.k8sDistro = inputPath;
107
-
108
- wrapper = mount(
109
- DirectoryConfig,
110
- newMountOptions
111
- );
112
-
113
- const checkbox = wrapper.find('[data-testid="rke2-directory-config-individual-config-checkbox"]');
114
-
115
- expect(checkbox.exists()).toBe(true);
116
- expect(wrapper.vm.isSettingCommonConfig).toBe(true);
117
-
118
- const commonInput = wrapper.find('[data-testid="rke2-directory-config-common-data-dir"]');
119
- const systemAgentInput = wrapper.find('[data-testid="rke2-directory-config-systemAgent-data-dir"]');
120
- const provisioningInput = wrapper.find('[data-testid="rke2-directory-config-provisioning-data-dir"]');
121
- const k8sDistroInput = wrapper.find('[data-testid="rke2-directory-config-k8sDistro-data-dir"]');
122
-
123
- expect(commonInput.exists()).toBe(true);
124
- expect(systemAgentInput.exists()).toBe(false);
125
- expect(provisioningInput.exists()).toBe(false);
126
- expect(k8sDistroInput.exists()).toBe(false);
127
-
128
- expect(wrapper.vm.value.systemAgent).toStrictEqual(inputPath);
129
- expect(wrapper.vm.value.provisioning).toStrictEqual(inputPath);
130
- expect(wrapper.vm.value.k8sDistro).toStrictEqual(inputPath);
131
- });
132
-
133
- it('checkbox should NOT be checked if some data dir values are the different (with all data dir values filled)', () => {
134
- const newMountOptions = clone(mountOptions);
135
- const inputPath1 = 'some-data-dir1';
136
- const inputPath2 = 'some-data-dir2';
137
- const inputPath3 = 'some-data-dir3';
138
-
139
- newMountOptions.propsData.value.systemAgent = inputPath1;
140
- newMountOptions.propsData.value.provisioning = inputPath2;
141
- newMountOptions.propsData.value.k8sDistro = inputPath3;
142
-
143
- wrapper = mount(
144
- DirectoryConfig,
145
- newMountOptions
146
- );
147
-
148
- expect(wrapper.vm.isSettingCommonConfig).toBe(false);
149
-
150
- const commonInput = wrapper.find('[data-testid="rke2-directory-config-common-data-dir"]');
151
- const systemAgentInput = wrapper.find('[data-testid="rke2-directory-config-systemAgent-data-dir"]');
152
- const provisioningInput = wrapper.find('[data-testid="rke2-directory-config-provisioning-data-dir"]');
153
- const k8sDistroInput = wrapper.find('[data-testid="rke2-directory-config-k8sDistro-data-dir"]');
154
-
155
- expect(commonInput.exists()).toBe(false);
156
- expect(systemAgentInput.exists()).toBe(true);
157
- expect(provisioningInput.exists()).toBe(true);
158
- expect(k8sDistroInput.exists()).toBe(true);
159
-
160
- expect(wrapper.vm.value.systemAgent).toStrictEqual(inputPath1);
161
- expect(wrapper.vm.value.provisioning).toStrictEqual(inputPath2);
162
- expect(wrapper.vm.value.k8sDistro).toStrictEqual(inputPath3);
163
- });
164
-
165
- it('on a mode different than _CREATE all visible inputs should be disabled (with common config)', () => {
166
- const newMountOptions = clone(mountOptions);
167
- const inputPath = 'some-data-dir';
168
-
169
- newMountOptions.propsData.value.systemAgent = inputPath;
170
- newMountOptions.propsData.value.provisioning = inputPath;
171
- newMountOptions.propsData.value.k8sDistro = inputPath;
172
- newMountOptions.propsData.mode = _EDIT;
173
-
174
- wrapper = mount(
175
- DirectoryConfig,
176
- newMountOptions
177
- );
178
-
179
- const checkbox = wrapper.find('[data-testid="rke2-directory-config-individual-config-checkbox"]');
180
- const commonInput = wrapper.find('[data-testid="rke2-directory-config-common-data-dir"]');
181
- const systemAgentInput = wrapper.find('[data-testid="rke2-directory-config-systemAgent-data-dir"]');
182
- const provisioningInput = wrapper.find('[data-testid="rke2-directory-config-provisioning-data-dir"]');
183
- const k8sDistroInput = wrapper.find('[data-testid="rke2-directory-config-k8sDistro-data-dir"]');
184
-
185
- expect(checkbox.exists()).toBe(true);
186
- expect(commonInput.exists()).toBe(true);
187
- expect(systemAgentInput.exists()).toBe(false);
188
- expect(provisioningInput.exists()).toBe(false);
189
- expect(k8sDistroInput.exists()).toBe(false);
190
-
191
- expect(checkbox.find('label').classes('disabled')).toBe(true);
192
- expect(commonInput.attributes('disabled')).toBe('disabled');
193
- });
194
-
195
69
  it('on a mode different than _CREATE all visible inputs should be disabled (with different values)', () => {
196
70
  const newMountOptions = clone(mountOptions);
197
71
  const inputPath1 = 'some-data-dir1';
@@ -208,19 +82,14 @@ describe('component: DirectoryConfig', () => {
208
82
  newMountOptions
209
83
  );
210
84
 
211
- const checkbox = wrapper.find('[data-testid="rke2-directory-config-individual-config-checkbox"]');
212
- const commonInput = wrapper.find('[data-testid="rke2-directory-config-common-data-dir"]');
213
85
  const systemAgentInput = wrapper.find('[data-testid="rke2-directory-config-systemAgent-data-dir"]');
214
86
  const provisioningInput = wrapper.find('[data-testid="rke2-directory-config-provisioning-data-dir"]');
215
87
  const k8sDistroInput = wrapper.find('[data-testid="rke2-directory-config-k8sDistro-data-dir"]');
216
88
 
217
- expect(checkbox.exists()).toBe(true);
218
- expect(commonInput.exists()).toBe(false);
219
89
  expect(systemAgentInput.exists()).toBe(true);
220
90
  expect(provisioningInput.exists()).toBe(true);
221
91
  expect(k8sDistroInput.exists()).toBe(true);
222
92
 
223
- expect(checkbox.find('label').classes('disabled')).toBe(true);
224
93
  expect(systemAgentInput.attributes('disabled')).toBe('disabled');
225
94
  expect(provisioningInput.attributes('disabled')).toBe('disabled');
226
95
  expect(k8sDistroInput.attributes('disabled')).toBe('disabled');
@@ -22,6 +22,7 @@ const defaultStubs = {
22
22
  BadgeState: true,
23
23
  Checkbox: true,
24
24
  ClusterMembershipEditor: true,
25
+ ClusterAppearance: true,
25
26
  DrainOptions: true,
26
27
  LabeledInput: true,
27
28
  Labels: true,
@@ -53,11 +54,23 @@ const defaultStubs = {
53
54
  const mockAgentArgs = { 'cloud-provider-name': { options: [], profile: { options: [{ anything: 'yes' }] } } };
54
55
 
55
56
  const defaultComputed = {
57
+ appsOSWarning() {
58
+ return false;
59
+ },
56
60
  showForm() {
57
61
  return true;
58
62
  },
59
63
  versionOptions() {
60
64
  return [
65
+ {
66
+ id: 'v1.31.0+rke2r1', value: 'v1.31.0+rke2r1', serverArgs: {}, agentArgs: mockAgentArgs, charts: {}
67
+ },
68
+ {
69
+ id: 'v1.30.0+rke2r1', value: 'v1.30.0+rke2r1', serverArgs: {}, agentArgs: mockAgentArgs, charts: {}
70
+ },
71
+ {
72
+ id: 'v1.29.1+rke2r1', value: 'v1.29.1+rke2r1', serverArgs: {}, agentArgs: mockAgentArgs, charts: {}
73
+ },
61
74
  {
62
75
  id: 'v1.25.0+rke2r1', value: 'v1.25.0+rke2r1', serverArgs: {}, agentArgs: mockAgentArgs, charts: {}
63
76
  },
@@ -332,4 +345,200 @@ describe('component: rke2', () => {
332
345
  expect(agent.element).toBeDefined();
333
346
  });
334
347
  });
348
+
349
+ it.each([
350
+ ['v1.25.0+k3s1', [{ value: 'aws' }, { value: 'azure' }], 'azure', true],
351
+ ['v1.31.0+k3s1', [{ value: 'aws' }, { value: 'azure' }], 'harvester', true],
352
+ ['v1.29.0+k3s1', [{ value: 'aws' }, { value: 'azure' }], 'harvester', false],
353
+ ['v1.31.0+k3s1', [{ value: 'aws' }], 'azure', false],
354
+ ])('should set isAzureProviderUnsupported', (k8s, providerOptions, cloudProvider, value) => {
355
+ const wrapper = mount(rke2, {
356
+ propsData: {
357
+ mode: _CREATE,
358
+ value: {
359
+ spec: {
360
+ ...defaultSpec,
361
+ kubernetesVersion: k8s
362
+ },
363
+ agentConfig: { 'cloud-provider-name': cloudProvider }
364
+ },
365
+ provider: 'custom'
366
+ },
367
+ data: () => ({}),
368
+ computed: {
369
+ ...defaultComputed,
370
+ cloudProviderOptions: () => providerOptions
371
+ },
372
+ mocks: {
373
+ ...defaultMocks,
374
+ $store: { dispatch: () => jest.fn(), getters: defaultGetters },
375
+ },
376
+ stubs: defaultStubs
377
+ });
378
+
379
+ expect((wrapper.vm as any).isAzureProviderUnsupported).toBe(value);
380
+ });
381
+
382
+ it.each([
383
+ ['edit', 'v1.31.0+k3s1', 'azure', false],
384
+ ['edit', 'v1.26.0+k3s1', 'azure', false],
385
+ ['edit', 'v1.28.0+k3s1', 'harvester', false],
386
+ ['edit', 'v1.28.0+k3s1', 'azure', true],
387
+ ['create', 'v1.28.0+k3s1', 'azure', false],
388
+ ['view', 'v1.28.0+k3s1', 'azure', false],
389
+ ])('should set canAzureMigrateOnEdit', (mode, k8s, liveCloudProvider, value) => {
390
+ const wrapper = mount(rke2, {
391
+ propsData: {
392
+ mode,
393
+ liveValue: {
394
+ spec: {
395
+ ...defaultSpec,
396
+ kubernetesVersion: k8s
397
+ },
398
+ agentConfig: { 'cloud-provider-name': liveCloudProvider }
399
+ },
400
+ value: {
401
+ spec: {
402
+ ...defaultSpec,
403
+ kubernetesVersion: k8s
404
+ },
405
+ agentConfig: { 'cloud-provider-name': liveCloudProvider }
406
+ },
407
+ provider: 'custom'
408
+ },
409
+ data: () => ({}),
410
+ computed: defaultComputed,
411
+ mocks: {
412
+ ...defaultMocks,
413
+ $store: { dispatch: () => jest.fn(), getters: defaultGetters },
414
+ },
415
+ stubs: defaultStubs
416
+ });
417
+
418
+ expect((wrapper.vm as any).canAzureMigrateOnEdit).toBe(value);
419
+ });
420
+
421
+ it.each([
422
+ ['', 'v1.32.0+rke2r1', 'amazon', 'v1.32.0+rke2r1'],
423
+ ['', 'v1.29.0+rke2r1', 'amazon', 'v1.29.0+rke2r1'],
424
+ ['', 'v1.29.0+rke2r1', 'azure', 'v1.29.0+rke2r1'],
425
+ ['not', 'v1.31.0+rke2r1', 'azure', undefined],
426
+ ])('should %p include version %p if Cloud Provider is %p', async(_, k8s, liveCloudProvider, value) => {
427
+ const wrapper = mount(rke2, {
428
+ propsData: {
429
+ mode: 'create',
430
+ value: {
431
+ spec: {
432
+ ...defaultSpec,
433
+ kubernetesVersion: k8s
434
+ },
435
+ agentConfig: { 'cloud-provider-name': liveCloudProvider }
436
+ },
437
+ provider: 'custom'
438
+ },
439
+ data: () => ({}),
440
+ computed: {
441
+ appsOSWarning: () => false,
442
+ showForm: () => false,
443
+ },
444
+ mocks: {
445
+ ...defaultMocks,
446
+ $store: { dispatch: () => jest.fn(), getters: defaultGetters },
447
+ },
448
+ stubs: defaultStubs
449
+ });
450
+
451
+ wrapper.setData({
452
+ rke2Versions: [{
453
+ id: k8s,
454
+ version: k8s,
455
+ serverArgs: true
456
+ }]
457
+ });
458
+
459
+ expect((wrapper.vm as any).versionOptions[0]?.value).toBe(value);
460
+ });
461
+
462
+ it.each([
463
+ ['enable', 'v1.28.0+rke2r1', false],
464
+ ['disable', 'v1.32.0+rke2r1', true],
465
+ ])('should %p Azure provider option if version is %p', async(_, k8s, value) => {
466
+ const wrapper = mount(rke2, {
467
+ propsData: {
468
+ mode: 'create',
469
+ value: {
470
+ spec: {
471
+ ...defaultSpec,
472
+ kubernetesVersion: k8s
473
+ },
474
+ agentConfig: { 'cloud-provider-name': 'azure' }
475
+ },
476
+ provider: 'custom'
477
+ },
478
+ data: () => ({
479
+ agentArgs: {
480
+ 'cloud-provider-name': {
481
+ options: [
482
+ 'azure',
483
+ 'amazon'
484
+ ]
485
+ }
486
+ }
487
+ }),
488
+ computed: defaultComputed,
489
+ mocks: {
490
+ ...defaultMocks,
491
+ $store: { dispatch: () => jest.fn(), getters: defaultGetters },
492
+ },
493
+ stubs: defaultStubs
494
+ });
495
+
496
+ const azureOption = (wrapper.vm as any).cloudProviderOptions.find((o: any) => o.value === 'azure');
497
+
498
+ expect(azureOption.disabled).toBe(value);
499
+ });
500
+
501
+ it.each([
502
+ ['enable', 'azure', 'v1.28.0+rke2r1', false], // azure provider / current
503
+ ['enable', 'external', 'v1.28.0+rke2r1', false], // external provider
504
+ ['enable', 'azure', 'v1.26.0+rke2r1', false], // version mismatch
505
+ ['disable', 'amazon', 'v1.26.0+rke2r1', true],
506
+ ['enable', '', 'v1.28.0+rke2r1', true], // default provider
507
+ ])('should %p provider option %p in edit mode if live provider is Azure and 1.27 <= k8s < 1.30', async(_, cloudProvider, k8s, value) => {
508
+ const wrapper = mount(rke2, {
509
+ propsData: {
510
+ mode: 'edit',
511
+ value: {
512
+ spec: {
513
+ ...defaultSpec,
514
+ kubernetesVersion: k8s
515
+ },
516
+ agentConfig: { 'cloud-provider-name': 'azure' }
517
+ },
518
+ provider: 'custom'
519
+ },
520
+ data: () => ({
521
+ canAzureMigrateOnEdit: true,
522
+ agentArgs: {
523
+ 'cloud-provider-name': {
524
+ options: [
525
+ 'azure',
526
+ 'amazon',
527
+ 'external'
528
+ ]
529
+ }
530
+ }
531
+ }),
532
+ computed: defaultComputed,
533
+ mocks: {
534
+ ...defaultMocks,
535
+ $store: { dispatch: () => jest.fn(), getters: defaultGetters },
536
+ },
537
+ stubs: defaultStubs
538
+ });
539
+
540
+ const azureOption = (wrapper.vm as any).cloudProviderOptions.find((o: any) => o.value === cloudProvider);
541
+
542
+ expect(azureOption.disabled).toBe(value);
543
+ });
335
544
  });
@@ -330,6 +330,14 @@ export default {
330
330
  });
331
331
  });
332
332
 
333
+ if (isElementalActive) {
334
+ // !this.subType means we are on the /create screen - we only want to show for rke2
335
+ // if a subType is selected, always add the ELEMENTAL_CLUSTER_PROVIDER type to cover edit scenarios
336
+ if ((!this.subType && !this.isRke1) || this.subType) {
337
+ addType(this.$plugin, ELEMENTAL_CLUSTER_PROVIDER, 'custom2', false);
338
+ }
339
+ }
340
+
333
341
  if (this.isRke1 ) {
334
342
  machineTypes.forEach((type) => {
335
343
  const id = type.spec.displayName || type.id;
@@ -346,10 +354,6 @@ export default {
346
354
  });
347
355
 
348
356
  addType(this.$plugin, 'custom', 'custom2', false);
349
-
350
- if (isElementalActive) {
351
- addType(this.$plugin, ELEMENTAL_CLUSTER_PROVIDER, 'custom2', false);
352
- }
353
357
  }
354
358
 
355
359
  // Add from extensions