@rancher/shell 0.5.3 → 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 (356) 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 +76 -74
  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/ClusterIconMenu.vue +9 -24
  22. package/components/CodeMirror.vue +16 -75
  23. package/components/CopyCode.vue +2 -6
  24. package/components/CopyToClipboard.vue +1 -2
  25. package/components/CopyToClipboardText.vue +9 -14
  26. package/components/CruResource.vue +0 -1
  27. package/components/EtcdInfoBanner.vue +5 -5
  28. package/components/ExplorerProjectsNamespaces.vue +1 -25
  29. package/components/FixedBanner.vue +0 -1
  30. package/components/IconOrSvg.vue +1 -1
  31. package/components/Markdown.vue +12 -16
  32. package/components/Questions/index.vue +1 -1
  33. package/components/ResourceDetail/Masthead.vue +9 -25
  34. package/components/ResourceDetail/index.vue +4 -1
  35. package/components/ResourceList/Masthead.vue +18 -1
  36. package/components/ResourceTable.vue +2 -14
  37. package/components/ResourceYaml.vue +5 -34
  38. package/components/SideNav.vue +65 -43
  39. package/components/SortableTable/THead.vue +9 -7
  40. package/components/SortableTable/index.vue +2 -1
  41. package/components/StatusTable.vue +1 -5
  42. package/components/TabTitle.vue +84 -0
  43. package/components/Tabbed/index.vue +0 -12
  44. package/components/YamlEditor.vue +0 -1
  45. package/components/__tests__/ChartPsp.test.ts +75 -0
  46. package/components/__tests__/CopyCode.test.ts +4 -5
  47. package/components/fleet/FleetBundles.vue +11 -5
  48. package/components/fleet/FleetRepos.vue +27 -62
  49. package/components/fleet/FleetResources.vue +1 -6
  50. package/components/fleet/FleetStatus.vue +3 -3
  51. package/components/fleet/FleetSummary.vue +30 -35
  52. package/components/form/ArrayList.vue +8 -1
  53. package/components/form/ArrayListSelect.vue +9 -9
  54. package/components/form/BannerSettings.vue +0 -3
  55. package/components/form/FileSelector.vue +0 -1
  56. package/components/form/KeyValue.vue +0 -2
  57. package/components/form/LabeledSelect.vue +0 -4
  58. package/components/form/Password.vue +1 -3
  59. package/components/form/Select.vue +1 -1
  60. package/components/form/SelectOrCreateAuthSecret.vue +4 -4
  61. package/components/form/__tests__/KeyValue.test.ts +1 -1
  62. package/components/formatter/Checked.vue +3 -11
  63. package/components/formatter/ClusterProvider.vue +18 -1
  64. package/components/formatter/FleetSummaryGraph.vue +11 -23
  65. package/components/formatter/LiveDate.vue +16 -0
  66. package/components/formatter/LiveDuration.vue +1 -1
  67. package/components/formatter/PercentageBar.vue +1 -1
  68. package/components/formatter/WorkloadDetailEndpoints.vue +22 -12
  69. package/components/formatter/__tests__/ClusterProvider.test.ts +28 -0
  70. package/components/nav/Group.vue +2 -2
  71. package/components/nav/Header.vue +2 -2
  72. package/components/nav/Jump.vue +9 -19
  73. package/components/nav/TopLevelMenu.vue +18 -66
  74. package/components/nav/Type.vue +7 -16
  75. package/components/nav/WindowManager/ContainerLogs.vue +19 -120
  76. package/components/nav/WindowManager/ContainerShell.vue +1 -6
  77. package/components/nav/WindowManager/index.vue +10 -11
  78. package/components/nav/__tests__/TopLevelMenu.test.ts +1 -34
  79. package/components/nav/__tests__/Type.test.ts +1 -31
  80. package/components/nuxt/nuxt-child.js +78 -14
  81. package/components/nuxt/nuxt.js +1 -1
  82. package/components/user.retention/user-retention-header.vue +34 -0
  83. package/composables/useI18n.ts +26 -0
  84. package/composables/useStore.ts +16 -0
  85. package/config/harvester-manager-types.js +0 -2
  86. package/config/home-links.js +32 -2
  87. package/config/private-label.js +0 -22
  88. package/config/product/explorer.js +4 -4
  89. package/config/product/fleet.js +1 -6
  90. package/config/product/legacy.js +1 -84
  91. package/config/product/manager.js +15 -8
  92. package/config/query-params.js +0 -1
  93. package/config/router.js +368 -385
  94. package/config/settings.ts +9 -2
  95. package/config/store.js +1 -1
  96. package/config/system-namespaces.js +0 -3
  97. package/config/table-headers.js +27 -47
  98. package/config/types.js +5 -0
  99. package/config/uiplugins.js +1 -1
  100. package/core/plugin-helpers.js +5 -3
  101. package/core/plugin-routes.ts +114 -56
  102. package/core/plugin.ts +10 -16
  103. package/core/plugins-loader.js +9 -7
  104. package/core/plugins.js +3 -0
  105. package/core/types-provisioning.ts +0 -7
  106. package/creators/app/init +0 -19
  107. package/detail/fleet.cattle.io.bundle.vue +1 -1
  108. package/detail/fleet.cattle.io.cluster.vue +1 -11
  109. package/detail/node.vue +0 -42
  110. package/detail/pod.vue +1 -68
  111. package/detail/provisioning.cattle.io.cluster.vue +8 -25
  112. package/detail/workload/index.vue +1 -15
  113. package/dialog/ScaleMachineDownDialog.vue +17 -34
  114. package/edit/auth/googleoauth.vue +5 -1
  115. package/edit/catalog.cattle.io.clusterrepo.vue +7 -20
  116. package/edit/cloudcredential.vue +0 -2
  117. package/edit/fleet.cattle.io.gitrepo.vue +4 -3
  118. package/edit/management.cattle.io.project.vue +52 -1
  119. package/edit/management.cattle.io.setting.vue +2 -32
  120. package/edit/monitoring.coreos.com.alertmanagerconfig/types/opsgenie.vue +1 -1
  121. package/edit/monitoring.coreos.com.alertmanagerconfig/types/pagerduty.vue +2 -1
  122. package/edit/monitoring.coreos.com.alertmanagerconfig/types/slack.vue +1 -1
  123. package/edit/monitoring.coreos.com.prometheusrule/AlertingRule.vue +3 -12
  124. package/edit/monitoring.coreos.com.prometheusrule/GroupRules.vue +1 -2
  125. package/edit/networking.k8s.io.networkpolicy/__tests__/PolicyRuleTarget.spec.ts +1 -1
  126. package/edit/provisioning.cattle.io.cluster/{tabs/Basics.vue → Basics.vue} +125 -106
  127. package/edit/provisioning.cattle.io.cluster/{tabs/MachinePool.vue → MachinePool.vue} +7 -1
  128. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +7 -15
  129. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts +237 -0
  130. package/edit/provisioning.cattle.io.cluster/__tests__/{CustomCommand.test.ts → CustomCommand.tests.ts} +0 -6
  131. package/edit/provisioning.cattle.io.cluster/__tests__/DrainOptions.test.ts +1 -1
  132. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +1 -7
  133. package/edit/provisioning.cattle.io.cluster/import.vue +2 -2
  134. package/edit/provisioning.cattle.io.cluster/index.vue +40 -109
  135. package/edit/provisioning.cattle.io.cluster/rke2.vue +689 -152
  136. package/edit/service.vue +0 -12
  137. package/edit/token.vue +0 -1
  138. package/edit/workload/Upgrading.vue +2 -3
  139. package/edit/workload/index.vue +1 -2
  140. package/edit/workload/mixins/workload.js +1 -1
  141. package/initialize/App.js +71 -25
  142. package/initialize/client.js +162 -21
  143. package/initialize/index.js +124 -47
  144. package/initialize/layouts.ts +26 -0
  145. package/{components/templates → layouts}/blank.vue +1 -1
  146. package/{components/templates → layouts}/default.vue +98 -8
  147. package/{components/templates → layouts}/error.vue +19 -10
  148. package/{components/templates → layouts}/home.vue +1 -4
  149. package/{components/templates → layouts}/plain.vue +1 -4
  150. package/{components/templates → layouts}/standalone.vue +1 -1
  151. package/{components/templates → layouts}/unauthenticated.vue +1 -1
  152. package/list/catalog.cattle.io.app.vue +0 -1
  153. package/list/management.cattle.io.feature.vue +7 -1
  154. package/list/management.cattle.io.setting.vue +0 -1
  155. package/list/management.cattle.io.user.vue +25 -1
  156. package/list/node.vue +0 -1
  157. package/machine-config/__tests__/vmwarevsphere.test.ts +161 -56
  158. package/machine-config/azure.vue +37 -21
  159. package/machine-config/vmwarevsphere.vue +47 -42
  160. package/middleware/authenticated.js +19 -14
  161. package/mixins/auth-config.js +7 -2
  162. package/mixins/brand.js +41 -29
  163. package/mixins/fetch.server.js +73 -0
  164. package/mixins/labeled-form-element.ts +1 -6
  165. package/models/__tests__/management.cattle.io.node.ts +0 -85
  166. package/models/__tests__/namespace.test.ts +9 -49
  167. package/models/cluster/node.js +4 -4
  168. package/models/cluster.x-k8s.io.machine.js +1 -1
  169. package/models/cluster.x-k8s.io.machinedeployment.js +0 -14
  170. package/models/fleet.cattle.io.cluster.js +0 -4
  171. package/models/fleet.cattle.io.gitrepo.js +13 -56
  172. package/models/management.cattle.io.cluster.js +3 -11
  173. package/models/management.cattle.io.kontainerdriver.js +0 -1
  174. package/models/management.cattle.io.node.js +14 -18
  175. package/models/management.cattle.io.nodepool.js +0 -17
  176. package/models/management.cattle.io.project.js +36 -0
  177. package/models/management.cattle.io.setting.js +7 -11
  178. package/models/management.cattle.io.user.js +65 -0
  179. package/models/namespace.js +1 -1
  180. package/models/pod.js +0 -20
  181. package/models/provisioning.cattle.io.cluster.js +9 -91
  182. package/models/secret.js +18 -126
  183. package/models/storage.k8s.io.storageclass.js +1 -1
  184. package/models/workload.js +0 -16
  185. package/models/workload.service.js +0 -18
  186. package/package.json +10 -12
  187. package/pages/about.vue +1 -0
  188. package/pages/account/create-key.vue +1 -0
  189. package/pages/account/index.vue +1 -0
  190. package/pages/auth/login.vue +1 -0
  191. package/pages/auth/logout.vue +2 -0
  192. package/pages/auth/setup.vue +4 -37
  193. package/pages/auth/verify.vue +8 -14
  194. package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +17 -2
  195. package/pages/c/_cluster/apps/charts/index.vue +58 -64
  196. package/pages/c/_cluster/apps/charts/install.helpers.js +13 -2
  197. package/pages/c/_cluster/apps/charts/install.vue +5 -5
  198. package/pages/c/_cluster/apps/index.vue +2 -0
  199. package/pages/c/_cluster/auth/index.vue +2 -0
  200. package/pages/c/_cluster/auth/user.retention/index.vue +384 -0
  201. package/pages/c/_cluster/ecm/index.vue +2 -0
  202. package/pages/c/_cluster/explorer/index.vue +53 -56
  203. package/pages/c/_cluster/explorer/tools/index.vue +3 -171
  204. package/pages/c/_cluster/fleet/index.vue +1 -1
  205. package/pages/c/_cluster/index.vue +2 -0
  206. package/pages/c/_cluster/manager/pages/_page.vue +5 -4
  207. package/pages/c/_cluster/monitoring/index.vue +1 -17
  208. package/pages/c/_cluster/settings/DefaultLinksEditor.vue +1 -1
  209. package/pages/c/_cluster/settings/banners.vue +2 -0
  210. package/pages/c/_cluster/settings/brand.vue +2 -3
  211. package/pages/c/_cluster/settings/index.vue +2 -0
  212. package/pages/c/_cluster/settings/links.vue +3 -2
  213. package/pages/c/_cluster/settings/performance.vue +1 -0
  214. package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +1 -2
  215. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +46 -10
  216. package/pages/c/_cluster/uiplugins/index.vue +2 -0
  217. package/pages/c/index.vue +9 -0
  218. package/pages/diagnostic.vue +2 -1
  219. package/pages/fail-whale.vue +1 -0
  220. package/pages/prefs.vue +1 -0
  221. package/pages/rio/mesh.vue +508 -0
  222. package/pages/support/index.vue +8 -2
  223. package/pkg/auto-import.js +1 -1
  224. package/plugins/axios.js +36 -0
  225. package/plugins/back-button.js +5 -3
  226. package/plugins/clean-html-directive.js +19 -1
  227. package/plugins/clean-tooltip-directive.js +1 -1
  228. package/plugins/codemirror-loader.js +1 -1
  229. package/plugins/codemirror.js +0 -41
  230. package/plugins/dashboard-store/__tests__/{mutations.test.ts → mutations.spec.ts} +1 -1
  231. package/plugins/dashboard-store/actions.js +17 -16
  232. package/plugins/dashboard-store/classify.js +18 -1
  233. package/plugins/dashboard-store/getters.js +7 -70
  234. package/plugins/dashboard-store/index.js +12 -0
  235. package/plugins/dashboard-store/mutations.js +4 -0
  236. package/plugins/dashboard-store/resource-class.js +20 -65
  237. package/plugins/i18n.js +1 -1
  238. package/plugins/steve/__tests__/getters.spec.ts +48 -26
  239. package/plugins/steve/__tests__/subscribe.spec.ts +106 -0
  240. package/plugins/steve/actions.js +37 -3
  241. package/plugins/steve/getters.js +24 -7
  242. package/plugins/steve/mutations.js +5 -2
  243. package/plugins/steve/norman-class.js +0 -19
  244. package/plugins/steve/steve-class.js +0 -22
  245. package/plugins/steve/subscribe.js +34 -13
  246. package/plugins/transitions.js +4 -0
  247. package/plugins/vue-clipboard2.js +4 -0
  248. package/rancher-components/Accordion/Accordion.vue +3 -2
  249. package/rancher-components/BadgeState/BadgeState.vue +3 -3
  250. package/rancher-components/Banner/Banner.test.ts +1 -5
  251. package/rancher-components/Banner/Banner.vue +2 -2
  252. package/rancher-components/Card/Card.vue +4 -4
  253. package/rancher-components/Form/Checkbox/Checkbox.vue +4 -3
  254. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +1 -1
  255. package/rancher-components/Form/LabeledInput/LabeledInput.vue +55 -24
  256. package/rancher-components/Form/Radio/RadioButton.test.ts +1 -3
  257. package/rancher-components/Form/Radio/RadioButton.vue +13 -7
  258. package/rancher-components/Form/Radio/RadioGroup.vue +4 -3
  259. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +7 -5
  260. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +7 -4
  261. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +9 -4
  262. package/rancher-components/StringList/StringList.vue +8 -8
  263. package/rancher-components/components/Accordion/Accordion.vue +3 -2
  264. package/rancher-components/components/BadgeState/BadgeState.test.ts +12 -0
  265. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +2 -19
  266. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +14 -11
  267. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +1 -1
  268. package/rancher-components/components/StringList/StringList.test.ts +0 -270
  269. package/rancher-components/components/StringList/StringList.vue +18 -57
  270. package/scripts/extension/bundle +7 -19
  271. package/scripts/extension/helm/scripts/package +3 -11
  272. package/scripts/extension/parse-tag-name +4 -4
  273. package/scripts/extension/publish +9 -20
  274. package/scripts/publish-shell.sh +1 -11
  275. package/scripts/test-plugins-build.sh +9 -85
  276. package/store/catalog.js +1 -1
  277. package/store/features.js +0 -1
  278. package/store/i18n.js +0 -11
  279. package/store/index.js +13 -11
  280. package/store/prefs.js +38 -33
  281. package/store/type-map.js +82 -157
  282. package/tsconfig.default.json +46 -0
  283. package/tsconfig.json +9 -35
  284. package/types/shell/index.d.ts +404 -465
  285. package/utils/axios.js +19 -0
  286. package/utils/create-yaml.js +1 -5
  287. package/utils/custom-validators.js +2 -0
  288. package/utils/error.js +1 -16
  289. package/utils/monitoring.js +2 -37
  290. package/utils/nuxt.js +39 -18
  291. package/utils/object.js +0 -24
  292. package/utils/router.scrollBehavior.js +14 -12
  293. package/utils/socket.js +1 -0
  294. package/utils/time.js +1 -1
  295. package/utils/title.ts +3 -0
  296. package/utils/url.ts +1 -1
  297. package/utils/validators/formRules/__tests__/index.test.ts +4 -49
  298. package/utils/validators/formRules/index.ts +9 -12
  299. package/utils/validators/setting.js +10 -6
  300. package/vue.config.js +3 -24
  301. package/chart/monitoring/steps/uninstall-v1.vue +0 -135
  302. package/components/Certificates.vue +0 -164
  303. package/components/__tests__/CodeMirror.spec.ts +0 -99
  304. package/components/fleet/__tests__/FleetSummary.test.ts +0 -316
  305. package/components/formatter/FleetClusterSummaryGraph.vue +0 -27
  306. package/components/formatter/__tests__/Checked.test.ts +0 -19
  307. package/components/formatter/__tests__/WorkloadDetailEndpoints.test.ts +0 -81
  308. package/components/nav/WindowManager/__tests__/ContainerLogs.test.ts +0 -186
  309. package/composables/useCompactInput.ts +0 -20
  310. package/composables/useLabeledFormElement.ts +0 -138
  311. package/creators/app/files/.gitlab-ci.yml +0 -14
  312. package/detail/__tests__/provisioning.cattle.io.cluster.test.ts +0 -77
  313. package/edit/__tests__/service.test.ts +0 -89
  314. package/edit/provisioning.cattle.io.cluster/__tests__/Advanced.test.ts +0 -112
  315. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +0 -473
  316. package/edit/provisioning.cattle.io.cluster/__tests__/index.test.ts +0 -73
  317. package/edit/provisioning.cattle.io.cluster/__tests__/utils/cluster.ts +0 -386
  318. package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +0 -137
  319. package/edit/provisioning.cattle.io.cluster/tabs/Advanced.vue +0 -157
  320. package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +0 -135
  321. package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +0 -189
  322. package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +0 -147
  323. package/edit/provisioning.cattle.io.cluster/tabs/upgrade/index.vue +0 -76
  324. package/mixins/v1-workload-metrics.js +0 -43
  325. package/models/__tests__/management.cattle.io.cluster.test.ts +0 -23
  326. package/models/__tests__/management.cattle.io.nodepool.ts +0 -83
  327. package/models/__tests__/provisioning.cattle.io.cluster.test.ts +0 -241
  328. package/models/__tests__/secret.test.ts +0 -37
  329. package/models/__tests__/storage.k8s.io.storageclass.test.ts +0 -22
  330. package/models/__tests__/workload.test.ts +0 -91
  331. package/plugins/clean-html.js +0 -53
  332. package/plugins/dashboard-store/__tests__/resource-class.test.ts +0 -49
  333. package/plugins/dashboard-store/__tests__/utils/store-mocks.ts +0 -7
  334. package/plugins/index.js +0 -11
  335. package/plugins/steve/__tests__/resource-utils.test.ts +0 -159
  336. package/plugins/steve/__tests__/steve-class.spec.ts +0 -59
  337. package/plugins/steve/__tests__/utils/steve-mocks.ts +0 -31
  338. package/plugins/steve/resource-utils.ts +0 -38
  339. package/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml +0 -50
  340. package/server/har-file.js +0 -183
  341. package/store/__tests__/type-map.test.ts +0 -1122
  342. package/tsconfig.paths.json +0 -18
  343. package/utils/azure.js +0 -24
  344. package/utils/clipboard.js +0 -5
  345. /package/components/form/__tests__/{NameNsDescription.test.ts → NameNsDescription.ts} +0 -0
  346. /package/edit/networking.k8s.io.networkpolicy/__tests__/utils/{selectors.test.ts → selectors.ts} +0 -0
  347. /package/edit/provisioning.cattle.io.cluster/{tabs/networking/ACE.vue → ACE.vue} +0 -0
  348. /package/edit/provisioning.cattle.io.cluster/{tabs/AgentConfiguration.vue → AgentConfiguration.vue} +0 -0
  349. /package/edit/provisioning.cattle.io.cluster/{tabs/upgrade/DrainOptions.vue → DrainOptions.vue} +0 -0
  350. /package/edit/provisioning.cattle.io.cluster/{tabs/MemberRoles.vue → MemberRoles.vue} +0 -0
  351. /package/edit/provisioning.cattle.io.cluster/{tabs/registries/RegistryConfigs.vue → RegistryConfigs.vue} +0 -0
  352. /package/edit/provisioning.cattle.io.cluster/{tabs/registries/RegistryMirrors.vue → RegistryMirrors.vue} +0 -0
  353. /package/edit/provisioning.cattle.io.cluster/{tabs/etcd/S3Config.vue → S3Config.vue} +0 -0
  354. /package/plugins/dashboard-store/__tests__/{actions.test.ts → actions.spec.ts} +0 -0
  355. /package/plugins/dashboard-store/__tests__/{getters.test.ts → getters.spec.ts} +0 -0
  356. /package/rancher-components/BadgeState/{BadgeState.spec.ts → BadgeState.test.ts} +0 -0
