@rancher/shell 0.5.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/.DS_Store +0 -0
  2. package/assets/images/providers/aks-black.svg +28 -0
  3. package/assets/images/providers/aks.svg +31 -0
  4. package/assets/styles/global/_labeled-input.scss +1 -0
  5. package/assets/styles/global/_layout.scss +0 -99
  6. package/assets/translations/en-us.yaml +77 -71
  7. package/assets/translations/zh-hans.yaml +25 -23
  8. package/babel.config.js +1 -7
  9. package/chart/gatekeeper.vue +11 -2
  10. package/chart/istio.vue +10 -1
  11. package/chart/logging/index.vue +11 -2
  12. package/chart/monitoring/alerting/index.vue +21 -7
  13. package/chart/monitoring/grafana/index.vue +2 -57
  14. package/chart/monitoring/index.vue +26 -52
  15. package/chart/monitoring/prometheus/index.vue +43 -37
  16. package/chart/rancher-backup/index.vue +10 -3
  17. package/cloud-credential/azure.vue +17 -4
  18. package/components/AsyncButton.vue +0 -9
  19. package/components/Carousel.vue +0 -1
  20. package/components/ChartPsp.vue +76 -0
  21. package/components/CodeMirror.vue +21 -19
  22. package/components/CopyCode.vue +2 -6
  23. package/components/CopyToClipboard.vue +1 -2
  24. package/components/CopyToClipboardText.vue +9 -14
  25. package/components/CruResource.vue +0 -1
  26. package/components/EtcdInfoBanner.vue +5 -5
  27. package/components/ExplorerProjectsNamespaces.vue +1 -25
  28. package/components/IconOrSvg.vue +1 -1
  29. package/components/Markdown.vue +12 -16
  30. package/components/Questions/index.vue +1 -1
  31. package/components/ResourceDetail/Masthead.vue +9 -25
  32. package/components/ResourceList/Masthead.vue +18 -1
  33. package/components/ResourceTable.vue +2 -14
  34. package/components/ResourceYaml.vue +0 -5
  35. package/components/SideNav.vue +1 -1
  36. package/components/SortableTable/THead.vue +9 -7
  37. package/components/SortableTable/index.vue +3 -2
  38. package/components/StatusTable.vue +1 -5
  39. package/components/TabTitle.vue +84 -0
  40. package/components/Tabbed/index.vue +0 -12
  41. package/components/__tests__/ChartPsp.test.ts +75 -0
  42. package/components/__tests__/CopyCode.test.ts +4 -5
  43. package/components/fleet/FleetBundles.vue +11 -5
  44. package/components/fleet/FleetRepos.vue +27 -62
  45. package/components/fleet/FleetResources.vue +1 -6
  46. package/components/fleet/FleetStatus.vue +3 -3
  47. package/components/fleet/FleetSummary.vue +30 -35
  48. package/components/form/ArrayList.vue +8 -1
  49. package/components/form/ArrayListSelect.vue +9 -9
  50. package/components/form/KeyValue.vue +0 -1
  51. package/components/form/LabeledSelect.vue +0 -4
  52. package/components/form/Password.vue +1 -3
  53. package/components/form/Select.vue +1 -1
  54. package/components/form/SelectOrCreateAuthSecret.vue +4 -4
  55. package/components/form/__tests__/KeyValue.test.ts +1 -1
  56. package/components/formatter/Checked.vue +3 -11
  57. package/components/formatter/ClusterProvider.vue +18 -1
  58. package/components/formatter/FleetSummaryGraph.vue +11 -23
  59. package/components/formatter/LiveDate.vue +16 -0
  60. package/components/formatter/LiveDuration.vue +1 -1
  61. package/components/formatter/PercentageBar.vue +1 -1
  62. package/components/formatter/__tests__/ClusterProvider.test.ts +28 -0
  63. package/components/nav/Group.vue +2 -2
  64. package/components/nav/Header.vue +2 -1
  65. package/components/nav/TopLevelMenu.vue +3 -29
  66. package/components/nav/Type.vue +3 -1
  67. package/components/nav/WindowManager/ContainerLogs.vue +19 -120
  68. package/components/nav/WindowManager/ContainerShell.vue +1 -6
  69. package/components/nav/WindowManager/index.vue +10 -11
  70. package/components/nav/__tests__/TopLevelMenu.test.ts +0 -33
  71. package/components/nav/__tests__/Type.test.ts +1 -1
  72. package/components/nuxt/nuxt-child.js +78 -14
  73. package/components/nuxt/nuxt.js +1 -1
  74. package/components/user.retention/user-retention-header.vue +34 -0
  75. package/composables/useI18n.ts +26 -0
  76. package/composables/useStore.ts +16 -0
  77. package/config/harvester-manager-types.js +0 -2
  78. package/config/home-links.js +32 -2
  79. package/config/private-label.js +0 -22
  80. package/config/product/explorer.js +4 -4
  81. package/config/product/fleet.js +1 -6
  82. package/config/product/legacy.js +1 -84
  83. package/config/product/manager.js +15 -8
  84. package/config/query-params.js +0 -1
  85. package/config/router.js +368 -385
  86. package/config/settings.ts +9 -2
  87. package/config/store.js +1 -1
  88. package/config/system-namespaces.js +0 -3
  89. package/config/table-headers.js +27 -47
  90. package/config/types.js +5 -0
  91. package/config/uiplugins.js +1 -1
  92. package/core/plugin-helpers.js +5 -3
  93. package/core/plugin-routes.ts +114 -56
  94. package/core/plugin.ts +10 -16
  95. package/core/plugins-loader.js +9 -7
  96. package/core/plugins.js +3 -0
  97. package/core/types-provisioning.ts +0 -7
  98. package/creators/app/init +0 -19
  99. package/detail/fleet.cattle.io.cluster.vue +1 -11
  100. package/detail/node.vue +0 -42
  101. package/detail/pod.vue +1 -68
  102. package/detail/provisioning.cattle.io.cluster.vue +4 -6
  103. package/detail/workload/index.vue +1 -15
  104. package/dialog/ScaleMachineDownDialog.vue +17 -34
  105. package/edit/auth/googleoauth.vue +5 -1
  106. package/edit/catalog.cattle.io.clusterrepo.vue +7 -20
  107. package/edit/cloudcredential.vue +0 -2
  108. package/edit/fleet.cattle.io.gitrepo.vue +4 -3
  109. package/edit/management.cattle.io.project.vue +52 -1
  110. package/edit/management.cattle.io.setting.vue +2 -31
  111. package/edit/monitoring.coreos.com.prometheusrule/AlertingRule.vue +3 -12
  112. package/edit/monitoring.coreos.com.prometheusrule/GroupRules.vue +1 -2
  113. package/edit/networking.k8s.io.networkpolicy/__tests__/PolicyRuleTarget.spec.ts +1 -1
  114. package/edit/provisioning.cattle.io.cluster/{tabs/Basics.vue → Basics.vue} +126 -109
  115. package/edit/provisioning.cattle.io.cluster/{tabs/MachinePool.vue → MachinePool.vue} +7 -1
  116. package/edit/provisioning.cattle.io.cluster/{tabs/registries/RegistryConfigs.vue → RegistryConfigs.vue} +3 -1
  117. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +7 -15
  118. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts +237 -0
  119. package/edit/provisioning.cattle.io.cluster/__tests__/{CustomCommand.test.ts → CustomCommand.tests.ts} +0 -6
  120. package/edit/provisioning.cattle.io.cluster/__tests__/DrainOptions.test.ts +1 -1
  121. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +1 -7
  122. package/edit/provisioning.cattle.io.cluster/import.vue +2 -2
  123. package/edit/provisioning.cattle.io.cluster/index.vue +37 -99
  124. package/edit/provisioning.cattle.io.cluster/rke2.vue +690 -181
  125. package/edit/service.vue +0 -12
  126. package/edit/workload/Upgrading.vue +2 -3
  127. package/edit/workload/index.vue +1 -2
  128. package/edit/workload/mixins/workload.js +1 -1
  129. package/initialize/App.js +71 -25
  130. package/initialize/client.js +162 -21
  131. package/initialize/index.js +124 -47
  132. package/initialize/layouts.ts +26 -0
  133. package/{components/templates → layouts}/blank.vue +1 -1
  134. package/{components/templates → layouts}/default.vue +98 -8
  135. package/{components/templates → layouts}/error.vue +19 -10
  136. package/{components/templates → layouts}/home.vue +1 -4
  137. package/{components/templates → layouts}/plain.vue +1 -4
  138. package/{components/templates → layouts}/standalone.vue +1 -1
  139. package/{components/templates → layouts}/unauthenticated.vue +1 -1
  140. package/list/management.cattle.io.feature.vue +7 -1
  141. package/list/management.cattle.io.user.vue +25 -1
  142. package/list/node.vue +0 -1
  143. package/machine-config/__tests__/vmwarevsphere.test.ts +161 -56
  144. package/machine-config/amazonec2.vue +1 -0
  145. package/machine-config/azure.vue +37 -21
  146. package/machine-config/vmwarevsphere.vue +47 -42
  147. package/middleware/authenticated.js +19 -14
  148. package/mixins/auth-config.js +7 -2
  149. package/mixins/brand.js +41 -29
  150. package/mixins/fetch.server.js +73 -0
  151. package/mixins/labeled-form-element.ts +1 -6
  152. package/models/__tests__/management.cattle.io.node.ts +0 -85
  153. package/models/__tests__/namespace.test.ts +9 -49
  154. package/models/cluster/node.js +4 -4
  155. package/models/cluster.x-k8s.io.machine.js +1 -1
  156. package/models/cluster.x-k8s.io.machinedeployment.js +0 -14
  157. package/models/fleet.cattle.io.cluster.js +0 -4
  158. package/models/fleet.cattle.io.gitrepo.js +13 -56
  159. package/models/management.cattle.io.cluster.js +3 -11
  160. package/models/management.cattle.io.kontainerdriver.js +0 -1
  161. package/models/management.cattle.io.node.js +14 -18
  162. package/models/management.cattle.io.nodepool.js +0 -17
  163. package/models/management.cattle.io.project.js +36 -0
  164. package/models/management.cattle.io.setting.js +7 -11
  165. package/models/management.cattle.io.user.js +65 -0
  166. package/models/namespace.js +1 -1
  167. package/models/pod.js +0 -20
  168. package/models/provisioning.cattle.io.cluster.js +8 -55
  169. package/models/secret.js +18 -117
  170. package/models/workload.js +0 -16
  171. package/models/workload.service.js +0 -18
  172. package/package.json +10 -12
  173. package/pages/about.vue +1 -0
  174. package/pages/account/create-key.vue +1 -0
  175. package/pages/account/index.vue +1 -0
  176. package/pages/auth/login.vue +1 -0
  177. package/pages/auth/logout.vue +2 -0
  178. package/pages/auth/setup.vue +4 -37
  179. package/pages/auth/verify.vue +8 -14
  180. package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +17 -2
  181. package/pages/c/_cluster/apps/charts/index.vue +58 -64
  182. package/pages/c/_cluster/apps/charts/install.helpers.js +13 -2
  183. package/pages/c/_cluster/apps/charts/install.vue +5 -5
  184. package/pages/c/_cluster/apps/index.vue +2 -0
  185. package/pages/c/_cluster/auth/index.vue +2 -0
  186. package/pages/c/_cluster/auth/user.retention/index.vue +384 -0
  187. package/pages/c/_cluster/ecm/index.vue +2 -0
  188. package/pages/c/_cluster/explorer/index.vue +53 -56
  189. package/pages/c/_cluster/explorer/tools/index.vue +3 -171
  190. package/pages/c/_cluster/fleet/index.vue +1 -1
  191. package/pages/c/_cluster/index.vue +2 -0
  192. package/pages/c/_cluster/manager/pages/_page.vue +5 -4
  193. package/pages/c/_cluster/monitoring/index.vue +1 -17
  194. package/pages/c/_cluster/settings/DefaultLinksEditor.vue +1 -0
  195. package/pages/c/_cluster/settings/banners.vue +2 -0
  196. package/pages/c/_cluster/settings/brand.vue +2 -0
  197. package/pages/c/_cluster/settings/index.vue +2 -0
  198. package/pages/c/_cluster/settings/links.vue +3 -2
  199. package/pages/c/_cluster/settings/performance.vue +1 -0
  200. package/pages/c/_cluster/uiplugins/AddExtensionRepos.vue +4 -4
  201. package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +1 -2
  202. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +46 -10
  203. package/pages/c/_cluster/uiplugins/SetupUIPlugins.vue +5 -2
  204. package/pages/c/_cluster/uiplugins/__tests__/AddExtensionRepos.test.ts +96 -0
  205. package/pages/c/_cluster/uiplugins/__tests__/SetupUIPlugins.test.ts +128 -0
  206. package/pages/c/_cluster/uiplugins/index.vue +2 -0
  207. package/pages/c/index.vue +9 -0
  208. package/pages/diagnostic.vue +2 -1
  209. package/pages/fail-whale.vue +1 -0
  210. package/pages/prefs.vue +1 -0
  211. package/pages/rio/mesh.vue +508 -0
  212. package/pages/support/index.vue +8 -2
  213. package/pkg/auto-import.js +1 -1
  214. package/plugins/axios.js +36 -0
  215. package/plugins/back-button.js +5 -3
  216. package/plugins/clean-html-directive.js +19 -1
  217. package/plugins/clean-tooltip-directive.js +1 -1
  218. package/plugins/codemirror-loader.js +1 -1
  219. package/plugins/codemirror.js +0 -41
  220. package/plugins/dashboard-store/__tests__/actions.spec.ts +250 -0
  221. package/plugins/dashboard-store/__tests__/{mutations.test.ts → mutations.spec.ts} +1 -1
  222. package/plugins/dashboard-store/actions.js +21 -22
  223. package/plugins/dashboard-store/classify.js +18 -1
  224. package/plugins/dashboard-store/getters.js +5 -10
  225. package/plugins/dashboard-store/index.js +12 -0
  226. package/plugins/dashboard-store/mutations.js +4 -0
  227. package/plugins/dashboard-store/resource-class.js +18 -59
  228. package/plugins/i18n.js +1 -1
  229. package/plugins/steve/__tests__/getters.spec.ts +56 -24
  230. package/plugins/steve/__tests__/subscribe.spec.ts +106 -0
  231. package/plugins/steve/getters.js +30 -7
  232. package/plugins/steve/mutations.js +5 -2
  233. package/plugins/steve/norman-class.js +0 -19
  234. package/plugins/steve/steve-class.js +0 -22
  235. package/plugins/steve/subscribe.js +34 -13
  236. package/plugins/transitions.js +4 -0
  237. package/plugins/vue-clipboard2.js +4 -0
  238. package/rancher-components/Accordion/Accordion.vue +3 -2
  239. package/rancher-components/BadgeState/BadgeState.vue +3 -3
  240. package/rancher-components/Banner/Banner.test.ts +1 -5
  241. package/rancher-components/Banner/Banner.vue +2 -2
  242. package/rancher-components/Card/Card.vue +4 -4
  243. package/rancher-components/Form/Checkbox/Checkbox.vue +4 -3
  244. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +1 -1
  245. package/rancher-components/Form/LabeledInput/LabeledInput.vue +55 -24
  246. package/rancher-components/Form/Radio/RadioButton.test.ts +1 -3
  247. package/rancher-components/Form/Radio/RadioButton.vue +13 -7
  248. package/rancher-components/Form/Radio/RadioGroup.vue +4 -3
  249. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +7 -5
  250. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +7 -4
  251. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +9 -4
  252. package/rancher-components/StringList/StringList.vue +8 -8
  253. package/rancher-components/components/Accordion/Accordion.vue +3 -2
  254. package/rancher-components/components/BadgeState/BadgeState.test.ts +12 -0
  255. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +2 -19
  256. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +14 -11
  257. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +1 -1
  258. package/rancher-components/components/StringList/StringList.test.ts +0 -270
  259. package/rancher-components/components/StringList/StringList.vue +18 -57
  260. package/scripts/extension/bundle +7 -19
  261. package/scripts/extension/helm/scripts/package +3 -11
  262. package/scripts/extension/parse-tag-name +4 -4
  263. package/scripts/extension/publish +9 -20
  264. package/scripts/publish-shell.sh +1 -11
  265. package/scripts/test-plugins-build.sh +9 -85
  266. package/store/catalog.js +1 -1
  267. package/store/features.js +0 -1
  268. package/store/i18n.js +0 -11
  269. package/store/index.js +11 -8
  270. package/store/prefs.js +38 -33
  271. package/store/type-map.js +8 -13
  272. package/tsconfig.default.json +46 -0
  273. package/tsconfig.json +9 -35
  274. package/types/shell/index.d.ts +404 -463
  275. package/utils/__tests__/create-yaml.test.ts +10 -0
  276. package/utils/axios.js +19 -0
  277. package/utils/create-yaml.js +6 -6
  278. package/utils/custom-validators.js +2 -0
  279. package/utils/error.js +1 -16
  280. package/utils/monitoring.js +2 -37
  281. package/utils/nuxt.js +39 -18
  282. package/utils/object.js +0 -14
  283. package/utils/router.scrollBehavior.js +14 -12
  284. package/utils/socket.js +1 -0
  285. package/utils/time.js +1 -1
  286. package/utils/title.ts +3 -0
  287. package/utils/url.ts +1 -1
  288. package/utils/validators/formRules/__tests__/index.test.ts +4 -49
  289. package/utils/validators/formRules/index.ts +9 -12
  290. package/utils/validators/setting.js +10 -6
  291. package/vue.config.js +3 -24
  292. package/chart/monitoring/steps/uninstall-v1.vue +0 -135
  293. package/components/Certificates.vue +0 -164
  294. package/components/fleet/__tests__/FleetSummary.test.ts +0 -316
  295. package/components/formatter/FleetClusterSummaryGraph.vue +0 -27
  296. package/components/formatter/__tests__/Checked.test.ts +0 -19
  297. package/components/nav/WindowManager/__tests__/ContainerLogs.test.ts +0 -186
  298. package/composables/useCompactInput.ts +0 -20
  299. package/composables/useLabeledFormElement.ts +0 -138
  300. package/creators/app/files/.gitlab-ci.yml +0 -14
  301. package/edit/__tests__/service.test.ts +0 -89
  302. package/edit/provisioning.cattle.io.cluster/__tests__/Advanced.test.ts +0 -112
  303. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +0 -473
  304. package/edit/provisioning.cattle.io.cluster/__tests__/index.test.ts +0 -73
  305. package/edit/provisioning.cattle.io.cluster/__tests__/utils/cluster.ts +0 -386
  306. package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +0 -137
  307. package/edit/provisioning.cattle.io.cluster/tabs/Advanced.vue +0 -157
  308. package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +0 -135
  309. package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +0 -189
  310. package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +0 -144
  311. package/edit/provisioning.cattle.io.cluster/tabs/upgrade/index.vue +0 -76
  312. package/mixins/v1-workload-metrics.js +0 -43
  313. package/models/__tests__/management.cattle.io.cluster.test.ts +0 -23
  314. package/models/__tests__/management.cattle.io.nodepool.ts +0 -83
  315. package/models/__tests__/provisioning.cattle.io.cluster.test.ts +0 -90
  316. package/models/__tests__/workload.test.ts +0 -91
  317. package/plugins/clean-html.js +0 -53
  318. package/plugins/dashboard-store/__tests__/actions.test.ts +0 -165
  319. package/plugins/dashboard-store/__tests__/resource-class.test.ts +0 -49
  320. package/plugins/dashboard-store/__tests__/utils/store-mocks.ts +0 -7
  321. package/plugins/index.js +0 -11
  322. package/plugins/steve/__tests__/steve-class.spec.ts +0 -59
  323. package/plugins/steve/__tests__/utils/steve-mocks.ts +0 -31
  324. package/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml +0 -50
  325. package/server/har-file.js +0 -183
  326. package/tsconfig.paths.json +0 -18
  327. package/utils/azure.js +0 -24
  328. package/utils/clipboard.js +0 -5
  329. /package/components/form/__tests__/{NameNsDescription.test.ts → NameNsDescription.ts} +0 -0
  330. /package/edit/networking.k8s.io.networkpolicy/__tests__/utils/{selectors.test.ts → selectors.ts} +0 -0
  331. /package/edit/provisioning.cattle.io.cluster/{tabs/networking/ACE.vue → ACE.vue} +0 -0
  332. /package/edit/provisioning.cattle.io.cluster/{tabs/AgentConfiguration.vue → AgentConfiguration.vue} +0 -0
  333. /package/edit/provisioning.cattle.io.cluster/{tabs/upgrade/DrainOptions.vue → DrainOptions.vue} +0 -0
  334. /package/edit/provisioning.cattle.io.cluster/{tabs/MemberRoles.vue → MemberRoles.vue} +0 -0
  335. /package/edit/provisioning.cattle.io.cluster/{tabs/registries/RegistryMirrors.vue → RegistryMirrors.vue} +0 -0
  336. /package/edit/provisioning.cattle.io.cluster/{tabs/etcd/S3Config.vue → S3Config.vue} +0 -0
  337. /package/plugins/dashboard-store/__tests__/{getters.test.ts → getters.spec.ts} +0 -0
  338. /package/rancher-components/BadgeState/{BadgeState.spec.ts → BadgeState.test.ts} +0 -0
