@rancher/shell 0.1.0 → 0.1.1

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 (595) hide show
  1. package/assets/styles/base/_basic.scss +0 -1
  2. package/assets/styles/base/_variables.scss +2 -0
  3. package/assets/styles/global/_labeled-input.scss +6 -1
  4. package/assets/styles/global/_select.scss +9 -0
  5. package/assets/styles/vendor/vue-js-modal.scss +4 -0
  6. package/assets/translations/en-us.yaml +240 -16
  7. package/assets/translations/zh-hans.yaml +335 -111
  8. package/chart/example.vue +1 -1
  9. package/chart/istio.vue +2 -2
  10. package/chart/logging/index.vue +2 -2
  11. package/chart/monitoring/alerting/index.vue +2 -2
  12. package/chart/monitoring/grafana/index.vue +2 -2
  13. package/chart/monitoring/index.vue +2 -2
  14. package/chart/monitoring/prometheus/index.vue +4 -4
  15. package/chart/rancher-alerting-drivers.vue +17 -3
  16. package/chart/rancher-backup/S3.vue +37 -4
  17. package/chart/rancher-backup/index.vue +3 -3
  18. package/cloud-credential/aws.vue +1 -1
  19. package/cloud-credential/azure.vue +1 -1
  20. package/cloud-credential/digitalocean.vue +1 -1
  21. package/cloud-credential/gcp.vue +1 -1
  22. package/cloud-credential/generic.vue +1 -1
  23. package/cloud-credential/harvester.vue +2 -2
  24. package/cloud-credential/linode.vue +1 -1
  25. package/cloud-credential/s3.vue +2 -2
  26. package/cloud-credential/vmwarevsphere.vue +1 -1
  27. package/components/ActionMenu.vue +11 -1
  28. package/components/Alert.vue +1 -1
  29. package/components/AssignTo.vue +2 -2
  30. package/components/AsyncButton.vue +25 -12
  31. package/components/AwsComplianceBanner.vue +44 -0
  32. package/components/BannerGraphic.vue +11 -2
  33. package/components/ChartReadme.vue +10 -2
  34. package/components/CompoundStatusBadge.vue +50 -0
  35. package/components/CopyToClipboardText.vue +25 -4
  36. package/components/CruResource.vue +185 -16
  37. package/components/CruResourceFooter.vue +17 -1
  38. package/components/EtcdInfoBanner.vue +1 -1
  39. package/components/FilterLabel.vue +254 -0
  40. package/components/GlobalRoleBindings.vue +2 -2
  41. package/components/GrafanaDashboard.vue +1 -1
  42. package/components/GrowlManager.vue +20 -9
  43. package/components/HarvesterServiceAddOnConfig.vue +2 -2
  44. package/components/Import.vue +2 -2
  45. package/components/LandingPagePreference.vue +2 -2
  46. package/components/Markdown.vue +44 -12
  47. package/components/ModalWithCard.vue +2 -2
  48. package/components/MoveModal.vue +1 -1
  49. package/components/PercentageBar.vue +1 -1
  50. package/components/PromptChangePassword.vue +1 -1
  51. package/components/PromptModal.vue +13 -2
  52. package/components/PromptRemove.vue +64 -33
  53. package/components/PromptRestore.vue +3 -3
  54. package/components/Questions/Boolean.vue +1 -1
  55. package/components/Questions/Float.vue +1 -1
  56. package/components/Questions/Int.vue +1 -1
  57. package/components/Questions/Reference.vue +1 -1
  58. package/components/Questions/String.vue +1 -1
  59. package/components/RelatedResources.vue +1 -1
  60. package/components/RelatedWorkloadsTable.vue +3 -1
  61. package/components/ResourceDetail/Masthead.vue +27 -9
  62. package/components/ResourceDetail/index.vue +72 -7
  63. package/components/ResourceList/Masthead.vue +22 -0
  64. package/components/ResourceList/ResourceLoadingIndicator.vue +137 -0
  65. package/components/ResourceList/index.vue +42 -7
  66. package/components/ResourceTable.vue +11 -2
  67. package/components/ResourceYaml.vue +7 -1
  68. package/components/SelectIconGrid.vue +14 -1
  69. package/components/SortableTable/THead.vue +1 -1
  70. package/components/SortableTable/debug.js +117 -0
  71. package/components/SortableTable/index.vue +200 -43
  72. package/components/SortableTable/paging.js +2 -12
  73. package/components/SortableTable/selection.js +3 -0
  74. package/components/SortableTable/sorting.js +3 -1
  75. package/components/Tabbed/Tab.vue +25 -4
  76. package/components/Tabbed/index.vue +133 -119
  77. package/components/TypeDescription.vue +1 -1
  78. package/components/VMConsoleBar.vue +1 -1
  79. package/components/Wizard.vue +53 -14
  80. package/components/YamlEditor.vue +10 -0
  81. package/components/__tests__/CopyCode.test.ts +1 -7
  82. package/components/__tests__/CruResource.test.ts +1 -8
  83. package/components/auth/AllowedPrincipals.vue +1 -1
  84. package/components/auth/AuthBanner.vue +2 -1
  85. package/components/auth/AzureWarning.vue +69 -0
  86. package/components/auth/RoleDetailEdit.vue +4 -4
  87. package/components/auth/login/ldap.vue +1 -1
  88. package/components/cards/ApplicationCard.vue +140 -0
  89. package/components/dialog/AddClusterMemberDialog.vue +1 -1
  90. package/components/dialog/AddCustomBadgeDialog.vue +4 -4
  91. package/components/dialog/AddProjectMemberDialog.vue +2 -2
  92. package/components/dialog/AddonConfigConfirmationDialog.vue +1 -1
  93. package/components/dialog/DrainNode.vue +3 -3
  94. package/components/dialog/ForceMachineRemoveDialog.vue +2 -2
  95. package/components/dialog/GenericPrompt.vue +2 -2
  96. package/components/dialog/RollbackWorkloadDialog.vue +2 -2
  97. package/components/dialog/RotateCertificatesDialog.vue +3 -3
  98. package/components/dialog/RotateEncryptionKeyDialog.vue +11 -6
  99. package/components/dialog/SaveAsRKETemplateDialog.vue +3 -3
  100. package/components/dialog/harvester/AddHotplugModal.vue +3 -3
  101. package/components/dialog/harvester/BackupModal.vue +3 -3
  102. package/components/dialog/harvester/CloneTemplate.vue +3 -3
  103. package/components/dialog/harvester/EjectCDROMDialog.vue +3 -3
  104. package/components/dialog/harvester/ExportImageDialog.vue +3 -3
  105. package/components/dialog/harvester/MaintenanceDialog.vue +2 -2
  106. package/components/dialog/harvester/MigrationDialog.vue +2 -2
  107. package/components/dialog/harvester/RestoreDialog.vue +2 -2
  108. package/components/dialog/harvester/SupportBundle.vue +2 -2
  109. package/components/dialog/harvester/UnplugVolume.vue +2 -2
  110. package/components/fleet/FleetBundleResources.vue +1 -1
  111. package/components/fleet/FleetBundles.vue +1 -1
  112. package/components/fleet/FleetResources.vue +5 -3
  113. package/components/fleet/ForceDirectedTreeChart/chartIcons.js +17 -0
  114. package/components/fleet/ForceDirectedTreeChart/index.vue +553 -0
  115. package/components/form/ArrayList.vue +22 -3
  116. package/components/form/BannerSettings.vue +3 -3
  117. package/components/form/ChangePassword.vue +2 -2
  118. package/components/form/Command.vue +28 -9
  119. package/components/form/Error.vue +50 -0
  120. package/components/form/Footer.vue +2 -5
  121. package/components/form/HealthCheck.vue +2 -2
  122. package/components/form/HookOption.vue +2 -2
  123. package/components/form/InputWithSelect.vue +12 -2
  124. package/components/form/KeyValue.vue +5 -2
  125. package/components/form/LabeledSelect.vue +27 -14
  126. package/components/form/Labels.vue +12 -0
  127. package/components/form/MatchExpressions.vue +44 -10
  128. package/components/form/Members/ClusterPermissionsEditor.vue +3 -3
  129. package/components/form/Members/MembershipEditor.vue +10 -1
  130. package/components/form/Members/ProjectMembershipEditor.vue +1 -0
  131. package/components/form/NameNsDescription.vue +202 -79
  132. package/components/form/Networking.vue +1 -1
  133. package/components/form/NodeAffinity.vue +41 -26
  134. package/components/form/NodeScheduling.vue +29 -3
  135. package/components/form/NotificationSettings.vue +2 -2
  136. package/components/form/Password.vue +1 -1
  137. package/components/form/PodAffinity.vue +64 -6
  138. package/components/form/PodSecurity.vue +2 -2
  139. package/components/form/Ports.vue +1 -1
  140. package/components/form/Probe.vue +60 -17
  141. package/components/form/ProjectMemberEditor.vue +3 -3
  142. package/components/form/ResourceQuota/NamespaceRow.vue +46 -2
  143. package/components/form/ResourceQuota/Project.vue +4 -0
  144. package/components/form/ResourceTabs/index.vue +19 -7
  145. package/components/form/RuleSelector.vue +1 -1
  146. package/components/form/Security.vue +56 -14
  147. package/components/form/Select.vue +52 -10
  148. package/components/form/SelectOrCreateAuthSecret.vue +70 -31
  149. package/components/form/ServiceNameSelect.vue +1 -1
  150. package/components/form/ServicePorts.vue +10 -2
  151. package/components/form/ShellInput.vue +1 -1
  152. package/components/form/SimpleSecretSelector.vue +2 -2
  153. package/components/form/Tolerations.vue +1 -1
  154. package/components/form/UnitInput.vue +12 -3
  155. package/components/form/ValueFromResource.vue +1 -1
  156. package/components/form/WorkloadPorts.vue +1 -1
  157. package/components/form/__tests__/Command.test.ts +63 -0
  158. package/components/form/__tests__/Error.test.ts +56 -0
  159. package/components/form/__tests__/MatchExpressions.test.ts +79 -0
  160. package/components/form/__tests__/Probe.test.ts +62 -0
  161. package/components/form/__tests__/Security.test.ts +55 -0
  162. package/components/form/__tests__/UnitInput.test.ts +31 -23
  163. package/components/formatter/BadgeStateFormatter.vue +1 -1
  164. package/components/formatter/Capitalize.vue +7 -0
  165. package/components/formatter/ClusterLink.vue +6 -2
  166. package/components/formatter/ClusterProvider.vue +36 -0
  167. package/components/formatter/DelayedValue.vue +43 -0
  168. package/components/formatter/Endpoints.vue +2 -2
  169. package/components/formatter/HarvesterDiskState.vue +1 -1
  170. package/components/formatter/HarvesterIpAddress.vue +37 -18
  171. package/components/formatter/HarvesterMigrationState.vue +1 -1
  172. package/components/formatter/HarvesterVmState.vue +1 -1
  173. package/components/formatter/LinkDetail.vue +11 -2
  174. package/components/formatter/LinkName.vue +2 -2
  175. package/components/formatter/LiveExpiryBadgeState.vue +1 -1
  176. package/components/formatter/LivePodRestarts.vue +47 -0
  177. package/components/formatter/MachineSummaryGraph.vue +51 -5
  178. package/components/formatter/PodsUsage.vue +5 -3
  179. package/components/formatter/Weight.vue +1 -1
  180. package/components/formatter/WorkloadHealthScale.vue +17 -6
  181. package/components/nav/HarvesterUpgrade.vue +15 -5
  182. package/components/nav/Header.vue +15 -6
  183. package/components/nav/Jump.vue +1 -1
  184. package/components/nav/NamespaceFilter.vue +30 -10
  185. package/components/nav/TopLevelMenu.vue +52 -14
  186. package/components/nav/WindowManager/ContainerLogs.vue +14 -2
  187. package/components/nav/WorkspaceSwitcher.vue +1 -1
  188. package/components/{NovncConsole.vue → novnc/NovncConsole.vue} +0 -0
  189. package/components/novnc/NovncConsoleItem.vue +89 -0
  190. package/components/novnc/NovncConsoleWrapper.vue +243 -0
  191. package/config/labels-annotations.js +6 -2
  192. package/config/product/explorer.js +7 -3
  193. package/config/product/fleet.js +4 -1
  194. package/config/product/manager.js +5 -6
  195. package/config/product/settings.js +12 -1
  196. package/config/query-params.js +2 -0
  197. package/config/roles.ts +5 -0
  198. package/config/settings.js +60 -63
  199. package/config/table-headers.js +47 -18
  200. package/config/types.js +24 -8
  201. package/content/docs/en-us/whats-new.md +25 -0
  202. package/core/plugin.ts +12 -2
  203. package/creators/app/init +7 -1
  204. package/creators/pkg/tsconfig.json +2 -3
  205. package/detail/catalog.cattle.io.app.vue +1 -1
  206. package/detail/cis.cattle.io.clusterscan.vue +1 -1
  207. package/detail/fleet.cattle.io.bundle.vue +73 -21
  208. package/detail/fleet.cattle.io.gitrepo.vue +5 -4
  209. package/detail/harvesterhci.io.host/HarvesterHostBasic.vue +25 -4
  210. package/detail/harvesterhci.io.host/HarvesterHostDisk.vue +2 -2
  211. package/detail/harvesterhci.io.virtualmachinebackup/index.vue +1 -1
  212. package/detail/helm.cattle.io.projecthelmchart.vue +1 -1
  213. package/detail/networking.k8s.io.ingress.vue +10 -2
  214. package/detail/pod.vue +37 -1
  215. package/detail/provisioning.cattle.io.cluster.vue +102 -15
  216. package/detail/workload/index.vue +163 -15
  217. package/edit/auth/azuread.vue +146 -34
  218. package/edit/auth/github.vue +3 -3
  219. package/edit/auth/googleoauth.vue +3 -3
  220. package/edit/auth/ldap/config.vue +15 -7
  221. package/edit/auth/ldap/index.vue +2 -2
  222. package/edit/auth/oidc.vue +3 -3
  223. package/edit/auth/saml.vue +3 -3
  224. package/edit/autoscaling.horizontalpodautoscaler/index.vue +1 -1
  225. package/edit/autoscaling.horizontalpodautoscaler/metric-identifier.vue +1 -1
  226. package/edit/autoscaling.horizontalpodautoscaler/metric-object-reference.vue +1 -1
  227. package/edit/autoscaling.horizontalpodautoscaler/metric-target.vue +1 -1
  228. package/edit/autoscaling.horizontalpodautoscaler/metrics-row.vue +1 -1
  229. package/edit/catalog.cattle.io.clusterrepo.vue +2 -2
  230. package/edit/cis.cattle.io.clusterscan.vue +4 -4
  231. package/edit/cis.cattle.io.clusterscanbenchmark.vue +1 -1
  232. package/edit/constraints.gatekeeper.sh.constraint/index.vue +1 -1
  233. package/edit/fleet.cattle.io.cluster.vue +1 -0
  234. package/edit/fleet.cattle.io.clustergroup.vue +1 -1
  235. package/edit/fleet.cattle.io.gitrepo.vue +290 -157
  236. package/edit/harvesterhci.io.host/HarvesterDisk.vue +4 -5
  237. package/edit/harvesterhci.io.host/index.vue +28 -19
  238. package/edit/harvesterhci.io.keypair.vue +1 -1
  239. package/edit/harvesterhci.io.managedchart/rancher-monitoring.vue +1 -1
  240. package/edit/harvesterhci.io.management.cluster.vue +1 -1
  241. package/edit/harvesterhci.io.networkattachmentdefinition.vue +2 -2
  242. package/edit/harvesterhci.io.setting/additional-ca.vue +1 -1
  243. package/edit/harvesterhci.io.setting/backup-target.vue +1 -1
  244. package/edit/harvesterhci.io.setting/http-proxy.vue +1 -1
  245. package/edit/harvesterhci.io.setting/index.vue +3 -3
  246. package/edit/harvesterhci.io.setting/overcommit-config.vue +4 -1
  247. package/edit/harvesterhci.io.setting/ssl-parameters.vue +1 -1
  248. package/edit/harvesterhci.io.setting/support-bundle-image.vue +1 -1
  249. package/edit/harvesterhci.io.setting/vip-pools.vue +1 -1
  250. package/edit/harvesterhci.io.setting/vm-force-reset-policy.vue +2 -2
  251. package/edit/harvesterhci.io.virtualmachinebackup.vue +2 -2
  252. package/edit/harvesterhci.io.virtualmachineimage.vue +2 -2
  253. package/edit/harvesterhci.io.virtualmachinetemplateversion.vue +26 -18
  254. package/edit/helm.cattle.io.projecthelmchart.vue +3 -3
  255. package/edit/k8s.cni.cncf.io.networkattachmentdefinition.vue +2 -2
  256. package/edit/kubevirt.io.virtualmachine/VirtualMachineAccessCredentials/AccessCredentialsUsers.vue +1 -1
  257. package/edit/kubevirt.io.virtualmachine/VirtualMachineAccessCredentials/index.vue +1 -1
  258. package/edit/kubevirt.io.virtualmachine/VirtualMachineCloudConfig/DataTemplate.vue +1 -0
  259. package/edit/kubevirt.io.virtualmachine/VirtualMachineCloudConfig/index.vue +2 -1
  260. package/edit/kubevirt.io.virtualmachine/VirtualMachineCpuMemory.vue +3 -1
  261. package/edit/kubevirt.io.virtualmachine/VirtualMachineNetwork/__tests__/HarvesterEditNetwork.test.ts +41 -0
  262. package/edit/kubevirt.io.virtualmachine/VirtualMachineNetwork/base.vue +79 -36
  263. package/edit/kubevirt.io.virtualmachine/VirtualMachineReserved.vue +54 -0
  264. package/edit/kubevirt.io.virtualmachine/VirtualMachineSSHKey.vue +1 -1
  265. package/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/index.vue +2 -3
  266. package/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/__tests__/HarvesterEditContainer.test.ts +40 -0
  267. package/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/__tests__/HarvesterEditExisting.test.ts +102 -0
  268. package/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/__tests__/HarvesterEditVMImage.test.ts +117 -0
  269. package/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/__tests__/HarvesterEditVolume.test.ts +74 -0
  270. package/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/container.vue +59 -13
  271. package/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/existing.vue +72 -16
  272. package/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/vmImage.vue +74 -14
  273. package/edit/kubevirt.io.virtualmachine/VirtualMachineVolume/type/volume.vue +35 -9
  274. package/edit/kubevirt.io.virtualmachine/index.vue +33 -24
  275. package/edit/logging-flow/index.vue +1 -1
  276. package/edit/logging.banzaicloud.io.output/index.vue +1 -1
  277. package/edit/logging.banzaicloud.io.output/providers/awsElasticsearch.vue +1 -1
  278. package/edit/logging.banzaicloud.io.output/providers/azurestorage.vue +1 -1
  279. package/edit/logging.banzaicloud.io.output/providers/cloudwatch.vue +1 -1
  280. package/edit/logging.banzaicloud.io.output/providers/datadog.vue +2 -2
  281. package/edit/logging.banzaicloud.io.output/providers/elasticsearch.vue +2 -2
  282. package/edit/logging.banzaicloud.io.output/providers/file.vue +1 -1
  283. package/edit/logging.banzaicloud.io.output/providers/forward.vue +1 -1
  284. package/edit/logging.banzaicloud.io.output/providers/gcs.vue +2 -2
  285. package/edit/logging.banzaicloud.io.output/providers/gelf.vue +2 -2
  286. package/edit/logging.banzaicloud.io.output/providers/kafka.vue +2 -2
  287. package/edit/logging.banzaicloud.io.output/providers/kinesisStream.vue +1 -1
  288. package/edit/logging.banzaicloud.io.output/providers/logdna.vue +1 -1
  289. package/edit/logging.banzaicloud.io.output/providers/logz.vue +2 -2
  290. package/edit/logging.banzaicloud.io.output/providers/loki.vue +2 -2
  291. package/edit/logging.banzaicloud.io.output/providers/newrelic.vue +1 -1
  292. package/edit/logging.banzaicloud.io.output/providers/s3.vue +2 -2
  293. package/edit/logging.banzaicloud.io.output/providers/splunkHec.vue +2 -2
  294. package/edit/logging.banzaicloud.io.output/providers/sumologic.vue +1 -1
  295. package/edit/logging.banzaicloud.io.output/providers/syslog.vue +2 -2
  296. package/edit/management.cattle.io.clusterroletemplatebinding.vue +2 -0
  297. package/edit/management.cattle.io.node.vue +71 -0
  298. package/edit/management.cattle.io.project.vue +28 -23
  299. package/edit/management.cattle.io.setting.vue +14 -3
  300. package/edit/management.cattle.io.user.vue +1 -1
  301. package/edit/monitoring.coreos.com.alertmanagerconfig/index.vue +4 -4
  302. package/edit/monitoring.coreos.com.alertmanagerconfig/receiverConfig.vue +13 -13
  303. package/edit/monitoring.coreos.com.alertmanagerconfig/routeConfig.vue +18 -10
  304. package/edit/monitoring.coreos.com.alertmanagerconfig/tls.vue +2 -2
  305. package/edit/monitoring.coreos.com.alertmanagerconfig/types/email.vue +12 -7
  306. package/edit/monitoring.coreos.com.alertmanagerconfig/types/opsgenie.vue +12 -7
  307. package/edit/monitoring.coreos.com.alertmanagerconfig/types/pagerduty.vue +20 -11
  308. package/edit/monitoring.coreos.com.alertmanagerconfig/types/slack.vue +13 -8
  309. package/edit/monitoring.coreos.com.alertmanagerconfig/types/webhook.vue +25 -7
  310. package/edit/monitoring.coreos.com.prometheusrule/AlertingRule.vue +2 -2
  311. package/edit/monitoring.coreos.com.prometheusrule/GroupRules.vue +20 -7
  312. package/edit/monitoring.coreos.com.prometheusrule/RecordingRule.vue +1 -1
  313. package/edit/monitoring.coreos.com.prometheusrule/index.vue +19 -8
  314. package/edit/monitoring.coreos.com.receiver/auth.vue +1 -1
  315. package/edit/monitoring.coreos.com.receiver/index.vue +2 -2
  316. package/edit/monitoring.coreos.com.receiver/tls.vue +2 -2
  317. package/edit/monitoring.coreos.com.receiver/types/email.vue +2 -2
  318. package/edit/monitoring.coreos.com.receiver/types/opsgenie.vue +2 -2
  319. package/edit/monitoring.coreos.com.receiver/types/pagerduty.vue +2 -2
  320. package/edit/monitoring.coreos.com.receiver/types/slack.vue +2 -2
  321. package/edit/monitoring.coreos.com.receiver/types/webhook.banner.vue +1 -1
  322. package/edit/monitoring.coreos.com.receiver/types/webhook.vue +3 -3
  323. package/edit/monitoring.coreos.com.route.vue +2 -2
  324. package/edit/namespace.vue +0 -8
  325. package/edit/network.harvesterhci.io.clusternetwork/vlan.vue +1 -1
  326. package/edit/networking.istio.io.destinationrule/LoadBalancer.vue +2 -2
  327. package/edit/networking.istio.io.destinationrule/index.vue +1 -1
  328. package/edit/networking.k8s.io.ingress/Certificate.vue +5 -1
  329. package/edit/networking.k8s.io.ingress/Certificates.vue +5 -0
  330. package/edit/networking.k8s.io.ingress/DefaultBackend.vue +17 -2
  331. package/edit/networking.k8s.io.ingress/IngressClass.vue +63 -0
  332. package/edit/networking.k8s.io.ingress/Rule.vue +42 -6
  333. package/edit/networking.k8s.io.ingress/RulePath.vue +29 -5
  334. package/edit/networking.k8s.io.ingress/Rules.vue +11 -0
  335. package/edit/networking.k8s.io.ingress/index.vue +104 -15
  336. package/edit/networking.k8s.io.networkpolicy/PolicyRulePort.vue +1 -1
  337. package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +2 -2
  338. package/edit/networking.k8s.io.networkpolicy/index.vue +2 -2
  339. package/edit/persistentvolume/index.vue +1 -1
  340. package/edit/persistentvolume/plugins/awsElasticBlockStore.vue +2 -2
  341. package/edit/persistentvolume/plugins/azureDisk.vue +2 -2
  342. package/edit/persistentvolume/plugins/azureFile.vue +2 -2
  343. package/edit/persistentvolume/plugins/cephfs.vue +4 -4
  344. package/edit/persistentvolume/plugins/cinder.vue +2 -2
  345. package/edit/persistentvolume/plugins/csi.vue +2 -2
  346. package/edit/persistentvolume/plugins/fc.vue +4 -4
  347. package/edit/persistentvolume/plugins/flexVolume.vue +2 -2
  348. package/edit/persistentvolume/plugins/flocker.vue +1 -1
  349. package/edit/persistentvolume/plugins/gcePersistentDisk.vue +2 -2
  350. package/edit/persistentvolume/plugins/glusterfs.vue +2 -2
  351. package/edit/persistentvolume/plugins/hostPath.vue +1 -1
  352. package/edit/persistentvolume/plugins/iscsi.vue +4 -4
  353. package/edit/persistentvolume/plugins/local.vue +1 -1
  354. package/edit/persistentvolume/plugins/longhorn.vue +2 -2
  355. package/edit/persistentvolume/plugins/nfs.vue +2 -2
  356. package/edit/persistentvolume/plugins/photonPersistentDisk.vue +1 -1
  357. package/edit/persistentvolume/plugins/portworxVolume.vue +2 -2
  358. package/edit/persistentvolume/plugins/quobyte.vue +2 -2
  359. package/edit/persistentvolume/plugins/rbd.vue +4 -4
  360. package/edit/persistentvolume/plugins/scaleIO.vue +2 -2
  361. package/edit/persistentvolume/plugins/storageos.vue +2 -2
  362. package/edit/persistentvolume/plugins/vsphereVolume.vue +1 -1
  363. package/edit/persistentvolumeclaim.vue +24 -8
  364. package/edit/provisioning.cattle.io.cluster/ACE.vue +2 -2
  365. package/edit/provisioning.cattle.io.cluster/CustomCommand.vue +8 -3
  366. package/edit/provisioning.cattle.io.cluster/DrainOptions.vue +2 -2
  367. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +15 -3
  368. package/edit/provisioning.cattle.io.cluster/RegistryConfigs.vue +16 -3
  369. package/edit/provisioning.cattle.io.cluster/S3Config.vue +2 -2
  370. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +1 -1
  371. package/edit/provisioning.cattle.io.cluster/__tests__/CustomCommand.tests.ts +1 -7
  372. package/edit/provisioning.cattle.io.cluster/import.vue +2 -1
  373. package/edit/provisioning.cattle.io.cluster/index.vue +26 -7
  374. package/edit/provisioning.cattle.io.cluster/rke2.vue +136 -48
  375. package/edit/resources.cattle.io.backup.vue +26 -8
  376. package/edit/resources.cattle.io.restore.vue +3 -3
  377. package/edit/secret/basic.vue +1 -1
  378. package/edit/secret/index.vue +80 -2
  379. package/edit/secret/registry.vue +2 -2
  380. package/edit/secret/ssh.vue +1 -1
  381. package/edit/secret/tls.vue +1 -1
  382. package/edit/service.vue +47 -11
  383. package/edit/serviceaccount.vue +1 -1
  384. package/edit/storage.k8s.io.storageclass/index.vue +1 -1
  385. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/aws-ebs.vue +7 -3
  386. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/azure-disk.vue +1 -1
  387. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/azure-file.vue +1 -1
  388. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/cinder.vue +2 -2
  389. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/gce-pd.vue +2 -2
  390. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/glusterfs.vue +1 -1
  391. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/portworx-volume.vue +1 -1
  392. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/quobyte.vue +1 -1
  393. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/rbd.vue +1 -1
  394. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/scaleio.vue +1 -1
  395. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/storageos.vue +1 -1
  396. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/vsphere-volume.vue +1 -1
  397. package/edit/token.vue +3 -3
  398. package/edit/ui.cattle.io.navlink.vue +2 -2
  399. package/edit/workload/Job.vue +111 -23
  400. package/edit/workload/Upgrading.vue +77 -22
  401. package/edit/workload/__tests__/Job.test.ts +72 -0
  402. package/edit/workload/__tests__/Upgrading.test.ts +60 -0
  403. package/edit/workload/index.vue +13 -1085
  404. package/edit/workload/mixins/workload.js +900 -0
  405. package/edit/workload/storage/Mount.vue +2 -2
  406. package/edit/workload/storage/awsElasticBlockStore.vue +1 -1
  407. package/edit/workload/storage/azureDisk.vue +2 -2
  408. package/edit/workload/storage/azureFile.vue +1 -1
  409. package/edit/workload/storage/ephemeralVolume/index.vue +2 -2
  410. package/edit/workload/storage/gcePersistentDisk.vue +1 -1
  411. package/edit/workload/storage/hostPath.vue +1 -1
  412. package/edit/workload/storage/nfs.vue +2 -2
  413. package/edit/workload/storage/persistentVolumeClaim/index.vue +2 -2
  414. package/edit/workload/storage/persistentVolumeClaim/persistentvolumeclaim.vue +3 -3
  415. package/edit/workload/storage/secret.vue +2 -2
  416. package/edit/workload/storage/vsphereVolume.vue +1 -1
  417. package/edit/workload/types/Deployment.vue +377 -0
  418. package/edit/workload/types/Generic.vue +295 -0
  419. package/layouts/default.vue +26 -7
  420. package/layouts/error.vue +3 -2
  421. package/layouts/home.vue +12 -2
  422. package/layouts/plain.vue +18 -2
  423. package/layouts/unauthenticated.vue +2 -1
  424. package/list/catalog.cattle.io.clusterrepo.vue +1 -1
  425. package/list/fleet.cattle.io.bundle.vue +1 -1
  426. package/list/fleet.cattle.io.cluster.vue +1 -1
  427. package/list/fleet.cattle.io.clusterregistrationtoken.vue +1 -1
  428. package/list/harvesterhci.io.dashboard/HarvesterUpgrade.vue +9 -8
  429. package/list/harvesterhci.io.dashboard/UpgradeInfo.vue +40 -0
  430. package/list/harvesterhci.io.dashboard/index.vue +14 -36
  431. package/list/harvesterhci.io.host/index.vue +24 -12
  432. package/list/harvesterhci.io.networkattachmentdefinition.vue +1 -1
  433. package/list/harvesterhci.io.setting.vue +1 -1
  434. package/list/harvesterhci.io.virtualmachinebackup.vue +1 -1
  435. package/list/harvesterhci.io.virtualmachineimage.vue +36 -3
  436. package/list/harvesterhci.io.virtualmachinetemplateversion.vue +1 -5
  437. package/list/helm.cattle.io.projecthelmchart.vue +1 -1
  438. package/list/kubevirt.io.virtualmachine.vue +4 -2
  439. package/list/management.cattle.io.feature.vue +3 -3
  440. package/list/management.cattle.io.setting.vue +2 -2
  441. package/list/monitoring.coreos.com.alertmanagerconfig.vue +1 -1
  442. package/list/namespace.vue +3 -1
  443. package/list/node.vue +10 -3
  444. package/list/persistentvolumeclaim.vue +42 -0
  445. package/list/provisioning.cattle.io.cluster.vue +22 -20
  446. package/list/workload.vue +31 -6
  447. package/machine-config/amazonec2.vue +37 -12
  448. package/machine-config/azure.vue +3 -3
  449. package/machine-config/digitalocean.vue +2 -2
  450. package/machine-config/generic.vue +1 -1
  451. package/machine-config/harvester.vue +124 -25
  452. package/machine-config/linode.vue +2 -2
  453. package/machine-config/vmwarevsphere.vue +5 -5
  454. package/middleware/authenticated.js +36 -6
  455. package/middleware/unauthenticated.js +22 -0
  456. package/mixins/brand.js +50 -3
  457. package/mixins/browser-tab-visibility.js +37 -0
  458. package/mixins/chart.js +36 -4
  459. package/mixins/{compact-input.js → compact-input.ts} +5 -3
  460. package/mixins/form-validation.js +122 -0
  461. package/mixins/harvester-vm/index.js +134 -90
  462. package/mixins/labeled-form-element.ts +193 -0
  463. package/mixins/resource-fetch.js +173 -0
  464. package/models/cluster.x-k8s.io.machine.js +6 -2
  465. package/models/etcdbackup.js +4 -0
  466. package/models/event.js +4 -0
  467. package/models/fleet.cattle.io.bundle.js +1 -1
  468. package/models/fleet.cattle.io.gitrepo.js +10 -0
  469. package/models/harvester/harvesterhci.io.virtualmachinebackup.js +5 -2
  470. package/models/harvester/harvesterhci.io.virtualmachineimage.js +11 -8
  471. package/models/harvester/harvesterhci.io.virtualmachinetemplateversion.js +11 -2
  472. package/models/harvester/kubevirt.io.virtualmachine.js +2 -2
  473. package/models/harvester/kubevirt.io.virtualmachineinstance.js +1 -1
  474. package/models/harvester/node.js +27 -32
  475. package/models/harvester/persistentvolumeclaim.js +1 -1
  476. package/models/management.cattle.io.cluster.js +17 -11
  477. package/models/management.cattle.io.clusterroletemplatebinding.js +2 -2
  478. package/models/management.cattle.io.globalrole.js +19 -0
  479. package/models/management.cattle.io.node.js +10 -11
  480. package/models/management.cattle.io.project.js +60 -26
  481. package/models/management.cattle.io.roletemplate.js +19 -0
  482. package/models/monitoring.coreos.com.alertmanagerconfig.js +3 -2
  483. package/models/monitoring.coreos.com.prometheusrule.js +9 -0
  484. package/models/namespace.js +9 -1
  485. package/models/networking.k8s.io.ingress.js +17 -5
  486. package/models/persistentvolumeclaim.js +47 -1
  487. package/models/projectroletemplatebinding.js +2 -2
  488. package/models/provisioning.cattle.io.cluster.js +92 -13
  489. package/models/rke.cattle.io.etcdsnapshot.js +4 -0
  490. package/models/service.js +11 -5
  491. package/models/storage.k8s.io.storageclass.js +14 -1
  492. package/models/workload.js +7 -2
  493. package/nuxt.config.js +27 -7
  494. package/package.json +10 -14
  495. package/pages/about.vue +15 -1
  496. package/pages/account/index.vue +1 -1
  497. package/pages/auth/login.vue +17 -5
  498. package/pages/auth/setup.vue +47 -9
  499. package/pages/c/_cluster/_product/_resource/create.vue +1 -1
  500. package/pages/c/_cluster/_product/members/index.vue +6 -1
  501. package/pages/c/_cluster/_product/projectsnamespaces.vue +113 -11
  502. package/pages/c/_cluster/apps/charts/chart.vue +1 -1
  503. package/pages/c/_cluster/apps/charts/index.vue +2 -2
  504. package/pages/c/_cluster/apps/charts/install.vue +197 -19
  505. package/pages/c/_cluster/auth/config/index.vue +1 -1
  506. package/pages/c/_cluster/explorer/EventsTable.vue +1 -15
  507. package/pages/c/_cluster/explorer/index.vue +64 -35
  508. package/pages/c/_cluster/explorer/tools/index.vue +1 -1
  509. package/pages/c/_cluster/fleet/GitRepoGraphConfig.js +249 -0
  510. package/pages/c/_cluster/fleet/index.vue +47 -65
  511. package/pages/c/_cluster/harvester/airgapupgrade/index.vue +7 -4
  512. package/pages/c/_cluster/harvester/console/_uid/vnc.vue +7 -1
  513. package/pages/c/_cluster/monitoring/alertmanagerconfig/_alertmanagerconfigid/receiver.vue +8 -14
  514. package/pages/c/_cluster/monitoring/index.vue +1 -1
  515. package/pages/c/_cluster/monitoring/route-receiver/index.vue +1 -1
  516. package/pages/c/_cluster/settings/banners.vue +2 -2
  517. package/pages/c/_cluster/settings/brand.vue +62 -7
  518. package/pages/c/_cluster/settings/performance.vue +167 -0
  519. package/pages/diagnostic.vue +468 -0
  520. package/pages/fail-whale.vue +17 -5
  521. package/pages/home.vue +36 -22
  522. package/pages/plugins.vue +1 -1
  523. package/pages/prefs.vue +20 -7
  524. package/pages/support/index.vue +51 -9
  525. package/pkg/auto-import.js +1 -1
  526. package/pkg/dynamic-importer.lib.js +8 -0
  527. package/pkg/tsconfig.json +26 -9
  528. package/pkg/vue.config.js +8 -0
  529. package/plugins/console.js +29 -0
  530. package/plugins/dashboard-store/actions.js +171 -28
  531. package/plugins/dashboard-store/getters.js +13 -1
  532. package/plugins/dashboard-store/index.js +5 -1
  533. package/plugins/dashboard-store/mutations.js +72 -22
  534. package/plugins/dashboard-store/resource-class.js +259 -184
  535. package/plugins/i18n.js +9 -3
  536. package/plugins/steve/actions.js +16 -1
  537. package/plugins/steve/getters.js +9 -1
  538. package/plugins/steve/index.js +6 -2
  539. package/plugins/steve/mutations.js +100 -5
  540. package/plugins/steve/norman-class.js +8 -0
  541. package/plugins/steve/performanceTesting.js +5 -0
  542. package/plugins/steve/subscribe.js +144 -12
  543. package/plugins/steve/web-worker.steve-sub-worker.js +129 -0
  544. package/promptRemove/kubevirt.io.virtualmachine.vue +3 -17
  545. package/promptRemove/management.cattle.io.project.vue +128 -0
  546. package/promptRemove/pod.vue +131 -0
  547. package/rancher-components/BadgeState/BadgeState.spec.ts +12 -0
  548. package/{components → rancher-components/BadgeState}/BadgeState.vue +18 -10
  549. package/rancher-components/BadgeState/index.ts +1 -0
  550. package/{components/__tests__ → rancher-components/Banner}/Banner.test.ts +1 -1
  551. package/{components → rancher-components/Banner}/Banner.vue +22 -7
  552. package/rancher-components/Banner/index.ts +1 -0
  553. package/{components → rancher-components/Card}/Card.vue +58 -12
  554. package/rancher-components/Card/index.ts +1 -0
  555. package/{components/form → rancher-components/Form/Checkbox}/Checkbox.vue +118 -25
  556. package/rancher-components/Form/Checkbox/index.ts +1 -0
  557. package/{components/form/__tests__ → rancher-components/Form/LabeledInput}/LabeledInput.test.ts +13 -2
  558. package/rancher-components/Form/LabeledInput/LabeledInput.vue +341 -0
  559. package/rancher-components/Form/LabeledInput/index.ts +1 -0
  560. package/{components/form → rancher-components/Form/Radio}/RadioButton.vue +50 -22
  561. package/{components/form → rancher-components/Form/Radio}/RadioGroup.vue +76 -28
  562. package/rancher-components/Form/Radio/index.ts +2 -0
  563. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +169 -0
  564. package/rancher-components/Form/TextArea/index.ts +1 -0
  565. package/rancher-components/Form/index.ts +4 -0
  566. package/{components/form → rancher-components/LabeledTooltip}/LabeledTooltip.vue +32 -11
  567. package/rancher-components/LabeledTooltip/index.ts +1 -0
  568. package/scripts/build-pkg.sh +4 -0
  569. package/scripts/publish-shell.sh +37 -18
  570. package/scripts/test-plugins-build.sh +115 -0
  571. package/store/catalog.js +4 -0
  572. package/store/growl.js +6 -0
  573. package/store/i18n.js +18 -9
  574. package/store/index.js +190 -107
  575. package/store/prefs.js +8 -2
  576. package/store/resource-fetch.js +44 -0
  577. package/store/type-map.js +43 -7
  578. package/store/uiplugins.ts +1 -1
  579. package/utils/favicon.js +40 -0
  580. package/utils/object.js +26 -9
  581. package/utils/promise.js +20 -0
  582. package/utils/socket.js +10 -1
  583. package/utils/string.js +16 -0
  584. package/utils/validators/formRules/__tests__/index.test.ts +928 -0
  585. package/utils/validators/formRules/index.ts +447 -0
  586. package/utils/validators/prometheusrule.js +1 -1
  587. package/utils/validators/vm.js +12 -5
  588. package/utils/width.js +39 -0
  589. package/yarn-error.log +196 -0
  590. package/components/NovncConsoleWrapper.vue +0 -150
  591. package/components/form/Container.vue +0 -143
  592. package/components/form/LabeledInput.vue +0 -245
  593. package/components/form/Scheduling.vue +0 -115
  594. package/components/form/TextAreaAutoGrow.vue +0 -127
  595. package/mixins/labeled-form-element.js +0 -137
