@rancher/shell 0.3.0 → 0.3.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 (322) hide show
  1. package/assets/styles/global/_button.scss +5 -1
  2. package/assets/styles/global/_columns.scss +4 -0
  3. package/assets/styles/global/_layout.scss +1 -2
  4. package/assets/styles/global/_select.scss +1 -4
  5. package/assets/styles/themes/_dark.scss +4 -4
  6. package/assets/styles/themes/_light.scss +4 -3
  7. package/assets/styles/themes/_suse.scss +1 -1
  8. package/assets/styles/vendor/vue-select.scss +4 -3
  9. package/assets/translations/en-us.yaml +669 -73
  10. package/assets/translations/zh-hans.yaml +547 -165
  11. package/chart/monitoring/steps/uninstall-v1.vue +2 -2
  12. package/cloud-credential/azure.vue +23 -0
  13. package/cloud-credential/harvester.vue +25 -62
  14. package/cloud-credential/pnap.vue +80 -0
  15. package/components/.DS_Store +0 -0
  16. package/components/AdvancedSection.vue +9 -2
  17. package/components/Alert.vue +2 -2
  18. package/components/ButtonDropdown.vue +0 -2
  19. package/components/ButtonGroup.vue +1 -0
  20. package/components/CollapsibleCard.vue +0 -1
  21. package/components/CruResource.vue +41 -4
  22. package/components/DetailTop.vue +58 -3
  23. package/components/DisableAuthProviderModal.vue +106 -0
  24. package/{rancher-components/components/Utils/DraggableZone → components}/DraggableZone.vue +0 -0
  25. package/components/ExplorerMembers.vue +253 -30
  26. package/components/ExplorerProjectsNamespaces.vue +77 -33
  27. package/components/GrowlManager.vue +3 -3
  28. package/components/IconOrSvg.vue +149 -0
  29. package/components/LogItem.vue +69 -0
  30. package/components/PodSecurityAdmission.vue +302 -0
  31. package/components/PromptModal.vue +1 -0
  32. package/components/ResourceDetail/Masthead.vue +54 -2
  33. package/components/ResourceDetail/index.vue +12 -5
  34. package/components/ResourceList/Masthead.vue +11 -1
  35. package/components/ResourceList/ResourceLoadingIndicator.vue +12 -2
  36. package/components/ResourceList/index.vue +53 -12
  37. package/components/ResourceList/resource-list.config.js +7 -0
  38. package/components/ResourceTable.vue +31 -6
  39. package/components/SimpleBox.vue +1 -1
  40. package/components/SortableTable/THead.vue +15 -5
  41. package/components/SortableTable/index.vue +21 -10
  42. package/components/Tabbed/index.vue +20 -15
  43. package/components/__tests__/.DS_Store +0 -0
  44. package/components/__tests__/AsyncButton.test.ts +140 -0
  45. package/components/__tests__/BackLink.test.ts +33 -0
  46. package/components/__tests__/ButtonGroup.test.ts +124 -0
  47. package/components/__tests__/ClusterBadge.test.ts +32 -0
  48. package/components/__tests__/CollapsibleCard.test.ts +64 -0
  49. package/components/__tests__/ConsumptionGauge.test.ts +88 -0
  50. package/components/__tests__/CruResource.test.ts +3 -2
  51. package/components/__tests__/FixedBanner.test.ts +129 -0
  52. package/components/__tests__/GrowlManager.test.ts +147 -0
  53. package/components/__tests__/NamespaceFilter.test.ts +33 -25
  54. package/components/__tests__/PercentageBar.test.ts +32 -0
  55. package/components/__tests__/PodSecurityAdmission.test.ts +398 -0
  56. package/components/auth/AuthBanner.vue +20 -10
  57. package/components/auth/RoleDetailEdit.vue +26 -17
  58. package/components/auth/SelectPrincipal.vue +36 -5
  59. package/components/form/ArrayList.vue +3 -35
  60. package/components/form/ArrayListGrouped.vue +13 -4
  61. package/components/form/ArrayListSelect.vue +5 -5
  62. package/components/form/Error.vue +8 -0
  63. package/components/form/KeyValue.vue +39 -7
  64. package/components/form/LabeledSelect.vue +5 -2
  65. package/components/form/Labels.vue +46 -16
  66. package/components/form/Members/ClusterPermissionsEditor.vue +17 -17
  67. package/components/form/Members/MembershipEditor.vue +12 -12
  68. package/components/form/NameNsDescription.vue +1 -1
  69. package/components/form/NodeScheduling.vue +1 -1
  70. package/components/form/Probe.vue +3 -3
  71. package/components/form/ResourceQuota/Project.vue +6 -6
  72. package/components/form/ResourceTabs/index.vue +1 -6
  73. package/components/form/Security.vue +7 -6
  74. package/components/form/Select.vue +3 -2
  75. package/components/form/SelectOrCreateAuthSecret.vue +22 -29
  76. package/components/form/ServicePorts.vue +8 -0
  77. package/components/form/WorkloadPorts.vue +7 -1
  78. package/components/form/__tests__/ArrayList.test.ts +74 -0
  79. package/components/form/__tests__/ArrayListGrouped.test.ts +6 -4
  80. package/components/formatter/Checked.vue +1 -1
  81. package/components/formatter/ClusterLink.vue +5 -0
  82. package/components/formatter/IconIsDefault.vue +2 -2
  83. package/components/formatter/InternalExternalIP.vue +11 -8
  84. package/components/formatter/LiveDuration.vue +78 -0
  85. package/components/formatter/WorkloadHealthScale.vue +5 -3
  86. package/components/nav/Header.vue +6 -3
  87. package/components/nav/NamespaceFilter.vue +146 -63
  88. package/components/nav/TopLevelMenu.vue +22 -19
  89. package/components/nav/WindowManager/ContainerLogs.vue +83 -126
  90. package/components/nav/WindowManager/ContainerShell.vue +9 -7
  91. package/components/nav/WindowManager/Window.vue +2 -0
  92. package/components/nav/WindowManager/index.vue +10 -0
  93. package/config/elemental-types.js +9 -0
  94. package/config/features.js +2 -0
  95. package/config/home-links.js +4 -1
  96. package/config/pod-security-admission.ts +82 -0
  97. package/config/product/apps.js +1 -1
  98. package/config/product/auth.js +6 -5
  99. package/config/product/explorer.js +6 -6
  100. package/config/product/fleet.js +1 -1
  101. package/config/product/manager.js +6 -2
  102. package/config/secret.js +0 -1
  103. package/config/settings.ts +26 -9
  104. package/config/table-headers.js +22 -11
  105. package/config/types.js +4 -1
  106. package/content/docs/zh-hans/getting-started.md +113 -137
  107. package/content/docs/zh-hans/whats-new.md +8 -46
  108. package/creators/pkg/package-lock.json +37 -0
  109. package/creators/pkg/package.json +1 -1
  110. package/detail/catalog.cattle.io.app.vue +1 -1
  111. package/detail/pod.vue +1 -1
  112. package/detail/provisioning.cattle.io.cluster.vue +35 -9
  113. package/detail/service.vue +2 -9
  114. package/detail/workload/index.vue +0 -1
  115. package/dialog/AddClusterMemberDialog.vue +22 -28
  116. package/dialog/AddProjectMemberDialog.vue +53 -9
  117. package/dialog/DiagnosticTimingsDialog.vue +8 -7
  118. package/dialog/DrainNode.vue +44 -48
  119. package/dialog/ForceMachineRemoveDialog.vue +5 -7
  120. package/dialog/GenericPrompt.vue +15 -20
  121. package/dialog/RollbackWorkloadDialog.vue +15 -46
  122. package/dialog/RotateCertificatesDialog.vue +5 -7
  123. package/dialog/RotateEncryptionKeyDialog.vue +5 -9
  124. package/dialog/SaveAsRKETemplateDialog.vue +5 -13
  125. package/dialog/ScaleMachineDownDialog.vue +1 -1
  126. package/dialog/ScalePoolDownDialog.vue +121 -0
  127. package/edit/__tests__/management.cattle.io.setting.test.ts +3 -3
  128. package/edit/auth/azuread.vue +16 -16
  129. package/edit/auth/github.vue +8 -0
  130. package/edit/auth/googleoauth.vue +10 -1
  131. package/edit/auth/ldap/index.vue +10 -0
  132. package/edit/auth/oidc.vue +10 -0
  133. package/edit/auth/saml.vue +10 -0
  134. package/edit/autoscaling.horizontalpodautoscaler/index.vue +1 -1
  135. package/edit/cloudcredential.vue +3 -7
  136. package/edit/logging-flow/Match.vue +39 -8
  137. package/edit/logging-flow/index.vue +27 -4
  138. package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +107 -0
  139. package/edit/management.cattle.io.project.vue +8 -1
  140. package/edit/management.cattle.io.setting.vue +5 -2
  141. package/edit/management.cattle.io.user.vue +7 -1
  142. package/edit/monitoring.coreos.com.alertmanagerconfig/receiverConfig.vue +23 -7
  143. package/edit/monitoring.coreos.com.alertmanagerconfig/types/email.vue +2 -2
  144. package/edit/monitoring.coreos.com.prometheusrule/GroupRules.vue +14 -6
  145. package/edit/namespace.vue +18 -4
  146. package/edit/networking.k8s.io.ingress/Certificate.vue +1 -0
  147. package/edit/networking.k8s.io.ingress/IngressClass.vue +8 -6
  148. package/edit/networking.k8s.io.ingress/RulePath.vue +12 -6
  149. package/edit/networking.k8s.io.ingress/index.vue +8 -6
  150. package/edit/persistentvolume/index.vue +30 -27
  151. package/edit/persistentvolume/plugins/cephfs.vue +29 -29
  152. package/edit/persistentvolume/plugins/csi.vue +102 -62
  153. package/edit/persistentvolume/plugins/fc.vue +19 -19
  154. package/edit/persistentvolume/plugins/iscsi.vue +45 -45
  155. package/edit/persistentvolume/plugins/rbd.vue +39 -39
  156. package/edit/persistentvolumeclaim.vue +78 -75
  157. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +11 -7
  158. package/edit/provisioning.cattle.io.cluster/RegistryConfigs.vue +10 -1
  159. package/edit/provisioning.cattle.io.cluster/RegistryMirrors.vue +87 -27
  160. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +3 -6
  161. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +93 -0
  162. package/edit/provisioning.cattle.io.cluster/import.vue +1 -1
  163. package/edit/provisioning.cattle.io.cluster/index.vue +29 -6
  164. package/edit/provisioning.cattle.io.cluster/rke2.vue +440 -152
  165. package/edit/secret/index.vue +3 -7
  166. package/edit/service.vue +3 -1
  167. package/edit/storage.k8s.io.storageclass/index.vue +100 -16
  168. package/edit/storage.k8s.io.storageclass/provisioners/driver.harvesterhci.io.vue +114 -0
  169. package/edit/workload/__tests__/index.test.ts +98 -0
  170. package/edit/workload/index.vue +58 -8
  171. package/edit/workload/mixins/workload.js +107 -70
  172. package/edit/workload/storage/ContainerMountPaths.vue +0 -10
  173. package/edit/workload/storage/emptyDir.vue +88 -0
  174. package/edit/workload/storage/ephemeralVolume/index.vue +1 -1
  175. package/edit/workload/storage/index.vue +8 -0
  176. package/edit/workload/storage/persistentVolumeClaim/index.vue +1 -1
  177. package/layouts/default.vue +57 -44
  178. package/list/__tests__/workload.test.ts +5 -2
  179. package/list/catalog.cattle.io.app.vue +1 -0
  180. package/list/cis.cattle.io.clusterscan.vue +1 -0
  181. package/list/fleet.cattle.io.bundle.vue +5 -6
  182. package/list/fleet.cattle.io.cluster.vue +6 -3
  183. package/list/fleet.cattle.io.clusterregistrationtoken.vue +5 -6
  184. package/list/fleet.cattle.io.gitrepo.vue +4 -9
  185. package/list/helm.cattle.io.projecthelmchart.vue +1 -5
  186. package/list/logging.banzaicloud.io.clusterflow.vue +4 -1
  187. package/list/logging.banzaicloud.io.flow.vue +6 -5
  188. package/list/management.cattle.io.cluster.vue +1 -0
  189. package/list/management.cattle.io.feature.vue +3 -4
  190. package/list/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +47 -0
  191. package/list/management.cattle.io.setting.vue +2 -2
  192. package/list/management.cattle.io.user.vue +4 -10
  193. package/list/monitoring.coreos.com.alertmanagerconfig.vue +2 -7
  194. package/list/node.vue +8 -5
  195. package/list/persistentvolume.vue +3 -3
  196. package/list/persistentvolumeclaim.vue +3 -4
  197. package/list/provisioning.cattle.io.cluster.vue +18 -19
  198. package/list/service.vue +6 -14
  199. package/list/workload.vue +43 -38
  200. package/machine-config/azure.vue +429 -60
  201. package/machine-config/pnap.vue +288 -0
  202. package/mixins/auth-config.js +1 -3
  203. package/mixins/browser-tab-visibility.js +8 -14
  204. package/mixins/chart.js +1 -1
  205. package/mixins/create-edit-view/impl.js +4 -0
  206. package/mixins/create-edit-view/index.js +4 -2
  207. package/mixins/resource-fetch-namespaced.js +98 -0
  208. package/mixins/resource-fetch.js +79 -45
  209. package/mixins/resource-manager.js +1 -23
  210. package/models/apps.controllerrevision.js +7 -0
  211. package/models/apps.daemonset.js +18 -0
  212. package/models/apps.deployment.js +44 -0
  213. package/models/apps.replicaset.js +7 -0
  214. package/models/apps.statefulset.js +18 -0
  215. package/models/batch.job.js +7 -14
  216. package/models/cluster/node.js +10 -2
  217. package/models/cluster.x-k8s.io.machine.js +26 -4
  218. package/models/cluster.x-k8s.io.machinedeployment.js +12 -2
  219. package/models/event.js +7 -0
  220. package/models/logging.banzaicloud.io.flow.js +4 -0
  221. package/models/management.cattle.io.cluster.js +1 -1
  222. package/models/management.cattle.io.clusterroletemplatebinding.js +1 -1
  223. package/models/management.cattle.io.globalrole.js +2 -2
  224. package/models/management.cattle.io.node.js +37 -2
  225. package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.ts +4 -0
  226. package/models/management.cattle.io.project.js +30 -11
  227. package/models/management.cattle.io.setting.js +1 -1
  228. package/models/management.cattle.io.user.js +37 -1
  229. package/models/namespace.js +42 -5
  230. package/models/persistentvolume.js +14 -2
  231. package/models/pod.js +15 -0
  232. package/models/projectroletemplatebinding.js +7 -0
  233. package/models/provisioning.cattle.io.cluster.js +61 -10
  234. package/models/rke-machine.cattle.io.pnapmachinetemplate.js +15 -0
  235. package/models/service.js +14 -13
  236. package/models/storage.k8s.io.storageclass.js +33 -18
  237. package/models/workload.js +38 -7
  238. package/nuxt.config.js +27 -17
  239. package/package.json +7 -7
  240. package/pages/about.vue +14 -2
  241. package/pages/c/_cluster/apps/charts/index.vue +4 -3
  242. package/pages/c/_cluster/apps/charts/install.vue +59 -22
  243. package/pages/c/_cluster/auth/config/_id.vue +6 -0
  244. package/pages/c/_cluster/auth/config/index.vue +8 -6
  245. package/pages/c/_cluster/auth/group.principal/assign-edit.vue +1 -1
  246. package/pages/c/_cluster/auth/roles/index.vue +1 -1
  247. package/pages/c/_cluster/explorer/index.vue +12 -6
  248. package/pages/c/_cluster/longhorn/index.vue +1 -1
  249. package/pages/c/_cluster/monitoring/alertmanagerconfig/_alertmanagerconfigid/receiver.vue +15 -4
  250. package/pages/c/_cluster/monitoring/index.vue +1 -1
  251. package/pages/c/_cluster/neuvector/index.vue +1 -1
  252. package/pages/c/_cluster/settings/performance.vue +48 -2
  253. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +34 -1
  254. package/pages/c/_cluster/uiplugins/index.vue +28 -2
  255. package/pages/diagnostic.vue +5 -4
  256. package/pages/home.vue +105 -30
  257. package/pages/prefs.vue +23 -12
  258. package/pages/rio/mesh.vue +1 -1
  259. package/pkg/dynamic-importer.lib.js +8 -0
  260. package/pkg/vue.config.js +4 -0
  261. package/plugins/dashboard-store/__tests__/mutations.spec.js +406 -0
  262. package/plugins/dashboard-store/actions.js +32 -25
  263. package/plugins/dashboard-store/getters.js +50 -33
  264. package/plugins/dashboard-store/mutations.js +134 -28
  265. package/plugins/dashboard-store/resource-class.js +21 -41
  266. package/plugins/steve/actions.js +30 -0
  267. package/plugins/steve/caches/resourceCache.js +60 -0
  268. package/plugins/steve/getters.js +44 -1
  269. package/plugins/steve/mutations.js +97 -36
  270. package/plugins/steve/resourceWatcher.js +277 -0
  271. package/plugins/steve/schema.utils.js +25 -0
  272. package/plugins/steve/subscribe.js +288 -115
  273. package/plugins/steve/worker/index.js +17 -0
  274. package/plugins/steve/worker/web-worker.advanced.js +302 -0
  275. package/plugins/steve/{web-worker.steve-sub-worker.js → worker/web-worker.basic.js} +3 -44
  276. package/rancher-components/Card/Card.vue +3 -3
  277. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +1 -0
  278. package/rancher-components/StringList/StringList.test.ts +45 -420
  279. package/rancher-components/StringList/StringList.vue +1 -10
  280. package/rancher-components/components/Banner/Banner.test.ts +44 -0
  281. package/rancher-components/components/Banner/Banner.vue +129 -61
  282. package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +13 -22
  283. package/rancher-components/components/Form/Checkbox/Checkbox.vue +8 -6
  284. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +9 -9
  285. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +0 -1
  286. package/rancher-components/components/StringList/StringList.test.ts +7 -7
  287. package/rancher-components/components/StringList/StringList.vue +21 -15
  288. package/scripts/test-plugins-build.sh +8 -0
  289. package/static/loading-indicator.html +1 -1
  290. package/store/index.js +54 -3
  291. package/store/plugins.js +0 -17
  292. package/store/pnap.js +128 -0
  293. package/store/prefs.js +4 -2
  294. package/store/type-map.js +55 -13
  295. package/types/pod-security-admission.ts +36 -0
  296. package/types/shell/index.d.ts +496 -396
  297. package/utils/__tests__/object.test.ts +17 -1
  298. package/utils/__tests__/pod-security-admission.test.ts +61 -0
  299. package/utils/async.ts +36 -0
  300. package/utils/color.js +45 -0
  301. package/utils/crypto/browserHashUtils.js +18 -0
  302. package/utils/dynamic-importer.js +8 -0
  303. package/utils/install-redirect.js +1 -1
  304. package/utils/object.js +24 -0
  305. package/utils/pod-security-admission.ts +39 -0
  306. package/utils/socket.js +61 -24
  307. package/utils/string.js +2 -0
  308. package/utils/svg-filter.js +301 -0
  309. package/utils/time.js +49 -0
  310. package/utils/validators/cidr.js +4 -0
  311. package/utils/validators/formRules/__tests__/index.test.ts +23 -3
  312. package/utils/validators/formRules/index.ts +14 -0
  313. package/config/product/harvester-manager.js +0 -162
  314. package/edit/harvesterhci.io.management.cluster.vue +0 -153
  315. package/list/harvesterhci.io.management.cluster.vue +0 -241
  316. package/machine-config/harvester.vue +0 -693
  317. package/models/harvesterhci.io.management.cluster.js +0 -228
  318. package/pages/c/_cluster/harvesterManager/index.vue +0 -24
  319. package/rancher-components/Card/Card.test.ts +0 -39
  320. package/rancher-components/Utils/DraggableZone/DraggableZone.vue +0 -181
  321. package/rancher-components/Utils/DraggableZone/index.ts +0 -1
  322. package/rancher-components/components/Utils/DraggableZone/index.ts +0 -1