@@ -1,14 +1,14 @@
1
1
  import https from 'https';
2
2
  import { addParam, parse as parseUrl, stringify as unParseUrl } from '@shell/utils/url';
3
3
  import { handleSpoofedRequest, loadSchemas } from '@shell/plugins/dashboard-store/actions';
4
- import { dropKeys, set } from '@shell/utils/object';
4
+ import { set } from '@shell/utils/object';
5
5
  import { deferred } from '@shell/utils/promise';
6
6
  import { streamJson, streamingSupported } from '@shell/utils/stream';
7
7
  import isObject from 'lodash/isObject';
8
8
  import { classify } from '@shell/plugins/dashboard-store/classify';
9
9
  import { NAMESPACE } from '@shell/config/types';
10
+ import jsyaml from 'js-yaml';
10
11
  import { handleKubeApiHeaderWarnings } from '@shell/plugins/steve/header-warnings';
11
- import { steveCleanForDownload } from '@shell/plugins/steve/resource-utils';
12
12
 
13
13
  export default {
14
14
 
@@ -330,7 +330,31 @@ export default {
330
330
 
331
331
  // remove fields added by steve before showing/downloading yamls
332
332
  cleanForDownload(ctx, yaml) {
333
- return steveCleanForDownload(yaml);
333
+ if (!yaml) {
334
+ return;
335
+ }
336
+ const rootKeys = [
337
+ 'id',
338
+ 'links',
339
+ 'type',
340
+ 'actions'
341
+ ];
342
+ const metadataKeys = [
343
+ 'fields',
344
+ 'relationships',
345
+ 'state',
346
+ ];
347
+ const conditionKeys = [
348
+ 'error',
349
+ 'transitioning',
350
+ ];
351
+ const obj = jsyaml.load(yaml);
352
+
353
+ dropKeys(obj, rootKeys);
354
+ dropKeys(obj?.metadata, metadataKeys);
355
+ (obj?.status?.conditions || []).forEach((condition) => dropKeys(condition, conditionKeys));
356
+
357
+ return jsyaml.dump(obj);
334
358
  }
335
359
  };
336
360
 
@@ -374,6 +398,16 @@ function dropUnderscores(obj) {
374
398
  }
375
399
  }
