@rancher/shell 3.0.5-rc.5 → 3.0.5-rc.6

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 (312) hide show
  1. package/assets/data/aws-regions.json +1 -0
  2. package/assets/images/key.svg +17 -0
  3. package/assets/styles/base/_spacing.scss +2 -2
  4. package/assets/styles/global/_form.scss +1 -1
  5. package/assets/styles/global/_labeled-input.scss +1 -1
  6. package/assets/styles/themes/_dark.scss +3 -0
  7. package/assets/styles/themes/_light.scss +3 -0
  8. package/assets/styles/vendor/vue-select.scss +1 -1
  9. package/assets/translations/en-us.yaml +404 -64
  10. package/assets/translations/zh-hans.yaml +3 -4
  11. package/cloud-credential/gcp.vue +9 -1
  12. package/components/AppModal.vue +2 -0
  13. package/components/CodeMirror.vue +1 -1
  14. package/components/ConfigMapSettings/Settings.vue +377 -0
  15. package/components/ConfigMapSettings/index.vue +354 -0
  16. package/components/CruResource.vue +1 -2
  17. package/components/DetailText.vue +61 -11
  18. package/components/Drawer/Chrome.vue +116 -0
  19. package/components/Drawer/ResourceDetailDrawer/ConfigTab.vue +61 -0
  20. package/components/Drawer/ResourceDetailDrawer/YamlTab.vue +48 -0
  21. package/components/Drawer/ResourceDetailDrawer/__tests__/ConfigTab.test.ts +54 -0
  22. package/components/Drawer/ResourceDetailDrawer/__tests__/YamlTab.test.ts +80 -0
  23. package/components/Drawer/ResourceDetailDrawer/__tests__/composables.test.ts +82 -0
  24. package/components/Drawer/ResourceDetailDrawer/__tests__/helpers.test.ts +42 -0
  25. package/components/Drawer/ResourceDetailDrawer/composables.ts +50 -0
  26. package/components/Drawer/ResourceDetailDrawer/helpers.ts +10 -0
  27. package/components/Drawer/ResourceDetailDrawer/index.vue +110 -0
  28. package/components/GrowlManager.vue +16 -15
  29. package/components/IconOrSvg.vue +5 -0
  30. package/components/KeyValueView.vue +1 -1
  31. package/components/LocaleSelector.vue +9 -1
  32. package/components/ProgressBarMulti.vue +1 -0
  33. package/components/PromptModal.vue +6 -1
  34. package/components/RelatedResources.vue +4 -12
  35. package/components/Resource/Detail/Additional.vue +46 -0
  36. package/components/Resource/Detail/Metadata/Annotations/__tests__/index.test.ts +1 -1
  37. package/components/Resource/Detail/Metadata/Annotations/index.vue +5 -0
  38. package/components/Resource/Detail/Metadata/IdentifyingInformation/__tests__/identifying-fields.test.ts +223 -0
  39. package/components/Resource/Detail/Metadata/IdentifyingInformation/composable.ts +37 -254
  40. package/components/Resource/Detail/Metadata/IdentifyingInformation/identifying-fields.ts +298 -0
  41. package/components/Resource/Detail/Metadata/IdentifyingInformation/index.vue +27 -5
  42. package/components/Resource/Detail/Metadata/KeyValue.vue +25 -17
  43. package/components/Resource/Detail/Metadata/Labels/__tests__/index.test.ts +1 -1
  44. package/components/Resource/Detail/Metadata/Labels/index.vue +4 -0
  45. package/components/Resource/Detail/Metadata/__tests__/KeyValue.test.ts +1 -1
  46. package/components/Resource/Detail/Metadata/__tests__/Rectangle.test.ts +1 -1
  47. package/components/Resource/Detail/Metadata/__tests__/composables.test.ts +75 -0
  48. package/components/Resource/Detail/Metadata/composables.ts +60 -11
  49. package/components/Resource/Detail/Metadata/index.vue +12 -5
  50. package/components/Resource/Detail/Page.vue +15 -0
  51. package/components/Resource/Detail/ResourceRow.vue +37 -18
  52. package/components/Resource/Detail/ResourceTabs/ConfigMapDataTab/__tests__/composables.test.ts +29 -0
  53. package/components/Resource/Detail/ResourceTabs/ConfigMapDataTab/__tests__/index.test.ts +48 -0
  54. package/components/Resource/Detail/ResourceTabs/ConfigMapDataTab/composables.ts +31 -0
  55. package/components/Resource/Detail/ResourceTabs/ConfigMapDataTab/index.vue +50 -0
  56. package/components/Resource/Detail/ResourceTabs/KnownHostsTab/__tests__/composables.test.ts +66 -0
  57. package/components/Resource/Detail/ResourceTabs/KnownHostsTab/composables.ts +21 -0
  58. package/components/Resource/Detail/ResourceTabs/KnownHostsTab/index.vue +31 -0
  59. package/components/Resource/Detail/ResourceTabs/SecretDataTab/Basic.vue +45 -0
  60. package/components/Resource/Detail/ResourceTabs/SecretDataTab/BasicAuth.vue +31 -0
  61. package/components/Resource/Detail/ResourceTabs/SecretDataTab/Certificate.vue +31 -0
  62. package/components/Resource/Detail/ResourceTabs/SecretDataTab/Registry.vue +22 -0
  63. package/components/Resource/Detail/ResourceTabs/SecretDataTab/ServiceAccountToken.vue +31 -0
  64. package/components/Resource/Detail/ResourceTabs/SecretDataTab/Ssh.vue +32 -0
  65. package/components/Resource/Detail/ResourceTabs/SecretDataTab/__tests__/Basic.test.ts +40 -0
  66. package/components/Resource/Detail/ResourceTabs/SecretDataTab/__tests__/BasicAuth.test.ts +33 -0
  67. package/components/Resource/Detail/ResourceTabs/SecretDataTab/__tests__/Certificate.test.ts +33 -0
  68. package/components/Resource/Detail/ResourceTabs/SecretDataTab/__tests__/Registry.test.ts +27 -0
  69. package/components/Resource/Detail/ResourceTabs/SecretDataTab/__tests__/ServiceAccountToken.test.ts +33 -0
  70. package/components/Resource/Detail/ResourceTabs/SecretDataTab/__tests__/Ssh.test.ts +33 -0
  71. package/components/Resource/Detail/ResourceTabs/SecretDataTab/__tests__/auth-types.test.ts +186 -0
  72. package/components/Resource/Detail/ResourceTabs/SecretDataTab/__tests__/composables.test.ts +102 -0
  73. package/components/Resource/Detail/ResourceTabs/SecretDataTab/auth-types.ts +109 -0
  74. package/components/Resource/Detail/ResourceTabs/SecretDataTab/composeables.ts +52 -0
  75. package/components/Resource/Detail/ResourceTabs/SecretDataTab/index.vue +71 -0
  76. package/components/Resource/Detail/TitleBar/Title.vue +2 -1
  77. package/components/Resource/Detail/TitleBar/__tests__/Title.test.ts +1 -1
  78. package/components/Resource/Detail/TitleBar/__tests__/Top.test.ts +1 -1
  79. package/components/Resource/Detail/TitleBar/__tests__/composables.test.ts +63 -0
  80. package/components/Resource/Detail/TitleBar/__tests__/index.test.ts +1 -1
  81. package/components/Resource/Detail/TitleBar/composables.ts +44 -0
  82. package/components/Resource/Detail/TitleBar/index.vue +83 -11
  83. package/components/Resource/Detail/composables.ts +45 -0
  84. package/components/ResourceDetail/Masthead/__tests__/index.test.ts +70 -0
  85. package/components/ResourceDetail/{__tests__/Masthead.test.ts → Masthead/__tests__/legacy.test.ts} +3 -3
  86. package/components/ResourceDetail/Masthead/index.vue +65 -0
  87. package/components/ResourceDetail/Masthead/latest.vue +44 -0
  88. package/components/ResourceDetail/__tests__/index.test.ts +26 -5
  89. package/components/ResourceDetail/index.vue +30 -16
  90. package/components/ResourceDetail/legacy.vue +18 -1
  91. package/components/ResourceList/Masthead.vue +6 -0
  92. package/components/ResourceYaml.vue +14 -1
  93. package/components/SlideInPanelManager.vue +46 -7
  94. package/components/StateDot/index.vue +28 -0
  95. package/components/Tabbed/index.vue +11 -15
  96. package/components/Wizard.vue +4 -2
  97. package/components/__tests__/ConfigMapSettings.test.ts +376 -0
  98. package/components/__tests__/GrowlManager.test.ts +0 -25
  99. package/components/auth/login/ldap.vue +1 -1
  100. package/components/fleet/FleetApplications.vue +0 -7
  101. package/components/fleet/FleetClusterTargets/TargetsList.vue +66 -0
  102. package/components/fleet/FleetClusterTargets/index.vue +455 -0
  103. package/components/fleet/FleetClusters.vue +25 -6
  104. package/components/fleet/FleetGitRepoPaths.vue +476 -0
  105. package/components/fleet/FleetHelmOps.vue +8 -0
  106. package/components/fleet/FleetRepos.vue +1 -6
  107. package/components/fleet/FleetResources.vue +4 -5
  108. package/components/fleet/FleetValuesFrom.vue +295 -0
  109. package/components/fleet/__tests__/FleetClusterTargets.test.ts +1224 -0
  110. package/components/fleet/__tests__/FleetGitRepoPaths.test.ts +265 -0
  111. package/components/fleet/__tests__/FleetOCIStorageSecret.test.ts +13 -13
  112. package/components/fleet/__tests__/FleetValuesFrom.test.ts +300 -0
  113. package/components/fleet/dashboard/ResourceCard.vue +1 -0
  114. package/components/fleet/dashboard/ResourceCardSummary.vue +1 -5
  115. package/components/fleet/dashboard/ResourceDetails.vue +8 -10
  116. package/components/fleet/dashboard/ResourcePanel.vue +15 -8
  117. package/components/form/ArrayList.vue +13 -2
  118. package/components/form/ChangePassword.vue +3 -1
  119. package/components/form/Footer.vue +10 -4
  120. package/components/form/KeyValue.vue +81 -43
  121. package/components/form/LabeledSelect.vue +56 -16
  122. package/components/form/Labels.vue +90 -17
  123. package/components/form/MatchExpressions.vue +46 -5
  124. package/components/form/NameNsDescription.vue +1 -1
  125. package/components/form/ResourceSelector.vue +1 -0
  126. package/components/form/ResourceTabs/index.vue +5 -0
  127. package/components/form/SecretSelector.vue +9 -2
  128. package/components/form/Select.vue +57 -19
  129. package/components/form/SimpleSecretSelector.vue +9 -2
  130. package/components/form/Taints.vue +21 -2
  131. package/components/form/UnitInput.vue +8 -0
  132. package/components/form/ValueFromResource.vue +1 -1
  133. package/components/form/__tests__/LabeledSelect.test.ts +8 -4
  134. package/components/form/__tests__/Labels.test.ts +360 -0
  135. package/components/form/__tests__/MatchExpressions.test.ts +16 -13
  136. package/components/form/__tests__/Select.test.ts +5 -2
  137. package/components/formatter/FleetApplicationSource.vue +1 -1
  138. package/components/formatter/WorkloadHealthScale.vue +1 -1
  139. package/components/google/AccountAccess.vue +211 -0
  140. package/components/google/types/gcp.d.ts +136 -0
  141. package/components/google/types/index.d.ts +101 -0
  142. package/components/google/util/__mocks__/gcp.ts +465 -0
  143. package/components/google/util/formatter.ts +82 -0
  144. package/components/google/util/gcp.ts +134 -0
  145. package/components/google/util/index.d.ts +11 -0
  146. package/components/nav/Favorite.vue +1 -1
  147. package/components/nav/Group.vue +70 -47
  148. package/components/nav/Header.vue +5 -1
  149. package/components/nav/NamespaceFilter.vue +13 -1
  150. package/components/nav/NotificationCenter/Notification.vue +510 -0
  151. package/components/nav/NotificationCenter/NotificationHeader.vue +112 -0
  152. package/components/nav/NotificationCenter/index.vue +148 -0
  153. package/composables/drawer.ts +26 -0
  154. package/composables/resources.test.ts +63 -0
  155. package/composables/resources.ts +38 -0
  156. package/composables/useIsNewDetailPageEnabled.ts +17 -0
  157. package/config/labels-annotations.js +6 -0
  158. package/config/product/auth.js +16 -1
  159. package/config/product/{cis.js → compliance.js} +23 -26
  160. package/config/product/explorer.js +5 -1
  161. package/config/product/fleet.js +7 -0
  162. package/config/product/settings.js +22 -11
  163. package/config/query-params.js +3 -0
  164. package/config/roles.ts +1 -1
  165. package/config/router/navigation-guards/authentication.js +51 -2
  166. package/config/router/routes.js +27 -31
  167. package/config/settings.ts +21 -3
  168. package/config/store.js +2 -0
  169. package/config/system-namespaces.js +1 -1
  170. package/config/table-headers.js +2 -2
  171. package/config/types.js +15 -6
  172. package/core/plugin.ts +32 -7
  173. package/core/types.ts +18 -1
  174. package/detail/{cis.cattle.io.clusterscan.vue → compliance.cattle.io.clusterscan.vue} +22 -18
  175. package/detail/management.cattle.io.fleetworkspace.vue +18 -27
  176. package/detail/management.cattle.io.oidcclient.vue +369 -0
  177. package/detail/node.vue +2 -2
  178. package/detail/pod.vue +2 -2
  179. package/detail/service.vue +10 -1
  180. package/detail/workload/index.vue +8 -2
  181. package/dialog/ExtensionCatalogUninstallDialog.vue +7 -4
  182. package/dialog/GenericPrompt.vue +1 -1
  183. package/dialog/ImportDialog.vue +8 -8
  184. package/dialog/OidcClientSecretDialog.vue +117 -0
  185. package/edit/__tests__/cis.cattle.io.clusterscan.test.ts +3 -3
  186. package/edit/__tests__/fleet.cattle.io.gitrepo.test.ts +5 -2
  187. package/edit/autoscaling.horizontalpodautoscaler/index.vue +4 -1
  188. package/edit/{cis.cattle.io.clusterscan.vue → compliance.cattle.io.clusterscan.vue} +30 -31
  189. package/edit/{cis.cattle.io.clusterscanbenchmark.vue → compliance.cattle.io.clusterscanbenchmark.vue} +4 -4
  190. package/edit/{cis.cattle.io.clusterscanprofile.vue → compliance.cattle.io.clusterscanprofile.vue} +5 -5
  191. package/edit/configmap.vue +4 -1
  192. package/edit/constraints.gatekeeper.sh.constraint/index.vue +1 -0
  193. package/edit/fleet.cattle.io.gitrepo.vue +44 -222
  194. package/edit/fleet.cattle.io.helmop.vue +44 -269
  195. package/edit/helm.cattle.io.projecthelmchart.vue +1 -0
  196. package/edit/k8s.cni.cncf.io.networkattachmentdefinition.vue +1 -0
  197. package/edit/logging-flow/index.vue +1 -0
  198. package/edit/logging.banzaicloud.io.output/index.vue +1 -0
  199. package/edit/management.cattle.io.fleetworkspace.vue +1 -0
  200. package/edit/management.cattle.io.oidcclient.vue +162 -0
  201. package/edit/management.cattle.io.project.vue +4 -1
  202. package/edit/monitoring.coreos.com.alertmanagerconfig/index.vue +1 -1
  203. package/edit/monitoring.coreos.com.alertmanagerconfig/receiverConfig.vue +5 -0
  204. package/edit/monitoring.coreos.com.prometheusrule/index.vue +1 -0
  205. package/edit/monitoring.coreos.com.receiver/auth.vue +30 -30
  206. package/edit/monitoring.coreos.com.receiver/index.vue +1 -0
  207. package/edit/monitoring.coreos.com.receiver/types/email.vue +1 -1
  208. package/edit/monitoring.coreos.com.route.vue +1 -0
  209. package/edit/namespace.vue +1 -0
  210. package/edit/networking.istio.io.destinationrule/index.vue +4 -1
  211. package/edit/networking.k8s.io.ingress/index.vue +4 -1
  212. package/edit/networking.k8s.io.networkpolicy/PolicyRules.vue +7 -2
  213. package/edit/networking.k8s.io.networkpolicy/index.vue +6 -2
  214. package/edit/node.vue +1 -0
  215. package/edit/persistentvolume/index.vue +4 -1
  216. package/edit/provisioning.cattle.io.cluster/rke2.vue +418 -382
  217. package/edit/provisioning.cattle.io.cluster/tabs/Basics.vue +27 -27
  218. package/edit/provisioning.cattle.io.cluster/tabs/MachinePool.vue +5 -0
  219. package/edit/resources.cattle.io.restore.vue +1 -1
  220. package/edit/secret/index.vue +1 -0
  221. package/edit/service.vue +4 -1
  222. package/edit/serviceaccount.vue +4 -1
  223. package/edit/storage.k8s.io.storageclass/index.vue +4 -1
  224. package/edit/workload/index.vue +5 -0
  225. package/list/{cis.cattle.io.clusterscan.vue → compliance.cattle.io.clusterscan.vue} +2 -2
  226. package/list/management.cattle.io.oidcclient.vue +108 -0
  227. package/list/node.vue +2 -0
  228. package/machine-config/amazonec2.vue +3 -24
  229. package/machine-config/components/GCEImage.vue +374 -0
  230. package/machine-config/google.vue +617 -0
  231. package/mixins/__tests__/brand.spec.ts +170 -0
  232. package/mixins/brand.js +16 -17
  233. package/mixins/create-edit-view/index.js +5 -0
  234. package/mixins/resource-fetch-api-pagination.js +16 -0
  235. package/mixins/vue-select-overrides.js +1 -0
  236. package/models/{cis.cattle.io.clusterscan.js → compliance.cattle.io.clusterscan.js} +8 -8
  237. package/models/{cis.cattle.io.clusterscanbenchmark.js → compliance.cattle.io.clusterscanbenchmark.js} +1 -1
  238. package/models/{cis.cattle.io.clusterscanprofile.js → compliance.cattle.io.clusterscanprofile.js} +5 -5
  239. package/models/{cis.cattle.io.clusterscanreport.js → compliance.cattle.io.clusterscanreport.js} +1 -1
  240. package/models/fleet-application.js +8 -79
  241. package/models/fleet.cattle.io.cluster.js +11 -0
  242. package/models/fleet.cattle.io.gitrepo.js +2 -2
  243. package/models/fleet.cattle.io.helmop.js +9 -39
  244. package/models/management.cattle.io.fleetworkspace.js +2 -1
  245. package/models/management.cattle.io.oidcclient.js +18 -0
  246. package/models/management.cattle.io.registration.js +3 -0
  247. package/models/provisioning.cattle.io.cluster.js +5 -5
  248. package/models/service.js +4 -0
  249. package/models/workload.js +5 -0
  250. package/package.json +1 -1
  251. package/pages/about.vue +4 -58
  252. package/pages/auth/login.vue +1 -1
  253. package/pages/c/_cluster/apps/charts/AddRepoLink.vue +0 -1
  254. package/pages/c/_cluster/apps/charts/index.vue +285 -81
  255. package/pages/c/_cluster/auth/user.retention/index.vue +87 -78
  256. package/pages/c/_cluster/explorer/index.vue +3 -3
  257. package/pages/c/_cluster/explorer/tools/pages/_page.vue +0 -1
  258. package/pages/c/_cluster/fleet/application/create.vue +3 -2
  259. package/pages/c/_cluster/fleet/index.vue +94 -56
  260. package/pages/c/_cluster/fleet/settings/index.vue +229 -0
  261. package/pages/c/_cluster/longhorn/index.vue +5 -2
  262. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +16 -1
  263. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +2 -2
  264. package/pages/explorer/resource/detail/configmap.vue +30 -7
  265. package/pages/explorer/resource/detail/secret.vue +50 -0
  266. package/pages/home.vue +9 -55
  267. package/pages/support/index.vue +4 -6
  268. package/plugins/dashboard-store/actions.js +19 -5
  269. package/plugins/dashboard-store/getters.js +4 -0
  270. package/plugins/dashboard-store/resource-class.js +16 -2
  271. package/plugins/steve/steve-pagination-utils.ts +26 -18
  272. package/plugins/steve/subscribe.js +6 -1
  273. package/rancher-components/Banner/Banner.vue +13 -0
  274. package/rancher-components/Form/Checkbox/Checkbox.vue +9 -4
  275. package/rancher-components/Form/LabeledInput/LabeledInput.vue +1 -1
  276. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +1 -0
  277. package/rancher-components/RcItemCard/RcItemCard.vue +8 -3
  278. package/store/auth.js +2 -0
  279. package/store/catalog.js +23 -1
  280. package/store/growl.js +97 -8
  281. package/store/index.js +6 -0
  282. package/store/notifications.ts +426 -0
  283. package/store/prefs.js +0 -1
  284. package/store/type-map.js +19 -16
  285. package/store/uiplugins.ts +15 -1
  286. package/types/fleet.d.ts +24 -0
  287. package/types/notifications/index.ts +74 -0
  288. package/types/shell/index.d.ts +46 -32
  289. package/types/store/dashboard-store.types.ts +16 -0
  290. package/utils/__tests__/fleet.test.ts +148 -0
  291. package/utils/__tests__/object.test.ts +54 -1
  292. package/utils/__tests__/string.test.ts +273 -1
  293. package/utils/__tests__/time.test.ts +31 -0
  294. package/utils/auth.js +9 -2
  295. package/utils/crypto/encryption.ts +103 -0
  296. package/utils/cspAdaptor.ts +51 -0
  297. package/utils/fleet.ts +54 -65
  298. package/utils/object.js +36 -0
  299. package/utils/pagination-utils.ts +1 -1
  300. package/utils/release-notes.ts +48 -0
  301. package/utils/selector-typed.ts +7 -2
  302. package/utils/string.js +24 -0
  303. package/utils/{time.js → time.ts} +25 -6
  304. package/utils/uiplugins.ts +22 -0
  305. package/utils/validators/formRules/index.ts +3 -0
  306. package/components/Resource/Detail/TitleBar/composable.ts +0 -31
  307. package/config/product/legacy.js +0 -62
  308. package/pages/c/_cluster/legacy/pages/_page.vue +0 -29
  309. package/pages/c/_cluster/legacy/project/_page.vue +0 -57
  310. package/pages/c/_cluster/legacy/project/index.vue +0 -32
  311. package/pages/c/_cluster/legacy/project/pipelines.vue +0 -96
  312. /package/components/ResourceDetail/{Masthead.vue → Masthead/legacy.vue} +0 -0
