@rancher/shell 0.4.0 → 0.5.0

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 (274) hide show
  1. package/assets/images/providers/ovhcloudmks.svg +122 -0
  2. package/assets/images/providers/ovhcloudpubliccloud.svg +122 -0
  3. package/assets/styles/global/_layout.scss +99 -0
  4. package/assets/translations/en-us.yaml +30 -5
  5. package/assets/translations/zh-hans.yaml +1 -1
  6. package/babel.config.js +7 -1
  7. package/chart/monitoring/alerting/index.vue +7 -21
  8. package/chart/monitoring/grafana/index.vue +55 -0
  9. package/chart/monitoring/index.vue +51 -17
  10. package/chart/monitoring/prometheus/index.vue +37 -43
  11. package/chart/rancher-backup/index.vue +2 -1
  12. package/cloud-credential/azure.vue +4 -17
  13. package/components/AsyncButton.vue +17 -5
  14. package/components/Certificates.vue +164 -0
  15. package/components/CodeMirror.vue +19 -21
  16. package/components/CruResource.vue +1 -0
  17. package/components/DraggableZone.vue +2 -2
  18. package/components/EtcdInfoBanner.vue +1 -1
  19. package/components/ExplorerProjectsNamespaces.vue +25 -1
  20. package/components/IconOrSvg.vue +1 -1
  21. package/components/LandingPagePreference.vue +1 -4
  22. package/components/PodSecurityAdmission.vue +2 -2
  23. package/components/Questions/index.vue +1 -1
  24. package/components/ResourceDetail/Masthead.vue +16 -3
  25. package/components/ResourceTable.vue +14 -2
  26. package/components/ResourceYaml.vue +5 -0
  27. package/components/SideNav.vue +1 -1
  28. package/components/SingleClusterInfo.vue +1 -4
  29. package/components/Tabbed/index.vue +12 -0
  30. package/components/fleet/FleetRepos.vue +62 -27
  31. package/components/fleet/FleetResources.vue +6 -1
  32. package/components/form/ArrayListSelect.vue +10 -0
  33. package/components/form/Error.vue +3 -3
  34. package/components/form/Footer.vue +2 -2
  35. package/components/form/GitPicker.vue +83 -38
  36. package/components/form/KeyValue.vue +4 -0
  37. package/components/form/LabeledSelect.vue +4 -0
  38. package/components/formatter/Checked.vue +11 -3
  39. package/components/formatter/FleetClusterSummaryGraph.vue +27 -0
  40. package/components/formatter/FleetSummaryGraph.vue +23 -11
  41. package/components/formatter/LiveDuration.vue +1 -1
  42. package/components/formatter/PercentageBar.vue +1 -1
  43. package/components/formatter/__tests__/Checked.test.ts +19 -0
  44. package/components/nav/Group.vue +2 -2
  45. package/components/nav/Header.vue +0 -1
  46. package/components/nav/TopLevelMenu.vue +36 -6
  47. package/components/nav/Type.vue +1 -3
  48. package/components/nav/WindowManager/ContainerLogs.vue +101 -3
  49. package/components/nav/WindowManager/ContainerShell.vue +6 -1
  50. package/components/nav/WindowManager/__tests__/ContainerLogs.test.ts +186 -0
  51. package/components/nav/WindowManager/index.vue +11 -10
  52. package/components/nav/__tests__/TopLevelMenu.test.ts +33 -0
  53. package/components/nav/__tests__/Type.test.ts +1 -1
  54. package/components/nuxt/nuxt-child.js +14 -78
  55. package/components/nuxt/nuxt.js +1 -1
  56. package/{layouts → components/templates}/blank.vue +1 -1
  57. package/{layouts → components/templates}/default.vue +8 -98
  58. package/{layouts → components/templates}/error.vue +10 -19
  59. package/{layouts → components/templates}/home.vue +4 -1
  60. package/{layouts → components/templates}/plain.vue +4 -1
  61. package/{layouts → components/templates}/standalone.vue +1 -1
  62. package/{layouts → components/templates}/unauthenticated.vue +1 -1
  63. package/composables/useCompactInput.test.ts +36 -0
  64. package/composables/useCompactInput.ts +20 -0
  65. package/composables/useLabeledFormElement.test.ts +135 -0
  66. package/composables/useLabeledFormElement.ts +138 -0
  67. package/config/harvester-manager-types.js +2 -0
  68. package/config/private-label.js +22 -0
  69. package/config/product/explorer.js +3 -0
  70. package/config/product/fleet.js +6 -1
  71. package/config/product/manager.js +8 -2
  72. package/config/query-params.js +1 -0
  73. package/config/router.js +385 -364
  74. package/config/settings.ts +1 -0
  75. package/config/store.js +1 -1
  76. package/config/system-namespaces.js +3 -0
  77. package/config/table-headers.js +47 -0
  78. package/core/plugin-routes.ts +56 -114
  79. package/core/plugin.ts +16 -10
  80. package/core/plugins-loader.js +7 -9
  81. package/core/plugins.js +0 -3
  82. package/creators/app/files/.gitlab-ci.yml +1 -1
  83. package/detail/fleet.cattle.io.cluster.vue +11 -1
  84. package/detail/provisioning.cattle.io.cluster.vue +4 -3
  85. package/dialog/ScaleMachineDownDialog.vue +34 -17
  86. package/edit/__tests__/service.test.ts +89 -0
  87. package/edit/auth/googleoauth.vue +1 -5
  88. package/edit/cloudcredential.vue +2 -0
  89. package/edit/configmap.vue +2 -1
  90. package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +2 -2
  91. package/edit/networking.k8s.io.networkpolicy/__tests__/PolicyRuleTarget.spec.ts +1 -1
  92. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +15 -7
  93. package/edit/provisioning.cattle.io.cluster/__tests__/Advanced.test.ts +112 -0
  94. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +473 -0
  95. package/edit/provisioning.cattle.io.cluster/__tests__/{CustomCommand.tests.ts → CustomCommand.test.ts} +4 -0
  96. package/edit/provisioning.cattle.io.cluster/__tests__/DrainOptions.test.ts +1 -1
  97. package/edit/provisioning.cattle.io.cluster/__tests__/index.test.ts +73 -0
  98. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +7 -1
  99. package/edit/provisioning.cattle.io.cluster/__tests__/utils/cluster.ts +386 -0
  100. package/edit/provisioning.cattle.io.cluster/import.vue +2 -2
  101. package/edit/provisioning.cattle.io.cluster/index.vue +92 -36
  102. package/edit/provisioning.cattle.io.cluster/rke2.vue +171 -583
  103. package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +137 -0
  104. package/edit/provisioning.cattle.io.cluster/tabs/Advanced.vue +157 -0
  105. package/edit/provisioning.cattle.io.cluster/{Basics.vue → tabs/Basics.vue} +94 -19
  106. package/edit/provisioning.cattle.io.cluster/{MachinePool.vue → tabs/MachinePool.vue} +1 -0
  107. package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +135 -0
  108. package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +189 -0
  109. package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +144 -0
  110. package/edit/provisioning.cattle.io.cluster/tabs/upgrade/index.vue +76 -0
  111. package/edit/service.vue +12 -0
  112. package/edit/workload/mixins/workload.js +1 -1
  113. package/initialize/App.js +25 -71
  114. package/initialize/client.js +21 -162
  115. package/initialize/index.js +27 -123
  116. package/list/management.cattle.io.feature.vue +1 -7
  117. package/list/node.vue +1 -0
  118. package/machine-config/__tests__/vmwarevsphere.test.ts +100 -21
  119. package/machine-config/vmwarevsphere.vue +73 -51
  120. package/middleware/authenticated.js +10 -17
  121. package/mixins/auth-config.js +2 -7
  122. package/mixins/brand.js +29 -41
  123. package/mixins/create-edit-view/index.js +2 -2
  124. package/mixins/labeled-form-element.ts +6 -1
  125. package/models/__tests__/management.cattle.io.node.ts +85 -0
  126. package/models/__tests__/management.cattle.io.nodepool.ts +83 -0
  127. package/models/__tests__/namespace.test.ts +49 -9
  128. package/models/__tests__/workload.test.ts +91 -0
  129. package/models/cluster/node.js +4 -4
  130. package/models/cluster.x-k8s.io.machinedeployment.js +14 -0
  131. package/models/fleet.cattle.io.cluster.js +4 -0
  132. package/models/fleet.cattle.io.gitrepo.js +56 -13
  133. package/models/management.cattle.io.kontainerdriver.js +1 -1
  134. package/models/management.cattle.io.node.js +18 -14
  135. package/models/management.cattle.io.nodepool.js +17 -0
  136. package/models/namespace.js +1 -1
  137. package/models/pod.js +20 -0
  138. package/models/provisioning.cattle.io.cluster.js +20 -3
  139. package/models/secret.js +117 -18
  140. package/models/workload.js +16 -0
  141. package/models/workload.service.js +18 -0
  142. package/package.json +10 -9
  143. package/pages/about.vue +0 -1
  144. package/pages/account/create-key.vue +0 -1
  145. package/pages/account/index.vue +0 -1
  146. package/pages/auth/login.vue +0 -1
  147. package/pages/auth/logout.vue +0 -2
  148. package/pages/auth/setup.vue +0 -4
  149. package/pages/auth/verify.vue +14 -8
  150. package/pages/c/_cluster/apps/charts/install.vue +4 -4
  151. package/pages/c/_cluster/apps/index.vue +0 -2
  152. package/pages/c/_cluster/auth/index.vue +0 -2
  153. package/pages/c/_cluster/ecm/index.vue +0 -2
  154. package/pages/c/_cluster/explorer/index.vue +28 -2
  155. package/pages/c/_cluster/fleet/index.vue +1 -1
  156. package/pages/c/_cluster/index.vue +0 -2
  157. package/pages/c/_cluster/settings/banners.vue +0 -2
  158. package/pages/c/_cluster/settings/brand.vue +0 -2
  159. package/pages/c/_cluster/settings/index.vue +0 -2
  160. package/pages/c/_cluster/settings/links.vue +0 -1
  161. package/pages/c/_cluster/settings/performance.vue +0 -1
  162. package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +2 -1
  163. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +10 -46
  164. package/pages/c/_cluster/uiplugins/index.vue +0 -2
  165. package/pages/diagnostic.vue +1 -2
  166. package/pages/fail-whale.vue +0 -1
  167. package/pages/prefs.vue +0 -1
  168. package/pages/support/index.vue +2 -8
  169. package/pkg/auto-import.js +1 -1
  170. package/plugins/axios.js +0 -36
  171. package/plugins/back-button.js +3 -5
  172. package/plugins/codemirror-loader.js +1 -1
  173. package/plugins/codemirror.js +41 -0
  174. package/plugins/dashboard-store/__tests__/{mutations.spec.ts → mutations.test.ts} +1 -1
  175. package/plugins/dashboard-store/__tests__/resource-class.test.ts +49 -0
  176. package/plugins/dashboard-store/__tests__/utils/store-mocks.ts +7 -0
  177. package/plugins/dashboard-store/actions.js +30 -4
  178. package/plugins/dashboard-store/classify.js +1 -18
  179. package/plugins/dashboard-store/getters.js +10 -5
  180. package/plugins/dashboard-store/index.js +0 -12
  181. package/plugins/dashboard-store/mutations.js +0 -4
  182. package/plugins/dashboard-store/resource-class.js +59 -18
  183. package/plugins/steve/__tests__/steve-class.spec.ts +59 -0
  184. package/plugins/steve/__tests__/utils/steve-mocks.ts +31 -0
  185. package/plugins/steve/getters.js +4 -1
  186. package/plugins/steve/norman-class.js +19 -0
  187. package/plugins/steve/steve-class.js +22 -0
  188. package/plugins/steve/subscribe.js +4 -10
  189. package/rancher-components/Accordion/Accordion.test.ts +45 -0
  190. package/rancher-components/Accordion/Accordion.vue +86 -0
  191. package/rancher-components/Accordion/index.ts +1 -0
  192. package/rancher-components/BadgeState/BadgeState.vue +3 -3
  193. package/rancher-components/Banner/Banner.vue +2 -2
  194. package/rancher-components/Card/Card.vue +3 -3
  195. package/rancher-components/Form/Checkbox/Checkbox.vue +3 -3
  196. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +18 -1
  197. package/rancher-components/Form/LabeledInput/LabeledInput.vue +65 -24
  198. package/rancher-components/Form/Radio/RadioButton.test.ts +7 -3
  199. package/rancher-components/Form/Radio/RadioButton.vue +13 -7
  200. package/rancher-components/Form/Radio/RadioGroup.test.ts +30 -0
  201. package/rancher-components/Form/Radio/RadioGroup.vue +8 -3
  202. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +6 -4
  203. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +7 -4
  204. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +9 -4
  205. package/rancher-components/StringList/StringList.test.ts +270 -0
  206. package/rancher-components/StringList/StringList.vue +65 -26
  207. package/rancher-components/components/Accordion/Accordion.test.ts +45 -0
  208. package/rancher-components/components/Accordion/Accordion.vue +86 -0
  209. package/rancher-components/components/Accordion/index.ts +1 -0
  210. package/rancher-components/components/BadgeState/BadgeState.vue +3 -3
  211. package/rancher-components/components/Banner/Banner.vue +2 -2
  212. package/rancher-components/components/Card/Card.vue +3 -3
  213. package/rancher-components/components/Form/Checkbox/Checkbox.vue +3 -3
  214. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +18 -1
  215. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +57 -24
  216. package/rancher-components/components/Form/Radio/RadioButton.vue +13 -7
  217. package/rancher-components/components/Form/Radio/RadioGroup.vue +4 -3
  218. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +6 -4
  219. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +7 -4
  220. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +9 -4
  221. package/rancher-components/components/StringList/StringList.vue +8 -8
  222. package/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml +50 -0
  223. package/scripts/extension/parse-tag-name +2 -2
  224. package/scripts/publish-shell.sh +10 -0
  225. package/scripts/test-plugins-build.sh +85 -9
  226. package/server/har-file.js +183 -0
  227. package/store/catalog.js +1 -1
  228. package/store/features.js +1 -0
  229. package/store/i18n.js +11 -0
  230. package/store/index.js +10 -11
  231. package/store/prefs.js +33 -35
  232. package/store/type-map.js +8 -7
  233. package/tsconfig.json +35 -9
  234. package/tsconfig.paths.json +21 -0
  235. package/types/shell/index.d.ts +427 -234
  236. package/types/vue-shim.d.ts +42 -0
  237. package/utils/__tests__/create-yaml.test.ts +60 -0
  238. package/utils/axios.js +0 -19
  239. package/utils/azure.js +24 -0
  240. package/utils/create-yaml.js +17 -10
  241. package/utils/git.ts +1 -1
  242. package/utils/monitoring.js +1 -1
  243. package/utils/nuxt.js +18 -39
  244. package/utils/object.js +14 -0
  245. package/utils/router.scrollBehavior.js +12 -14
  246. package/utils/time.js +1 -1
  247. package/utils/url.ts +1 -1
  248. package/vue.config.js +23 -2
  249. package/.DS_Store +0 -0
  250. package/assets/images/providers/aks-black.svg +0 -28
  251. package/assets/images/providers/aks.svg +0 -31
  252. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts +0 -234
  253. package/initialize/layouts.ts +0 -26
  254. package/mixins/fetch.server.js +0 -73
  255. package/pages/c/index.vue +0 -9
  256. package/pages/rio/mesh.vue +0 -508
  257. package/plugins/transitions.js +0 -4
  258. package/scripts/.DS_Store +0 -0
  259. package/scripts/verdaccio.log +0 -205
  260. package/tsconfig.default.json +0 -46
  261. package/yarn-error.log +0 -200
  262. /package/components/form/__tests__/{NameNsDescription.ts → NameNsDescription.test.ts} +0 -0
  263. /package/edit/networking.k8s.io.networkpolicy/__tests__/utils/{selectors.ts → selectors.test.ts} +0 -0
  264. /package/edit/provisioning.cattle.io.cluster/{AgentConfiguration.vue → tabs/AgentConfiguration.vue} +0 -0
  265. /package/edit/provisioning.cattle.io.cluster/{MemberRoles.vue → tabs/MemberRoles.vue} +0 -0
  266. /package/edit/provisioning.cattle.io.cluster/{S3Config.vue → tabs/etcd/S3Config.vue} +0 -0
  267. /package/edit/provisioning.cattle.io.cluster/{ACE.vue → tabs/networking/ACE.vue} +0 -0
  268. /package/edit/provisioning.cattle.io.cluster/{RegistryConfigs.vue → tabs/registries/RegistryConfigs.vue} +0 -0
  269. /package/edit/provisioning.cattle.io.cluster/{RegistryMirrors.vue → tabs/registries/RegistryMirrors.vue} +0 -0
  270. /package/edit/provisioning.cattle.io.cluster/{DrainOptions.vue → tabs/upgrade/DrainOptions.vue} +0 -0
  271. /package/plugins/dashboard-store/__tests__/{actions.spec.ts → actions.test.ts} +0 -0
  272. /package/plugins/dashboard-store/__tests__/{getters.spec.ts → getters.test.ts} +0 -0
  273. /package/rancher-components/BadgeState/{BadgeState.spec.ts → BadgeState.test.ts} +0 -0
  274. /package/rancher-components/components/BadgeState/{BadgeState.spec.ts → BadgeState.test.ts} +0 -0
