@rancher/shell 3.0.4 → 3.0.5-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/assets/images/providers/sks.svg +1 -0
  2. package/assets/styles/base/_basic.scss +6 -0
  3. package/assets/styles/base/_helpers.scss +4 -0
  4. package/assets/styles/base/_variables.scss +1 -0
  5. package/assets/styles/global/_button.scss +1 -0
  6. package/assets/translations/en-us.yaml +65 -15
  7. package/assets/translations/zh-hans.yaml +4 -3
  8. package/chart/monitoring/index.vue +3 -1
  9. package/cloud-credential/aws.vue +2 -0
  10. package/components/ActionDropdownShell.vue +71 -0
  11. package/components/AppModal.vue +18 -4
  12. package/components/AsyncButton.vue +24 -7
  13. package/components/BannerGraphic.vue +1 -0
  14. package/components/CommunityLinks.vue +4 -59
  15. package/components/CopyToClipboardText.vue +2 -1
  16. package/components/CruResource.vue +6 -1
  17. package/components/DetailText.vue +5 -0
  18. package/components/ExplorerMembers.vue +1 -1
  19. package/components/ExplorerProjectsNamespaces.vue +68 -18
  20. package/components/GlobalRoleBindings.vue +5 -1
  21. package/components/GrowlManager.vue +1 -0
  22. package/components/LandingPagePreference.vue +7 -3
  23. package/components/LocaleSelector.vue +39 -95
  24. package/components/ModalManager.vue +55 -0
  25. package/components/ModalWithCard.vue +1 -0
  26. package/components/PromptModal.vue +47 -8
  27. package/components/PromptRemove.vue +1 -0
  28. package/components/PromptRestore.vue +1 -0
  29. package/components/ResourceCancelModal.vue +1 -0
  30. package/components/ResourceDetail/Masthead.vue +38 -12
  31. package/components/ResourceDetail/__tests__/Masthead.test.ts +5 -1
  32. package/components/ResourceDetail/index.vue +47 -12
  33. package/components/ResourceTable.vue +54 -19
  34. package/components/SideNav.vue +5 -1
  35. package/components/SlideInPanelManager.vue +126 -0
  36. package/components/SortableTable/THead.vue +5 -2
  37. package/components/SortableTable/actions.js +1 -1
  38. package/components/SortableTable/index.vue +64 -51
  39. package/components/SortableTable/paging.js +16 -19
  40. package/components/SortableTable/selection.js +0 -11
  41. package/components/Wizard.vue +2 -2
  42. package/components/__tests__/AsyncButton.test.ts +2 -2
  43. package/components/__tests__/ModalManager.spec.ts +176 -0
  44. package/components/__tests__/PromptModal.test.ts +148 -0
  45. package/components/__tests__/SlideInPanelManager.spec.ts +166 -0
  46. package/components/auth/AuthBanner.vue +13 -11
  47. package/components/auth/Principal.vue +1 -0
  48. package/components/auth/__tests__/RoleDetailEdit.test.ts +3 -2
  49. package/components/auth/login/ldap.vue +1 -1
  50. package/components/fleet/FleetResources.vue +21 -6
  51. package/components/form/ArrayList.vue +76 -60
  52. package/components/form/BannerSettings.vue +17 -2
  53. package/components/form/ColorInput.vue +35 -6
  54. package/components/form/Command.vue +6 -15
  55. package/components/form/EnvVars.vue +16 -8
  56. package/components/form/HealthCheck.vue +3 -3
  57. package/components/form/HookOption.vue +11 -16
  58. package/components/form/LabeledSelect.vue +18 -22
  59. package/components/form/LifecycleHooks.vue +3 -3
  60. package/components/form/MatchExpressions.vue +14 -8
  61. package/components/form/NameNsDescription.vue +128 -104
  62. package/components/form/Networking.vue +20 -12
  63. package/components/form/NodeAffinity.vue +31 -23
  64. package/components/form/NodeScheduling.vue +13 -3
  65. package/components/form/NotificationSettings.vue +15 -1
  66. package/components/form/Password.vue +1 -0
  67. package/components/form/PodAffinity.vue +43 -43
  68. package/components/form/Probe.vue +68 -66
  69. package/components/form/ResourceQuota/Project.vue +5 -1
  70. package/components/form/ResourceSelector.vue +7 -9
  71. package/components/form/SSHKnownHosts/__tests__/KnownHostsEditDialog.test.ts +16 -24
  72. package/components/form/SSHKnownHosts/index.vue +30 -13
  73. package/components/form/Security.vue +54 -56
  74. package/components/form/Select.vue +32 -21
  75. package/components/form/ShellInput.vue +5 -1
  76. package/components/form/Tolerations.vue +5 -1
  77. package/components/form/ValueFromResource.vue +134 -121
  78. package/components/form/WorkloadPorts.vue +18 -18
  79. package/components/form/__tests__/ArrayList.test.ts +5 -2
  80. package/components/form/__tests__/ColorInput.test.ts +35 -0
  81. package/components/form/__tests__/LabeledSelect.test.ts +40 -0
  82. package/components/form/__tests__/MatchExpressions.test.ts +12 -12
  83. package/components/form/__tests__/NameNsDescription.test.ts +115 -14
  84. package/components/form/__tests__/Probe.test.ts +12 -8
  85. package/components/form/__tests__/SSHKnownHosts.test.ts +22 -2
  86. package/components/form/__tests__/Select.test.ts +37 -0
  87. package/components/formatter/InternalExternalIP.vue +2 -0
  88. package/components/formatter/SecretData.vue +20 -7
  89. package/components/nav/Group.vue +27 -5
  90. package/components/nav/Header.vue +17 -43
  91. package/components/nav/NamespaceFilter.vue +134 -86
  92. package/components/nav/TopLevelMenu.vue +4 -5
  93. package/components/nav/Type.vue +12 -1
  94. package/components/nav/WindowManager/ContainerLogs.vue +87 -61
  95. package/components/nav/WindowManager/ContainerLogsActions.vue +76 -0
  96. package/components/templates/blank.vue +4 -1
  97. package/components/templates/default.vue +8 -3
  98. package/components/templates/home.vue +10 -1
  99. package/components/templates/plain.vue +10 -4
  100. package/composables/focusTrap.ts +12 -4
  101. package/composables/useRuntimeFlag.ts +29 -0
  102. package/config/router/routes.js +20 -13
  103. package/config/store.js +4 -0
  104. package/config/uiplugins.js +5 -1
  105. package/core/types.ts +12 -6
  106. package/detail/catalog.cattle.io.app.vue +6 -1
  107. package/detail/fleet.cattle.io.bundle.vue +70 -6
  108. package/detail/fleet.cattle.io.gitrepo.vue +1 -1
  109. package/detail/namespace.vue +0 -3
  110. package/detail/node.vue +17 -13
  111. package/detail/provisioning.cattle.io.cluster.vue +72 -6
  112. package/dialog/AddCustomBadgeDialog.vue +1 -1
  113. package/{pages/c/_cluster/uiplugins/AddExtensionRepos.vue → dialog/AddExtensionReposDialog.vue} +72 -42
  114. package/{components/AssignTo.vue → dialog/AssignToDialog.vue} +71 -80
  115. package/dialog/ChangePasswordDialog.vue +106 -0
  116. package/dialog/DeactivateDriverDialog.vue +1 -0
  117. package/{pages/c/_cluster/uiplugins/DeveloperInstallDialog.vue → dialog/DeveloperLoadExtensionDialog.vue} +74 -71
  118. package/dialog/DisableAuthProviderDialog.vue +101 -0
  119. package/dialog/DrainNode.vue +1 -1
  120. package/{pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue → dialog/ExtensionCatalogInstallDialog.vue} +100 -88
  121. package/{pages/c/_cluster/uiplugins/CatalogList/CatalogUninstallDialog.vue → dialog/ExtensionCatalogUninstallDialog.vue} +69 -57
  122. package/dialog/FeatureFlagListDialog.vue +288 -0
  123. package/dialog/ForceMachineRemoveDialog.vue +5 -2
  124. package/{components/Import.vue → dialog/ImportDialog.vue} +0 -5
  125. package/{pages/c/_cluster/uiplugins/InstallDialog.vue → dialog/InstallExtensionDialog.vue} +124 -106
  126. package/{components/form/SSHKnownHosts → dialog}/KnownHostsEditDialog.vue +52 -59
  127. package/dialog/MoveNamespaceDialog.vue +157 -0
  128. package/dialog/ScalePoolDownDialog.vue +1 -1
  129. package/{components/nav/Jump.vue → dialog/SearchDialog.vue} +34 -14
  130. package/{pages/c/_cluster/uiplugins/UninstallDialog.vue → dialog/UninstallExtensionDialog.vue} +67 -58
  131. package/dialog/WechatDialog.vue +57 -0
  132. package/edit/__tests__/monitoring.coreos.com.prometheusrule.test.ts +16 -3
  133. package/edit/auth/__tests__/oidc.test.ts +152 -109
  134. package/edit/auth/azuread.vue +2 -1
  135. package/edit/auth/github.vue +1 -1
  136. package/edit/auth/googleoauth.vue +5 -1
  137. package/edit/auth/ldap/index.vue +1 -1
  138. package/edit/auth/oidc.vue +38 -5
  139. package/edit/auth/saml.vue +1 -1
  140. package/edit/cloudcredential.vue +24 -9
  141. package/edit/logging.banzaicloud.io.output/__tests__/logging.banzaicloud.io.output.test.ts +40 -9
  142. package/edit/management.cattle.io.user.vue +28 -3
  143. package/edit/namespace.vue +1 -4
  144. package/edit/networking.k8s.io.ingress/IngressClass.vue +7 -3
  145. package/edit/networking.k8s.io.ingress/__tests__/IngressClass.test.ts +58 -0
  146. package/edit/persistentvolume/__tests__/persistentvolume.test.ts +14 -2
  147. package/edit/provisioning.cattle.io.cluster/CustomCommand.vue +4 -1
  148. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +26 -9
  149. package/edit/provisioning.cattle.io.cluster/__tests__/Advanced.test.ts +8 -8
  150. package/edit/provisioning.cattle.io.cluster/__tests__/DirectoryConfig.test.ts +26 -12
  151. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +66 -0
  152. package/edit/provisioning.cattle.io.cluster/__tests__/utils/rke2-test-data.ts +58 -0
  153. package/edit/provisioning.cattle.io.cluster/rke2.vue +49 -41
  154. package/edit/provisioning.cattle.io.cluster/tabs/AgentConfiguration.vue +6 -1
  155. package/edit/provisioning.cattle.io.cluster/tabs/DirectoryConfig.vue +5 -3
  156. package/edit/provisioning.cattle.io.cluster/tabs/MachinePool.vue +33 -2
  157. package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +2 -2
  158. package/edit/token.vue +2 -0
  159. package/edit/workload/index.vue +1 -0
  160. package/edit/workload/mixins/workload.js +0 -2
  161. package/initialize/install-plugins.js +2 -1
  162. package/list/harvesterhci.io.management.cluster.vue +4 -1
  163. package/list/management.cattle.io.feature.vue +4 -287
  164. package/list/provisioning.cattle.io.cluster.vue +20 -12
  165. package/machine-config/azure.vue +16 -4
  166. package/mixins/vue-select-overrides.js +0 -4
  167. package/models/__tests__/namespace.test.ts +25 -1
  168. package/models/cloudcredential.js +5 -0
  169. package/models/fleet.cattle.io.cluster.js +8 -2
  170. package/models/fleet.cattle.io.gitrepo.js +8 -34
  171. package/models/kontainerdriver.js +6 -3
  172. package/models/management.cattle.io.feature.js +7 -1
  173. package/models/management.cattle.io.node.js +3 -3
  174. package/models/namespace.js +11 -6
  175. package/models/nodedriver.js +6 -3
  176. package/models/workload.js +4 -1
  177. package/package.json +3 -3
  178. package/pages/about.vue +13 -3
  179. package/pages/account/index.vue +16 -6
  180. package/pages/auth/login.vue +18 -7
  181. package/pages/auth/logout.vue +4 -1
  182. package/pages/auth/setup.vue +2 -0
  183. package/pages/auth/verify.vue +13 -8
  184. package/pages/c/_cluster/apps/charts/chart.vue +1 -1
  185. package/pages/c/_cluster/apps/charts/install.vue +26 -26
  186. package/pages/c/_cluster/auth/config/index.vue +10 -12
  187. package/pages/c/_cluster/explorer/EventsTable.vue +38 -33
  188. package/pages/c/_cluster/explorer/index.vue +17 -15
  189. package/pages/c/_cluster/istio/index.vue +2 -2
  190. package/pages/c/_cluster/longhorn/index.vue +1 -1
  191. package/pages/c/_cluster/monitoring/index.vue +1 -1
  192. package/pages/c/_cluster/monitoring/monitor/_namespace/_id.vue +4 -2
  193. package/pages/c/_cluster/monitoring/monitor/create.vue +4 -2
  194. package/pages/c/_cluster/monitoring/route-receiver/_id.vue +4 -2
  195. package/pages/c/_cluster/monitoring/route-receiver/create.vue +5 -2
  196. package/pages/c/_cluster/neuvector/index.vue +1 -1
  197. package/pages/c/_cluster/settings/banners.vue +4 -3
  198. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +8 -10
  199. package/pages/c/_cluster/uiplugins/__tests__/AddExtensionRepos.test.ts +4 -7
  200. package/pages/c/_cluster/uiplugins/index.vue +98 -55
  201. package/pages/diagnostic.vue +59 -11
  202. package/pages/fail-whale.vue +14 -8
  203. package/pages/home.vue +24 -18
  204. package/pages/prefs.vue +7 -6
  205. package/pages/support/index.vue +4 -1
  206. package/plugins/internal-api/index.ts +37 -0
  207. package/plugins/internal-api/shared/base-api.ts +13 -0
  208. package/plugins/internal-api/shell/shell.api.ts +108 -0
  209. package/plugins/steve/actions.js +0 -12
  210. package/public/index.html +1 -0
  211. package/rancher-components/Card/Card.vue +1 -1
  212. package/rancher-components/Form/Checkbox/Checkbox.test.ts +59 -1
  213. package/rancher-components/Form/Checkbox/Checkbox.vue +27 -3
  214. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +47 -0
  215. package/rancher-components/Form/LabeledInput/LabeledInput.vue +20 -2
  216. package/rancher-components/Form/Radio/RadioButton.test.ts +36 -1
  217. package/rancher-components/Form/Radio/RadioButton.vue +20 -4
  218. package/rancher-components/Form/Radio/RadioGroup.test.ts +60 -0
  219. package/rancher-components/Form/Radio/RadioGroup.vue +52 -10
  220. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.test.ts +17 -0
  221. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +5 -0
  222. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +10 -1
  223. package/rancher-components/RcButton/RcButton.vue +2 -1
  224. package/rancher-components/RcButton/types.ts +1 -0
  225. package/rancher-components/RcDropdown/RcDropdown.vue +18 -6
  226. package/rancher-components/RcDropdown/RcDropdownItem.vue +3 -56
  227. package/rancher-components/RcDropdown/RcDropdownItemCheckbox.vue +68 -0
  228. package/rancher-components/RcDropdown/RcDropdownItemSelect.vue +92 -0
  229. package/rancher-components/RcDropdown/RcDropdownTrigger.vue +10 -0
  230. package/rancher-components/RcDropdown/index.ts +2 -0
  231. package/rancher-components/RcDropdown/useDropdownCollection.ts +8 -0
  232. package/rancher-components/RcDropdown/useDropdownContext.ts +9 -3
  233. package/rancher-components/RcDropdown/useDropdownItem.ts +63 -0
  234. package/scripts/extension/bundle +20 -0
  235. package/scripts/extension/helm/charts/ui-plugin-server/templates/cr.yaml +2 -1
  236. package/scripts/extension/helm/charts/ui-plugin-server/values.yaml +2 -0
  237. package/scripts/extension/helmpatch +44 -31
  238. package/scripts/extension/publish +12 -12
  239. package/scripts/typegen.sh +2 -4
  240. package/server/har-file.js +25 -3
  241. package/store/action-menu.js +26 -56
  242. package/store/features.js +2 -1
  243. package/store/index.js +5 -0
  244. package/store/modal.ts +71 -0
  245. package/store/slideInPanel.ts +47 -0
  246. package/store/type-map.js +12 -1
  247. package/store/type-map.utils.ts +4 -4
  248. package/types/global-vue.d.ts +5 -0
  249. package/types/internal-api/shell/growl.d.ts +25 -0
  250. package/types/internal-api/shell/modal.d.ts +77 -0
  251. package/types/internal-api/shell/slideIn.d.ts +15 -0
  252. package/types/resources/fleet.d.ts +0 -14
  253. package/types/shell/index.d.ts +43 -24
  254. package/types/vue-shim.d.ts +4 -1
  255. package/utils/__mocks__/tabbable.js +13 -0
  256. package/utils/__tests__/object.test.ts +38 -4
  257. package/utils/cluster.js +35 -0
  258. package/utils/fleet.ts +15 -73
  259. package/utils/object.js +48 -5
  260. package/utils/validators/formRules/__tests__/index.test.ts +10 -1
  261. package/utils/validators/formRules/index.ts +27 -3
  262. package/utils/validators/machine-pool.ts +20 -0
  263. package/components/DisableAuthProviderModal.vue +0 -114
  264. package/components/MoveModal.vue +0 -166
  265. package/components/PromptChangePassword.vue +0 -123
  266. package/components/fleet/FleetBundleResources.vue +0 -86
  267. package/components/formatter/ExtensionCache.vue +0 -74
  268. package/components/formatter/Port.vue +0 -24
  269. package/components/formatter/SecretType.vue +0 -41
  270. package/types/vue-shim.d +0 -20