@@ -0,0 +1,354 @@
1
+ <script lang="ts">
2
+ import { PropType } from 'vue';
3
+ import jsyaml from 'js-yaml';
4
+ import { merge } from 'lodash';
5
+ import { set, get } from '@shell/utils/object';
6
+ import YAML from 'yaml';
7
+ import { CONFIG_MAP, MANAGEMENT } from '@shell/config/types';
8
+ import { _EDIT, _VIEW } from '@shell/config/query-params';
9
+ import { toSeconds } from '@shell/utils/duration';
10
+ import Loading from '@shell/components/Loading.vue';
11
+ import AsyncButton from '@shell/components/AsyncButton.vue';
12
+ import { Banner } from '@components/Banner';
13
+ import Settings from '@shell/components/ConfigMapSettings/Settings.vue';
14
+
15
+ export type SettingType = 'string' | 'number' | 'boolean' | 'array' | 'object';
16
+
17
+ export type SettingHandler = 'Textarea' | 'KeyValue' | 'Taints' | 'UnitInput';
18
+
19
+ export interface Item {
20
+ type: SettingType,
21
+ value: string
22
+ }
23
+
24
+ export interface Group {
25
+ name: string,
26
+ children: string[],
27
+ expanded?: boolean,
28
+ weight: number,
29
+ }
30
+
31
+ export interface Setting {
32
+ path: string,
33
+ type: SettingType,
34
+ handler?: SettingHandler,
35
+ items?: Item[],
36
+ default: object | string | boolean | number,
37
+ tooltip?: boolean,
38
+ info?: boolean,
39
+ placeholder?: boolean,
40
+ class?: string,
41
+ weight: number,
42
+ // validationRules,
43
+ }
44
+
45
+ interface DataType {
46
+ noPermissions: boolean,
47
+ configMap: object | null,
48
+ values: object,
49
+ errors: string[]
50
+ valuesErrors: string[],
51
+ }
52
+
53
+ export default {
54
+
55
+ name: 'ConfigMapSettings',
56
+
57
+ emits: ['done', 'errors'],
58
+
59
+ components: {
60
+ Loading,
61
+ AsyncButton,
62
+ Banner,
63
+ Settings,
64
+ },
65
+
66
+ props: {
67
+ /**
68
+ * A key-value object that defines a flat list of settings.
69
+ * Each entry describe the setting name and the path where to get/set in the ConfigMap data field
70
+ *
71
+ * example:
72
+ *
73
+ * {
74
+ * setting-name: {
75
+ * weight: 0,
76
+ * type: 'number',
77
+ * path: 'the.path.to.nested.value',
78
+ * default: '50',
79
+ * tooltip: false,
80
+ * info: false,
81
+ * },
82
+ * ...
83
+ * }
84
+ */
85
+ settings: {
86
+ type: Object as PropType<Record<string, Setting>>,
87
+ required: true
88
+ },
89
+
90
+ /**
91
+ * Groups of Settings
92
+ */
93
+ groups: {
94
+ type: Array as PropType<Group[]>,
95
+ default: () => [],
96
+ },
97
+
98
+ /**
99
+ * ConfigMap name
100
+ */
101
+ name: {
102
+ type: String,
103
+ required: true
104
+ },
105
+
106
+ /**
107
+ * ConfigMap namespace
108
+ */
109
+ namespace: {
110
+ type: String,
111
+ required: true
112
+ },
113
+
114
+ /**
115
+ * The key in ConfigMap.data where to save the settings values
116
+ */
117
+ dataKey: {
118
+ type: String,
119
+ required: true
120
+ },
121
+
122
+ inStore: {
123
+ type: String,
124
+ default: 'cluster',
125
+ },
126
+
127
+ labelKeyPrefix: {
128
+ type: String,
129
+ default: 'settings'
130
+ },
131
+
132
+ showDescription: {
133
+ type: Boolean,
134
+ default: false
135
+ },
136
+
137
+ showInfo: {
138
+ type: Boolean,
139
+ default: false
140
+ },
141
+ },
142
+
143
+ async fetch() {
144
+ if (this.$store.getters[`${ this.inStore }/schemaFor`](CONFIG_MAP)) {
145
+ try {
146
+ this.configMap = await this.$store.dispatch(`${ this.inStore }/find`, { type: CONFIG_MAP, id: `${ this.namespace }/${ this.name }` });
147
+ } catch (err) {
148
+ }
149
+
150
+ this.initValues();
151
+ } else {
152
+ this.noPermissions = true;
153
+ }
154
+ },
155
+
156
+ data(): DataType {
157
+ return {
158
+ noPermissions: false,
159
+ configMap: null,
160
+ values: {},
161
+ errors: [],
162
+ valuesErrors: []
163
+ };
164
+ },
165
+
166
+ computed: {
167
+ mode() {
168
+ if (this.valuesErrors.length) {
169
+ return _VIEW;
170
+ }
171
+
172
+ const settingsSchema = this.$store.getters[`${ this.inStore }/schemaFor`](MANAGEMENT.SETTING);
173
+ const configMapsSchema = this.$store.getters[`${ this.inStore }/schemaFor`](CONFIG_MAP);
174
+
175
+ if (settingsSchema?.resourceMethods?.includes('PUT') && configMapsSchema?.resourceMethods?.includes('PUT')) {
176
+ return _EDIT;
177
+ }
178
+
179
+ return _VIEW;
180
+ },
181
+
182
+ canEdit() {
183
+ return this.mode === _EDIT;
184
+ },
185
+
186
+ fetchState(): {pending: boolean} {
187
+ return (this as any).$fetchState;
188
+ },
189
+ },
190
+
191
+ methods: {
192
+ async save(btnCB: (arg: boolean) => void) {
193
+ const configMap = this.configMap || await this.$store.dispatch(`${ this.inStore }/create`, {
194
+ type: CONFIG_MAP,
195
+ metadata: {
196
+ namespace: this.namespace,
197
+ name: this.name
198
+ }
199
+ });
200
+
201
+ if (!configMap.data) {
202
+ configMap.data = {};
203
+ }
204
+
205
+ try {
206
+ const configMapValues = YAML.parse(configMap.data[this.dataKey] || '');
207
+
208
+ const currentValues = this.buildValues(this.values, this.encodeValue);
209
+
210
+ const values = merge(configMapValues, currentValues);
211
+
212
+ configMap.data[this.dataKey] = jsyaml.dump(values);
213
+
214
+ await configMap.save();
215
+
216
+ this.$emit('done', configMap);
217
+ btnCB(true);
218
+ } catch (err) {
219
+ this.errors.push(err as string);
220
+ this.$emit('errors', this.errors);
221
+ btnCB(false);
222
+ }
223
+ },
224
+
225
+ initValues() {
226
+ try {
227
+ const configMapValues = get(this.configMap || {}, `data.${ this.dataKey }`);
228
+ const currentValues = YAML.parse(configMapValues || '');
229
+
230
+ this.values = this.buildValues(currentValues, this.decodeValue);
231
+ } catch (err) {
232
+ const msg = this.t(`${ this.labelKeyPrefix }.parseError`, { id: `${ this.namespace }/${ this.name }`, path: `data.${ this.dataKey }` }, true);
233
+
234
+ this.valuesErrors.push(msg);
235
+ }
236
+ },
237
+
238
+ buildValues<T = object | string | boolean | number>(values: object, fn: (name: string, value: T) => T) {
239
+ return Object.keys(this.settings).reduce((acc, name) => {
240
+ const value = get(values, this.settings[name].path);
241
+
242
+ set(acc, this.settings[name].path, fn(name, value));
243
+
244
+ return acc;
245
+ }, {});
246
+ },
247
+
248
+ decodeValue<T = object | string | boolean | number>(name: string, value: T): T {
249
+ // use default value
250
+ if (value === undefined) {
251
+ value = this.settings[name].default as T;
252
+ }
253
+
254
+ // object types to json
255
+ if (this.settings[name].type === 'object' && this.settings[name].handler === 'Textarea') {
256
+ value = JSON.stringify(value || {}) as T;
257
+ }
258
+
259
+ // number in seconds
260
+ if (this.settings[name].type === 'number' && this.settings[name].handler === 'UnitInput') {
261
+ value = toSeconds(value) as T;
262
+ }
263
+
264
+ return value;
265
+ },
266
+
267
+ encodeValue<T = object | string | boolean | number>(name: string, value: T): T {
268
+ // object types from json
269
+ if (this.settings[name].type === 'object' && this.settings[name].handler === 'Textarea') {
270
+ value = YAML.parse(value as string);
271
+ }
272
+
273
+ // number to string with unit of measure
274
+ if (this.settings[name].type === 'number' && this.settings[name].handler === 'UnitInput') {
275
+ value = `${ value || 0 }s` as T;
276
+ }
277
+
278
+ return value;
279
+ }
280
+ }
281
+ };
282
+ </script>
283
+
284
+ <template>
285
+ <Loading v-if="fetchState.pending" />
286
+ <div v-else-if="noPermissions">
287
+ <slot name="no-permissions">
288
+ <span>
289
+ {{ t(`${ labelKeyPrefix }.noPermissions`) }}
290
+ </span>
291
+ </slot>
292
+ </div>
293
+ <div
294
+ v-else
295
+ data-testid="cm-settings"
296
+ >
297
+ <slot name="header">
298
+ <div class="header">
299
+ <h1>
300
+ {{ t(`${ labelKeyPrefix }.title`) }}
301
+ </h1>
302
+
303
+ <label
304
+ v-if="showDescription"
305
+ class="text-label"
306
+ >
307
+ {{ t(`${ labelKeyPrefix }.description`, {}, true) }}
308
+ </label>
309
+ </div>
310
+ </slot>
311
+
312
+ <slot name="info">
313
+ <Banner
314
+ v-if="showInfo"
315
+ color="info"
316
+ :label="t(`${ labelKeyPrefix }.info`, {}, true)"
317
+ />
318
+ </slot>
319
+
320
+ <slot name="errors">
321
+ <template
322
+ v-for="(err, j) in [ ...valuesErrors, ...errors ]"
323
+ :key="j"
324
+ >
325
+ <Banner
326
+ color="error"
327
+ data-testid="cm-settings-error"
328
+ :label="err"
329
+ />
330
+ </template>
331
+ </slot>
332
+
333
+ <Settings
334
+ class="mt-10"
335
+ :settings="settings"
336
+ :groups="groups"
337
+ :values="values"
338
+ :mode="mode"
339
+ :label-key-prefix="labelKeyPrefix"
340
+ @update:value="values=$event"
341
+ />
342
+
343
+ <div v-if="canEdit">
344
+ <AsyncButton
345
+ class="pull-right mt-30"
346
+ :action-label="t(`${ labelKeyPrefix }.apply`)"
347
+ @click="save"
348
+ />
349
+ </div>
350
+ </div>
351
+ </template>
352
+
353
+ <style scoped lang='scss'>
354
+ </style>
@@ -412,7 +412,6 @@ export default {
412
412
  newNamespace.applyDefaults();
413
413
  await newNamespace.save();
414
414
  } catch (e) {
415
- // this.errors = exceptionToErrorsArray(e);
416
415
  this.$emit('error', exceptionToErrorsArray(e));
417
416
  throw new Error(`Could not create the new namespace. ${ e.message }`);
418
417
  }