@@ -0,0 +1,288 @@
1
+ <script>
2
+ import { NORMAN } from '@shell/config/types';
3
+ import { exceptionToErrorsArray, stringify } from '@shell/utils/error';
4
+ import { _CREATE } from '@shell/config/query-params';
5
+ import CreateEditView from '@shell/mixins/create-edit-view';
6
+ import Loading from '@shell/components/Loading';
7
+ import { Banner } from '@components/Banner';
8
+ import LabeledSelect from '@shell/components/form/LabeledSelect';
9
+ import { LabeledInput } from '@components/Form/LabeledInput';
10
+
11
+ export default {
12
+ components: {
13
+ Loading,
14
+ Banner,
15
+ LabeledSelect,
16
+ LabeledInput,
17
+ },
18
+
19
+ mixins: [CreateEditView],
20
+
21
+ props: {
22
+ credentialId: {
23
+ type: String,
24
+ required: true,
25
+ },
26
+ disabled: {
27
+ type: Boolean,
28
+ default: false,
29
+ },
30
+ },
31
+
32
+ async fetch() {
33
+ this.errors = [];
34
+
35
+ try {
36
+ if (this.credentialId) {
37
+ this.credential = await this.$store.dispatch('rancher/find', {
38
+ type: NORMAN.CLOUD_CREDENTIAL,
39
+ id: this.credentialId,
40
+ });
41
+ this.$set(this.value, 'clientIdentifier', this.credential.decodedData.clientIdentifier);
42
+ }
43
+ } catch (e) {
44
+ this.credential = null;
45
+ }
46
+
47
+ try {
48
+ this.allProducts = await this.$store.dispatch('pnap/allProducts', { credentialId: this.credentialId });
49
+
50
+ this.osChoices = await this.$store.dispatch('pnap/osChoices', { credentialId: this.credentialId });
51
+
52
+ const serverOs = this.osChoices[0].value;
53
+
54
+ if (!this.value.serverOs) {
55
+ this.value.serverOs = serverOs;
56
+ }
57
+ if (!this.value.serverLocation) {
58
+ this.value.serverLocation = 'PHX';
59
+ }
60
+ if (!this.value.serverType) {
61
+ this.value.serverType = 's1.c1.medium';
62
+ }
63
+ this.updateInterfaces();
64
+ } catch (e) {
65
+ this.errors = exceptionToErrorsArray(e);
66
+ }
67
+ },
68
+
69
+ data() {
70
+ return {
71
+ credential: null,
72
+ allProducts: null,
73
+ osChoices: null,
74
+ };
75
+ },
76
+
77
+ watch: {
78
+ 'credentialId'() {
79
+ this.$fetch();
80
+ },
81
+ },
82
+
83
+ computed: {
84
+ isCreate() {
85
+ return this.mode === _CREATE;
86
+ },
87
+ locationChoices() {
88
+ const products = this.allProducts;
89
+ const result = [];
90
+
91
+ if (Array.isArray(products)) {
92
+ const map = new Map();
93
+
94
+ for (const prod of products) {
95
+ for (const plan of prod.plans) {
96
+ if (!map.has(plan.location)) {
97
+ map.set(plan.location, true);
98
+ result.push({ value: plan.location, label: plan.location });
99
+ }
100
+ }
101
+ }
102
+ } else {
103
+ result.push({ value: products.message });
104
+ }
105
+
106
+ return result;
107
+ },
108
+ typeChoices() {
109
+ const products = this.allProducts;
110
+ const result = [];
111
+
112
+ if (Array.isArray(products)) {
113
+ const map = new Map();
114
+ const serverLocation = this.value.serverLocation;
115
+
116
+ for (const prod of products) {
117
+ for (const plan of prod.plans) {
118
+ if (
119
+ !map.has(prod.productCode) &&
120
+ plan.location === serverLocation
121
+ ) {
122
+ map.set(prod.productCode, true);
123
+ result.push({
124
+ value: prod.productCode,
125
+ label: `${ prod.productCode } - $${ plan.price }/hour`,
126
+ });
127
+ }
128
+ }
129
+ }
130
+ if (!map.has(this.value.serverType) && products.length > 0) {
131
+ this.preselectFirst(result[0].value);
132
+ }
133
+ } else {
134
+ result.push({ value: products.message });
135
+ }
136
+
137
+ return result;
138
+ },
139
+ type() {
140
+ const products = this.allProducts;
141
+
142
+ if (Array.isArray(products)) {
143
+ const serverLocation = this.value.serverLocation;
144
+ const serverType = this.value.serverType;
145
+
146
+ for (const prod of products) {
147
+ for (const plan of prod.plans) {
148
+ if (prod.productCode === serverType && plan.location === serverLocation) {
149
+ return prod;
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ return products.message;
156
+ },
157
+ },
158
+
159
+ methods: {
160
+ stringify,
161
+
162
+ updateInterfaces() {
163
+ if (!this.value.interfaces) {
164
+ this.value.interfaces = [];
165
+ }
166
+ },
167
+
168
+ preselectFirst(val) {
169
+ this.value.serverType = val;
170
+ },
171
+ },
172
+ };
173
+ </script>
174
+
175
+ <template>
176
+ <Loading
177
+ v-if="$fetchState.pending"
178
+ :delayed="true"
179
+ />
180
+ <div v-else-if="errors.length">
181
+ <div
182
+ v-for="(err, idx) in errors"
183
+ :key="idx"
184
+ >
185
+ <Banner
186
+ color="error"
187
+ :label="stringify(err)"
188
+ />
189
+ </div>
190
+ </div>
191
+ <div v-else>
192
+ <div class="row mt-20">
193
+ <div class="col span-6">
194
+ <LabeledSelect
195
+ v-model="value.serverLocation"
196
+ :mode="mode"
197
+ :options="locationChoices"
198
+ :searchable="true"
199
+ :required="true"
200
+ :disabled="disabled"
201
+ :label="t('cluster.machineConfig.pnap.serverLocation.label')"
202
+ />
203
+ </div>
204
+ <div class="col span-6">
205
+ <LabeledSelect
206
+ v-model="value.serverType"
207
+ :mode="mode"
208
+ :options="typeChoices"
209
+ :searchable="true"
210
+ :required="true"
211
+ :disabled="disabled"
212
+ :label="t('cluster.machineConfig.pnap.serverType.label')"
213
+ />
214
+ </div>
215
+ </div>
216
+ <div class="row mt-20">
217
+ <div class="col span-3">
218
+ <LabeledInput
219
+ v-model="type.metadata.cpu"
220
+ :mode="mode"
221
+ :disabled="true"
222
+ :label="t('cluster.machineConfig.pnap.serverCpu.label')"
223
+ />
224
+ </div>
225
+ <div class="col span-3">
226
+ <LabeledInput
227
+ v-model="type.metadata.coresPerCpu"
228
+ :mode="mode"
229
+ :disabled="true"
230
+ :label="t('cluster.machineConfig.pnap.serverCoresPerCpu.label')"
231
+ />
232
+ </div>
233
+ <div class="col span-3">
234
+ <LabeledInput
235
+ v-model="type.metadata.cpuCount"
236
+ :mode="mode"
237
+ :disabled="true"
238
+ :label="t('cluster.machineConfig.pnap.serverCpuCount.label')"
239
+ />
240
+ </div>
241
+ <div class="col span-3">
242
+ <LabeledInput
243
+ v-model="type.metadata.cpuFrequency"
244
+ :mode="mode"
245
+ :disabled="true"
246
+ :label="t('cluster.machineConfig.pnap.serverCpuFrequency.label')"
247
+ />
248
+ </div>
249
+ </div>
250
+ <div class="row mt-20">
251
+ <div class="col span-3">
252
+ <LabeledInput
253
+ v-model="type.metadata.ramInGb"
254
+ :mode="mode"
255
+ :disabled="true"
256
+ :label="t('cluster.machineConfig.pnap.serverRam.label')"
257
+ />
258
+ </div>
259
+ <div class="col span-3">
260
+ <LabeledInput
261
+ v-model="type.metadata.storage"
262
+ :mode="mode"
263
+ :disabled="true"
264
+ :label="t('cluster.machineConfig.pnap.serverStorage.label')"
265
+ />
266
+ </div>
267
+ <div class="col span-3">
268
+ <LabeledInput
269
+ v-model="type.metadata.network"
270
+ :mode="mode"
271
+ :disabled="true"
272
+ :label="t('cluster.machineConfig.pnap.serverNetwork.label')"
273
+ />
274
+ </div>
275
+ <div class="col span-3">
276
+ <LabeledSelect
277
+ v-model="value.serverOs"
278
+ :mode="mode"
279
+ :options="osChoices"
280
+ :searchable="true"
281
+ :required="true"
282
+ :disabled="disabled"
283
+ :label="t('cluster.machineConfig.pnap.serverOs.label')"
284
+ />
285
+ </div>
286
+ </div>
287
+ </div>
288
+ </template>
@@ -214,7 +214,7 @@ export default {
214
214
  }
215
215
  },
216
216
 
217
- async disable(btnCb) {
217
+ async disable() {
218
218
  try {
219
219
  if (this.model.hasAction('disable')) {
220
220
  await this.model.doAction('disable');
@@ -233,10 +233,8 @@ export default {
233
233
  opt: { url: '/v3/principals', force: true }
234
234
  });
235
235
  this.showLdap = false;
236
- btnCb(true);
237
236
  } catch (err) {
238
237
  this.errors = [err];
239
- btnCb(false);
240
238
  }
241
239
  },
242
240
 
@@ -5,33 +5,27 @@ export default {
5
5
  computed: { ...mapGetters(['isSingleProduct']) },
6
6
  methods: {
7
7
  setTabVisibilityListener(isAdd) {
8
- const method = isAdd ? 'addEventListener' : 'removeEventListener';
8
+ if ((!this.isSingleProduct || this.isSingleProduct?.enableSessionCheck) && this.$config.rancherEnv !== 'desktop') {
9
+ const method = isAdd ? 'addEventListener' : 'removeEventListener';
9
10
 
10
- document[method]('visibilitychange', this.visibilityChange, true);
11
+ document[method]('visibilitychange', this.visibilityChange, true);
12
+ }
11
13
  },
12
14
 
13
15
  async visibilityChange() {
14
16
  if (!document.hidden) {
15
- await this.$store.dispatch('rancher/findAll', {
17
+ await this.$store.dispatch('rancher/request', {
16
18
  type: NORMAN.USER,
17
- opt: {
18
- url: '/v3/users',
19
- filter: { me: true },
20
- force: true
21
- }
19
+ opt: { url: '/v3/users?me=true' }
22
20
  });
23
21
  }
24
22
  },
25
23
  },
26
24
 
27
25
  mounted() {
28
- if ((!this.isSingleProduct || this.isSingleProduct?.enableSessionCheck) && this.$config.rancherEnv !== 'desktop') {
29
- this.setTabVisibilityListener(true);
30
- }
26
+ this.setTabVisibilityListener(true);
31
27
  },
32
28
  beforeDestroy() {
33
- if ((!this.isSingleProduct || this.isSingleProduct?.enableSessionCheck) && this.$config.rancherEnv !== 'desktop') {
34
- this.setTabVisibilityListener(false);
35
- }
29
+ this.setTabVisibilityListener(false);
36
30
  },
37
31
  };
package/mixins/chart.js CHANGED
@@ -242,7 +242,7 @@ export default {
242
242
 
243
243
  methods: {
244
244
  async fetchChart() {
245
- await this.$store.dispatch('catalog/load');
245
+ await this.$store.dispatch('catalog/load', { force: true, reset: true }); // not the problem
246
246
 
247
247
  if ( this.query.appNamespace && this.query.appName ) {
248
248
  // First check the URL query for an app name and namespace.
@@ -187,6 +187,10 @@ export default {
187
187
  } else {
188
188
  await this.value.save();
189
189
  }
190
+ },
191
+
192
+ setErrors(errors) {
193
+ this.errors = errors;
190
194
  }
191
195
  },
192
196
  };
@@ -1,7 +1,9 @@
1
1
  import { _EDIT, _YAML } from '@shell/config/query-params';
2
+ import Vue from 'vue';
3
+
2
4
  import impl from './impl';
3
5
 
4
- export default {
6
+ export default Vue.extend({
5
7
  ...impl,
6
8
 
7
9
  props: {
@@ -43,4 +45,4 @@ export default {
43
45
  default: false,
44
46
  },
45
47
  },
46
- };
48
+ });
@@ -0,0 +1,98 @@
1
+ import { mapGetters } from 'vuex';
2
+ import { ResourceListComponentName } from '../components/ResourceList/resource-list.config';
3
+
4
+ /**
5
+ * Companion mixin used with `resource-fetch` for `ResourceList` to determine if the user needs to filter the list by a single namespace
6
+ */
7
+ export default {
8
+
9
+ data() {
10
+ return { forceUpdateLiveAndDelayed: 0 };
11
+ },
12
+
13
+ computed: {
14
+ ...mapGetters(['currentProduct', 'currentCluster', 'isSingleNamespace']),
15
+
16
+ /**
17
+ * Does the user need to update the filter to supply a single namespace?
18
+ */
19
+ namespaceFilterRequired() {
20
+ return this.__namespaceRequired && !this.__singleNamespaceFilter;
21
+ },
22
+
23
+ /**
24
+ * Returns the namespace that requests should be filtered by
25
+ */
26
+ namespaceFilter() {
27
+ return this.__namespaceRequired ? this.__singleNamespaceFilter : '';
28
+ },
29
+
30
+ /**
31
+ * If the Project/Namespace filter from the header contains a single NS... return it
32
+ */
33
+ __singleNamespaceFilter() {
34
+ const ns = this.isSingleNamespace;
35
+
36
+ return ns ? ns.replace('ns://', '') : '';
37
+ },
38
+
39
+ /**
40
+ * Do we need to filter the list by a namespace?
41
+ */
42
+ __namespaceRequired() {
43
+ if (!this.forceNsFilter?.enabled || this.perfConfig.forceNsFilter.threshold === undefined) {
44
+ return false;
45
+ }
46
+
47
+ return !this.currentProduct.showWorkspaceSwitcher && this.__areResourcesNamespaced && this.__areResourcesTooMany;
48
+ },
49
+
50
+ /**
51
+ * Are all core list resources namespaced?
52
+ */
53
+ __areResourcesNamespaced() {
54
+ return (this.loadResources || []).every((type) => {
55
+ const schema = this.$store.getters['cluster/schemaFor'](type);
56
+
57
+ return schema?.attributes?.namespaced;
58
+ });
59
+ },
60
+
61
+ /**
62
+ * Are there too many core list resources to show in the list?
63
+ */
64
+ __areResourcesTooMany() {
65
+ // __getCountForResources is defined on resource-fetch mixin...
66
+ const count = this.__getCountForResources(this.loadResources);
67
+
68
+ return count > this.perfConfig.forceNsFilter.threshold;
69
+ },
70
+
71
+ },
72
+
73
+ watch: {
74
+ __namespaceRequired: {
75
+ handler(neu) {
76
+ this.$store.dispatch('setNamespaceFilterMode', neu ? 'namespace' : null, { root: true });
77
+ },
78
+ immediate: true,
79
+ },
80
+
81
+ async namespaceFilter(neu) {
82
+ if (neu) {
83
+ // When a NS filter is required and the user selects a different one, kick off a new set of API requests
84
+ //
85
+ // ResourceList has two modes
86
+ // 1) ResourceList component handles API request to fetch resources
87
+ // 2) Custom list component handles API request to fetch resources
88
+ //
89
+ // This covers case 2
90
+ if (this.$options.name !== ResourceListComponentName && !!this.$fetch) {
91
+ await this.$fetch();
92
+ }
93
+ // Ensure any live/delayed columns get updated
94
+ this.forceUpdateLiveAndDelayed = new Date().getTime();
95
+ }
96
+ }
97
+ }
98
+ };
@@ -1,11 +1,15 @@
1
1
  import { mapGetters } from 'vuex';
2
2
  import { COUNT, MANAGEMENT } from '@shell/config/types';
3
3
  import { SETTING, DEFAULT_PERF_SETTING } from '@shell/config/settings';
4
+ import ResourceFetchNamespaced from '@shell/mixins/resource-fetch-namespaced';
4
5
 
5
6
  // Number of pages to fetch when loading incrementally
6
7
  const PAGES = 4;
7
8
 
8
9
  export default {
10
+
11
+ mixins: [ResourceFetchNamespaced],
12
+
9
13
  data() {
10
14
  // fetching the settings related to manual refresh from global settings
11
15
  const perfSetting = this.$store.getters['management/byId'](MANAGEMENT.SETTING, SETTING.UI_PERFORMANCE);
@@ -24,16 +28,21 @@ export default {
24
28
  return {
25
29
  perfConfig,
26
30
  init: false,
27
- counts: {},
28
31
  multipleResources: [],
32
+ loadResources: [this.resource],
29
33
  // manual refresh vars
30
34
  hasManualRefresh: false,
31
35
  watch: true,
32
36
  isTooManyItemsToAutoUpdate: false,
33
37
  force: false,
34
38
  // incremental loading vars
35
- incremental: 0,
39
+ incremental: false,
36
40
  fetchedResourceType: [],
41
+ // force ns filtering
42
+ forceNsFilter: {
43
+ ...perfConfig.forceNsFilter,
44
+ threshold: parseInt(perfConfig?.forceNsFilter?.threshold || '0', 10)
45
+ }
37
46
  };
38
47
  },
39
48
  beforeDestroy() {
@@ -42,10 +51,8 @@ export default {
42
51
  // clear up the store to make sure we aren't storing anything that might interfere with the next rendered list view
43
52
  this.$store.dispatch('resource-fetch/clearData');
44
53
 
45
- const inStore = this.$store.getters['currentStore'](COUNT);
46
-
47
- this.fetchedResourceType.forEach((type) => {
48
- this.$store.dispatch(`${ inStore }/incrementLoadCounter`, type);
54
+ this.fetchedResourceType.forEach((item) => {
55
+ this.$store.dispatch(`${ item.currStore }/incrementLoadCounter`, item.type);
49
56
  });
50
57
  }
51
58
  },
@@ -53,9 +60,13 @@ export default {
53
60
  computed: {
54
61
  ...mapGetters({ refreshFlag: 'resource-fetch/refreshFlag' }),
55
62
  rows() {
56
- const inStore = this.$store.getters['currentStore'](this.resource);
63
+ const currResource = this.fetchedResourceType.find(item => item.type === this.resource);
57
64
 
58
- return this.$store.getters[`${ inStore }/all`](this.resource);
65
+ if (currResource) {
66
+ return this.$store.getters[`${ currResource.currStore }/all`](this.resource);
67
+ } else {
68
+ return [];
69
+ }
59
70
  },
60
71
  loading() {
61
72
  return this.rows.length ? false : this.$fetchState.pending;
@@ -70,11 +81,15 @@ export default {
70
81
  }
71
82
  },
72
83
  methods: {
73
- $fetchType(type, multipleResources = []) {
74
- const inStore = this.$store.getters['currentStore'](COUNT);
75
-
84
+ // this defines all the flags needed for the mechanism
85
+ // to work. They should be defined based on the main list view
86
+ // resource that is to be displayed. The secondary resources
87
+ // fetched should follow what was defined (if it is manual and/or incremental)
88
+ $initializeFetchData(type, multipleResources = [], storeType) {
76
89
  if (!this.init) {
77
- this.__gatherResourceFetchData(type, multipleResources);
90
+ const currStore = storeType || this.$store.getters['currentStore']();
91
+
92
+ this.__gatherResourceFetchData(type, multipleResources, currStore);
78
93
 
79
94
  // make sure after init that, if we have a manual refresh, we always set the force = true
80
95
  if (!this.watch) {
@@ -85,31 +100,61 @@ export default {
85
100
  this.hasManualRefresh = true;
86
101
  }
87
102
  }
103
+ },
104
+ // data fetching for the mechanism
105
+ $fetchType(type, multipleResources = [], storeType) {
106
+ const currStore = storeType || this.$store.getters['currentStore']();
107
+
108
+ this.$initializeFetchData(type, multipleResources, currStore);
88
109
 
89
- if (!this.fetchedResourceType.includes(type)) {
90
- this.fetchedResourceType.push(type);
110
+ if (!this.fetchedResourceType.find(item => item.type === type)) {
111
+ this.fetchedResourceType.push({
112
+ type,
113
+ currStore
114
+ });
91
115
  }
92
116
 
93
- return this.$store.dispatch(`${ inStore }/findAll`, {
117
+ let incremental = 0;
118
+
119
+ if (this.incremental) {
120
+ const resourceCount = this.__getCountForResources([type], this.namespaceFilter, currStore);
121
+
122
+ incremental = Math.ceil(resourceCount / PAGES);
123
+ }
124
+
125
+ const opt = {
126
+ incremental,
127
+ watch: this.watch,
128
+ force: this.force,
129
+ hasManualRefresh: this.hasManualRefresh
130
+ };
131
+
132
+ const schema = this.$store.getters[`${ currStore }/schemaFor`](type);
133
+
134
+ if (schema?.attributes?.namespaced) {
135
+ opt.namespaced = this.namespaceFilter;
136
+ }
137
+
138
+ return this.$store.dispatch(`${ currStore }/findAll`, {
94
139
  type,
95
- opt: {
96
- incremental: this.incremental,
97
- watch: this.watch,
98
- force: this.force,
99
- hasManualRefresh: this.hasManualRefresh
100
- }
140
+ opt
101
141
  });
102
142
  },
103
- __getCountForResource(resourceName) {
104
- let resourceCount;
105
143
 
106
- if (this.counts[`${ resourceName }`]) {
107
- resourceCount = this.counts[`${ resourceName }`].summary?.count;
108
- }
144
+ __getCountForResources(resourceNames, namespace, storeType) {
145
+ const currStore = storeType || this.$store.getters['currentStore']();
146
+
147
+ return resourceNames.reduce((res, type) => res + this.__getCountForResource(type, namespace, currStore), 0);
148
+ },
149
+
150
+ __getCountForResource(resourceName, namespace, storeType) {
151
+ const resourceCounts = this.$store.getters[`${ storeType }/all`](COUNT)[0]?.counts[`${ resourceName }`]; // NB `rancher` store behaves differently, lacks counts but has resource
152
+ const resourceCount = namespace && resourceCounts?.namespaces ? resourceCounts?.namespaces[namespace]?.count : resourceCounts?.summary?.count;
109
153
 
110
154
  return resourceCount || 0;
111
155
  },
112
- __gatherResourceFetchData(type, multipleResources) {
156
+
157
+ __gatherResourceFetchData(resourceName, multipleResources, currStore) {
113
158
  // flag to prevent a first data update being triggered from the requestData watcher
114
159
  this.init = true;
115
160
 
@@ -123,8 +168,6 @@ export default {
123
168
 
124
169
  // other vars
125
170
  this.multipleResources = multipleResources;
126
- const resourceName = type;
127
- const inStore = this.$store.getters['currentStore'](resourceName);
128
171
  let resourceCount = 0;
129
172
 
130
173
  // manual refresh vars
@@ -132,30 +175,21 @@ export default {
132
175
  let isTooManyItemsToAutoUpdate = false;
133
176
 
134
177
  // incremental loading vars
135
- let incremental = 0;
178
+ let incremental = false;
136
179
 
137
180
  // get resource counts
138
- if ( this.$store.getters[`${ inStore }/haveAll`](COUNT) ) {
139
- this.counts = this.$store.getters[`${ inStore }/all`](COUNT)[0].counts;
140
-
141
- if (this.multipleResources.length) {
142
- this.multipleResources.forEach((item) => {
143
- resourceCount = resourceCount + this.__getCountForResource(item);
144
- });
145
- } else {
146
- resourceCount = this.__getCountForResource(resourceName);
147
- }
148
- }
181
+ const resourcesForCount = this.multipleResources.length ? this.multipleResources : [resourceName];
182
+
183
+ resourceCount = this.__getCountForResources(resourcesForCount, this.namespaceFilter, currStore);
149
184
 
150
185
  // manual refresh check
151
186
  if (manualDataRefreshEnabled && resourceCount >= manualDataRefreshThreshold) {
152
187
  watch = false;
153
188
  isTooManyItemsToAutoUpdate = true;
154
189
  }
155
- // manual refresh check
156
- if (incrementalLoadingEnabled && incrementalLoadingThreshold > 0 && resourceCount >= incrementalLoadingThreshold) {
157
- incremental = Math.ceil(resourceCount / PAGES);
158
- }
190
+
191
+ // incremental loading check
192
+ incremental = incrementalLoadingEnabled && incrementalLoadingThreshold > 0 && resourceCount >= incrementalLoadingThreshold;
159
193
 
160
194
  // pass on the flag that controls the appearance of the manual refresh button on the sortable table
161
195
  this.$store.dispatch('resource-fetch/updateIsTooManyItems', isTooManyItemsToAutoUpdate);