@@ -1,90 +0,0 @@
1
- import ProvCluster from '@shell/models/provisioning.cattle.io.cluster';
2
-
3
- describe('class ProvCluster', () => {
4
- const importedClusterInfo = {
5
- clusterName: 'test', provisioner: 'imported', mgmt: { spec: { gkeConfig: {} } }, spec: {}
6
- };
7
- const importedGkeClusterInfo = {
8
- clusterName: 'test', provisioner: 'rke2', mgmt: { spec: { gkeConfig: { imported: true } } }
9
- };
10
- const importedAksClusterInfo = {
11
- clusterName: 'test', provisioner: 'rke2', mgmt: { spec: { aksConfig: { imported: true } } }
12
- };
13
- const importedEksClusterInfo = {
14
- clusterName: 'test', provisioner: 'rke2', mgmt: { spec: { eksConfig: { imported: true } } }
15
- };
16
- const notImportedGkeClusterInfo = {
17
- clusterName: 'test', provisioner: 'rke2', mgmt: { spec: { gkeConfig: { imported: false } }, rkeConfig: {} }
18
- };
19
- const importedClusterInfoWithProviderForEmberParam = {
20
- clusterName: 'test', provisioner: 'rke2', mgmt: { providerForEmberParam: 'import' }
21
- };
22
- const localClusterInfo = {
23
- clusterName: 'test', provisioner: 'imported', mgmt: { isLocal: true, spec: { gkeConfig: {} } }, spec: {}
24
- };
25
- const doRke2Info = {
26
- clusterName: 'test', provisioner: 'rke2', mgmt: { isLocal: false, providerForEmberParam: 'import' }, spec: { rkeConfig: {} }
27
- };
28
-
29
- describe('isImported', () => {
30
- const testCases = [
31
- [importedClusterInfo, true],
32
- [importedGkeClusterInfo, true],
33
- [importedAksClusterInfo, true],
34
- [importedEksClusterInfo, true],
35
- [notImportedGkeClusterInfo, false],
36
- [importedClusterInfoWithProviderForEmberParam, true],
37
- [localClusterInfo, false],
38
- [doRke2Info, false],
39
- [{}, false],
40
- ];
41
- const resetMocks = () => {
42
- // Clear all mock function calls:
43
- jest.clearAllMocks();
44
- };
45
-
46
- it.each(testCases)('should return the isImported value properly based on the props data', (clusterData: Object, expected: Boolean) => {
47
- const cluster = new ProvCluster({ spec: clusterData.spec });
48
-
49
- jest.spyOn(cluster, 'mgmt', 'get').mockReturnValue(
50
- clusterData.mgmt
51
- );
52
- jest.spyOn(cluster, 'provisioner', 'get').mockReturnValue(
53
- clusterData.provisioner
54
- );
55
-
56
- expect(cluster.isImported).toBe(expected);
57
- resetMocks();
58
- }
59
- );
60
- });
61
-
62
- describe('mgmt', () => {
63
- const testCases = [
64
- [importedClusterInfo, importedClusterInfo.mgmt],
65
- [importedGkeClusterInfo, importedGkeClusterInfo.mgmt],
66
- [importedAksClusterInfo, importedAksClusterInfo.mgmt],
67
- [importedEksClusterInfo, importedEksClusterInfo.mgmt],
68
- [notImportedGkeClusterInfo, notImportedGkeClusterInfo.mgmt],
69
- [importedClusterInfoWithProviderForEmberParam, importedClusterInfoWithProviderForEmberParam.mgmt],
70
- [localClusterInfo, localClusterInfo.mgmt],
71
- [doRke2Info, doRke2Info.mgmt],
72
- [{}, null],
73
- ];
74
-
75
- const resetMocks = () => {
76
- // Clear all mock function calls:
77
- jest.clearAllMocks();
78
- };
79
-
80
- it.each(testCases)('should return the isImported value properly based on the props data', (clusterData: Object, expected: Object) => {
81
- const clusterMock = jest.fn(() => clusterData.mgmt);
82
- const ctx = { rootGetters: { 'management/byId': clusterMock } };
83
- const cluster = new ProvCluster({ status: { clusterName: clusterData.clusterName } }, ctx);
84
-
85
- expect(cluster.mgmt).toBe(expected);
86
- resetMocks();
87
- }
88
- );
89
- });
90
- });
@@ -1,91 +0,0 @@
1
- import Workload from '@shell/models/workload.js';
2
- import { steveClassJunkObject } from '@shell/plugins/steve/__tests__/utils/steve-mocks';
3
-
4
- describe('class: Workload', () => {
5
- describe('given custom workload keys', () => {
6
- const customContainerImage = 'image';
7
- const customContainer = {
8
- image: customContainerImage,
9
- __active: 'whatever',
10
- active: 'whatever',
11
- _init: 'whatever',
12
- error: 'whatever',
13
- };
14
- const customWorkload = {
15
- ...steveClassJunkObject,
16
- type: '123abv',
17
- __rehydrate: 'whatever',
18
- __clone: 'whatever',
19
- spec: {
20
- template: {
21
- spec: {
22
- containers: [customContainer],
23
- initContainers: [customContainer],
24
- }
25
- }
26
- }
27
- };
28
-
29
- customWorkload.metadata.name = 'abc';
30
-
31
- it('should keep internal keys', () => {
32
- const workload = new Workload(customWorkload, {
33
- getters: { schemaFor: () => ({ linkFor: jest.fn() }) },
34
- dispatch: jest.fn(),
35
- rootGetters: { 'i18n/t': jest.fn() },
36
- });
37
-
38
- expect({ ...workload }).toStrictEqual(customWorkload);
39
- });
40
-
41
- describe('method: save', () => {
42
- it('should remove all the internal keys', async() => {
43
- const dispatch = jest.fn();
44
- const workload = new Workload(customWorkload, {
45
- getters: { schemaFor: () => ({ linkFor: jest.fn() }) },
46
- dispatch,
47
- rootGetters: {
48
- 'i18n/t': jest.fn(),
49
- 'i18n/exists': () => true,
50
- },
51
- });
52
- const expectation = {
53
- metadata: {
54
- name: 'abc',
55
- fields: 'whatever',
56
- resourceVersion: 'whatever',
57
- clusterName: 'whatever',
58
- deletionGracePeriodSeconds: 'whatever',
59
- generateName: 'whatever',
60
- },
61
- spec: {
62
- template: {
63
- spec: {
64
- containers: [{ image: customContainerImage }],
65
- initContainers: [{ image: customContainerImage }]
66
- }
67
- }
68
- }
69
- };
70
-
71
- await workload.save();
72
-
73
- const opt = {
74
- data: expectation,
75
- headers: {
76
- accept: 'application/json',
77
- 'content-type': 'application/json',
78
- },
79
- method: 'post',
80
- url: undefined,
81
- };
82
-
83
- // Data sent should have been cleaned
84
- expect(dispatch).toHaveBeenCalledWith('request', { opt, type: customWorkload.type });
85
-
86
- // Original workload model should remain unchanged
87
- expect({ ...workload }).toStrictEqual(customWorkload);
88
- });
89
- });
90
- });
91
- });
@@ -1,53 +0,0 @@
1
- import DOMPurify from 'dompurify';
2
- import { uniq } from '@shell/utils/array';
3
-
4
- const ALLOWED_TAGS = [
5
- 'code',
6
- 'li',
7
- 'a',
8
- 'p',
9
- 'b',
10
- 'br',
11
- 'ul',
12
- 'pre',
13
- 'span',
14
- 'div',
15
- 'i',
16
- 'em',
17
- 'strong',
18
- 'h1',
19
- 'h2',
20
- 'h3',
21
- 'h4',
22
- 'h5',
23
- 'h6',
24
- 'table',
25
- 'thead',
26
- 'tr',
27
- 'th',
28
- 'tbody',
29
- 'td',
30
- 'blockquote'
31
- ];
32
-
33
- // Allow 'A' tags to keep the target=_blank attribute if they have it
34
- DOMPurify.addHook('uponSanitizeAttribute', (node, data) => {
35
- if (node.tagName === 'A' && data.attrName === 'target' && data.attrValue === '_blank') {
36
- data.forceKeepAttr = true;
37
- }
38
- });
39
-
40
- // Ensure if an 'A' tag has target=_blank that we add noopener, noreferrer and nofollow to the 'rel' attribute
41
- DOMPurify.addHook('afterSanitizeAttributes', (node) => {
42
- if (node.tagName === 'A' && node?.target === '_blank') {
43
- const rel = ['noopener', 'noreferrer', 'nofollow'];
44
- const existingRel = node.rel?.length ? node.rel.split(' ') : [];
45
- const combined = uniq([...rel, ...existingRel]);
46
-
47
- node.setAttribute('rel', combined.join(' '));
48
- }
49
- });
50
-
51
- export const purifyHTML = (value, options = { ALLOWED_TAGS }) => {
52
- return DOMPurify.sanitize(value, options);
53
- };
@@ -1,165 +0,0 @@
1
- import _actions from '@shell/plugins/dashboard-store/actions';
2
-
3
- const { findAll } = _actions;
4
-
5
- describe('dashboard-store: actions', () => {
6
- const setupContext = () => {
7
- const commit = jest.fn();
8
- const dispatch = jest.fn((...args) => {
9
- switch (args[0]) {
10
- case 'request':
11
- return { data: ['requestData'] };
12
- }
13
- });
14
- const state = { config: { namespace: 'unitTest' } };
15
- const getters = {
16
- normalizeType: jest.fn(() => 'getters.normalizeType'),
17
- typeRegistered: jest.fn(() => false),
18
- haveAll: jest.fn(() => false),
19
- haveAllNamespace: jest.fn(() => false),
20
- all: jest.fn(() => 'getters.all'),
21
- urlFor: jest.fn(() => 'getters.urlFor'), // we're not testing the urlFor getter so we don't need to do anything with opt here
22
- };
23
- const rootGetters = {
24
- 'type-map/optionsFor': jest.fn(),
25
- 'auth/fromHeader': 'foo'
26
- };
27
-
28
- // we're not testing function output based off of state or getter inputs here since they are dependencies and should be tested independently
29
- return {
30
- state,
31
- getters,
32
- rootGetters,
33
- commit,
34
- dispatch
35
- };
36
- };
37
-
38
- const standardAssertions = {
39
- returnsPromise:
40
- {
41
- assertionLabel: 'returns a promise',
42
- valueGetter: ({ findAllPromise }) => typeof findAllPromise.then,
43
- valueExpected: 'function'
44
- },
45
- callsAll: {
46
- assertionLabel: 'calls the "all" getter with the normalizedType',
47
- valueGetter: ({ getters }) => getters.all.mock.calls[0][0],
48
- valueExpected: 'getters.normalizeType'
49
- },
50
- returnsFromAll: {
51
- assertionLabel: 'returns the value expected from the "all" getter',
52
- valueGetter: ({ findAllReturnValue }) => findAllReturnValue,
53
- valueExpected: 'getters.all'
54
- },
55
- firstDispatchAction: {
56
- assertionLabel: 'first dispatch should be the "request" action',
57
- valueGetter: ({ dispatch }) => dispatch.mock.calls[0][0],
58
- valueExpected: 'request'
59
- },
60
- firstDispatchParams: {
61
- assertionLabel: 'first dispatch parameters should be provided a normalized type and a url, streaming, and "metadata.managedFields" excluded under opt',
62
- valueGetter: ({ dispatch }) => dispatch.mock.calls[0][1],
63
- valueExpected: {
64
- type: 'getters.normalizeType',
65
- opt: {
66
- url: 'getters.urlFor',
67
- stream: true
68
- }
69
- },
70
- assertionMethod: 'toMatchObject'
71
- },
72
- secondDispatchAction: {
73
- assertionLabel: 'second dispatch should be the "watch" action',
74
- valueGetter: ({ dispatch }) => dispatch.mock.calls[1][0],
75
- valueExpected: 'watch'
76
- },
77
- secondDispatchParams: {
78
- assertionLabel: 'second dispatch parameters should have a normalized type and force set to false',
79
- valueGetter: ({ dispatch }) => dispatch.mock.calls[1][1],
80
- valueExpected: { type: 'getters.normalizeType', force: false },
81
- assertionMethod: 'toMatchObject'
82
- },
83
- countDispatches: {
84
- assertionLabel: 'should only make two dispatches',
85
- valueGetter: ({ dispatch }) => dispatch.mock.calls,
86
- valueExpected: 2,
87
- assertionMethod: 'toHaveLength'
88
- },
89
- firstCommitMutation: {
90
- assertionLabel: 'first commit should be the "registerType" mutation',
91
- valueGetter: ({ commit }) => commit.mock.calls[0][0],
92
- valueExpected: 'registerType'
93
- },
94
- firstCommitParams: {
95
- assertionLabel: 'first commit parameter should be a normalized type',
96
- valueGetter: ({ commit }) => commit.mock.calls[0][1],
97
- valueExpected: 'getters.normalizeType'
98
- },
99
- secondCommitMutation: {
100
- assertionLabel: 'second commit should be the "loadAll" mutation',
101
- valueGetter: ({ commit }) => commit.mock.calls[1][0],
102
- valueExpected: 'loadAll'
103
- },
104
- secondCommitParams: {
105
- assertionLabel: 'second commit parameters should have a normalized type, ctx.state.config.namespace, data returned by request, and skipHaveAll set to false',
106
- valueGetter: ({ commit }) => commit.mock.calls[1][1],
107
- valueExpected: {
108
- type: 'getters.normalizeType',
109
- ctx: { state: { config: { namespace: 'unitTest' } } },
110
- data: ['requestData'],
111
- skipHaveAll: false,
112
- },
113
- assertionMethod: 'toMatchObject'
114
- },
115
- countCommits: {
116
- assertionLabel: 'should only make two commits',
117
- valueGetter: ({ commit }) => commit.mock.calls,
118
- valueExpected: 2,
119
- assertionMethod: 'toHaveLength'
120
- }
121
-
122
- };
123
-
124
- describe('dashboard-store > actions > findAll', () => {
125
- describe('called without a cache for the type in the second param', () => {
126
- const {
127
- dispatch, commit, getters, rootGetters, state
128
- } = setupContext();
129
-
130
- const findAllPromise = findAll(
131
- {
132
- dispatch, commit, getters, rootGetters, state
133
- },
134
- { type: 'type' }
135
- );
136
-
137
- const assertionChain = [
138
- standardAssertions.returnsPromise,
139
- standardAssertions.callsAll,
140
- standardAssertions.returnsFromAll,
141
- standardAssertions.firstDispatchAction,
142
- standardAssertions.firstDispatchParams,
143
- standardAssertions.secondDispatchAction,
144
- standardAssertions.secondDispatchParams,
145
- standardAssertions.countDispatches,
146
- standardAssertions.firstCommitMutation,
147
- standardAssertions.firstCommitParams,
148
- standardAssertions.secondCommitMutation,
149
- standardAssertions.secondCommitParams,
150
- standardAssertions.countCommits
151
- ];
152
-
153
- it.each(assertionChain)(
154
- '$assertionLabel',
155
- async({ valueGetter, valueExpected, assertionMethod = 'toBe' }) => {
156
- const findAllReturnValue = await findAllPromise;
157
-
158
- expect(valueGetter({
159
- findAllPromise, findAllReturnValue, getters, dispatch, commit
160
- }))[assertionMethod](valueExpected);
161
- }
162
- );
163
- });
164
- });
165
- });
@@ -1,49 +0,0 @@
1
- import Resource from '@shell/plugins/dashboard-store/resource-class.js';
2
- import { resourceClassJunkObject } from '@shell/plugins/dashboard-store/__tests__/utils/store-mocks';
3
-
4
- describe('class: Resource', () => {
5
- describe('given custom resource keys', () => {
6
- const customResource = resourceClassJunkObject;
7
-
8
- it('should keep internal keys', () => {
9
- const resource = new Resource(customResource, {
10
- getters: { schemaFor: () => ({ linkFor: jest.fn() }) },
11
- dispatch: jest.fn(),
12
- rootGetters: { 'i18n/t': jest.fn() },
13
- });
14
-
15
- expect({ ...resource }).toStrictEqual(customResource);
16
- });
17
-
18
- describe('method: save', () => {
19
- it('should remove all the internal keys', async() => {
20
- const dispatch = jest.fn();
21
- const resource = new Resource(customResource, {
22
- getters: { schemaFor: () => ({ linkFor: jest.fn() }) },
23
- dispatch,
24
- rootGetters: { 'i18n/t': jest.fn() },
25
- });
26
-
27
- const expectation = { type: customResource.type };
28
-
29
- await resource.save();
30
-
31
- const opt = {
32
- data: expectation,
33
- headers: {
34
- accept: 'application/json',
35
- 'content-type': 'application/json',
36
- },
37
- method: 'post',
38
- url: undefined,
39
- };
40
-
41
- // Data sent should have been cleaned
42
- expect(dispatch).toHaveBeenCalledWith('request', { opt, type: customResource.type });
43
-
44
- // Original workload model should remain unchanged
45
- expect({ ...resource }).toStrictEqual(customResource);
46
- });
47
- });
48
- });
49
- });
@@ -1,7 +0,0 @@
1
- const customType = 'dsaf';
2
-
3
- export const resourceClassJunkObject = {
4
- type: customType,
5
- __rehydrate: 'whatever',
6
- __clone: 'whatever',
7
- };
package/plugins/index.js DELETED
@@ -1,11 +0,0 @@
1
- /**
2
- * Load the directives
3
- *
4
- * These are included in a function that can be explictly called, so that we can be sure
5
- * of the execution order, rather than importing them at the top of a file.
6
- */
7
- export function loadDirectives() {
8
- import('./clean-html-directive');
9
- import('./clean-tooltip-directive');
10
- import('./directives');
11
- }
@@ -1,59 +0,0 @@
1
- import Steve from '@shell/plugins/steve/steve-class.js';
2
- import { steveClassJunkObject } from './utils/steve-mocks';
3
-
4
- describe('class: Steve', () => {
5
- describe('given custom resource keys', () => {
6
- const customResource = steveClassJunkObject;
7
-
8
- it('should keep internal keys', () => {
9
- const steve = new Steve(customResource, {
10
- getters: { schemaFor: () => ({ linkFor: jest.fn() }) },
11
- dispatch: jest.fn(),
12
- rootGetters: { 'i18n/t': jest.fn() },
13
- });
14
-
15
- expect({ ...steve }).toStrictEqual(customResource);
16
- });
17
-
18
- describe('method: save', () => {
19
- it('should remove all the internal keys', async() => {
20
- const dispatch = jest.fn();
21
- const steve = new Steve(customResource, {
22
- getters: { schemaFor: () => ({ linkFor: jest.fn() }) },
23
- dispatch,
24
- rootGetters: { 'i18n/t': jest.fn() },
25
- });
26
-
27
- const expectation = {
28
- type: customResource.type,
29
- metadata: {
30
- resourceVersion: 'whatever',
31
- fields: 'whatever',
32
- clusterName: 'whatever',
33
- deletionGracePeriodSeconds: 'whatever',
34
- generateName: 'whatever',
35
- },
36
- spec: { versions: {} }
37
- };
38
-
39
- await steve.save();
40
-
41
- const opt = {
42
- data: expectation,
43
- headers: {
44
- accept: 'application/json',
45
- 'content-type': 'application/json',
46
- },
47
- method: 'post',
48
- url: undefined,
49
- };
50
-
51
- // Data sent should have been cleaned
52
- expect(dispatch).toHaveBeenCalledWith('request', { opt, type: customResource.type });
53
-
54
- // Original workload model should remain unchanged
55
- expect({ ...steve }).toStrictEqual(customResource);
56
- });
57
- });
58
- });
59
- });
@@ -1,31 +0,0 @@
1
- import { resourceClassJunkObject } from '@shell/plugins/dashboard-store/__tests__/utils/store-mocks';
2
-
3
- const customType = 'asdasd';
4
-
5
- export const steveClassJunkObject = {
6
- ...resourceClassJunkObject,
7
- type: customType,
8
- __clone: 'whatever',
9
- metadata: {
10
- clusterName: 'whatever',
11
- creationTimestamp: 'whatever',
12
- deletionGracePeriodSeconds: 'whatever',
13
- deletionTimestamp: 'whatever',
14
- fields: 'whatever',
15
- finalizers: 'whatever',
16
- generateName: 'whatever',
17
- generation: 'whatever',
18
- initializers: 'whatever',
19
- managedFields: 'whatever',
20
- ownerReferences: 'whatever',
21
- relationships: 'whatever',
22
- selfLink: 'whatever',
23
- state: 'whatever',
24
- uid: 'whatever',
25
- resourceVersion: 'whatever',
26
- },
27
- spec: { versions: { schema: 'whatever' } },
28
- links: 'whatever',
29
- status: 'whatever',
30
- stringData: 'whatever',
31
- };
@@ -1,50 +0,0 @@
1
- .podman-setup: &podman-setup
2
- - zypper --non-interactive install jq podman
3
- - usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $(id -nu)
4
- - podman login -u $REGISTRY_USER -p $REGISTRY_PASSWORD $REGISTRY
5
-
6
- check_version_collisions:
7
- stage: check_version
8
- rules:
9
- - changes:
10
- - package.json
11
- script:
12
- - *podman-setup
13
- - |
14
- PACKAGE_VERSION=`jq -r .version package.json`
15
- PACKAGE_NAME=`jq -r .name package.json`
16
-
17
- readarray -t VERSIONS < <(podman search $REGISTRY/$IMAGE_NAMESPACE/ui-extension-$PACKAGE_NAME --list-tags --format {{.Tag}})
18
-
19
- echo -e "Checking for version collisions with Extension version: ${PACKAGE_VERSION}"
20
- for version in ${VERSIONS[@]}; do
21
- if [[ ${version} == ${PACKAGE_VERSION} ]]; then
22
- echo "Cannot overwrite production image version ${version} since it already exists."
23
- podman logout $REGISTRY
24
- exit 1
25
- fi
26
- done
27
-
28
- echo -e "Published image not found for version ${PACKAGE_VERSION}, continuing build..."
29
- tags:
30
- - linux
31
-
32
- build_and_release:
33
- stage: build_catalog
34
- rules:
35
- - changes:
36
- - package.json
37
- script:
38
- - *podman-setup
39
- - zypper addrepo https://download.opensuse.org/repositories/devel:languages:nodejs/SLE_12_SP5/devel:languages:nodejs.repo
40
- - zypper --non-interactive --no-gpg-checks refresh
41
- - zypper --non-interactive install go git nodejs14 npm helm
42
- - YQ_URL="https://github.com/mikefarah/yq/releases/download/v4.35.2/yq_linux_amd64"
43
- - curl -sLf ${YQ_URL} -o /usr/bin/yq && chmod +x /usr/bin/yq
44
- - npm install -g --unsafe-perm yarn
45
- - yarn
46
- - yarn publish-pkgs -cl -r $REGISTRY -o $IMAGE_NAMESPACE
47
- - podman push `podman images -f reference!=registry.suse.com/bci/bci-base --format "{{index .Names 0}}"`
48
- - podman logout $REGISTRY
49
- tags:
50
- - linux