@@ -836,7 +835,7 @@ export default {
836
835
  :offer-preview="isEdit"
837
836
  :done-route="doneRoute"
838
837
  :done-override="resource.doneOverride"
839
- :errors="errors"
838
+ :show-errors="false"
840
839
  :apply-hooks="applyHooks"
841
840
  class="resource-container cru__content"
842
841
  @error="e=>$emit('error', e)"
@@ -22,7 +22,7 @@ export default {
22
22
 
23
23
  value: {
24
24
  type: String,
25
- default: null,
25
+ default: '',
26
26
  },
27
27
 
28
28
  maxLength: {
@@ -40,6 +40,12 @@ export default {
40
40
  default: false
41
41
  },
42
42
 
43
+ // Will manage it's own state around showing or hiding sensitive data
44
+ concealStandAlone: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+
43
49
  monospace: {
44
50
  type: Boolean,
45
51
  default: true
@@ -54,7 +60,7 @@ export default {
54
60
  data() {
55
61
  const expanded = this.value.length <= this.maxLength;
56
62
 
57
- return { expanded };
63
+ return { expanded, standAloneHide: true };
58
64
  },
59
65
 
60
66
  computed: {
@@ -127,6 +133,10 @@ export default {
127
133
  },
128
134
 
129
135
  hideSensitiveData() {
136
+ if (this.concealStandAlone) {
137
+ return this.standAloneHide;
138
+ }
139
+
130
140
  return this.$store.getters['prefs/get'](HIDE_SENSITIVE);
131
141
  },
132
142
 
@@ -134,6 +144,14 @@ export default {
134
144
  return this.conceal && this.hideSensitiveData && !this.isBinary;
135
145
  },
136
146
 
147
+ sensitiveIcon() {
148
+ return this.standAloneHide ? 'icon-show' : 'icon-hide';
149
+ },
150
+
151
+ sensitiveAria() {
152
+ return this.standAloneHide ? this.t('detailText.sensitive.show') : this.t('detailText.sensitive.hide');
153
+ },
154
+
137
155
  ...mapGetters({ t: 'i18n/t' })
138
156
  },
139
157
  methods: {
@@ -169,6 +187,7 @@ export default {
169
187
  :options="{mode:{name:'javascript', json:true}, lineNumbers:false, foldGutter:false, readOnly:true}"
170
188
  :value="jsonStr"
171
189
  :class="{'conceal': concealed}"
190
+ aria-live="polite"
172
191
  />
173
192
 
174
193
  <span
@@ -176,6 +195,7 @@ export default {
176
195
  v-clean-html="bodyHtml"
177
196
  data-testid="detail-top_html"
178
197
  :class="{'conceal': concealed, 'monospace': monospace && !isBinary}"
198
+ aria-live="polite"
179
199
  />
180
200
 
181
201
  <template v-if="!isBinary && !jsonStr && isLong && !expanded">
@@ -185,13 +205,27 @@ export default {
185
205
  >{{ plusMore }}</a>
186
206
  </template>
187
207
 
188
- <CopyToClipboard
189
- v-if="copy && !isBinary"
190
- :text="value"
191
- class="role-tertiary"
192
- action-color=""
193
- :aria-label="t('detailText.copyAriaLabel', {item: itemLabel })"
194
- />
208
+ <div class="action-group">
209
+ <button
210
+ v-if="conceal && concealStandAlone"
211
+ class="sensitive btn ready-for-action role-tertiary"
212
+ :aria-label="sensitiveAria"
213
+ @click="standAloneHide = !standAloneHide"
214
+ >
215
+ <i
216
+ class="icon icon-lg"
217
+ :class="sensitiveIcon"
218
+ :alt="sensitiveAria"
219
+ />
220
+ </button>
221
+ <CopyToClipboard
222
+ v-if="copy && !isBinary"
223
+ :text="value"
224
+ class="role-tertiary"
225
+ action-color=""
226
+ :aria-label="t('detailText.copyAriaLabel', {item: itemLabel })"
227
+ />
228
+ </div>
195
229
  </div>
196
230
  </template>
197
231
 
@@ -205,11 +239,27 @@ export default {
205
239
  border-radius: var(--border-radius);
206
240
  border: solid var(--border-width) var(--input-border);
207
241
 
208
- > button {
242
+ .action-group {
209
243
  position: absolute;
210
244
  top: -1px;
211
245
  right: -1px;
212
- border-radius: 0 0 0 var(--border-radius);
246
+ white-space-collapse:collapse;
247
+ display: flex;
248
+ flex-direction: row;
249
+ justify-content: flex-end;
250
+
251
+ button{
252
+ border-radius: 0;
253
+
254
+ &:first-of-type {
255
+ border-radius: 0 0 0 var(--border-radius);
256
+ }
257
+
258
+ &.sensitive {
259
+ margin-right: -1px;
260
+ padding: 12px 16px;
261
+ }
262
+ }
213
263
  }
214
264
  }
215
265
 
@@ -0,0 +1,116 @@
1
+ <script lang="ts">
2
+ import { useI18n } from '@shell/composables/useI18n';
3
+ import { useStore } from 'vuex';
4
+ import { computed } from 'vue';
5
+ export interface Props {
6
+ ariaTarget: string;
7
+ }
8
+ </script>
9
+
10
+ <script setup lang="ts">
11
+ const props = defineProps<Props>();
12
+ const emit = defineEmits(['close']);
13
+
14
+ const store = useStore();
15
+ const i18n = useI18n(store);
16
+
17
+ const ariaLabel = computed(() => i18n.t('component.drawer.chrome.ariaLabel.close', { target: props.ariaTarget }));
18
+
19
+ </script>
20
+ <template>
21
+ <div class="chrome">
22
+ <div class="header pp-4">
23
+ <slot name="header">
24
+ <div class="title">
25
+ <slot name="title" />
26
+ </div>
27
+ <div class="actions">
28
+ <button
29
+ class="btn role-link"
30
+ :aria-label="ariaLabel"
31
+ @click="emit('close')"
32
+ >
33
+ <i class="icon icon-close" />
34
+ </button>
35
+ </div>
36
+ </slot>
37
+ </div>
38
+ <div class="body pp-4">
39
+ <slot name="body" />
40
+ </div>
41
+ <div class="footer pp-4">
42
+ <slot name="footer">
43
+ <div class="actions">
44
+ <button
45
+ class="btn role-secondary"
46
+ :aria-label="ariaLabel"
47
+ @click="emit('close')"
48
+ >
49
+ {{ i18n.t('component.drawer.chrome.close') }}
50
+ </button>
51
+ <slot name="additional-actions" />
52
+ </div>
53
+ </slot>
54
+ </div>
55
+ </div>
56
+ </template>
57
+ <style lang="scss" scoped>
58
+ .chrome {
59
+ position: absolute;
60
+ top: 0;
61
+ bottom: 0;
62
+ left: 0;
63
+ right: 0;
64
+ z-index: 1000;
65
+
66
+ display: flex;
67
+ flex-direction: column;
68
+
69
+ & >.header {
70
+ display: flex;
71
+ flex-direction: row;
72
+ align-items: center;
73
+
74
+ background-color: var(--body-bg);
75
+ border-bottom: 1px solid var(--border);
76
+ height: var(--header-height);
77
+
78
+ & > .title {
79
+ flex: 1;
80
+ font-size: 16px;
81
+ }
82
+
83
+ & > .actions {
84
+ button {
85
+ display: inline-flex;
86
+ $size: 24px;
87
+ width: $size;
88
+ height: $size;
89
+ color: var(--body-text);
90
+
91
+ justify-content: center;
92
+ }
93
+ }
94
+ }
95
+
96
+ .body {
97
+ background-color: var(--drawer-body-bg);
98
+ flex: 1;
99
+ overflow-y: scroll;
100
+ }
101
+
102
+ .footer {
103
+ display: flex;
104
+ flex-direction: row;
105
+ justify-content: flex-end;
106
+
107
+ background-color: var(--body-bg);
108
+ border-top: 1px solid var(--border);
109
+ height: 72px;
110
+
111
+ .actions > * {
112
+ margin-left: 16px;
113
+ }
114
+ }
115
+ }
116
+ </style>
@@ -0,0 +1,61 @@
1
+ <script lang="ts">
2
+ import { useI18n } from '@shell/composables/useI18n';
3
+ import { _VIEW } from '@shell/config/query-params';
4
+ import { useStore } from 'vuex';
5
+ import Tab from '@shell/components/Tabbed/Tab.vue';
6
+
7
+ export interface Props {
8
+ resource: any;
9
+ component: any;
10
+ resourceType: string;
11
+ }
12
+ </script>
13
+ <script setup lang="ts">
14
+ const props = defineProps<Props>();
15
+ const store = useStore();
16
+ const i18n = useI18n(store);
17
+ </script>
18
+ <template>
19
+ <Tab
20
+ class="config-tab"
21
+ name="config-tab"
22
+ :label="i18n.t('component.drawer.resourceDetailDrawer.configTab.title')"
23
+ >
24
+ <div class="container">
25
+ <component
26
+ :is="props.component"
27
+ :value="props.resource"
28
+ :liveValue="props.resource"
29
+ :resourceType="props.resourceType"
30
+ :mode="_VIEW"
31
+ :real-mode="_VIEW"
32
+ :initial-value="props.resource"
33
+ :use-tabbed-hash="false /* Have to disable hashing on child components or it modifies the url and closes the drawer */"
34
+ as="config"
35
+ />
36
+ </div>
37
+ </Tab>
38
+ </template>
39
+
40
+ <style lang="scss" scoped>
41
+ .config-tab {
42
+ .container {
43
+ background-color: var(--body-bg);
44
+ border-radius: var(--border-radius-md);
45
+ padding: 16px;
46
+ max-width: 100%;
47
+ width: 100%;
48
+ position: relative;
49
+ }
50
+
51
+ // Handle the loading indicator
52
+ :deep() .overlay-content-mode {
53
+ left: 0;
54
+ top: 0;
55
+ }
56
+
57
+ :deep() .cru-resource-footer {
58
+ display: none;
59
+ }
60
+ }
61
+ </style>