@@ -1,28 +1,28 @@
1
1
  import { mount } from '@vue/test-utils';
2
- import vmwarevsphere, { DEFAULT_VALUES } from '@shell/machine-config/vmwarevsphere.vue';
2
+ import vmwarevsphere, { DEFAULT_VALUES, SENTINEL } from '@shell/machine-config/vmwarevsphere.vue';
3
+ import { cleanHtmlDirective } from '@shell/plugins/clean-html-directive';
3
4
 
4
5
  describe('component: vmwarevsphere', () => {
6
+ const defaultGetters = { 'i18n/t': jest.fn().mockImplementation((key: string) => key) };
7
+ const defaultSetup = {
8
+ propsData: {
9
+ poolId: 'poolId',
10
+ credentialId: 'credentialId',
11
+ disabled: false,
12
+ mode: 'create',
13
+ value: { initted: false },
14
+ provider: 'vmwarevsphere'
15
+ },
16
+ mocks: {
17
+ $fetchState: { pending: false },
18
+ $store: { getters: defaultGetters },
19
+ },
20
+ stubs: { CodeMirror: true },
21
+ directives: { cleanHtmlDirective }
22
+ };
23
+
5
24
  it('should mount successfully with correct default values', () => {
6
- const defaultGetters = { 'i18n/t': jest.fn() };
7
- const wrapper = mount(vmwarevsphere, {
8
- propsData: {
9
- poolId: 'poolId',
10
- credentialId: 'credentialId',
11
- disabled: false,
12
- mode: 'create',
13
- value: {
14
- initted: false,
15
- network: [],
16
- tag: []
17
- },
18
- provider: 'vmwarevsphere'
19
- },
20
- mocks: {
21
- $fetchState: { pending: false },
22
- $store: { getters: defaultGetters },
23
- },
24
- stubs: { CodeMirror: true }
25
- });
25
+ const wrapper = mount(vmwarevsphere, defaultSetup);
26
26
 
27
27
  const dataCenterElement = wrapper.find(`[data-testid="datacenter"]`).element;
28
28
  const resourcePoolElement = wrapper.find(`[data-testid="resourcePool"]`).element;
@@ -69,4 +69,83 @@ describe('component: vmwarevsphere', () => {
69
69
  expect(cfgparam).toStrictEqual(defaultCfgparam);
70
70
  expect(os).toStrictEqual(defaultOs);
71
71
  });
72
+
73
+ describe('mapPathOptionsToContent', () => {
74
+ const testCases = [
75
+ [['/Datacenter'], [{ label: '/Datacenter', value: '/Datacenter' }]],
76
+ [['Datacenter'], [{ label: 'Datacenter', value: 'Datacenter' }]],
77
+ [['/Datacenter/vm/datastore'], [{ label: '/Datacenter/vm/datastore', value: '/Datacenter/vm/datastore' }]],
78
+ ];
79
+
80
+ it.each(testCases)('should generate label/value object without manipultion', (rawData, expected) => {
81
+ const wrapper = mount(vmwarevsphere, defaultSetup);
82
+
83
+ expect(wrapper.vm.mapPathOptionsToContent(rawData)).toStrictEqual(expected);
84
+ });
85
+ });
86
+
87
+ describe('mapHostOptionsToContent', () => {
88
+ const hostPlaceholder = {
89
+ label: 'cluster.machineConfig.vsphere.hostOptions.any',
90
+ value: SENTINEL
91
+ };
92
+ const testCases = [
93
+ [[''], [hostPlaceholder]],
94
+ [['host'], [{ label: 'host', value: 'host' }]],
95
+ ];
96
+
97
+ it.each(testCases)('should generate label/value object for host options properly', (rawData, expected) => {
98
+ const wrapper = mount(vmwarevsphere, defaultSetup);
99
+
100
+ expect(wrapper.vm.mapHostOptionsToContent(rawData)).toStrictEqual(expected);
101
+ });
102
+ });
103
+
104
+ describe('mapFolderOptionsToContent', () => {
105
+ const folderPlaceholder = {
106
+ label: '\u00A0',
107
+ value: ''
108
+ };
109
+ const testCases = [
110
+ [[undefined], [folderPlaceholder]],
111
+ [[null], [folderPlaceholder]],
112
+ [[''], [folderPlaceholder]],
113
+ [['folder'], [{ label: 'folder', value: 'folder' }]],
114
+ ];
115
+
116
+ it.each(testCases)('should generate label/value object for folder options properly', (rawData, expected) => {
117
+ const wrapper = mount(vmwarevsphere, defaultSetup);
118
+
119
+ expect(wrapper.vm.mapFolderOptionsToContent(rawData)).toStrictEqual(expected);
120
+ });
121
+ });
122
+
123
+ describe('mapCustomAttributesToContent', () => {
124
+ const testCases = [
125
+ [[{ name: 'name', key: 'key' }], [{ label: 'name', value: 'key' }]],
126
+ [[{ name: 'name', key: 111 }], [{ label: 'name', value: '111' }]],
127
+ ];
128
+
129
+ it.each(testCases)('should generate label/value object for custom attributes options properly', (rawData, expected) => {
130
+ const wrapper = mount(vmwarevsphere, defaultSetup);
131
+
132
+ expect(wrapper.vm.mapCustomAttributesToContent(rawData)).toStrictEqual(expected);
133
+ });
134
+ });
135
+
136
+ describe('mapTagsToContent', () => {
137
+ it('should generate label/value object for tag options properly', () => {
138
+ const tag = {
139
+ id: 'tag_id',
140
+ name: 'tag_name',
141
+ category: 'tag_category',
142
+ };
143
+ const expectedReslut = [{
144
+ ...tag, label: `${ tag.category } / ${ tag.name }`, value: tag.id
145
+ }];
146
+ const wrapper = mount(vmwarevsphere, defaultSetup);
147
+
148
+ expect(wrapper.vm.mapTagsToContent([tag])).toStrictEqual(expectedReslut);
149
+ });
150
+ });
72
151
  });
@@ -2,7 +2,6 @@
2
2
  import Loading from '@shell/components/Loading';
3
3
  import CreateEditView from '@shell/mixins/create-edit-view';
4
4
  import LabeledSelect from '@shell/components/form/LabeledSelect';
5
- // import { Checkbox } from '@components/Form/Checkbox';
6
5
  import { exceptionToErrorsArray, stringify } from '@shell/utils/error';
7
6
  import { Banner } from '@components/Banner';
8
7
  import UnitInput from '@shell/components/form/UnitInput';
@@ -16,7 +15,7 @@ import { get, set } from '@shell/utils/object';
16
15
  import { integerString, keyValueStrings } from '@shell/utils/computed';
17
16
  import { _CREATE, _EDIT, _VIEW } from '@shell/config/query-params';
18
17
 
19
- const SENTINEL = '__SENTINEL__';
18
+ export const SENTINEL = '__SENTINEL__';
20
19
  const VAPP_MODE = {
21
20
  DISABLED: 'disabled',
22
21
  AUTO: 'auto',
@@ -108,7 +107,7 @@ const getInitialVappMode = (c) => {
108
107
  return VAPP_MODE.DISABLED;
109
108
  }
110
109
 
111
- const d = getDefaultVappOptions(c.network);
110
+ const d = getDefaultVappOptions(c.network || []);
112
111
 
113
112
  if (
114
113
  c.vappIpprotocol === d.vappIpprotocol &&
@@ -297,6 +296,10 @@ export default {
297
296
  ...createOptionHelpers('attributeKeys'),
298
297
  ...createOptionHelpers('networks'),
299
298
 
299
+ isDisabled() {
300
+ return this.disabled || this.mode === _VIEW;
301
+ },
302
+
300
303
  showTemplate() {
301
304
  return this.value.creationType === 'template';
302
305
  },
@@ -326,7 +329,9 @@ export default {
326
329
  },
327
330
 
328
331
  templateTooltip() {
329
- return this.failedToLoadTemplates ? this.t('cluster.machineConfig.vsphere.instanceOptions.template.none') : null;
332
+ const rawTemplateValue = this.value.cloneFrom;
333
+
334
+ return this.failedToLoadTemplates ? this.t('cluster.machineConfig.vsphere.instanceOptions.template.none') : rawTemplateValue;
330
335
  },
331
336
 
332
337
  host: {
@@ -350,6 +355,24 @@ export default {
350
355
 
351
356
  gracefulShutdownTimeout: integerString('value.gracefulShutdownTimeout'),
352
357
 
358
+ network: {
359
+ get() {
360
+ return this.value.network || [];
361
+ },
362
+ set(newValue) {
363
+ set(this.value, 'network', newValue);
364
+ }
365
+ },
366
+
367
+ tag: {
368
+ get() {
369
+ return this.value.tag || [];
370
+ },
371
+ set(newValue) {
372
+ set(this.value, 'tag', newValue);
373
+ }
374
+ },
375
+
353
376
  showCloudConfigYaml() {
354
377
  return this.value.creationType !== 'legacy';
355
378
  },
@@ -375,7 +398,7 @@ export default {
375
398
  },
376
399
  vappMode(value) {
377
400
  if (value === VAPP_MODE.AUTO) {
378
- const defaultVappOptions = getDefaultVappOptions(this.value.network);
401
+ const defaultVappOptions = getDefaultVappOptions(this.value.network || []);
379
402
 
380
403
  return this.updateVappOptions(defaultVappOptions);
381
404
  }
@@ -488,7 +511,7 @@ export default {
488
511
 
489
512
  const options = await this.requestOptions('resource-pools', this.value.datacenter);
490
513
 
491
- const content = this.mapPoolOptionsToContent(options);
514
+ const content = this.mapPathOptionsToContent(options);
492
515
 
493
516
  this.resetValueIfNecessary('pool', content, options);
494
517
 
@@ -620,7 +643,7 @@ export default {
620
643
  resetValueIfNecessary(key, content, options, isArray = false) {
621
644
  const isValueInContent = () => {
622
645
  if (isArray) {
623
- return this.value[key].every((value) => content.find((c) => c.value === value));
646
+ return this.value[key]?.every((value) => content.find((c) => c.value === value));
624
647
  }
625
648
 
626
649
  return content.find((c) => c.value === this.value[key] );
@@ -645,10 +668,8 @@ export default {
645
668
 
646
669
  mapPathOptionsToContent(pathOptions) {
647
670
  return (pathOptions || []).map((pathOption) => {
648
- const split = pathOption.split('/');
649
-
650
671
  return {
651
- label: split[split.length - 1],
672
+ label: pathOption,
652
673
  value: pathOption
653
674
  };
654
675
  });
@@ -669,18 +690,6 @@ export default {
669
690
  }));
670
691
  },
671
692
 
672
- mapPoolOptionsToContent(pathOptions) {
673
- return pathOptions.map((pathOption) => {
674
- const splitOptions = pathOption.split('/');
675
- const label = splitOptions.slice(2).join('/');
676
-
677
- return {
678
- label,
679
- value: pathOption
680
- };
681
- });
682
- },
683
-
684
693
  mapCustomAttributesToContent(customAttributes) {
685
694
  return customAttributes.map((customAttribute) => ({
686
695
  label: customAttribute.name,
@@ -766,7 +775,8 @@ export default {
766
775
  :mode="mode"
767
776
  :options="dataCenters"
768
777
  :label="t('cluster.machineConfig.vsphere.scheduling.dataCenter')"
769
- :disabled="disabled"
778
+ :disabled="isDisabled"
779
+ :tooltip="value.datacenter"
770
780
  />
771
781
  </div>
772
782
  <div
@@ -779,7 +789,8 @@ export default {
779
789
  :mode="mode"
780
790
  :options="resourcePools"
781
791
  :label="t('cluster.machineConfig.vsphere.scheduling.resourcePool')"
782
- :disabled="disabled"
792
+ :disabled="isDisabled"
793
+ :tooltip="value.pool"
783
794
  />
784
795
  </div>
785
796
  </div>
@@ -794,7 +805,8 @@ export default {
794
805
  :mode="mode"
795
806
  :options="dataStores"
796
807
  :label="t('cluster.machineConfig.vsphere.scheduling.dataStore')"
797
- :disabled="disabled"
808
+ :disabled="isDisabled"
809
+ :tooltip="value.datastore"
798
810
  />
799
811
  </div>
800
812
  <div
@@ -807,7 +819,8 @@ export default {
807
819
  :mode="mode"
808
820
  :options="folders"
809
821
  :label="t('cluster.machineConfig.vsphere.scheduling.folder')"
810
- :disabled="disabled"
822
+ :disabled="isDisabled"
823
+ :tooltip="value.folder"
811
824
  />
812
825
  </div>
813
826
  </div>
@@ -822,7 +835,8 @@ export default {
822
835
  :mode="mode"
823
836
  :options="hosts"
824
837
  :label="t('cluster.machineConfig.vsphere.scheduling.host.label')"
825
- :disabled="disabled"
838
+ :disabled="isDisabled"
839
+ :tooltip="host"
826
840
  />
827
841
  <p class="text-muted mt-5">
828
842
  {{ t('cluster.machineConfig.vsphere.scheduling.host.note') }}
@@ -837,7 +851,7 @@ export default {
837
851
  :mode="mode"
838
852
  :label="t('cluster.machineConfig.vsphere.scheduling.gracefulShutdownTimeout.label')"
839
853
  :suffix="t('suffix.seconds', { count: gracefulShutdownTimeout})"
840
- :disabled="disabled"
854
+ :disabled="isDisabled"
841
855
  min="0"
842
856
  />
843
857
  <p class="text-muted mt-5">
@@ -869,7 +883,7 @@ export default {
869
883
  :mode="mode"
870
884
  :label="t('cluster.machineConfig.vsphere.instanceOptions.cpus')"
871
885
  :suffix="t('suffix.cores')"
872
- :disabled="disabled"
886
+ :disabled="isDisabled"
873
887
  />
874
888
  </div>
875
889
  <div class="col span-6">
@@ -878,7 +892,7 @@ export default {
878
892
  :mode="mode"
879
893
  :label="t('cluster.machineConfig.vsphere.instanceOptions.memory')"
880
894
  :suffix="t('suffix.mib')"
881
- :disabled="disabled"
895
+ :disabled="isDisabled"
882
896
  />
883
897
  </div>
884
898
  </div>
@@ -889,7 +903,7 @@ export default {
889
903
  :mode="mode"
890
904
  :label="t('cluster.machineConfig.vsphere.instanceOptions.disk')"
891
905
  :suffix="t('suffix.mib')"
892
- :disabled="disabled"
906
+ :disabled="isDisabled"
893
907
  />
894
908
  </div>
895
909
  <div class="col span-6">
@@ -898,7 +912,7 @@ export default {
898
912
  :mode="mode"
899
913
  :options="osOptions"
900
914
  :label="t('cluster.machineConfig.vsphere.instanceOptions.os')"
901
- :disabled="disabled"
915
+ :disabled="isDisabled"
902
916
  />
903
917
  </div>
904
918
  </div>
@@ -912,7 +926,7 @@ export default {
912
926
  :mode="mode"
913
927
  :options="creationMethods"
914
928
  :label="t('cluster.machineConfig.vsphere.instanceOptions.creationMethod')"
915
- :disabled="disabled"
929
+ :disabled="isDisabled"
916
930
  />
917
931
  </div>
918
932
  <div
@@ -925,7 +939,7 @@ export default {
925
939
  :mode="mode"
926
940
  :options="templates"
927
941
  :label="t('cluster.machineConfig.vsphere.instanceOptions.template.label')"
928
- :disabled="disabled"
942
+ :disabled="isDisabled"
929
943
  :status="templateStatus"
930
944
  :tooltip="templateTooltip"
931
945
  />
@@ -940,7 +954,7 @@ export default {
940
954
  :mode="mode"
941
955
  :options="contentLibraries"
942
956
  :label="t('cluster.machineConfig.vsphere.instanceOptions.contentLibrary')"
943
- :disabled="disabled"
957
+ :disabled="isDisabled"
944
958
  />
945
959
  </div>
946
960
  <div
@@ -954,7 +968,8 @@ export default {
954
968
  :options="libraryTemplates"
955
969
  :searchable="true"
956
970
  :label="t('cluster.machineConfig.vsphere.instanceOptions.libraryTemplate')"
957
- :disabled="disabled"
971
+ :disabled="isDisabled"
972
+ :tooltip="value.cloneFrom"
958
973
  />
959
974
  </div>
960
975
  <div
@@ -967,7 +982,8 @@ export default {
967
982
  :mode="mode"
968
983
  :options="virtualMachines"
969
984
  :label="t('cluster.machineConfig.vsphere.instanceOptions.virtualMachine')"
970
- :disabled="disabled"
985
+ :disabled="isDisabled"
986
+ :tooltip="value.cloneFrom"
971
987
  />
972
988
  </div>
973
989
  <div
@@ -979,7 +995,7 @@ export default {
979
995
  :mode="mode"
980
996
  :label="t('cluster.machineConfig.vsphere.instanceOptions.osIsoUrl.label')"
981
997
  :placeholder="t('cluster.machineConfig.vsphere.instanceOptions.osIsoUrl.placeholder')"
982
- :disabled="disabled"
998
+ :disabled="isDisabled"
983
999
  />
984
1000
  </div>
985
1001
  </div>
@@ -993,7 +1009,7 @@ export default {
993
1009
  :mode="mode"
994
1010
  :label="t('cluster.machineConfig.vsphere.instanceOptions.cloudInit.label')"
995
1011
  :placeholder="t('cluster.machineConfig.vsphere.instanceOptions.cloudInit.placeholder')"
996
- :disabled="disabled"
1012
+ :disabled="isDisabled"
997
1013
  />
998
1014
  <p class="text-muted mt-5">
999
1015
  {{ t('cluster.machineConfig.vsphere.instanceOptions.cloudInit.note') }}
@@ -1010,7 +1026,7 @@ export default {
1010
1026
  ref="yaml-additional"
1011
1027
  v-model="value.cloudConfig"
1012
1028
  :editor-mode="mode === 'view' ? 'VIEW_CODE' : 'EDIT_CODE'"
1013
- :disabled="disabled"
1029
+ :disabled="isDisabled"
1014
1030
  initial-yaml-values="# Additional Manifest YAML"
1015
1031
  class="yaml-editor"
1016
1032
  />
@@ -1022,11 +1038,11 @@ export default {
1022
1038
  {{ t('cluster.machineConfig.vsphere.networks.label') }}
1023
1039
  </label>
1024
1040
  <ArrayListSelect
1025
- v-model="value.network"
1041
+ v-model="network"
1026
1042
  :options="networks"
1027
1043
  :array-list-props="{ addLabel: t('cluster.machineConfig.vsphere.networks.add') }"
1028
1044
  :loading="networksLoading"
1029
- :disabled="disabled"
1045
+ :disabled="isDisabled"
1030
1046
  />
1031
1047
  </div>
1032
1048
  </div>
@@ -1041,7 +1057,7 @@ export default {
1041
1057
  :key-placeholder="t('cluster.machineConfig.vsphere.guestinfo.keyPlaceholder')"
1042
1058
  :value-placeholder="t('cluster.machineConfig.vsphere.guestinfo.valuePlaceholder')"
1043
1059
  :read-allowed="false"
1044
- :disabled="disabled"
1060
+ :disabled="isDisabled"
1045
1061
  />
1046
1062
  </div>
1047
1063
  </div>
@@ -1064,11 +1080,11 @@ export default {
1064
1080
  </h4>
1065
1081
  <div slot="body">
1066
1082
  <ArrayListSelect
1067
- v-model="value.tag"
1083
+ v-model="tag"
1068
1084
  :options="tags"
1069
1085
  :array-list-props="{ addLabel: t('cluster.machineConfig.vsphere.tags.addTag') }"
1070
1086
  :loading="tagsLoading"
1071
- :disabled="disabled"
1087
+ :disabled="isDisabled"
1072
1088
  />
1073
1089
  </div>
1074
1090
  </Card>
@@ -1097,7 +1113,7 @@ export default {
1097
1113
  :loading="attributeKeysLoading"
1098
1114
  :key-taggable="false"
1099
1115
  :key-option-unique="true"
1100
- :disabled="disabled"
1116
+ :disabled="isDisabled"
1101
1117
  />
1102
1118
  </div>
1103
1119
  </Card>
@@ -1123,7 +1139,7 @@ export default {
1123
1139
  name="restoreMode"
1124
1140
  :label="t('cluster.machineConfig.vsphere.vAppOptions.restoreType')"
1125
1141
  :options="vAppOptions"
1126
- :disabled="disabled"
1142
+ :disabled="isDisabled"
1127
1143
  />
1128
1144
  </div>
1129
1145
  </div>
@@ -1138,7 +1154,7 @@ export default {
1138
1154
  :label="t('cluster.machineConfig.vsphere.vAppOptions.transport.label')"
1139
1155
  :tooltip="t('cluster.machineConfig.vsphere.vAppOptions.transport.tooltip')"
1140
1156
  :placeholder="t('cluster.machineConfig.vsphere.vAppOptions.transport.placeholder')"
1141
- :disabled="disabled"
1157
+ :disabled="isDisabled"
1142
1158
  />
1143
1159
  </div>
1144
1160
  <div class="col span-4">
@@ -1148,7 +1164,7 @@ export default {
1148
1164
  :label="t('cluster.machineConfig.vsphere.vAppOptions.protocol.label')"
1149
1165
  :tooltip="t('cluster.machineConfig.vsphere.vAppOptions.protocol.tooltip')"
1150
1166
  :placeholder="t('cluster.machineConfig.vsphere.vAppOptions.protocol.placeholder')"
1151
- :disabled="disabled"
1167
+ :disabled="isDisabled"
1152
1168
  />
1153
1169
  </div>
1154
1170
  <div class="col span-4">
@@ -1158,7 +1174,7 @@ export default {
1158
1174
  :label="t('cluster.machineConfig.vsphere.vAppOptions.allocation.label')"
1159
1175
  :tooltip="t('cluster.machineConfig.vsphere.vAppOptions.allocation.tooltip')"
1160
1176
  :placeholder="t('cluster.machineConfig.vsphere.vAppOptions.allocation.placeholder')"
1161
- :disabled="disabled"
1177
+ :disabled="isDisabled"
1162
1178
  />
1163
1179
  </div>
1164
1180
  </div>
@@ -1174,7 +1190,7 @@ export default {
1174
1190
  :value-placeholder="t('cluster.machineConfig.vsphere.vAppOptions.properties.valuePlaceholder')"
1175
1191
  :add-label="t('cluster.machineConfig.vsphere.vAppOptions.properties.add')"
1176
1192
  :read-allowed="false"
1177
- :disabled="disabled"
1193
+ :disabled="isDisabled"
1178
1194
  />
1179
1195
  </div>
1180
1196
  </div>
@@ -1182,3 +1198,9 @@ export default {
1182
1198
  </Card>
1183
1199
  </div>
1184
1200
  </template>
1201
+
1202
+ <style lang="scss" scoped>
1203
+ ::v-deep .labeled-tooltip .status-icon.icon-info {
1204
+ z-index: 0;
1205
+ }
1206
+ </style>
@@ -305,9 +305,6 @@ export default async function({
305
305
  notLoggedIn();
306
306
  } else {
307
307
  store.commit('setError', { error: e, locationError: new Error('Auth Middleware') });
308
- if ( process.server ) {
309
- redirect(302, '/fail-whale');
310
- }
311
308
  }
312
309
 
313
310
  return;
@@ -318,14 +315,12 @@ export default async function({
318
315
  store.dispatch('gcStartIntervals');
319
316
  }
320
317
 
321
- if (!process.server) {
322
- const backTo = window.localStorage.getItem(BACK_TO);
318
+ const backTo = window.localStorage.getItem(BACK_TO);
323
319
 
324
- if (backTo) {
325
- window.localStorage.removeItem(BACK_TO);
320
+ if (backTo) {
321
+ window.localStorage.removeItem(BACK_TO);
326
322
 
327
- window.location.href = backTo;
328
- }
323
+ window.location.href = backTo;
329
324
  }
330
325
 
331
326
  // GC should be notified of route change before any find/get request is made that might be used for that page
@@ -366,14 +361,12 @@ export default async function({
366
361
  return redirected();
367
362
  }
368
363
 
369
- if (process.client) {
370
- store.app.router.afterEach((to, from) => {
371
- // Clear state used to record if back button was used for navigation
372
- setTimeout(() => {
373
- window._popStateDetected = false;
374
- }, 1);
375
- });
376
- }
364
+ store.app.router.afterEach((to, from) => {
365
+ // Clear state used to record if back button was used for navigation
366
+ setTimeout(() => {
367
+ window._popStateDetected = false;
368
+ }, 1);
369
+ });
377
370
  }
378
371
 
379
372
  try {
@@ -42,13 +42,8 @@ export default {
42
42
  },
43
43
 
44
44
  serverUrl() {
45
- if (process.client) {
46
- // Client-side rendered: use the current window location
47
- return window.location.origin;
48
- }
49
-
50
- // Server-side rendered
51
- return this.serverSetting || '';
45
+ // Client-side rendered: use the current window location
46
+ return window.location.origin;
52
47
  },
53
48
 
54
49
  baseUrl() {