@@ -0,0 +1,447 @@
1
+ import { RBAC } from '@shell/config/types';
2
+ import { HCI } from '@shell/config/labels-annotations';
3
+ import isEmpty from 'lodash/isEmpty';
4
+ import has from 'lodash/has';
5
+ // import uniq from 'lodash/uniq';
6
+ import cronstrue from 'cronstrue';
7
+
8
+ // import uniq from 'lodash/uniq';
9
+ export type Validator = (val: any, arg?: any) => undefined | string;
10
+
11
+ export type ValidatorFactory = (arg1: any, arg2?: any) => Validator
12
+
13
+ type ServicePort = {
14
+ name?: string,
15
+ nodePort?: string | number,
16
+ port?: string | number,
17
+ targetPort?: string | number,
18
+ idx: number
19
+ }
20
+
21
+ export class Port {
22
+ empty: boolean;
23
+ int: number;
24
+ string: string;
25
+ isNumber: boolean;
26
+ isInt: boolean;
27
+ constructor(port: number | string | undefined) {
28
+ this.string = String(port);
29
+ this.int = parseInt(this.string, 10);
30
+ this.empty = (!port && this.int !== 0);
31
+ this.isNumber = !isNaN(this.int) && !this.string.includes('e'); // leaving out the exponent edge case to keep the logic simple and because port numbers aren't that big...
32
+ this.isInt = this.isNumber && !this.string.includes('.');
33
+ }
34
+ }
35
+
36
+ const httpsKeys = [
37
+ 'server-url'
38
+ ];
39
+
40
+ const runValidators = (val: any, validators: Validator[]) => {
41
+ for (const validator of validators) {
42
+ const message = validator(val);
43
+
44
+ if (message) {
45
+ return message;
46
+ }
47
+ }
48
+ };
49
+
50
+ // "t" is the function name we use for getting a translated string
51
+ export default function(t: (key: string, options?: any) => string, opt: {displayKey?: string} = {}) {
52
+ const { displayKey = 'Value' } = opt;
53
+
54
+ // utility validators these validators only get used by other validators
55
+ const startDot: ValidatorFactory = (label: string): Validator => (val: string) => val?.slice(0, 1) === '.' ? t(`validation.dns.${ label }.startDot`, { key: displayKey }) : undefined;
56
+
57
+ const endDot = (label: string): Validator => (val: string) => val?.slice(-1) === '.' ? t(`validation.dns.${ label }.endDot`, { key: displayKey }) : undefined;
58
+
59
+ const startNumber: ValidatorFactory = (label: string): Validator => (val: string) => val?.slice(0, 1)?.match(/[0-9]/) ? t(`validation.dns.${ label }.startNumber`, { key: displayKey }) : undefined;
60
+
61
+ const startHyphen: ValidatorFactory = (label: string): Validator => (val: string) => val?.slice(0, 1) === '-' ? t(`validation.dns.${ label }.startHyphen`, { key: displayKey }) : undefined;
62
+
63
+ const endHyphen: ValidatorFactory = (label: string): Validator => (val: string) => val?.slice(-1) === '-' ? t(`validation.dns.${ label }.endHyphen`, { key: displayKey }) : undefined;
64
+
65
+ const requiredInt: Validator = (val: string) => isNaN(parseInt(val, 10)) ? t('validation.number.requiredInt', { key: displayKey }) : undefined;
66
+
67
+ const portNumber: Validator = (val: string) => parseInt(val, 10) < 1 || parseInt(val, 10) > 65535 ? t('validation.number.between', {
68
+ key: displayKey, min: '1', max: '65535'
69
+ }) : undefined;
70
+
71
+ const dnsChars: Validator = (val: string) => {
72
+ const matchedChars = val?.match(/[^${'A-Za-z0-9-'}]/g);
73
+
74
+ if (matchedChars) {
75
+ return t('validation.chars', {
76
+ key: displayKey, count: matchedChars.length, chars: matchedChars.map(char => char === ' ' ? 'Space' : `"${ char }"`).join(', ')
77
+ });
78
+ }
79
+
80
+ return undefined;
81
+ };
82
+
83
+ // the weird edge case here deals with internationalized domain names which are prepended with 'xn--'
84
+ // https://datatracker.ietf.org/doc/html/rfc5891#section-4.2.3.1
85
+ const dnsDoubleDash: Validator = (val: string) => (val?.substr(2, 2) === '--' && val?.substr(0, 2) !== 'xn') ? t(`validation.dns.doubleHyphen`, { key: displayKey }) : undefined;
86
+
87
+ const dnsIanaServiceNameDoubleDash: Validator = (val: string) => (val?.substr(2, 2) === '--' && val?.substr(0, 2) !== 'xn') ? t(`validation.dns.doubleHyphen`, { key: displayKey }) : undefined;
88
+
89
+ const dnsEmpty: ValidatorFactory = (label: string): Validator => (val = '') => val.length === 0 ? t(`validation.dns.${ label }.emptyLabel`, { key: displayKey, min: 1 }) : undefined;
90
+
91
+ const dnsTooLong: ValidatorFactory = (label: string, length = 63): Validator => (val = '') => val.length > length ? t(`validation.dns.${ label }.tooLongLabel`, { key: displayKey, max: length }) : undefined;
92
+
93
+ // eslint-disable-next-line no-unused-vars
94
+ const hostnameEmpty: Validator = (val = '') => val.length === 0 ? t('validation.dns.hostname.empty', { key: displayKey }) : undefined;
95
+
96
+ const hostnameTooLong: Validator = (val = '') => val.length > 253 ? t('validation.dns.hostname.tooLong', { key: displayKey, max: 253 }) : undefined;
97
+
98
+ const absolutePath: Validator = (val = '') => val[0] !== '/' && val.length > 0 ? t('validation.path', { key: displayKey }) : undefined;
99
+
100
+ const required: Validator = (val: any) => !val && val !== false ? t('validation.required', { key: displayKey }) : undefined;
101
+
102
+ const noUpperCase: Validator = (val = '') => val.toLowerCase() !== val ? t('validation.noUpperCase', { key: displayKey }) : undefined;
103
+
104
+ const cronSchedule: Validator = (val: string) => {
105
+ try {
106
+ cronstrue.toString(val);
107
+ } catch (e) {
108
+ return t('validation.invalidCron');
109
+ }
110
+ };
111
+
112
+ const isHttps: ValidatorFactory = (key: string) => {
113
+ const isHttps: Validator = (val: string) => httpsKeys.includes(key) && !val.toLowerCase().startsWith('https://') ? t('validation.setting.serverUrl.https') : undefined;
114
+
115
+ return isHttps;
116
+ };
117
+
118
+ const interval: Validator = (val: string) => !/^\d+[hms]$/.test(val) ? t('validation.monitoring.route.interval', { key: displayKey }) : undefined;
119
+
120
+ const containerImage: Validator = (val: any) => !val?.image ? t('workload.validation.containerImage', { name: val.name }) : undefined;
121
+
122
+ const containerImages: Validator = (val: any | [any]) => {
123
+ const containers = val.jobTemplate ? val?.jobTemplate?.spec?.template?.spec?.containers : val?.template?.spec?.containers;
124
+
125
+ if (!containers || !containers.length) {
126
+ return t('validation.required', { key: t('workload.container.titles.containers') });
127
+ }
128
+
129
+ // making sure each container has an imagename
130
+ return containers.map((container: any) => containerImage(container)).find((containerError: string) => containerError);
131
+ };
132
+
133
+ const dnsLabel: Validator = (val: string) => {
134
+ const validators = [
135
+ dnsChars,
136
+ startHyphen('label'),
137
+ endHyphen('label'),
138
+ dnsDoubleDash,
139
+ // dnsEmpty('label'), // questionable as to if this is needed if the field is also required...
140
+ dnsTooLong('label')
141
+ ];
142
+
143
+ return runValidators(val, validators);
144
+ };
145
+
146
+ const dnsLabelIanaServiceName: Validator = (val: string) => {
147
+ const validators = [
148
+ dnsChars,
149
+ startHyphen('label'),
150
+ endHyphen('label'),
151
+ dnsIanaServiceNameDoubleDash,
152
+ dnsEmpty('label'), // questionable as to if this is needed if the field is also required...
153
+ dnsTooLong('label', 15)
154
+ ];
155
+
156
+ return runValidators(val, validators);
157
+ };
158
+
159
+ const dnsLabelRestricted: Validator = (val: string) => {
160
+ const validators = [
161
+ dnsChars,
162
+ startNumber('label'),
163
+ startHyphen('label'),
164
+ endHyphen('label'),
165
+ dnsDoubleDash,
166
+ dnsEmpty('label'), // questionable as to if this is needed if the field is also required...
167
+ dnsTooLong('label')
168
+ ];
169
+
170
+ return runValidators(val, validators);
171
+ };
172
+
173
+ const hostname: Validator = (val: string) => {
174
+ if (val) {
175
+ const validators = [
176
+ startDot('hostname'),
177
+ hostnameTooLong,
178
+ endDot('hostname')
179
+ ];
180
+
181
+ const hostNameMessage = runValidators(val, validators);
182
+
183
+ if (hostNameMessage) {
184
+ return hostNameMessage;
185
+ }
186
+
187
+ const labels = val.split('.');
188
+ const labelValidators = [
189
+ dnsChars,
190
+ startHyphen('hostname'),
191
+ endHyphen('hostname'),
192
+ dnsDoubleDash,
193
+ dnsEmpty('hostname'),
194
+ dnsTooLong('hostname')
195
+ ];
196
+
197
+ for ( let i = 0; i < labels.length; i++ ) {
198
+ const labelMessage = runValidators(labels[i], labelValidators);
199
+
200
+ if (labelMessage) {
201
+ return labelMessage;
202
+ }
203
+ }
204
+ }
205
+ };
206
+
207
+ const externalName: Validator = (val: string) => {
208
+ if (isEmpty(val)) {
209
+ return t('validation.service.externalName.none');
210
+ } else {
211
+ return hostname(val);
212
+ }
213
+ };
214
+
215
+ const testRule = (val: string | undefined) => {
216
+ return 'This is an error returned by the testRule validator';
217
+ };
218
+
219
+ const ruleGroups: Validator = (val: {groups?: any}) => isEmpty(val?.groups) ? t('validation.prometheusRule.groups.required') : undefined;
220
+
221
+ const clusterName: ValidatorFactory = (isRke2: boolean): Validator => (val: string | undefined) => isRke2 && (val || '')?.match(/^(c-.{5}|local)$/i) ? t('validation.cluster.name') : undefined;
222
+
223
+ const servicePort = (val: ServicePort) => {
224
+ const {
225
+ name,
226
+ idx
227
+ } = val;
228
+
229
+ const nodePort = new Port(val.nodePort);
230
+ const listeningPort = new Port(val.port);
231
+ const targetPort = new Port(val.targetPort);
232
+
233
+ if (isEmpty(name)) {
234
+ return t('validation.service.ports.name.required', { position: idx + 1 });
235
+ }
236
+
237
+ if (!nodePort.empty) {
238
+ if (!nodePort.isInt) {
239
+ return t('validation.service.ports.nodePort.requiredInt', { position: idx + 1 });
240
+ } else if (nodePort.int < 1 || nodePort.int > 65535) {
241
+ return t('validation.service.ports.nodePort.between', { position: idx + 1 });
242
+ }
243
+ }
244
+
245
+ if (!listeningPort.empty) {
246
+ if (!listeningPort.isInt) {
247
+ return t('validation.service.ports.port.requiredInt', { position: idx + 1 });
248
+ } else if (listeningPort.int < 1 || listeningPort.int > 65535) {
249
+ return t('validation.service.ports.port.between', { position: idx + 1 });
250
+ } else if (listeningPort.string?.includes('.')) {
251
+ return listeningPort;
252
+ }
253
+ } else {
254
+ return t('validation.service.ports.port.required', { position: idx + 1 });
255
+ }
256
+
257
+ if (!targetPort.empty) {
258
+ if (!targetPort.isInt) {
259
+ const ianaServiceNameErrors = dnsLabelIanaServiceName(targetPort.string);
260
+
261
+ if (ianaServiceNameErrors) {
262
+ return ianaServiceNameErrors;
263
+ }
264
+ } else if (targetPort.int < 1 || targetPort.int > 65535) {
265
+ return t('validation.service.ports.targetPort.between', { position: idx + 1 });
266
+ }
267
+ } else {
268
+ return t('validation.service.ports.targetPort.required', { position: idx + 1 });
269
+ }
270
+
271
+ return undefined;
272
+ };
273
+
274
+ const groupIsValid: Validator = (val, readableIndex) => {
275
+ let returnMessage: string | undefined;
276
+
277
+ if (isEmpty(val?.name)) {
278
+ return t('validation.prometheusRule.groups.valid.name', { index: readableIndex });
279
+ }
280
+
281
+ if (isEmpty(val.rules)) {
282
+ return t('validation.prometheusRule.groups.valid.singleEntry', { index: readableIndex });
283
+ } else {
284
+ val.rules.forEach((rule: any, idx: number) => {
285
+ const readableRuleIndex = idx + 1;
286
+
287
+ if (has(rule, 'alert') && isEmpty(rule?.alert) && !returnMessage) {
288
+ returnMessage = t('validation.prometheusRule.groups.valid.rule.alertName', { groupIndex: readableIndex, ruleIndex: readableRuleIndex });
289
+ } else if (has(rule, 'record') && isEmpty(rule?.record)) {
290
+ returnMessage = t('validation.prometheusRule.groups.valid.rule.recordName', { groupIndex: readableIndex, ruleIndex: readableRuleIndex });
291
+ }
292
+
293
+ if ((has(rule, 'expr') && isEmpty(rule.expr) && !returnMessage) || (!has(rule, 'expr') && !returnMessage)) {
294
+ returnMessage = t('validation.prometheusRule.groups.valid.rule.expr', { groupIndex: readableIndex, ruleIndex: readableRuleIndex });
295
+ }
296
+
297
+ if (has(rule, 'alert')) {
298
+ if (
299
+ (has(rule, 'labels') && isEmpty(rule.labels) && !returnMessage) ||
300
+ (!has(rule, 'labels') && !returnMessage)
301
+ ) {
302
+ returnMessage = t('validation.prometheusRule.groups.valid.rule.labels', { groupIndex: readableIndex, ruleIndex: readableRuleIndex });
303
+ }
304
+ }
305
+ });
306
+ }
307
+
308
+ return returnMessage;
309
+ };
310
+
311
+ const groupsAreValid: Validator = (val) => {
312
+ const groups = [...val]; // making a new array in the function because I'm gonna mutate it later...
313
+ let message;
314
+
315
+ groups.forEach((group, idx, arr) => {
316
+ message = groupIsValid(group, idx + 1);
317
+ if (!!message) {
318
+ arr.length = idx + 1; // this is a tricksy way of breaking a forEach loop since we just want the first message
319
+ }
320
+ });
321
+
322
+ return message;
323
+ };
324
+
325
+ const matching: Validator = (val) => {
326
+ if (isEmpty(val?.match) && isEmpty(val?.['match_re'])) {
327
+ return t('validation.monitoring.route.match');
328
+ }
329
+ };
330
+
331
+ const roleTemplateRules: ValidatorFactory = (type): Validator => (val = []) => {
332
+ if (val.some((rule: any) => isEmpty(rule.verbs))) {
333
+ return t('validation.roleTemplate.roleTemplateRules.missingVerb');
334
+ }
335
+
336
+ if (type === RBAC.ROLE) {
337
+ if (val.some((rule: any) => isEmpty(rule.resources))) {
338
+ return t('validation.roleTemplate.roleTemplateRules.missingResource');
339
+ }
340
+
341
+ if (val.some((rule: any) => isEmpty(rule.apiGroups))) {
342
+ return t('validation.roleTemplate.roleTemplateRules.missingApiGroup');
343
+ }
344
+ } else if (val.some((rule: any) => isEmpty(rule.resources) && isEmpty(rule.nonResourceURLs) && isEmpty(rule.apiGroups))) {
345
+ return t('validation.roleTemplate.roleTemplateRules.missingOneResource');
346
+ }
347
+
348
+ return undefined;
349
+ };
350
+
351
+ // The existing validator for clusterIp never actually returns an error
352
+ const clusterIp: Validator = val => undefined;
353
+
354
+ const backupTarget: Validator = (val) => {
355
+ const parseValue = JSON.parse(val);
356
+ const type = parseValue.type;
357
+
358
+ if (!type) {
359
+ return t('validation.required', { key: 'Type' });
360
+ }
361
+
362
+ if (type === 's3') {
363
+ if (!parseValue.accessKeyId) {
364
+ return t('validation.required', { key: 'accessKeyId' });
365
+ }
366
+
367
+ if (!parseValue.secretAccessKey) {
368
+ return t('validation.required', { key: 'secretAccessKey' });
369
+ }
370
+
371
+ if (!parseValue.bucketRegion) {
372
+ return t('validation.required', { key: 'bucketRegion' });
373
+ }
374
+
375
+ if (!parseValue.bucketName) {
376
+ return t('validation.required', { key: 'bucketName' });
377
+ }
378
+ }
379
+
380
+ return undefined;
381
+ };
382
+
383
+ const imageUrl: Validator = (val) => {
384
+ const VM_IMAGE_FILE_FORMAT = ['qcow', 'qcow2', 'raw', 'img', 'iso'];
385
+
386
+ if (!val || val === '') {
387
+ return undefined;
388
+ }
389
+
390
+ const urlSlug = val.split('/').pop();
391
+ const fileExtension = urlSlug.split('.').pop().toLowerCase();
392
+
393
+ if (!VM_IMAGE_FILE_FORMAT.includes(fileExtension)) {
394
+ return t('harvester.validation.image.ruleTip');
395
+ }
396
+
397
+ return undefined;
398
+ };
399
+
400
+ const fileRequired: Validator = (val = {}) => {
401
+ if (!val[HCI.IMAGE_NAME]) {
402
+ return t('validation.required', { key: t('harvester.image.fileName') });
403
+ }
404
+ };
405
+
406
+ const subDomain: Validator = (val) => {
407
+ const matchedChars = val?.match(/[^a-z0-9.-]/g);
408
+
409
+ if (matchedChars) {
410
+ return t('validation.chars', {
411
+ key: displayKey, count: matchedChars.length, chars: matchedChars.map((char: string) => char === ' ' ? 'Space' : `"${ char }"`).join(', ')
412
+ });
413
+ }
414
+
415
+ return runValidators(val, [startHyphen('label'), endHyphen('label'), startDot('label'), endDot('label'), required]);
416
+ };
417
+
418
+ return {
419
+ noUpperCase,
420
+ required,
421
+ requiredInt,
422
+ portNumber,
423
+ cronSchedule,
424
+ isHttps,
425
+ interval,
426
+ containerImage,
427
+ containerImages,
428
+ ruleGroups,
429
+ groupsAreValid,
430
+ matching,
431
+ clusterName,
432
+ roleTemplateRules,
433
+ servicePort,
434
+ clusterIp,
435
+ externalName,
436
+ backupTarget,
437
+ imageUrl,
438
+ fileRequired,
439
+ dnsLabel,
440
+ dnsLabelIanaServiceName,
441
+ dnsLabelRestricted,
442
+ hostname,
443
+ testRule,
444
+ subDomain,
445
+ absolutePath
446
+ };
447
+ }
@@ -9,7 +9,7 @@ export function ruleGroups(spec, getters, errors, validatorArgs) {
9
9
  return errors;
10
10
  }