@@ -62,8 +62,21 @@ export interface ValidationOptions {
62
62
  key?: string,
63
63
  }
64
64
 
65
- // "t" is the function name we use for getting a translated string
66
- export default function(t: Translation, { key = 'Value' }: ValidationOptions): { [key:string]: Validator<any> | ValidatorFactory } {
65
+ /**
66
+ * @param t the function name we use for getting a translated string
67
+ * @param key the argument passed to the translation to reference the label
68
+ * @returns { Validator<any> | ValidatorFactory } A dictionary of actual validation functions or factories (require parameter)
69
+ * @description
70
+ * This function returns a set of validators that can be used in the form validation process.
71
+ * @example
72
+ * const validators = formRulesGenerator(t, { key: 'MyLabel' });
73
+ * validators.required(); // '"MyLabel" is required'
74
+ * validators.minLength(5)('123'); // '"MyLabel" must contain more than 5 characters'
75
+ */
76
+ export default function(
77
+ t: Translation,
78
+ { key = 'Value' }: ValidationOptions
79
+ ): { [key: string]: Validator<any> | ValidatorFactory } {
67
80
  // utility validators these validators only get used by other validators
68
81
  const startDot: ValidatorFactory = (label: string): Validator => (val: string) => val?.slice(0, 1) === '.' ? t(`validation.dns.${ label }.startDot`, { key }) : undefined;
69
82
 
@@ -157,7 +170,18 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): {
157
170
 
158
171
  const url: Validator = (val: string) => val && !isUrl(val) ? t('validation.setting.serverUrl.url') : undefined;
159
172
 
160
- const gitRepository: Validator = (val: string) => val && !/^((http|git|ssh|http(s)|file|\/?)|(git@[\w\.]+))(:(\/\/)?)([\w\.@\:\/\-]+)([\d\/\w.-]+?)(.git){0,1}(\/)?$/gm.test(val) ? t('validation.git.repository') : undefined;
173
+ const gitRepository: Validator = (url: string) => {
174
+ const regexPart1 = /^((http|git|ssh|http(s)|file|\/?)|(git@[\w\.]+))(:(\/\/)?)/gm;
175
+ const regexPart2 = /^([\w\.@\:\/\-]+)([\d\/\w.-]+?)(.git){0,1}(\/)?$/gm;
176
+
177
+ if (url) {
178
+ const urlPart2 = url.replaceAll(regexPart1, '');
179
+
180
+ return !urlPart2 || url === urlPart2 || !regexPart2.test(urlPart2.replaceAll('%20', '')) ? t('validation.git.repository') : undefined;
181
+ }
182
+
183
+ return undefined;
184
+ };
161
185
 
162
186
  const alphanumeric: Validator = (val: string) => val && !/^[a-zA-Z0-9]+$/.test(val) ? t('validation.alphanumeric', { key }) : undefined;
163
187
 
@@ -0,0 +1,20 @@
1
+ const FIELDS = {
2
+ NAME: 'pool.name',
3
+ QUANTITY: 'pool.quantity'
4
+ };
5
+
6
+ const RULESETS = [
7
+ {
8
+ path: FIELDS.QUANTITY,
9
+ rules: ['requiredInt', 'isPositive'],
10
+ },
11
+ {
12
+ path: FIELDS.NAME,
13
+ rules: ['required'],
14
+ }
15
+ ];
16
+
17
+ export const MACHINE_POOL_VALIDATION = {
18
+ FIELDS,
19
+ RULESETS
20
+ };
@@ -1,114 +0,0 @@
1
- <script>
2
- import { Card } from '@components/Card';
3
- import AppModal from '@shell/components/AppModal.vue';
4
-
5
- export default {
6
- name: 'PromptRemove',
7
-
8
- emits: ['disable'],
9
-
10
- components: { Card, AppModal },
11
- props: {
12
- /**
13
- * Inherited global identifier prefix for tests
14
- * Define a term based on the parent component to avoid conflicts on multiple components
15
- */
16
- componentTestid: {
17
- type: String,
18
- default: 'disable-auth-provider'
19
- }
20
- },
21
- data() {
22
- return { showModal: false };
23
- },
24
- methods: {
25
- show() {
26
- this.showModal = true;
27
- },
28
- close() {
29
- this.showModal = false;
30
- },
31
- disable() {
32
- this.showModal = false;
33
- this.$emit('disable');
34
- },
35
- }
36
- };
37
- </script>
38
-
39
- <template>
40
- <app-modal
41
- v-if="showModal"
42
- custom-class="remove-modal"
43
- name="disableAuthProviderModal"
44
- :width="400"
45
- height="auto"
46
- styles="max-height: 100vh;"
47
- @close="close"
48
- >
49
- <Card
50
- class="disable-auth-provider"
51
- :show-highlight-border="false"
52
- >
53
- <template #title>
54
- <h4 class="text-default-text">
55
- {{ t('promptRemove.title') }}
56
- </h4>
57
- </template>
58
- <template #body>
59
- <div class="mb-10">
60
- <p v-clean-html="t('promptRemove.attemptingToRemoveAuthConfig', null, true)" />
61
- </div>
62
- </template>
63
- <template #actions>
64
- <button
65
- class="btn role-secondary"
66
- @click="close"
67
- >
68
- {{ t('generic.cancel') }}
69
- </button>
70
- <div class="spacer" />
71
- <button
72
- class="btn role-primary bg-error ml-10"
73
- :data-testid="componentTestid + '-confirm-button'"
74
- @click="disable"
75
- >
76
- {{ t('generic.disable') }}
77
- </button>
78
- </template>
79
- </Card>
80
- </app-modal>
81
- </template>
82
-
83
- <style lang='scss'>
84
- .disable-auth-provider {
85
- &.card-container {
86
- box-shadow: none;
87
- }
88
- #confirm {
89
- width: 90%;
90
- margin-left: 3px;
91
- }
92
-
93
- .remove-modal {
94
- border-radius: var(--border-radius);
95
- overflow: scroll;
96
- max-height: 100vh;
97
- & ::-webkit-scrollbar-corner {
98
- background: rgba(0,0,0,0);
99
- }
100
- }
101
-
102
- .actions {
103
- text-align: right;
104
- }
105
-
106
- .card-actions {
107
- display: flex;
108
-
109
- .spacer {
110
- flex: 1;
111
- }
112
- }
113
- }
114
- </style>
@@ -1,166 +0,0 @@
1
- <script>
2
- import { mapState, mapGetters } from 'vuex';
3
- import { Card } from '@components/Card';
4
- import AsyncButton from '@shell/components/AsyncButton';
5
- import AppModal from '@shell/components/AppModal.vue';
6
- import LabeledSelect from '@shell/components/form/LabeledSelect';
7
- import { MANAGEMENT } from '@shell/config/types';
8
- import Loading from '@shell/components/Loading';
9
- import { PROJECT } from '@shell/config/labels-annotations';
10
-
11
- export default {
12
- emits: ['moving'],
13
-
14
- components: {
15
- AsyncButton, Card, LabeledSelect, Loading, AppModal
16
- },
17
-
18
- async fetch() {
19
- this.projects = await this.$store.dispatch('management/findAll', { type: MANAGEMENT.PROJECT });
20
- },
21
-
22
- data() {
23
- return {
24
- modalName: 'move-modal', projects: [], targetProject: null, showModal: false
25
- };
26
- },
27
-
28
- computed: {
29
- ...mapState('action-menu', ['showPromptMove', 'toMove']),
30
- ...mapGetters(['currentCluster']),
31
-
32
- excludedProjects() {
33
- return this.toMove.filter((namespace) => !!namespace.project).map((namespace) => namespace.project.shortId);
34
- },
35
-
36
- projectOptions() {
37
- return this.projects.reduce((inCluster, project) => {
38
- if (!this.excludedProjects.includes(project.shortId) && project.spec?.clusterName === this.currentCluster.id) {
39
- inCluster.push({
40
- value: project.shortId,
41
- label: project.nameDisplay
42
- });
43
- }
44
-
45
- return inCluster;
46
- }, []);
47
- }
48
- },
49
-
50
- watch: {
51
- showPromptMove(show) {
52
- if (show) {
53
- this.showModal = true;
54
- } else {
55
- this.showModal = false;
56
- }
57
- }
58
- },
59
-
60
- methods: {
61
- close() {
62
- this.$store.commit('action-menu/togglePromptMove');
63
- },
64
-
65
- async move(finish) {
66
- const cluster = this.$store.getters['currentCluster'];
67
- const clusterWithProjectId = `${ cluster.id }:${ this.targetProject }`;
68
-
69
- const promises = this.toMove.map((namespace) => {
70
- namespace.setLabel(PROJECT, this.targetProject);
71
- namespace.setAnnotation(PROJECT, clusterWithProjectId);
72
-
73
- return namespace.save();
74
- });
75
-
76
- try {
77
- this.$emit('moving');
78
- await Promise.all(promises);
79
- finish(true);
80
- this.targetProject = null;
81
- this.close();
82
- } catch (ex) {
83
- finish(false);
84
- }
85
- }
86
- }
87
- };
88
- </script>
89
- <template>
90
- <app-modal
91
- v-if="showModal"
92
- class="move-modal"
93
- :name="modalName"
94
- :width="440"
95
- height="auto"
96
- @close="close"
97
- >
98
- <Loading v-if="$fetchState.pending" />
99
- <Card
100
- v-else
101
- class="move-modal-card"
102
- :show-highlight-border="false"
103
- >
104
- <template #title>
105
- <h4 class="text-default-text">
106
- {{ t('moveModal.title') }}
107
- </h4>
108
- </template>
109
- <template #body>
110
- <div>
111
- {{ t('moveModal.description') }}
112
- <ul class="namespaces">
113
- <li
114
- v-for="(namespace, i) in toMove"
115
- :key="i"
116
- >
117
- {{ namespace.nameDisplay }}
118
- </li>
119
- </ul>
120
- </div>
121
- <LabeledSelect
122
- v-model:value="targetProject"
123
- :options="projectOptions"
124
- :label="t('moveModal.targetProject')"
125
- />
126
- </template>
127
- <template #actions>
128
- <button
129
- class="btn role-secondary"
130
- @click="close"
131
- >
132
- {{ t('generic.cancel') }}
133
- </button>
134
- <AsyncButton
135
- :action-label="t('moveModal.moveButtonLabel')"
136
- class="btn bg-primary ml-10"
137
- :disabled="!targetProject"
138
- @click="move"
139
- />
140
- </template>
141
- </Card>
142
- </app-modal>
143
- </template>
144
-
145
- <style lang='scss'>
146
- .move-modal {
147
- .namespaces {
148
- max-height: 200px;
149
- overflow-y: scroll;
150
- }
151
-
152
- .move-modal-card {
153
- box-shadow: none;
154
-
155
- border-radius: var(--border-radius);
156
- }
157
-
158
- .actions {
159
- text-align: right;
160
- }
161
- .card-actions {
162
- display: flex;
163
- justify-content: center;
164
- }
165
- }
166
- </style>
@@ -1,123 +0,0 @@
1
- <script>
2
- import { mapGetters } from 'vuex';
3
- import ChangePassword from '@shell/components/form/ChangePassword';
4
- import { Card } from '@components/Card';
5
- import AsyncButton from '@shell/components/AsyncButton';
6
- import AppModal from '@shell/components/AppModal.vue';
7
-
8
- export default {
9
- components: {
10
- Card, AsyncButton, ChangePassword, AppModal
11
- },
12
- data() {
13
- return {
14
- valid: false, password: '', showModal: false
15
- };
16
- },
17
- computed: { ...mapGetters({ t: 'i18n/t' }) },
18
- methods: {
19
- show(show) {
20
- if (show) {
21
- this.showModal = true;
22
- } else {
23
- this.showModal = false;
24
- }
25
- },
26
- async submit(buttonCb) {
27
- try {
28
- await this.$refs.changePassword.save();
29
- this.show(false);
30
- buttonCb(true);
31
- } catch (err) {
32
- buttonCb(false);
33
- }
34
- }
35
- },
36
- };
37
- </script>
38
-
39
- <template>
40
- <app-modal
41
- v-if="showModal"
42
- custom-class="change-password-modal"
43
- data-testid="change-password__modal"
44
- name="password-modal"
45
- :width="500"
46
- :height="465"
47
- :trigger-focus-trap="true"
48
- @close="show(false)"
49
- >
50
- <Card
51
- class="prompt-password"
52
- :show-highlight-border="false"
53
- >
54
- <template #title>
55
- <h4 class="text-default-text">
56
- {{ t("changePassword.title") }}
57
- </h4>
58
- </template>
59
-
60
- <template #body>
61
- <form @submit.prevent>
62
- <ChangePassword
63
- ref="changePassword"
64
- @valid="valid = $event"
65
- />
66
- </form>
67
- </template>
68
-
69
- <template #actions>
70
- <!-- type reset is required by lastpass -->
71
- <button
72
- class="btn role-secondary"
73
- role="button"
74
- :aria-label="t('changePassword.cancel')"
75
- type="reset"
76
- @click="show(false)"
77
- >
78
- {{ t("changePassword.cancel") }}
79
- </button>
80
- <AsyncButton
81
- type="submit"
82
- mode="apply"
83
- class="btn bg-error ml-10"
84
- :disabled="!valid"
85
- value="LOGIN"
86
- @click="submit"
87
- />
88
- </template>
89
- </Card>
90
- </app-modal>
91
- </template>
92
-
93
- <style lang="scss" scoped>
94
- .prompt-password {
95
- :deep() .card-wrap {
96
- display: flex;
97
- flex-direction: column;
98
-
99
- .card-body {
100
- flex: 1;
101
- justify-content: start;
102
- & > div {
103
- flex: 1;
104
- display: flex;
105
- }
106
- }
107
-
108
- .card-actions {
109
- display: flex;
110
- justify-content: flex-end;
111
- width: 100%;
112
- }
113
- }
114
- }
115
-
116
- .prompt-password {
117
- flex: 1;
118
- display: flex;
119
- form {
120
- flex: 1;
121
- }
122
- }
123
- </style>
@@ -1,86 +0,0 @@
1
- <script>
2
- import { colorForState, stateDisplay, stateSort } from '@shell/plugins/dashboard-store/resource-class';
3
- import SortableTable from '@shell/components/SortableTable';
4
- import { randomStr } from '@shell/utils/string';
5
-
6
- export default {
7
- name: 'FleetBundleResources',
8
-
9
- components: { SortableTable },
10
-
11
- props: {
12
- value: {
13
- type: Array,
14
- default: () => [],
15
- }
16
- },
17
-
18
- computed: {
19
- computedResources() {
20
- return this.value.map((item) => {
21
- const { state } = item;
22
- const color = colorForState(state).replace('text-', 'bg-');
23
- const display = stateDisplay(state);
24
-
25
- return {
26
- ...item,
27
- tableKey: randomStr(),
28
- stateBackground: color,
29
- stateDisplay: display,
30
- stateSort: stateSort(color, display),
31
- };
32
- });
33
- },
34
-
35
- resourceHeaders() {
36
- return [
37
- {
38
- name: 'state',
39
- value: 'state',
40
- label: 'State',
41
- sort: 'stateSort',
42
- formatter: 'BadgeStateFormatter',
43
- width: 100,
44
- },
45
- {
46
- name: 'apiVersion',
47
- value: 'apiVersion',
48
- sort: 'apiVersion',
49
- label: 'API Version',
50
- },
51
- {
52
- name: 'kind',
53
- value: 'kind',
54
- sort: 'kind',
55
- label: 'Kind',
56
- },
57
- {
58
- name: 'name',
59
- value: 'name',
60
- sort: 'name',
61
- label: 'Name',
62
- formatter: 'LinkDetail',
63
- },
64
- {
65
- name: 'namespace',
66
- value: 'namespace',
67
- sort: 'namespace',
68
- label: 'Namespace',
69
- },
70
- ];
71
- },
72
- }
73
- };
74
- </script>
75
-
76
- <template>
77
- <SortableTable
78
- :rows="computedResources"
79
- :headers="resourceHeaders"
80
- :table-actions="false"
81
- :row-actions="false"
82
- key-field="tableKey"
83
- default-sort-by="state"
84
- :paged="true"
85
- />
86
- </template>
@@ -1,74 +0,0 @@
1
- <script>
2
- import { BadgeState } from '@components/BadgeState';
3
- import { stateDisplay } from '@shell/plugins/dashboard-store/resource-class';
4
-
5
- export default {
6
- props: {
7
- value: {
8
- type: String,
9
- default: ''
10
- }
11
- },
12
-
13
- components: { BadgeState },
14
-
15
- data() {
16
- const STATES = {
17
- cached: {
18
- color: 'info', icon: 'dot-open', label: 'Cached', compoundIcon: 'checkmark'
19
- },
20
- pending: {
21
- color: 'warning', icon: 'tag', label: 'In Progress', compoundIcon: 'info'
22
- },
23
- disabled: {
24
- color: 'error', icon: 'dot-half', label: 'Cache Disabled', compoundIcon: 'info'
25
- },
26
- };
27
-
28
- return {
29
- STATES,
30
- stateDisplay: '',
31
- stateBackground: ''
32
- };
33
- },
34
-
35
- watch: {
36
- value: {
37
- handler() {
38
- const out = this.value || 'pending';
39
- const color = this.colorForState(out);
40
-
41
- this.stateDisplay = stateDisplay(out);
42
- this.stateBackground = color.replace('text-', 'bg-');
43
- },
44
- immediate: true
45
- }
46
- },
47
-
48
- methods: {
49
- colorForState(state) {
50
- const key = (state).toLowerCase();
51
- let color;
52
-
53
- if ( this.STATES[key] && this.STATES[key].color ) {
54
- color = this.STATES[key].color;
55
- }
56
-
57
- if ( !color ) {
58
- color = 'info';
59
- }
60
-
61
- return `text-${ color }`;
62
- }
63
- }
64
- };
65
- </script>
66
-
67
- <template>
68
- <div>
69
- <BadgeState
70
- :color="stateBackground"
71
- :label="stateDisplay"
72
- />
73
- </div>
74
- </template>
@@ -1,24 +0,0 @@
1
- <script>
2
- export default {
3
- props: {
4
- value: {
5
- type: Array,
6
- default: () => []
7
- }
8
- },
9
- data() {
10
- const { hostPort = '', protocol = '' } = this.value[0] || {};
11
-
12
- return { hostPort, protocol };
13
- }
14
- };
15
- </script>
16
-
17
- <template>
18
- <div v-if="hostPort">
19
- {{ hostPort+'/'+protocol }}
20
- </div>
21
- <div v-else>
22
-
23
- </div>
24
- </template>
@@ -1,41 +0,0 @@
1
- <script>
2
- import { SERVICE_ACCOUNT } from '@shell/config/types';
3
- export default {
4
- props: {
5
- value: {
6
- type: [String, Object],
7
- default: 'Opaque'
8
- }
9
- },
10
- data() {
11
- if (this.value.typeDisplay) {
12
- this.findServiceAccount();
13
-
14
- return { typeDisplay: this.value.typeDisplay, serviceAccountLink: null };
15
- }
16
-
17
- return { typeDisplay: this.value, serviceAccountLink: null };
18
- },
19
- methods: {
20
- async findServiceAccount() {
21
- const serviceAccount = await this.$store.dispatch('cluster/find', { type: SERVICE_ACCOUNT, id: this.value.serviceAccountID });
22
-
23
- if (serviceAccount) {
24
- this.serviceAccountLink = serviceAccount.detailLocation;
25
- }
26
- }
27
- }
28
- };
29
- </script>>
30
-
31
- <template>
32
- <router-link
33
- v-if="serviceAccountLink"
34
- :to="serviceAccountLink"
35
- >
36
- {{ typeDisplay }}
37
- </router-link>
38
- <div v-else>
39
- {{ typeDisplay }}
40
- </div>
41
- </template>