376
400
 
401
+ function dropKeys(obj, keys) {
402
+ if ( !obj ) {
403
+ return;
404
+ }
405
+
406
+ for ( const k of keys ) {
407
+ delete obj[k];
408
+ }
409
+ }
410
+
377
411
  function dropCattleKeys(obj) {
378
412
  if ( !obj ) {
379
413
  return;
@@ -24,14 +24,11 @@ const GC_IGNORE_TYPES = {
24
24
  [UI.NAV_LINK]: true,
25
25
  };
26
26
 
27
- // Include calls to /v1 AND /k8s/clusters/<cluster id>/v1
28
- const steveRegEx = new RegExp('(/v1)|(\/k8s\/clusters\/[a-z0-9-]+\/v1)');
29
-
30
27
  export default {
31
28
  urlOptions: () => (url, opt) => {
32
29
  opt = opt || {};
33
30
  const parsedUrl = parse(url);
34
- const isSteve = steveRegEx.test(parsedUrl.path);
31
+ const isSteve = parsedUrl.path.startsWith('/v1');
35
32
 
36
33
  // labelSelector
37
34
  if ( opt.labelSelector ) {
@@ -126,10 +123,30 @@ export default {
126
123
  // `namespaced` is either
127
124
  // - a string representing a single namespace - add restriction to the url
128
125
  // - an array of namespaces or projects - add restriction as a param
129
- if (opt?.namespaced && !pAndNFiltering.isApplicable(opt)) {
130
- const parts = url.split('/');
126
+ if (!opt?.url && opt?.namespaced && !pAndNFiltering.isApplicable(opt)) {
127
+ // Update path to include `namespace`, but take into account
128
+ // - if there is an id
129
+ // - if there are query params
130
+
131
+ // Construct a url so query params / fragments are avoided
132
+ const urlObj = new URL(url);
133
+ const path = urlObj.pathname;
134
+
135
+ if (!!path?.length && path[path.length - 1] === '/') {
136
+ urlObj.pathname = path.substring(0, path.length - 1);
137
+ }
138
+ const parts = urlObj.pathname.split('/');
139
+
140
+ if (id) {
141
+ // namespace should go before the id in the path
142
+ parts.splice(parts.length - 1, 0, opt.namespaced);
143
+ urlObj.pathname = parts.join('/');
144
+ } else {
145
+ // namespace should go at the end of the path
146
+ urlObj.pathname = `${ urlObj.pathname.split('/').join('/') }/${ opt.namespaced }`;
147
+ }
131
148
 
132
- url = `${ parts.join('/') }/${ opt.namespaced }`;
149
+ url = urlObj.toString();
133
150
  }
134
151
 
135
152
  return url;
@@ -9,7 +9,6 @@ import {
9
9
  batchChanges,
10
10
  replace
11
11
  } from '@shell/plugins/dashboard-store/mutations';
12
- import { keyForSubscribe } from '@shell/plugins/steve/resourceWatcher';
13
12
  import { perfLoadAll } from '@shell/plugins/steve/performanceTesting';
14
13
  import Vue from 'vue';
15
14
  import { classify } from '@shell/plugins/dashboard-store/classify';
@@ -151,7 +150,11 @@ export default {
151
150
 
152
151
  forgetType(state, type) {
153
152
  if ( forgetType(state, type) ) {
154
- delete state.inError[keyForSubscribe({ type })];
153
+ Object.keys(state.inError).forEach((key) => {
154
+ if (key.startsWith(type)) {
155
+ delete state.inError[key];
156
+ }
157
+ });
155
158
  }
156
159
  },
157
160
 
@@ -3,7 +3,6 @@ import pickBy from 'lodash/pickBy';
3
3
  import Vue from 'vue';
4
4
  import { matchesSomeRegex } from '@shell/utils/string';
5
5
  import Resource from '@shell/plugins/dashboard-store/resource-class';
6
- import { findBy } from '@shell/utils/array';
7
6
 
8
7
  export default class NormanModel extends Resource {
9
8
  setLabels(val) {
@@ -57,22 +56,4 @@ export default class NormanModel extends Resource {
57
56
  Vue.set(this, key, { ...spec[key] });
58
57
  });
59
58
  }
60
-
61
- isCondition(condition, withStatus = 'True') {
62
- if ( !this.conditions ) {
63
- return false;
64
- }
65
-
66
- const entry = findBy((this.conditions || []), 'type', condition);
67
-
68
- if ( !entry ) {
69
- return false;
70
- }
71
-
72
- if ( !withStatus ) {
73
- return true;
74
- }
75
-
76
- return (entry.status || '').toLowerCase() === `${ withStatus }`.toLowerCase();
77
- }
78
59
  }
@@ -1,17 +1,5 @@
1
1
  import { DESCRIPTION } from '@shell/config/labels-annotations';
2
2
  import HybridModel from './hybrid-class';
3
- import { NEVER_ADD } from '@shell/utils/create-yaml';
4
- import { deleteProperty } from '@shell/utils/object';
5
-
6
- // Some fields that are removed for YAML (NEVER_ADD) are required via API
7
- const STEVE_ADD = [
8
- 'metadata.resourceVersion',
9
- 'metadata.fields',
10
- 'metadata.clusterName',
11
- 'metadata.deletionGracePeriodSeconds',
12
- 'metadata.generateName',
13
- ];
14
- const STEVE_NEVER_SAVE = NEVER_ADD.filter((na) => !STEVE_ADD.includes(na));
15
3
 
16
4
  export default class SteveModel extends HybridModel {
17
5
  get name() {
@@ -40,14 +28,4 @@ export default class SteveModel extends HybridModel {
40
28
 
41
29
  this._description = value;
42
30
  }
43
-
44
- cleanForSave(data, forNew) {
45
- const val = super.cleanForSave(data);
46
-
47
- for (const field of STEVE_NEVER_SAVE) {
48
- deleteProperty(val, field);
49
- }
50
-
51
- return val;
52
- }
53
31
  }
@@ -22,7 +22,8 @@ import Socket, {
22
22
  EVENT_DISCONNECT_ERROR,
23
23
  NO_WATCH,
24
24
  NO_SCHEMA,
25
- REVISION_TOO_OLD
25
+ REVISION_TOO_OLD,
26
+ NO_PERMS
26
27
  } from '@shell/utils/socket';
27
28
  import { normalizeType } from '@shell/plugins/dashboard-store/normalize';
28
29
  import day from 'dayjs';
@@ -332,6 +333,10 @@ const sharedActions = {
332
333
 
333
334
  commit('setWantSocket', true);
334
335
 
336
+ if ( process.server ) {
337
+ return;
338
+ }
339
+
335
340
  state.debugSocket && console.info(`Subscribe [${ getters.storeName }]`); // eslint-disable-line no-console
336
341
 
337
342
  const url = `${ state.config.baseUrl }/subscribe`;
@@ -430,6 +435,14 @@ const sharedActions = {
430
435
  return;
431
436
  }
432
437
 
438
+ const schema = getters.schemaFor(type, false, false);
439
+
440
+ if (!!schema?.attributes?.verbs?.includes && !schema.attributes.verbs.includes('watch')) {
441
+ state.debugSocket && console.info('Will not Watch (type does not have watch verb)', JSON.stringify(params)); // eslint-disable-line no-console
442
+
443
+ return;
444
+ }
445
+
433
446
  // If socket is in error don't try to watch.... unless we `force` it
434
447
  const inError = getters.inError(params);
435
448
 
@@ -597,7 +610,7 @@ const defaultActions = {
597
610
  },
598
611
 
599
612
  rehydrateSubscribe({ state, dispatch }) {
600
- if ( state.wantSocket && !state.socket ) {
613
+ if ( process.client && state.wantSocket && !state.socket ) {
601
614
  dispatch('subscribe');
602
615
  }
603
616
  },
@@ -635,13 +648,17 @@ const defaultActions = {
635
648
  await dispatch('find', {
636
649
  type: resourceType,
637
650
  id,
638
- opt,
651
+ opt: {
652
+ ...opt,
653
+ // Pass the namespace so `find` can construct the url correctly
654
+ namespaced: namespace,
655
+ // Ensure that find calls watch with no revision (otherwise it'll use the revision from the resource which is probably stale)
656
+ revision: null
657
+ },
639
658
  });
640
- commit('clearInError', params);
641
659
 
642
660
  return;
643
661
  }
644
-
645
662
  let have, want;
646
663
 
647
664
  if ( selector ) {
@@ -724,9 +741,11 @@ const defaultActions = {
724
741
  }
725
742
 
726
743
  // Try resending any frames that were attempted to be sent while the socket was down, once.
727
- for ( const obj of state.pendingFrames.slice() ) {
728
- commit('dequeuePendingFrame', obj);
729
- dispatch('sendImmediate', obj);
744
+ if ( !process.server ) {
745
+ for ( const obj of state.pendingFrames.slice() ) {
746
+ commit('dequeuePendingFrame', obj);
747
+ dispatch('sendImmediate', obj);
748
+ }
730
749
  }
731
750
  },
732
751
 
@@ -844,15 +863,17 @@ const defaultActions = {
844
863
  const err = msg.data?.error?.toLowerCase();
845
864
 
846
865
  if ( err.includes('watch not allowed') ) {
847
- commit('setInError', { type: msg.resourceType, reason: NO_WATCH });
866
+ commit('setInError', { msg, reason: NO_WATCH });
848
867
  } else if ( err.includes('failed to find schema') ) {
849
- commit('setInError', { type: msg.resourceType, reason: NO_SCHEMA });
868
+ commit('setInError', { msg, reason: NO_SCHEMA });
850
869
  } else if ( err.includes('too old') ) {
851
870
  // Set an error for (all) subs of this type. This..
852
871
  // 1) blocks attempts by resource.stop to resub (as type is in error)
853
872
  // 2) will be cleared when resyncWatch --> watch (with force) --> resource.start completes
854
- commit('setInError', { type: msg.resourceType, reason: REVISION_TOO_OLD });
873
+ commit('setInError', { msg, reason: REVISION_TOO_OLD });
855
874
  dispatch('resyncWatch', msg);
875
+ } else if ( err.includes('the server does not allow this method on the requested resource')) {
876
+ commit('setInError', { msg, reason: NO_PERMS });
856
877
  }
857
878
  },
858
879
 
@@ -1023,10 +1044,10 @@ const defaultMutations = {
1023
1044
  }
1024
1045
  },
1025
1046
 
1026
- setInError(state, msg) {
1047
+ setInError(state, { msg, reason }) {
1027
1048
  const key = keyForSubscribe(msg);
1028
1049
 
1029
- state.inError[key] = msg.reason;
1050
+ state.inError[key] = reason;
1030
1051
  },
1031
1052
 
1032
1053
  clearInError(state, msg) {
@@ -0,0 +1,4 @@
1
+ import Vue from 'vue';
2
+ import Transitions from 'vue2-transitions';
3
+
4
+ Vue.use(Transitions);
@@ -0,0 +1,4 @@
1
+ import Vue from 'vue';
2
+ import VueClipboard from 'vue-clipboard2';
3
+
4
+ Vue.use(VueClipboard);
@@ -1,7 +1,8 @@
1
1
  <script lang="ts">
2
- import Vue from 'vue';
2
+ import { defineComponent } from 'vue';
3
3
  import { mapGetters } from 'vuex';
4
- export default Vue.extend({
4
+
5
+ export default defineComponent({
5
6
  props: {
6
7
  title: {
7
8
  type: String,
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import Vue, { PropType } from 'vue';
2
+ import { PropType, defineComponent } from 'vue';
3
3
 
4
4
  interface Badge {
5
5
  stateBackground: string;
@@ -11,7 +11,7 @@ interface Badge {
11
11
  * <p>Represents a badge whose label and color is either taken from the value property or
12
12
  * from the label and color properties. The state property takes precedence.</p>
13
13
  */
14
- export default Vue.extend({
14
+ export default defineComponent({
15
15
  props: {
16
16
  /**
17
17
  * A value having the properties `stateBackground` and `stateDisplay`
@@ -59,7 +59,7 @@ export default Vue.extend({
59
59
  </script>
60
60
 
61
61
  <template>
62
- <span :class="{'badge-state': true, [bg]: true}">
62
+ <span :class="['badge-state', bg]">
63
63
  <i
64
64
  v-if="icon"
65
65
  class="icon"
@@ -1,16 +1,12 @@
1
1
  import { mount } from '@vue/test-utils';
2
2
  import { Banner } from './index';
3
- import { cleanHtmlDirective } from '@shell/plugins/clean-html-directive';
4
3
 
5
4
  describe('component: Banner', () => {
6
5
  it('should display text based on label', () => {
7
6
  const label = 'test';
8
7
  const wrapper = mount(
9
8
  Banner,
10
- {
11
- directives: { cleanHtmlDirective },
12
- propsData: { label }
13
- });
9
+ { propsData: { label } });
14
10
 
15
11
  const element = wrapper.find('span').element;
16
12
 
@@ -1,9 +1,9 @@
1
1
  <script lang="ts">
2
- import Vue from 'vue';
2
+ import { defineComponent } from 'vue';
3
3
  import { nlToBr } from '@shell/utils/string';
4
4
  import { stringify } from '@shell/utils/error';
5
5
 
6
- export default Vue.extend({
6
+ export default defineComponent({
7
7
  props: {
8
8
  /**
9
9
  * A color class that represents the color of the banner.
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import Vue from 'vue';
2
+ import { defineComponent, PropType } from 'vue';
3
3
 
4
- export default Vue.extend({
4
+ export default defineComponent({
5
5
  name: 'Card',
6
6
  props: {
7
7
  /**
@@ -22,7 +22,7 @@ export default Vue.extend({
22
22
  * The function to invoke when the default action button is clicked.
23
23
  */
24
24
  buttonAction: {
25
- type: Function,
25
+ type: Function as PropType<(event: MouseEvent) => void>,
26
26
  default: (): void => { }
27
27
  },
28
28
  /**
@@ -151,7 +151,7 @@ export default Vue.extend({
151
151
 
152
152
  .card-body {
153
153
  justify-content: flex-start;
154
- overflow: scroll;
154
+ overflow: auto;
155
155
  }
156
156
 
157
157
  > * {
@@ -1,10 +1,10 @@
1
1
  <script lang="ts">
2
- import Vue, { PropType } from 'vue';
2
+ import { PropType, defineComponent } from 'vue';
3
3
  import { _EDIT, _VIEW } from '@shell/config/query-params';
4
4
  import { addObject, removeObject } from '@shell/utils/array';
5
5
  import cloneDeep from 'lodash/cloneDeep';
6
6
 
7
- export default Vue.extend({
7
+ export default defineComponent({
8
8
  name: 'Checkbox',
9
9
 
10
10
  props: {
@@ -140,7 +140,7 @@ export default Vue.extend({
140
140
  /**
141
141
  * Toggles the checked state for the checkbox and emits an 'input' event.
142
142
  */
143
- clicked(event: MouseEvent): boolean | void {
143
+ clicked(event: MouseEvent | KeyboardEvent): boolean | void {
144
144
  if ((event.target as HTMLLinkElement).tagName === 'A' && (event.target as HTMLLinkElement).href) {
145
145
  // Ignore links inside the checkbox label so you can click them
146
146
  return true;
@@ -325,6 +325,7 @@ $fontColor: var(--input-label);
325
325
  border-radius: var(--border-radius);
326
326
  transition: all 0.3s ease-out;
327
327
  border: 1px solid var(--border);
328
+ flex-shrink: 0;
328
329
  }
329
330
 
330
331
  input {
@@ -5,7 +5,7 @@ describe('component: LabeledInput', () => {
5
5
  it('should emit input only once', () => {
6
6
  const value = '2';
7
7
  const delay = 1;
8
- const wrapper = mount(LabeledInput as any, {
8
+ const wrapper = mount(LabeledInput, {
9
9
  propsData: { delay },
10
10
  mocks: { $store: { getters: { 'i18n/t': jest.fn() } } }
11
11
  });
@@ -1,21 +1,27 @@
1
1
  <script lang="ts">
2
- import Vue, { VueConstructor } from 'vue';
3
- import CompactInput from '@shell/mixins/compact-input';
4
- import LabeledFormElement from '@shell/mixins/labeled-form-element';
2
+ import { defineComponent } from 'vue';
5
3
  import TextAreaAutoGrow from '@components/Form/TextArea/TextAreaAutoGrow.vue';
6
4
  import LabeledTooltip from '@components/LabeledTooltip/LabeledTooltip.vue';
7
5
  import { escapeHtml } from '@shell/utils/string';
8
6
  import cronstrue from 'cronstrue';
9
7
  import { isValidCron } from 'cron-validator';
10
8
  import { debounce } from 'lodash';
9
+ import { useLabeledFormElement, labeledFormElementProps } from '@shell/composables/useLabeledFormElement';
10
+ import { useCompactInput } from '@shell/composables/useCompactInput';
11
11
 
12
- export default (
13
- Vue as VueConstructor<Vue & InstanceType<typeof LabeledFormElement> & InstanceType<typeof CompactInput>>
14
- ).extend({
12
+ declare module 'vue/types/vue' {
13
+ interface Vue {
14
+ onInput: (event: Event) => void | ((event: Event) => void);
15
+ }
16
+ }
17
+
18
+ export default defineComponent({
15
19
  components: { LabeledTooltip, TextAreaAutoGrow },
16
- mixins: [LabeledFormElement, CompactInput],
20
+
21
+ inheritAttrs: false,
17
22
 
18
23
  props: {
24
+ ...labeledFormElementProps,
19
25
  /**
20
26
  * The type of the Labeled Input.
21
27
  * @values text, cron, multiline, multiline-password
@@ -93,21 +99,36 @@ export default (
93
99
  },
94
100
  },
95
101
 
102
+ setup(props, { emit }) {
103
+ const {
104
+ focused,
105
+ onFocusLabeled,
106
+ onBlurLabeled,
107
+ isDisabled,
108
+ validationMessage,
109
+ requiredField
110
+ } = useLabeledFormElement(props, emit);
111
+ const { isCompact } = useCompactInput(props);
112
+
113
+ return {
114
+ focused,
115
+ onFocusLabeled,
116
+ onBlurLabeled,
117
+ isDisabled,
118
+ validationMessage,
119
+ requiredField,
120
+ isCompact,
121
+ };
122
+ },
123
+
96
124
  data() {
97
125
  return {
98
126
  updated: false,
99
- validationErrors: ''
127
+ validationErrors: '',
100
128
  };
101
129
  },
102
130
 
103
131
  computed: {
104
- /**
105
- * Determines if the Labeled Input @input event should be debounced.
106
- */
107
- onInput(): ((value: string) => void) | void {
108
- return this.delay ? debounce(this.delayInput, this.delay) : this.delayInput;
109
- },
110
-
111
132
  /**
112
133
  * Determines if the Labeled Input should display a label.
113
134
  */
@@ -122,7 +143,7 @@ export default (
122
143
  return !!this.tooltip || !!this.tooltipKey;
123
144
  },
124
145
 
125
- tooltipValue(): string | undefined {
146
+ tooltipValue(): string | Record<string, unknown> | undefined {
126
147
  if (this.hasTooltip) {
127
148
  return this.tooltipKey ? this.t(this.tooltipKey) : this.tooltip;
128
149
  }
@@ -144,7 +165,7 @@ export default (
144
165
  if (this.type !== 'cron' || !this.value) {
145
166
  return;
146
167
  }
147
- if (!isValidCron(this.value)) {
168
+ if (typeof this.value === 'string' && !isValidCron(this.value)) {
148
169
  return this.t('generic.invalidCron');
149
170
  }
150
171
  try {
@@ -173,15 +194,22 @@ export default (
173
194
  /**
174
195
  * The max length for the Labeled Input.
175
196
  */
176
- _maxlength(): number | null {
197
+ _maxlength(): number | undefined {
177
198
  if (this.type === 'text' && this.maxlength) {
178
199
  return this.maxlength;
179
200
  }
180
201
 
181
- return null;
202
+ return undefined;
182
203
  },
183
204
  },
184
205
 
206
+ created() {
207
+ /**
208
+ * Determines if the Labeled Input @input event should be debounced.
209
+ */
210
+ this.onInput = this.delay ? debounce(this.delayInput, this.delay) : this.delayInput;
211
+ },
212
+
185
213
  methods: {
186
214
  /**
187
215
  * Attempts to give the Labeled Input focus.
@@ -220,7 +248,9 @@ export default (
220
248
  * NOTE: In multiline, TextAreaAutoGrow emits a string with the value
221
249
  * https://github.com/rancher/dashboard/issues/10249
222
250
  */
223
- delayInput(value: string): void {
251
+ delayInput(val: string | Event): void {
252
+ const value = typeof val === 'string' ? val : (val?.target as HTMLInputElement)?.value;
253
+
224
254
  this.$emit('input', value);
225
255
  },
226
256
 
@@ -237,7 +267,7 @@ export default (
237
267
  * event.
238
268
  * @see labeled-form-element.ts mixin for onBlurLabeled()
239
269
  */
240
- onBlur(event: string): void {
270
+ onBlur(event: string | FocusEvent): void {
241
271
  this.$emit('blur', event);
242
272
  this.onBlurLabeled();
243
273
  },
@@ -289,7 +319,7 @@ export default (
289
319
  :placeholder="_placeholder"
290
320
  autocapitalize="off"
291
321
  :class="{ conceal: type === 'multiline-password' }"
292
- @input="onInput($event)"
322
+ @input="onInput"
293
323
  @focus="onFocus"
294
324
  @blur="onBlur"
295
325
  />
@@ -306,7 +336,7 @@ export default (
306
336
  autocomplete="off"
307
337
  autocapitalize="off"
308
338
  :data-lpignore="ignorePasswordManagers"
309
- @input="onInput($event.target.value)"
339
+ @input="onInput"
310
340
  @focus="onFocus"
311
341
  @blur="onBlur"
312
342
  @change="onChange"
@@ -331,8 +361,9 @@ export default (
331
361
  >{{ cronHint }}</label>
332
362
  <label
333
363
  v-if="subLabel"
364
+ v-clean-html="subLabel"
334
365
  class="sub-label"
335
- >{{ subLabel }}</label>
366
+ />
336
367
  </div>
337
368
  </template>
338
369
  <style scoped lang="scss">
@@ -1,6 +1,5 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
  import { RadioButton } from './index';
3
- import { cleanHtmlDirective } from '@shell/plugins/clean-html-directive';
4
3
 
5
4
  describe('radioButton.vue', () => {
6
5
  it('renders label slot contents', () => {
@@ -13,8 +12,7 @@ describe('radioButton.vue', () => {
13
12
  const wrapper = shallowMount(
14
13
  RadioButton,
15
14
  {
16
- directives: { cleanHtmlDirective },
17
- propsData: {
15
+ propsData: {
18
16
  label: 'Test Label', val: {}, value: {}
19
17
  }
20
18
  });