11
11
 
12
- export function groupsAreValid(groups, getters, errors, validatorArgs) {
12
+ export function groupsAreValid(groups = [], getters, errors, validatorArgs) {
13
13
  groups.forEach((group, groupIndex) => {
14
14
  const readableGroupIndex = groupIndex + 1; // oh that ol zero based array index....
15
15
 
@@ -119,15 +119,15 @@ export function vmDisks(spec, getters, errors, validatorArgs, displayKey, value)
119
119
  errors.push(getters['i18n/t']('harvester.validation.vm.volume.needImageOrExisting'));
120
120
  }
121
121
 
122
- let hasImageVolumeOrExistingVolume = false;
122
+ let requiredVolume = false;
123
123
 
124
124
  _volumes.forEach((V, idx) => {
125
125
  const { type, typeValue } = getVolumeType(V, _volumeClaimTemplates);
126
126
  const prefix = V.name || idx + 1;
127
127
 
128
- if (type === SOURCE_TYPE.IMAGE || type === SOURCE_TYPE.ATTACH_VOLUME) { // root image
128
+ if ([SOURCE_TYPE.IMAGE, SOURCE_TYPE.ATTACH_VOLUME, SOURCE_TYPE.CONTAINER].includes(type)) { // root image
129
129
  // const message = getters['i18n/t']('harvester.validation.vm.volume.needImageOrExisting');
130
- hasImageVolumeOrExistingVolume = true;
130
+ requiredVolume = true;
131
131
  // errors.push(message);
132
132
  }
133
133
 
@@ -160,14 +160,14 @@ export function vmDisks(spec, getters, errors, validatorArgs, displayKey, value)
160
160
  }
161
161
  }
162
162
 
163
- if (V?.containerDisk && !V.containerDisk.image) {
163
+ if (type === SOURCE_TYPE.CONTAINER && !V.containerDisk.image) {
164
164
  const message = getters['i18n/t']('harvester.validation.vm.volume.docker');
165
165
 
166
166
  errors.push(getters['i18n/t']('harvester.validation.vm.volume.error', { prefix, message }));
167
167
  }
168
168
  });
169
169
 
170
- if (!hasImageVolumeOrExistingVolume && !value.links) {
170
+ if (!requiredVolume && !value.links) {
171
171
  const message = getters['i18n/t']('harvester.validation.vm.volume.needImageOrExisting');
172
172
 
173
173
  errors.push(message);
@@ -210,5 +210,12 @@ export function getVolumeType(V, DVTS) {
210
210
  };
211
211
  }
212
212
 
213
+ if (V.containerDisk) {
214
+ return {
215
+ type: SOURCE_TYPE.CONTAINER,
216
+ typeValue: null
217
+ };
218
+ }
219
+
213
220
  return {};
214
221
  }
package/utils/width.js ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Sets the width of a DOM element. Adapted from [youmightnotneedjquery.com](https://youmightnotneedjquery.com/#set_width)
3
+ * @param {Element} el - The target DOM element
4
+ * @param {function | string | number} val - The desired width represented as a Number
5
+ */
6
+ export function setWidth(el, val) {
7
+ if (!el) {
8
+ return;
9
+ }
10
+
11
+ if (typeof val === 'function') {
12
+ val = val();
13
+ }
14
+
15
+ if (typeof val === 'string') {
16
+ el.style.width = val;
17
+
18
+ return;
19
+ }
20
+
21
+ el.style.width = `${ val }px`;
22
+ }
23
+
24
+ /**
25
+ * Gets the width of a DOM element. Adapted from [youmightnotneedjquery.com](https://youmightnotneedjquery.com/#get_width)
26
+ * @param {Element} el - The target DOM element
27
+ * @returns Number representing the width for the provided element
28
+ */
29
+ export function getWidth(el) {
30
+ if (!el || !el.length) {
31
+ return;
32
+ }
33
+
34
+ if (el.length) {
35
+ return parseFloat(getComputedStyle(el[0]).width.replace('px', ''));
36
+ } else {
37
+ return parseFloat(getComputedStyle(el).width.replace('px', ''));
38
+ }
39
+ }