@rancher/shell 0.4.0 → 0.5.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 (274) hide show
  1. package/assets/images/providers/ovhcloudmks.svg +122 -0
  2. package/assets/images/providers/ovhcloudpubliccloud.svg +122 -0
  3. package/assets/styles/global/_layout.scss +99 -0
  4. package/assets/translations/en-us.yaml +30 -5
  5. package/assets/translations/zh-hans.yaml +1 -1
  6. package/babel.config.js +7 -1
  7. package/chart/monitoring/alerting/index.vue +7 -21
  8. package/chart/monitoring/grafana/index.vue +55 -0
  9. package/chart/monitoring/index.vue +51 -17
  10. package/chart/monitoring/prometheus/index.vue +37 -43
  11. package/chart/rancher-backup/index.vue +2 -1
  12. package/cloud-credential/azure.vue +4 -17
  13. package/components/AsyncButton.vue +17 -5
  14. package/components/Certificates.vue +164 -0
  15. package/components/CodeMirror.vue +19 -21
  16. package/components/CruResource.vue +1 -0
  17. package/components/DraggableZone.vue +2 -2
  18. package/components/EtcdInfoBanner.vue +1 -1
  19. package/components/ExplorerProjectsNamespaces.vue +25 -1
  20. package/components/IconOrSvg.vue +1 -1
  21. package/components/LandingPagePreference.vue +1 -4
  22. package/components/PodSecurityAdmission.vue +2 -2
  23. package/components/Questions/index.vue +1 -1
  24. package/components/ResourceDetail/Masthead.vue +16 -3
  25. package/components/ResourceTable.vue +14 -2
  26. package/components/ResourceYaml.vue +5 -0
  27. package/components/SideNav.vue +1 -1
  28. package/components/SingleClusterInfo.vue +1 -4
  29. package/components/Tabbed/index.vue +12 -0
  30. package/components/fleet/FleetRepos.vue +62 -27
  31. package/components/fleet/FleetResources.vue +6 -1
  32. package/components/form/ArrayListSelect.vue +10 -0
  33. package/components/form/Error.vue +3 -3
  34. package/components/form/Footer.vue +2 -2
  35. package/components/form/GitPicker.vue +83 -38
  36. package/components/form/KeyValue.vue +4 -0
  37. package/components/form/LabeledSelect.vue +4 -0
  38. package/components/formatter/Checked.vue +11 -3
  39. package/components/formatter/FleetClusterSummaryGraph.vue +27 -0
  40. package/components/formatter/FleetSummaryGraph.vue +23 -11
  41. package/components/formatter/LiveDuration.vue +1 -1
  42. package/components/formatter/PercentageBar.vue +1 -1
  43. package/components/formatter/__tests__/Checked.test.ts +19 -0
  44. package/components/nav/Group.vue +2 -2
  45. package/components/nav/Header.vue +0 -1
  46. package/components/nav/TopLevelMenu.vue +36 -6
  47. package/components/nav/Type.vue +1 -3
  48. package/components/nav/WindowManager/ContainerLogs.vue +101 -3
  49. package/components/nav/WindowManager/ContainerShell.vue +6 -1
  50. package/components/nav/WindowManager/__tests__/ContainerLogs.test.ts +186 -0
  51. package/components/nav/WindowManager/index.vue +11 -10
  52. package/components/nav/__tests__/TopLevelMenu.test.ts +33 -0
  53. package/components/nav/__tests__/Type.test.ts +1 -1
  54. package/components/nuxt/nuxt-child.js +14 -78
  55. package/components/nuxt/nuxt.js +1 -1
  56. package/{layouts → components/templates}/blank.vue +1 -1
  57. package/{layouts → components/templates}/default.vue +8 -98
  58. package/{layouts → components/templates}/error.vue +10 -19
  59. package/{layouts → components/templates}/home.vue +4 -1
  60. package/{layouts → components/templates}/plain.vue +4 -1
  61. package/{layouts → components/templates}/standalone.vue +1 -1
  62. package/{layouts → components/templates}/unauthenticated.vue +1 -1
  63. package/composables/useCompactInput.test.ts +36 -0
  64. package/composables/useCompactInput.ts +20 -0
  65. package/composables/useLabeledFormElement.test.ts +135 -0
  66. package/composables/useLabeledFormElement.ts +138 -0
  67. package/config/harvester-manager-types.js +2 -0
  68. package/config/private-label.js +22 -0
  69. package/config/product/explorer.js +3 -0
  70. package/config/product/fleet.js +6 -1
  71. package/config/product/manager.js +8 -2
  72. package/config/query-params.js +1 -0
  73. package/config/router.js +385 -364
  74. package/config/settings.ts +1 -0
  75. package/config/store.js +1 -1
  76. package/config/system-namespaces.js +3 -0
  77. package/config/table-headers.js +47 -0
  78. package/core/plugin-routes.ts +56 -114
  79. package/core/plugin.ts +16 -10
  80. package/core/plugins-loader.js +7 -9
  81. package/core/plugins.js +0 -3
  82. package/creators/app/files/.gitlab-ci.yml +1 -1
  83. package/detail/fleet.cattle.io.cluster.vue +11 -1
  84. package/detail/provisioning.cattle.io.cluster.vue +4 -3
  85. package/dialog/ScaleMachineDownDialog.vue +34 -17
  86. package/edit/__tests__/service.test.ts +89 -0
  87. package/edit/auth/googleoauth.vue +1 -5
  88. package/edit/cloudcredential.vue +2 -0
  89. package/edit/configmap.vue +2 -1
  90. package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +2 -2
  91. package/edit/networking.k8s.io.networkpolicy/__tests__/PolicyRuleTarget.spec.ts +1 -1
  92. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +15 -7
  93. package/edit/provisioning.cattle.io.cluster/__tests__/Advanced.test.ts +112 -0
  94. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +473 -0
  95. package/edit/provisioning.cattle.io.cluster/__tests__/{CustomCommand.tests.ts → CustomCommand.test.ts} +4 -0
  96. package/edit/provisioning.cattle.io.cluster/__tests__/DrainOptions.test.ts +1 -1
  97. package/edit/provisioning.cattle.io.cluster/__tests__/index.test.ts +73 -0
  98. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +7 -1
  99. package/edit/provisioning.cattle.io.cluster/__tests__/utils/cluster.ts +386 -0
  100. package/edit/provisioning.cattle.io.cluster/import.vue +2 -2
  101. package/edit/provisioning.cattle.io.cluster/index.vue +92 -36
  102. package/edit/provisioning.cattle.io.cluster/rke2.vue +171 -583
  103. package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +137 -0
  104. package/edit/provisioning.cattle.io.cluster/tabs/Advanced.vue +157 -0
  105. package/edit/provisioning.cattle.io.cluster/{Basics.vue → tabs/Basics.vue} +94 -19
  106. package/edit/provisioning.cattle.io.cluster/{MachinePool.vue → tabs/MachinePool.vue} +1 -0
  107. package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +135 -0
  108. package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +189 -0
  109. package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +144 -0
  110. package/edit/provisioning.cattle.io.cluster/tabs/upgrade/index.vue +76 -0
  111. package/edit/service.vue +12 -0
  112. package/edit/workload/mixins/workload.js +1 -1
  113. package/initialize/App.js +25 -71
  114. package/initialize/client.js +21 -162
  115. package/initialize/index.js +27 -123
  116. package/list/management.cattle.io.feature.vue +1 -7
  117. package/list/node.vue +1 -0
  118. package/machine-config/__tests__/vmwarevsphere.test.ts +100 -21
  119. package/machine-config/vmwarevsphere.vue +73 -51
  120. package/middleware/authenticated.js +10 -17
  121. package/mixins/auth-config.js +2 -7
  122. package/mixins/brand.js +29 -41
  123. package/mixins/create-edit-view/index.js +2 -2
  124. package/mixins/labeled-form-element.ts +6 -1
  125. package/models/__tests__/management.cattle.io.node.ts +85 -0
  126. package/models/__tests__/management.cattle.io.nodepool.ts +83 -0
  127. package/models/__tests__/namespace.test.ts +49 -9
  128. package/models/__tests__/workload.test.ts +91 -0
  129. package/models/cluster/node.js +4 -4
  130. package/models/cluster.x-k8s.io.machinedeployment.js +14 -0
  131. package/models/fleet.cattle.io.cluster.js +4 -0
  132. package/models/fleet.cattle.io.gitrepo.js +56 -13
  133. package/models/management.cattle.io.kontainerdriver.js +1 -1
  134. package/models/management.cattle.io.node.js +18 -14
  135. package/models/management.cattle.io.nodepool.js +17 -0
  136. package/models/namespace.js +1 -1
  137. package/models/pod.js +20 -0
  138. package/models/provisioning.cattle.io.cluster.js +20 -3
  139. package/models/secret.js +117 -18
  140. package/models/workload.js +16 -0
  141. package/models/workload.service.js +18 -0
  142. package/package.json +10 -9
  143. package/pages/about.vue +0 -1
  144. package/pages/account/create-key.vue +0 -1
  145. package/pages/account/index.vue +0 -1
  146. package/pages/auth/login.vue +0 -1
  147. package/pages/auth/logout.vue +0 -2
  148. package/pages/auth/setup.vue +0 -4
  149. package/pages/auth/verify.vue +14 -8
  150. package/pages/c/_cluster/apps/charts/install.vue +4 -4
  151. package/pages/c/_cluster/apps/index.vue +0 -2
  152. package/pages/c/_cluster/auth/index.vue +0 -2
  153. package/pages/c/_cluster/ecm/index.vue +0 -2
  154. package/pages/c/_cluster/explorer/index.vue +28 -2
  155. package/pages/c/_cluster/fleet/index.vue +1 -1
  156. package/pages/c/_cluster/index.vue +0 -2
  157. package/pages/c/_cluster/settings/banners.vue +0 -2
  158. package/pages/c/_cluster/settings/brand.vue +0 -2
  159. package/pages/c/_cluster/settings/index.vue +0 -2
  160. package/pages/c/_cluster/settings/links.vue +0 -1
  161. package/pages/c/_cluster/settings/performance.vue +0 -1
  162. package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +2 -1
  163. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +10 -46
  164. package/pages/c/_cluster/uiplugins/index.vue +0 -2
  165. package/pages/diagnostic.vue +1 -2
  166. package/pages/fail-whale.vue +0 -1
  167. package/pages/prefs.vue +0 -1
  168. package/pages/support/index.vue +2 -8
  169. package/pkg/auto-import.js +1 -1
  170. package/plugins/axios.js +0 -36
  171. package/plugins/back-button.js +3 -5
  172. package/plugins/codemirror-loader.js +1 -1
  173. package/plugins/codemirror.js +41 -0
  174. package/plugins/dashboard-store/__tests__/{mutations.spec.ts → mutations.test.ts} +1 -1
  175. package/plugins/dashboard-store/__tests__/resource-class.test.ts +49 -0
  176. package/plugins/dashboard-store/__tests__/utils/store-mocks.ts +7 -0
  177. package/plugins/dashboard-store/actions.js +30 -4
  178. package/plugins/dashboard-store/classify.js +1 -18
  179. package/plugins/dashboard-store/getters.js +10 -5
  180. package/plugins/dashboard-store/index.js +0 -12
  181. package/plugins/dashboard-store/mutations.js +0 -4
  182. package/plugins/dashboard-store/resource-class.js +59 -18
  183. package/plugins/steve/__tests__/steve-class.spec.ts +59 -0
  184. package/plugins/steve/__tests__/utils/steve-mocks.ts +31 -0
  185. package/plugins/steve/getters.js +4 -1
  186. package/plugins/steve/norman-class.js +19 -0
  187. package/plugins/steve/steve-class.js +22 -0
  188. package/plugins/steve/subscribe.js +4 -10
  189. package/rancher-components/Accordion/Accordion.test.ts +45 -0
  190. package/rancher-components/Accordion/Accordion.vue +86 -0
  191. package/rancher-components/Accordion/index.ts +1 -0
  192. package/rancher-components/BadgeState/BadgeState.vue +3 -3
  193. package/rancher-components/Banner/Banner.vue +2 -2
  194. package/rancher-components/Card/Card.vue +3 -3
  195. package/rancher-components/Form/Checkbox/Checkbox.vue +3 -3
  196. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +18 -1
  197. package/rancher-components/Form/LabeledInput/LabeledInput.vue +65 -24
  198. package/rancher-components/Form/Radio/RadioButton.test.ts +7 -3
  199. package/rancher-components/Form/Radio/RadioButton.vue +13 -7
  200. package/rancher-components/Form/Radio/RadioGroup.test.ts +30 -0
  201. package/rancher-components/Form/Radio/RadioGroup.vue +8 -3
  202. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +6 -4
  203. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +7 -4
  204. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +9 -4
  205. package/rancher-components/StringList/StringList.test.ts +270 -0
  206. package/rancher-components/StringList/StringList.vue +65 -26
  207. package/rancher-components/components/Accordion/Accordion.test.ts +45 -0
  208. package/rancher-components/components/Accordion/Accordion.vue +86 -0
  209. package/rancher-components/components/Accordion/index.ts +1 -0
  210. package/rancher-components/components/BadgeState/BadgeState.vue +3 -3
  211. package/rancher-components/components/Banner/Banner.vue +2 -2
  212. package/rancher-components/components/Card/Card.vue +3 -3
  213. package/rancher-components/components/Form/Checkbox/Checkbox.vue +3 -3
  214. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +18 -1
  215. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +57 -24
  216. package/rancher-components/components/Form/Radio/RadioButton.vue +13 -7
  217. package/rancher-components/components/Form/Radio/RadioGroup.vue +4 -3
  218. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +6 -4
  219. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +7 -4
  220. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +9 -4
  221. package/rancher-components/components/StringList/StringList.vue +8 -8
  222. package/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml +50 -0
  223. package/scripts/extension/parse-tag-name +2 -2
  224. package/scripts/publish-shell.sh +10 -0
  225. package/scripts/test-plugins-build.sh +85 -9
  226. package/server/har-file.js +183 -0
  227. package/store/catalog.js +1 -1
  228. package/store/features.js +1 -0
  229. package/store/i18n.js +11 -0
  230. package/store/index.js +10 -11
  231. package/store/prefs.js +33 -35
  232. package/store/type-map.js +8 -7
  233. package/tsconfig.json +35 -9
  234. package/tsconfig.paths.json +21 -0
  235. package/types/shell/index.d.ts +427 -234
  236. package/types/vue-shim.d.ts +42 -0
  237. package/utils/__tests__/create-yaml.test.ts +60 -0
  238. package/utils/axios.js +0 -19
  239. package/utils/azure.js +24 -0
  240. package/utils/create-yaml.js +17 -10
  241. package/utils/git.ts +1 -1
  242. package/utils/monitoring.js +1 -1
  243. package/utils/nuxt.js +18 -39
  244. package/utils/object.js +14 -0
  245. package/utils/router.scrollBehavior.js +12 -14
  246. package/utils/time.js +1 -1
  247. package/utils/url.ts +1 -1
  248. package/vue.config.js +23 -2
  249. package/.DS_Store +0 -0
  250. package/assets/images/providers/aks-black.svg +0 -28
  251. package/assets/images/providers/aks.svg +0 -31
  252. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts +0 -234
  253. package/initialize/layouts.ts +0 -26
  254. package/mixins/fetch.server.js +0 -73
  255. package/pages/c/index.vue +0 -9
  256. package/pages/rio/mesh.vue +0 -508
  257. package/plugins/transitions.js +0 -4
  258. package/scripts/.DS_Store +0 -0
  259. package/scripts/verdaccio.log +0 -205
  260. package/tsconfig.default.json +0 -46
  261. package/yarn-error.log +0 -200
  262. /package/components/form/__tests__/{NameNsDescription.ts → NameNsDescription.test.ts} +0 -0
  263. /package/edit/networking.k8s.io.networkpolicy/__tests__/utils/{selectors.ts → selectors.test.ts} +0 -0
  264. /package/edit/provisioning.cattle.io.cluster/{AgentConfiguration.vue → tabs/AgentConfiguration.vue} +0 -0
  265. /package/edit/provisioning.cattle.io.cluster/{MemberRoles.vue → tabs/MemberRoles.vue} +0 -0
  266. /package/edit/provisioning.cattle.io.cluster/{S3Config.vue → tabs/etcd/S3Config.vue} +0 -0
  267. /package/edit/provisioning.cattle.io.cluster/{ACE.vue → tabs/networking/ACE.vue} +0 -0
  268. /package/edit/provisioning.cattle.io.cluster/{RegistryConfigs.vue → tabs/registries/RegistryConfigs.vue} +0 -0
  269. /package/edit/provisioning.cattle.io.cluster/{RegistryMirrors.vue → tabs/registries/RegistryMirrors.vue} +0 -0
  270. /package/edit/provisioning.cattle.io.cluster/{DrainOptions.vue → tabs/upgrade/DrainOptions.vue} +0 -0
  271. /package/plugins/dashboard-store/__tests__/{actions.spec.ts → actions.test.ts} +0 -0
  272. /package/plugins/dashboard-store/__tests__/{getters.spec.ts → getters.test.ts} +0 -0
  273. /package/rancher-components/BadgeState/{BadgeState.spec.ts → BadgeState.test.ts} +0 -0
  274. /package/rancher-components/components/BadgeState/{BadgeState.spec.ts → BadgeState.test.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import Vue from 'vue';
2
+ import { defineComponent } from 'vue';
3
3
  import { _VIEW, _CREATE } from '@shell/config/query-params';
4
4
  import LabeledSelect from '@shell/components/form/LabeledSelect.vue';
5
5
  import Checkbox from '@components/Form/Checkbox/Checkbox.vue';
@@ -25,7 +25,7 @@ const getExemptionControl = (): PSAExemptionControl => ({
25
25
  value: ''
26
26
  });
27
27
 
28
- export default Vue.extend({
28
+ export default defineComponent({
29
29
  components: {
30
30
  Checkbox, LabeledSelect, LabeledInput
31
31
  },
@@ -258,7 +258,7 @@ export default {
258
258
  }
259
259
 
260
260
  if ( this.tabbed === 'multiple' ) {
261
- return this.groups.length > 1;
261
+ return !!this.groups.length;
262
262
  }
263
263
 
264
264
  return true;
@@ -422,6 +422,7 @@ export default {
422
422
  <span v-if="value.detailPageHeaderActionOverride && value.detailPageHeaderActionOverride(realMode)">{{ value.detailPageHeaderActionOverride(realMode) }}</span>
423
423
  <t
424
424
  v-else
425
+ class="mastehead-resource-title"
425
426
  :k="'resourceDetail.header.' + realMode"
426
427
  :subtype="resourceSubtype"
427
428
  :name="displayName"
@@ -544,6 +545,10 @@ export default {
544
545
 
545
546
  HEADER {
546
547
  margin: 0;
548
+
549
+ .title {
550
+ overflow: hidden;
551
+ }
547
552
  }
548
553
 
549
554
  .primaryheader {
@@ -553,6 +558,17 @@ export default {
553
558
 
554
559
  h1 {
555
560
  margin: 0;
561
+ overflow: hidden;
562
+ display: flex;
563
+ flex-direction: row;
564
+ align-items: center;
565
+
566
+ .mastehead-resource-title {
567
+ padding: 0 8px;
568
+ text-overflow: ellipsis;
569
+ overflow: hidden;
570
+ white-space: nowrap;
571
+ }
556
572
  }
557
573
  }
558
574
 
@@ -575,9 +591,6 @@ export default {
575
591
 
576
592
  .masthead-state {
577
593
  font-size: initial;
578
- display: inline-block;
579
- position: relative;
580
- top: -2px;
581
594
  }
582
595
 
583
596
  .masthead-istio {
@@ -97,6 +97,14 @@ export default {
97
97
  default: 'sortableTable.paging.resource',
98
98
  },
99
99
 
100
+ /**
101
+ * Additional params to pass to the pagingLabel translation
102
+ */
103
+ pagingParams: {
104
+ type: Object,
105
+ default: null,
106
+ },
107
+
100
108
  rowActions: {
101
109
  type: Boolean,
102
110
  default: true,
@@ -392,7 +400,11 @@ export default {
392
400
  return standard.concat(this.listGroups);
393
401
  },
394
402
 
395
- pagingParams() {
403
+ parsedPagingParams() {
404
+ if (this.pagingParams) {
405
+ return this.pagingParams;
406
+ }
407
+
396
408
  if ( !this.schema ) {
397
409
  return {
398
410
  singularLabel: '',
@@ -482,7 +494,7 @@ export default {
482
494
  :group-options="groupOptions"
483
495
  :search="search"
484
496
  :paging="true"
485
- :paging-params="pagingParams"
497
+ :paging-params="parsedPagingParams"
486
498
  :paging-label="pagingLabel"
487
499
  :row-actions="rowActions"
488
500
  :table-actions="_showBulkActions"
@@ -190,6 +190,11 @@ export default {
190
190
 
191
191
  cm.foldLinesMatching(/managedFields/);
192
192
 
193
+ // Allow the model to supply an array of json paths to fold other sections in the YAML for the given resource type
194
+ if (this.value?.yamlFolding) {
195
+ this.value.yamlFolding.forEach((path) => cm.foldYaml(path));
196
+ }
197
+
193
198
  // regardless of edit or create we should probably fold all the comments so they dont get out of hand.
194
199
  const saved = cm.getMode().fold;
195
200
 
@@ -583,7 +583,7 @@ export default {
583
583
  }
584
584
  }
585
585
 
586
- &.nuxt-link-active:not(:hover) {
586
+ &.router-link-active:not(:hover) {
587
587
  A {
588
588
  background-color: var(--nav-active);
589
589
  }
@@ -13,10 +13,7 @@ export default {
13
13
  },
14
14
 
15
15
  async fetch() {
16
- this.clusters = await this.$store.dispatch('management/findAll', {
17
- type: MANAGEMENT.CLUSTER,
18
- opt: { url: MANAGEMENT.CLUSTER }
19
- });
16
+ this.clusters = await this.$store.dispatch('management/findAll', { type: MANAGEMENT.CLUSTER });
20
17
  },
21
18
 
22
19
  data() {
@@ -19,6 +19,11 @@ export default {
19
19
  default: false
20
20
  },
21
21
 
22
+ hideSingleTab: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+
22
27
  showTabsAddRemove: {
23
28
  type: Boolean,
24
29
  default: false
@@ -86,6 +91,11 @@ export default {
86
91
  sortedTabs() {
87
92
  return sortBy(this.tabs, ['weight:desc', 'labelDisplay', 'name']);
88
93
  },
94
+
95
+ // hide tabs based on tab count IF flag is active
96
+ hideTabs() {
97
+ return this.hideSingleTab && this.sortedTabs.length === 1;
98
+ }
89
99
  },
90
100
 
91
101
  watch: {
@@ -225,11 +235,13 @@ export default {
225
235
  <template>
226
236
  <div :class="{'side-tabs': !!sideTabs, 'tabs-only': tabsOnly }">
227
237
  <ul
238
+ v-if="!hideTabs"
228
239
  ref="tablist"
229
240
  role="tablist"
230
241
  class="tabs"
231
242
  :class="{'clearfix':!sideTabs, 'vertical': sideTabs, 'horizontal': !sideTabs}"
232
243
  tabindex="0"
244
+ data-testid="tabbed-block"
233
245
  @keydown.right.prevent="selectNext(1)"
234
246
  @keydown.left.prevent="selectNext(-1)"
235
247
  @keydown.down.prevent="selectNext(1)"
@@ -8,8 +8,16 @@ import {
8
8
  AGE,
9
9
  STATE,
10
10
  NAME,
11
- FLEET_SUMMARY
11
+ FLEET_SUMMARY,
12
+ FLEET_REPO,
13
+ FLEET_REPO_TARGET,
14
+ FLEET_REPO_CLUSTERS_READY,
15
+ FLEET_REPO_CLUSTER_SUMMARY,
16
+ FLEET_REPO_PER_CLUSTER_STATE
17
+
12
18
  } from '@shell/config/table-headers';
19
+ import { FLEET } from '@shell/config/labels-annotations';
20
+ import { STATES_ENUM } from '@shell/plugins/dashboard-store/resource-class';
13
21
 
14
22
  export default {
15
23
 
@@ -19,6 +27,11 @@ export default {
19
27
  ResourceTable, Link, Shortened, FleetIntro
20
28
  },
21
29
  props: {
30
+ clusterId: {
31
+ type: String,
32
+ required: false,
33
+ default: null,
34
+ },
22
35
  rows: {
23
36
  type: Array,
24
37
  required: true,
@@ -54,35 +67,46 @@ export default {
54
67
  });
55
68
  },
56
69
 
70
+ isClusterView() {
71
+ return !!this.clusterId;
72
+ },
73
+
57
74
  noRows() {
58
75
  return !this.filteredRows.length;
59
76
  },
60
77
 
61
78
  headers() {
62
- const out = [
63
- STATE,
64
- NAME,
65
- {
66
- name: 'repo',
67
- labelKey: 'tableHeaders.repo',
68
- value: 'repoDisplay',
69
- sort: 'repoDisplay',
70
- search: ['spec.repo', 'status.commit'],
79
+ // Cluster summary is only shown in the cluster view
80
+ const fleetClusterSummary = {
81
+ ...FLEET_REPO_CLUSTER_SUMMARY,
82
+ formatterOpts: {
83
+ // Fleet uses labels to identify clusters
84
+ clusterLabel: this.clusterId
71
85
  },
72
- {
73
- name: 'target',
74
- labelKey: 'tableHeaders.target',
75
- value: 'targetInfo.modeDisplay',
76
- sort: ['targetInfo.modeDisplay', 'targetInfo.cluster', 'targetInfo.clusterGroup'],
77
- },
78
- {
79
- name: 'clustersReady',
80
- labelKey: 'tableHeaders.clustersReady',
81
- value: 'status.readyClusters',
82
- sort: 'status.readyClusters',
83
- search: false,
86
+ };
87
+
88
+ // if hasPerClusterState then use the repo state
89
+ const fleetPerClusterState = {
90
+ ...FLEET_REPO_PER_CLUSTER_STATE,
91
+ value: (row) => {
92
+ const statePerCluster = row.clusterResourceStatus?.find((c) => {
93
+ return c.clusterLabel === this.clusterId;
94
+ });
95
+
96
+ return statePerCluster ? statePerCluster?.status?.displayStatus : STATES_ENUM.ACTIVE;
84
97
  },
85
- FLEET_SUMMARY,
98
+ };
99
+
100
+ const summary = this.isClusterView ? [fleetClusterSummary] : [FLEET_REPO_CLUSTERS_READY, FLEET_SUMMARY];
101
+
102
+ const state = this.isClusterView ? fleetPerClusterState : STATE;
103
+
104
+ const out = [
105
+ state,
106
+ NAME,
107
+ FLEET_REPO,
108
+ FLEET_REPO_TARGET,
109
+ ...summary,
86
110
  AGE
87
111
  ];
88
112
 
@@ -92,6 +116,12 @@ export default {
92
116
  methods: {
93
117
  parseTargetMode(row) {
94
118
  return row.targetInfo?.mode === 'clusterGroup' ? this.t('fleet.gitRepo.warningTooltip.clusterGroup') : this.t('fleet.gitRepo.warningTooltip.cluster');
119
+ },
120
+
121
+ clusterViewResourceStatus(row) {
122
+ return row.clusterResourceStatus.find((c) => {
123
+ return c.metadata?.labels[FLEET.CLUSTER_NAME] === this.clusterId;
124
+ });
95
125
  }
96
126
  },
97
127
  };
@@ -111,7 +141,7 @@ export default {
111
141
  key-field="_key"
112
142
  v-on="$listeners"
113
143
  >
114
- <template #cell:repo="{row}">
144
+ <template #cell:repo="{ row }">
115
145
  <Link
116
146
  :row="row"
117
147
  :value="row.spec.repo"
@@ -119,6 +149,7 @@ export default {
119
149
  before-icon-key="repoIcon"
120
150
  url-key="spec.repo"
121
151
  />
152
+ {{ row.cluster }}
122
153
  <template v-if="row.commitDisplay">
123
154
  <div class="text-muted">
124
155
  <Shortened
@@ -130,7 +161,10 @@ export default {
130
161
  </template>
131
162
  </template>
132
163
 
133
- <template #cell:clustersReady="{row}">
164
+ <template
165
+ v-if="!isClusterView"
166
+ #cell:clustersReady="{ row }"
167
+ >
134
168
  <span
135
169
  v-if="!row.clusterInfo"
136
170
  class="text-muted"
@@ -138,7 +172,8 @@ export default {
138
172
  <span
139
173
  v-else-if="row.clusterInfo.unready"
140
174
  class="text-warning"
141
- >{{ row.clusterInfo.ready }}/{{ row.clusterInfo.total }}</span>
175
+ >{{ row.clusterInfo.ready }}/{{
176
+ row.clusterInfo.total }}</span>
142
177
  <span
143
178
  v-else
144
179
  class="cluster-count-info"
@@ -152,7 +187,7 @@ export default {
152
187
  </span>
153
188
  </template>
154
189
 
155
- <template #cell:target="{row}">
190
+ <template #cell:target="{ row }">
156
191
  {{ row.targetInfo.modeDisplay }}
157
192
  </template>
158
193
  </ResourceTable>
@@ -11,7 +11,12 @@ export default {
11
11
  value: {
12
12
  type: Object,
13
13
  required: true,
14
- }
14
+ },
15
+ clusterId: {
16
+ type: String,
17
+ required: false,
18
+ default: null,
19
+ },
15
20
  },
16
21
 
17
22
  computed: {
@@ -24,6 +24,10 @@ export default {
24
24
  loading: {
25
25
  type: Boolean,
26
26
  default: false
27
+ },
28
+ disabled: {
29
+ type: Boolean,
30
+ default: true
27
31
  }
28
32
  },
29
33
  computed: {
@@ -34,6 +38,10 @@ export default {
34
38
 
35
39
  addAllowed() {
36
40
  return this.filteredOptions.length > 0;
41
+ },
42
+
43
+ defaultAddValue() {
44
+ return this.options[0]?.value;
37
45
  }
38
46
  },
39
47
 
@@ -62,6 +70,8 @@ export default {
62
70
  class="array-list-select"
63
71
  :add-allowed="addAllowed || loading"
64
72
  :loading="loading"
73
+ :defaultAddValue="defaultAddValue"
74
+ :disabled="disabled"
65
75
  @input="$emit('input', $event)"
66
76
  >
67
77
  <template v-slot:columns="scope">
@@ -1,10 +1,10 @@
1
1
  <script lang="ts">
2
- import Vue, { PropType } from 'vue';
2
+ import { PropType, defineComponent } from 'vue';
3
3
  import Banner from '@components/Banner/Banner.vue';
4
4
 
5
- type Rule = (v?: string) => undefined | string;
5
+ type Rule = (v?: string | number | Record<string, any> | unknown[]) => undefined | string;
6
6
 
7
- export default Vue.extend<any, any, any, any>({
7
+ export default defineComponent({
8
8
  components: { Banner },
9
9
  props: {
10
10
  value: {
@@ -1,10 +1,10 @@
1
1
  <script lang="ts">
2
- import Vue from 'vue';
2
+ import { defineComponent } from 'vue';
3
3
  import { _VIEW } from '@shell/config/query-params';
4
4
  import AsyncButton, { AsyncButtonCallback } from '@shell/components/AsyncButton.vue';
5
5
  import Banner from '@components/Banner/Banner.vue';
6
6
 
7
- export default Vue.extend({
7
+ export default defineComponent({
8
8
  components: { AsyncButton, Banner },
9
9
 
10
10
  props: {
@@ -1,12 +1,13 @@
1
1
  <script lang="ts">
2
- import Vue from 'vue';
2
+ import { defineComponent, inject } from 'vue';
3
3
  import SortableTable from '@shell/components/SortableTable/index.vue';
4
4
  import RadioButton from '@components/Form/Radio/RadioButton.vue';
5
5
  import debounce from 'lodash/debounce';
6
6
  import { isArray } from '@shell/utils/array';
7
7
  import LabeledSelect from '@shell/components/form/LabeledSelect.vue';
8
8
  import LabeledInput from '@components/Form/LabeledInput/LabeledInput.vue';
9
- import { GitUtils } from '../../utils/git';
9
+ import { GitUtils, Commit } from '@shell/utils/git';
10
+ import type { DebouncedFunc } from 'lodash';
10
11
 
11
12
  interface commit {
12
13
  [key: string]: any,
@@ -17,21 +18,45 @@ interface Data {
17
18
  repo: boolean,
18
19
  branch: boolean,
19
20
  commits: boolean,
21
+ branches?: unknown,
20
22
  },
21
23
 
22
24
  repos: object[],
23
25
  branches: object[],
24
26
  commits: commit[],
25
27
 
26
- selectedAccOrOrg: string| null,
27
- selectedRepo: object| null,
28
- selectedBranch: object| null,
29
- selectedCommit: object | null,
28
+ selectedAccOrOrg: string | undefined,
29
+ selectedRepo: object | undefined,
30
+ selectedBranch: object | undefined,
31
+ selectedCommit: Commit | null,
30
32
  }
31
33
 
32
- const debounceTime = 1000;
34
+ interface CommitHeader {
35
+ name: string;
36
+ label: string;
37
+ width?: number;
38
+ formatter?: string;
39
+ formatterOpts?: { [key: string]: any };
40
+ value?: string | string[];
41
+ sort?: string | string[];
42
+ defaultSort?: boolean;
43
+ }
44
+
45
+ interface NonReactiveProps {
46
+ onSearchRepo: DebouncedFunc<(param: any) => Promise<any>> | undefined;
47
+ onSearchBranch: DebouncedFunc<(param: any) => Promise<any>> | undefined;
48
+ debounceTime: number;
49
+ }
50
+
51
+ const debounceTime = 1_000;
33
52
 
34
- export default Vue.extend<Data, any, any, any>({
53
+ const provideProps: NonReactiveProps = {
54
+ onSearchRepo: undefined,
55
+ onSearchBranch: undefined,
56
+ debounceTime,
57
+ };
58
+
59
+ export default defineComponent({
35
60
 
36
61
  components: {
37
62
  LabeledSelect,
@@ -52,10 +77,20 @@ export default Vue.extend<Data, any, any, any>({
52
77
  }
53
78
  },
54
79
 
55
- data() {
80
+ setup() {
81
+ const onSearchRepo = inject('onSearchRepo', provideProps.onSearchRepo);
82
+ const onSearchBranch = inject('onSearchBranch', provideProps.onSearchBranch);
83
+ const debounceTime = inject('debounceTime', provideProps.debounceTime);
84
+
56
85
  return {
86
+ onSearchRepo,
87
+ onSearchBranch,
57
88
  debounceTime,
89
+ };
90
+ },
58
91
 
92
+ data(): Data {
93
+ return {
59
94
  hasError: {
60
95
  repo: false,
61
96
  branch: false,
@@ -66,10 +101,10 @@ export default Vue.extend<Data, any, any, any>({
66
101
  branches: [],
67
102
  commits: [] as commit[],
68
103
 
69
- selectedAccOrOrg: null,
70
- selectedRepo: null,
71
- selectedBranch: null,
72
- selectedCommit: {},
104
+ selectedAccOrOrg: undefined,
105
+ selectedRepo: undefined,
106
+ selectedBranch: undefined,
107
+ selectedCommit: null,
73
108
  };
74
109
  },
75
110
 
@@ -95,13 +130,14 @@ export default Vue.extend<Data, any, any, any>({
95
130
  },
96
131
 
97
132
  computed: {
98
- commitHeaders() {
133
+ commitHeaders(): CommitHeader[] {
99
134
  return [
100
135
  {
101
136
  name: 'index',
102
137
  label: this.t(`gitPicker.${ this.type }.tableHeaders.choose.label`),
103
138
  width: 60,
104
- }, {
139
+ },
140
+ {
105
141
  name: 'sha',
106
142
  label: this.t(`gitPicker.${ this.type }.tableHeaders.sha.label`),
107
143
  width: 90,
@@ -134,17 +170,20 @@ export default Vue.extend<Data, any, any, any>({
134
170
  ];
135
171
  },
136
172
 
137
- preparedRepos() {
173
+ preparedRepos(): unknown {
138
174
  return this.normalizeArray(this.repos, (item: any) => ({ id: item.id, name: item.name }));
139
175
  },
140
176
 
141
- preparedBranches() {
177
+ preparedBranches(): unknown {
142
178
  return this.normalizeArray(this.branches, (item: any) => ({ id: item.id, name: item.name }));
143
179
  },
144
180
 
145
- preparedCommits() {
146
- return this.normalizeArray(this.commits, (c: any) => GitUtils[this.type].normalize.commit(c));
181
+ preparedCommits(): Commit[] {
182
+ return this.normalizeArray(this.commits, (c) => GitUtils[this.type].normalize.commit(c));
147
183
  },
184
+ selectedCommitId(): string | undefined {
185
+ return this.selectedCommit?.commitId;
186
+ }
148
187
  },
149
188
 
150
189
  methods: {
@@ -164,10 +203,10 @@ export default Vue.extend<Data, any, any, any>({
164
203
 
165
204
  reset() {
166
205
  this.repos = [];
167
- this.selectedAccOrOrg = null;
168
- this.selectedRepo = null;
169
- this.selectedBranch = null;
170
- this.selectedCommit = {};
206
+ this.selectedAccOrOrg = undefined;
207
+ this.selectedRepo = undefined;
208
+ this.selectedBranch = undefined;
209
+ this.selectedCommit = null;
171
210
 
172
211
  this.communicateReset();
173
212
  },
@@ -217,13 +256,13 @@ export default Vue.extend<Data, any, any, any>({
217
256
 
218
257
  async fetchRepos() {
219
258
  this.repos = [];
220
- this.selectedRepo = null;
221
- this.selectedBranch = null;
222
- this.selectedCommit = {};
259
+ this.selectedRepo = undefined;
260
+ this.selectedBranch = undefined;
261
+ this.selectedCommit = null;
223
262
 
224
263
  this.communicateReset();
225
264
 
226
- if (this.selectedAccOrOrg.length) {
265
+ if (this.selectedAccOrOrg?.length) {
227
266
  try {
228
267
  const res = await this.$store.dispatch(`${ this.type }/fetchRecentRepos`, { username: this.selectedAccOrOrg });
229
268
 
@@ -237,8 +276,8 @@ export default Vue.extend<Data, any, any, any>({
237
276
  },
238
277
 
239
278
  async fetchBranches() {
240
- this.selectedBranch = null;
241
- this.selectedCommit = {};
279
+ this.selectedBranch = undefined;
280
+ this.selectedCommit = null;
242
281
 
243
282
  this.communicateReset();
244
283
 
@@ -253,7 +292,7 @@ export default Vue.extend<Data, any, any, any>({
253
292
  },
254
293
 
255
294
  async fetchCommits() {
256
- this.selectedCommit = {};
295
+ this.selectedCommit = null;
257
296
 
258
297
  this.communicateReset();
259
298
 
@@ -279,7 +318,7 @@ export default Vue.extend<Data, any, any, any>({
279
318
  },
280
319
 
281
320
  final(commitId: string) {
282
- this.selectedCommit = this.preparedCommits.find((c: { commitId?: string }) => c.commitId === commitId);
321
+ this.selectedCommit = this.preparedCommits.find((c: { commitId?: string }) => c.commitId === commitId) || null;
283
322
 
284
323
  if (this.selectedAccOrOrg && this.selectedRepo && this.selectedCommit?.commitId) {
285
324
  this.$emit('change', {
@@ -337,7 +376,7 @@ export default Vue.extend<Data, any, any, any>({
337
376
  },
338
377
 
339
378
  status(value: boolean) {
340
- return value ? 'error' : null;
379
+ return value ? 'error' : undefined;
341
380
  },
342
381
 
343
382
  reposRules() {
@@ -355,11 +394,17 @@ export default Vue.extend<Data, any, any, any>({
355
394
  const commitId = this.$route.query?.commit;
356
395
 
357
396
  if (commitId) {
358
- const table = this.$refs.commitsTable;
359
- const page = table.getPageByRow(commitId, ({ commitId }: commit) => commitId);
397
+ const table = this.$refs.commitsTable as unknown as {
398
+ getPageByRow: (id: string | (string | null)[], callback: (commit: any) => any) => any;
399
+ setPage: (page: any) => void;
400
+ };
401
+ const page = table?.getPageByRow(commitId, ({ commitId }: commit) => commitId);
360
402
 
361
- table.setPage(page);
403
+ table?.setPage(page);
362
404
  }
405
+ },
406
+ selectReduction(e: unknown) {
407
+ return e;
363
408
  }
364
409
  },
365
410
  });
@@ -393,7 +438,7 @@ export default Vue.extend<Data, any, any, any>({
393
438
  :options="preparedRepos"
394
439
  :clearable="true"
395
440
  :searchable="true"
396
- :reduce="(e) => e"
441
+ :reduce="selectReduction"
397
442
  :rules="[reposRules]"
398
443
  :status="status(hasError.repo)"
399
444
  :option-label="'name'"
@@ -412,7 +457,7 @@ export default Vue.extend<Data, any, any, any>({
412
457
  :label="t(`gitPicker.${ type }.branch.inputLabel`)"
413
458
  :options="preparedBranches"
414
459
  :clearable="false"
415
- :reduce="(e) => e"
460
+ :reduce="selectReduction"
416
461
  :searchable="true"
417
462
  :rules="[branchesRules]"
418
463
  :status="status(hasError.branch)"
@@ -441,7 +486,7 @@ export default Vue.extend<Data, any, any, any>({
441
486
  >
442
487
  <template #cell:index="{row}">
443
488
  <RadioButton
444
- :value="selectedCommit.commitId"
489
+ :value="selectedCommitId"
445
490
  :val="row.commitId"
446
491
  @input="final($event)"
447
492
  />