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

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 (200) hide show
  1. package/assets/images/icons/document.svg +3 -0
  2. package/assets/images/vendor/cognito.svg +1 -0
  3. package/assets/styles/app.scss +1 -0
  4. package/assets/styles/base/_basic.scss +10 -0
  5. package/assets/styles/base/_spacing.scss +29 -0
  6. package/assets/styles/global/_layout.scss +1 -1
  7. package/assets/styles/themes/_dark.scss +25 -0
  8. package/assets/styles/themes/_light.scss +65 -0
  9. package/assets/translations/en-us.yaml +322 -24
  10. package/assets/translations/zh-hans.yaml +8 -5
  11. package/components/Certificates.vue +5 -0
  12. package/components/FilterPanel.vue +156 -0
  13. package/components/{fleet/ForceDirectedTreeChart/index.vue → ForceDirectedTreeChart.vue} +47 -41
  14. package/components/IconOrSvg.vue +14 -35
  15. package/components/PromptRemove.vue +5 -1
  16. package/components/Resource/Detail/Card/PodsCard/Bubble.vue +13 -0
  17. package/components/Resource/Detail/Card/PodsCard/composable.ts +30 -0
  18. package/components/Resource/Detail/Card/PodsCard/index.vue +118 -0
  19. package/components/Resource/Detail/Card/ResourceUsageCard/composable.ts +51 -0
  20. package/components/Resource/Detail/Card/ResourceUsageCard/index.vue +79 -0
  21. package/components/Resource/Detail/Card/Scaler.vue +89 -0
  22. package/components/Resource/Detail/Card/StateCard/composables.ts +112 -0
  23. package/components/Resource/Detail/Card/StateCard/index.vue +39 -0
  24. package/components/Resource/Detail/Card/VerticalGap.vue +11 -0
  25. package/components/Resource/Detail/Card/__tests__/Card.test.ts +36 -0
  26. package/components/Resource/Detail/Card/__tests__/PodsCard.test.ts +84 -0
  27. package/components/Resource/Detail/Card/__tests__/ResourceUsageCard.test.ts +72 -0
  28. package/components/Resource/Detail/Card/__tests__/Scaler.test.ts +87 -0
  29. package/components/Resource/Detail/Card/__tests__/StateCard.test.ts +53 -0
  30. package/components/Resource/Detail/Card/__tests__/VerticalGap.test.ts +14 -0
  31. package/components/Resource/Detail/Card/__tests__/index.test.ts +36 -0
  32. package/components/Resource/Detail/Card/index.vue +56 -0
  33. package/components/Resource/Detail/Metadata/Annotations/__tests__/index.test.ts +19 -0
  34. package/components/Resource/Detail/Metadata/Annotations/composable.ts +12 -0
  35. package/components/Resource/Detail/Metadata/Annotations/index.vue +26 -0
  36. package/components/Resource/Detail/Metadata/IdentifyingInformation/__tests__/index.test.ts +103 -0
  37. package/components/Resource/Detail/Metadata/IdentifyingInformation/composable.ts +281 -0
  38. package/components/Resource/Detail/Metadata/IdentifyingInformation/index.vue +111 -0
  39. package/components/Resource/Detail/Metadata/KeyValue.vue +130 -0
  40. package/components/Resource/Detail/Metadata/Labels/__tests__/index.test.ts +18 -0
  41. package/components/Resource/Detail/Metadata/Labels/composable.ts +12 -0
  42. package/components/Resource/Detail/Metadata/Labels/index.vue +27 -0
  43. package/components/Resource/Detail/Metadata/Rectangle.vue +32 -0
  44. package/components/Resource/Detail/Metadata/__tests__/KeyValue.test.ts +107 -0
  45. package/components/Resource/Detail/Metadata/__tests__/Rectangle.test.ts +24 -0
  46. package/components/Resource/Detail/Metadata/__tests__/index.test.ts +91 -0
  47. package/components/Resource/Detail/Metadata/composables.ts +29 -0
  48. package/components/Resource/Detail/Metadata/index.vue +66 -0
  49. package/components/Resource/Detail/Page.vue +22 -0
  50. package/components/Resource/Detail/PercentageBar.vue +40 -0
  51. package/components/Resource/Detail/ResourceRow.vue +119 -0
  52. package/components/Resource/Detail/SpacedRow.vue +14 -0
  53. package/components/Resource/Detail/StatusBar.vue +59 -0
  54. package/components/Resource/Detail/StatusRow.vue +61 -0
  55. package/components/Resource/Detail/TitleBar/Title.vue +13 -0
  56. package/components/Resource/Detail/TitleBar/Top.vue +14 -0
  57. package/components/Resource/Detail/TitleBar/__tests__/Title.test.ts +17 -0
  58. package/components/Resource/Detail/TitleBar/__tests__/Top.test.ts +17 -0
  59. package/components/Resource/Detail/TitleBar/__tests__/index.test.ts +142 -0
  60. package/components/Resource/Detail/TitleBar/composable.ts +31 -0
  61. package/components/Resource/Detail/TitleBar/index.vue +124 -0
  62. package/components/Resource/Detail/Top/index.vue +34 -0
  63. package/components/Resource/Detail/__tests__/Page.test.ts +32 -0
  64. package/components/ResourceDetail/__tests__/index.test.ts +114 -0
  65. package/components/ResourceDetail/index.vue +64 -562
  66. package/components/ResourceDetail/legacy.vue +545 -0
  67. package/components/ResourceTable.vue +41 -7
  68. package/components/SlideInPanelManager.vue +76 -8
  69. package/components/SortableTable/index.vue +13 -2
  70. package/components/SortableTable/selection.js +21 -8
  71. package/components/StatusBadge.vue +6 -4
  72. package/components/SubtleLink.vue +25 -0
  73. package/components/Wizard.vue +12 -1
  74. package/components/YamlEditor.vue +1 -1
  75. package/components/__tests__/FilterPanel.test.ts +81 -0
  76. package/components/auth/AuthBanner.vue +2 -3
  77. package/components/auth/RoleDetailEdit.vue +45 -3
  78. package/components/auth/login/oidc.vue +6 -1
  79. package/components/fleet/FleetApplications.vue +181 -0
  80. package/components/fleet/FleetHelmOps.vue +115 -0
  81. package/components/fleet/FleetIntro.vue +58 -28
  82. package/components/fleet/FleetNoWorkspaces.vue +5 -1
  83. package/components/fleet/FleetOCIStorageSecret.vue +171 -0
  84. package/components/fleet/FleetRepos.vue +38 -76
  85. package/components/fleet/FleetResources.vue +50 -22
  86. package/components/fleet/FleetSummary.vue +26 -51
  87. package/components/fleet/__tests__/FleetOCIStorageSecret.test.ts +213 -0
  88. package/components/fleet/__tests__/FleetSummary.test.ts +39 -39
  89. package/components/fleet/dashboard/Empty.vue +73 -0
  90. package/components/fleet/dashboard/ResourceCard.vue +183 -0
  91. package/components/fleet/dashboard/ResourceCardSummary.vue +199 -0
  92. package/components/fleet/dashboard/ResourceDetails.vue +196 -0
  93. package/components/fleet/dashboard/ResourcePanel.vue +376 -0
  94. package/components/form/ArrayList.vue +6 -0
  95. package/components/form/SimpleSecretSelector.vue +8 -2
  96. package/components/form/ValueFromResource.vue +31 -19
  97. package/components/formatter/FleetApplicationClustersReady.vue +77 -0
  98. package/components/formatter/FleetApplicationSource.vue +71 -0
  99. package/components/formatter/FleetSummaryGraph.vue +7 -0
  100. package/components/nav/Header.vue +8 -7
  101. package/components/nav/TopLevelMenu.helper.ts +55 -34
  102. package/components/nav/TopLevelMenu.vue +11 -0
  103. package/components/nav/Type.vue +4 -1
  104. package/composables/useI18n.ts +12 -11
  105. package/config/labels-annotations.js +14 -11
  106. package/config/product/auth.js +1 -0
  107. package/config/product/fleet.js +70 -17
  108. package/config/query-params.js +3 -1
  109. package/config/roles.ts +1 -0
  110. package/config/router/routes.js +20 -2
  111. package/config/secret.ts +15 -0
  112. package/config/settings.ts +3 -2
  113. package/config/table-headers.js +52 -22
  114. package/config/types.js +2 -0
  115. package/core/plugin-helpers.ts +3 -2
  116. package/detail/fleet.cattle.io.cluster.vue +28 -15
  117. package/detail/fleet.cattle.io.gitrepo.vue +10 -1
  118. package/detail/fleet.cattle.io.helmop.vue +157 -0
  119. package/dialog/HelmOpForceUpdateDialog.vue +132 -0
  120. package/dialog/RedeployWorkloadDialog.vue +164 -0
  121. package/edit/__tests__/fleet.cattle.io.gitrepo.test.ts +56 -67
  122. package/edit/auth/oidc.vue +159 -93
  123. package/edit/fleet.cattle.io.gitrepo.vue +26 -33
  124. package/edit/fleet.cattle.io.helmop.vue +997 -0
  125. package/edit/management.cattle.io.fleetworkspace.vue +43 -10
  126. package/list/fleet.cattle.io.gitrepo.vue +1 -1
  127. package/list/fleet.cattle.io.helmop.vue +108 -0
  128. package/list/namespace.vue +5 -2
  129. package/mixins/auth-config.js +8 -1
  130. package/mixins/preset.js +100 -0
  131. package/mixins/resource-fetch-api-pagination.js +2 -0
  132. package/mixins/resource-fetch.js +1 -1
  133. package/mixins/resource-table-watch.js +45 -0
  134. package/models/__tests__/chart.test.ts +273 -0
  135. package/models/__tests__/fleet.cattle.io.gitrepo.test.ts +1 -1
  136. package/models/chart.js +144 -2
  137. package/models/fleet-application.js +385 -0
  138. package/models/fleet.cattle.io.bundle.js +9 -8
  139. package/models/fleet.cattle.io.gitrepo.js +41 -365
  140. package/models/fleet.cattle.io.helmop.js +228 -0
  141. package/models/management.cattle.io.authconfig.js +1 -0
  142. package/models/management.cattle.io.fleetworkspace.js +12 -0
  143. package/models/workload.js +14 -18
  144. package/package.json +2 -1
  145. package/pages/auth/verify.vue +13 -1
  146. package/pages/c/_cluster/apps/charts/AddRepoLink.vue +37 -0
  147. package/pages/c/_cluster/apps/charts/AppChartCardFooter.vue +80 -0
  148. package/pages/c/_cluster/apps/charts/AppChartCardSubHeader.vue +54 -0
  149. package/pages/c/_cluster/apps/charts/StatusLabel.vue +33 -0
  150. package/pages/c/_cluster/apps/charts/index.vue +302 -484
  151. package/pages/c/_cluster/explorer/EventsTable.vue +1 -1
  152. package/pages/c/_cluster/fleet/__tests__/index.test.ts +426 -0
  153. package/pages/c/_cluster/fleet/application/_resource/_id.vue +14 -0
  154. package/pages/c/_cluster/fleet/application/_resource/create.vue +14 -0
  155. package/pages/c/_cluster/fleet/application/create.vue +340 -0
  156. package/pages/c/_cluster/fleet/application/index.vue +139 -0
  157. package/pages/c/_cluster/fleet/graph/config.js +277 -0
  158. package/pages/c/_cluster/fleet/index.vue +772 -330
  159. package/pages/explorer/resource/detail/configmap.vue +19 -0
  160. package/plugins/dashboard-store/actions.js +31 -9
  161. package/plugins/dashboard-store/getters.js +34 -21
  162. package/plugins/dashboard-store/mutations.js +51 -7
  163. package/plugins/dashboard-store/resource-class.js +14 -2
  164. package/plugins/steve/__tests__/subscribe.spec.ts +66 -1
  165. package/plugins/steve/actions.js +3 -0
  166. package/plugins/steve/steve-pagination-utils.ts +14 -13
  167. package/plugins/steve/subscribe.js +229 -42
  168. package/rancher-components/BadgeState/BadgeState.vue +3 -1
  169. package/rancher-components/Form/Checkbox/Checkbox.vue +2 -2
  170. package/rancher-components/RcItemCard/RcItemCard.test.ts +189 -0
  171. package/rancher-components/RcItemCard/RcItemCard.vue +425 -0
  172. package/rancher-components/RcItemCard/RcItemCardAction.vue +24 -0
  173. package/rancher-components/RcItemCard/index.ts +2 -0
  174. package/store/auth.js +1 -0
  175. package/store/catalog.js +62 -24
  176. package/store/index.js +33 -14
  177. package/store/slideInPanel.ts +6 -0
  178. package/store/type-map.js +1 -0
  179. package/types/fleet.d.ts +35 -0
  180. package/types/resources/settings.d.ts +19 -1
  181. package/types/shell/index.d.ts +339 -272
  182. package/types/store/dashboard-store.types.ts +17 -3
  183. package/types/store/pagination.types.ts +6 -1
  184. package/types/store/subscribe.types.ts +50 -0
  185. package/utils/auth.js +32 -3
  186. package/utils/fleet-types.ts +0 -0
  187. package/utils/fleet.ts +200 -1
  188. package/utils/pagination-utils.ts +26 -1
  189. package/utils/pagination-wrapper.ts +132 -50
  190. package/utils/settings.ts +4 -1
  191. package/utils/style.ts +39 -0
  192. package/utils/validators/formRules/__tests__/index.test.ts +36 -3
  193. package/utils/validators/formRules/index.ts +10 -3
  194. package/utils/window.js +11 -7
  195. package/components/__tests__/ApplicationCard.test.ts +0 -27
  196. package/components/cards/ApplicationCard.vue +0 -145
  197. package/components/fleet/ForceDirectedTreeChart/chartIcons.js +0 -17
  198. package/config/secret.js +0 -14
  199. package/pages/c/_cluster/fleet/GitRepoGraphConfig.js +0 -249
  200. /package/{components/form/SSHKnownHosts → dialog}/__tests__/KnownHostsEditDialog.test.ts +0 -0
@@ -761,6 +761,52 @@ export const FLEET_SUMMARY = {
761
761
  width: 100,
762
762
  };
763
763
 
764
+ export const FLEET_APPLICATION_TYPE = {
765
+ name: 'applicationType',
766
+ labelKey: 'fleet.tableHeaders.applicationType',
767
+ value: 'kind',
768
+ sort: 'kind',
769
+ search: false,
770
+ align: 'center',
771
+ width: 100,
772
+ };
773
+
774
+ export const FLEET_APPLICATION_SOURCE = {
775
+ name: 'applicationSource',
776
+ labelKey: 'fleet.tableHeaders.applicationSource',
777
+ value: 'source.value',
778
+ formatter: 'FleetApplicationSource',
779
+ sort: 'source.value',
780
+ search: ['source.value', 'sourceSub.value'],
781
+ };
782
+
783
+ export const FLEET_APPLICATION_TARGET = {
784
+ name: 'applicationTarget',
785
+ labelKey: 'fleet.tableHeaders.applicationTarget',
786
+ value: 'targetInfo.modeDisplay',
787
+ sort: ['targetInfo.modeDisplay', 'targetInfo.cluster', 'targetInfo.clusterGroup'],
788
+ };
789
+
790
+ export const FLEET_APPLICATION_CLUSTERS_READY = {
791
+ name: 'applicationClustersReady',
792
+ labelKey: 'fleet.tableHeaders.applicationClustersReady',
793
+ value: 'readyClusters',
794
+ formatter: 'FleetApplicationClustersReady',
795
+ sort: 'readyClusters',
796
+ search: false,
797
+ };
798
+
799
+ export const FLEET_APPLICATION_RESOURCES_SUMMARY = {
800
+ name: 'applicationResourcesSummary',
801
+ labelKey: 'fleet.tableHeaders.applicationResourcesSummary',
802
+ value: 'status.resourceCounts',
803
+ sort: false,
804
+ search: false,
805
+ formatter: 'FleetSummaryGraph',
806
+ align: 'center',
807
+ width: 100,
808
+ };
809
+
764
810
  export const FLEET_REPO_CLUSTER_SUMMARY = {
765
811
  name: 'clusterSummary',
766
812
  labelKey: 'tableHeaders.clusterResources',
@@ -1052,36 +1098,20 @@ export const FLEET_BUNDLE_LAST_UPDATED = {
1052
1098
  sort: ['lastUpdateTime']
1053
1099
  };
1054
1100
 
1055
- export const FLEET_BUNDLE_TYPE = {
1056
- name: 'bundleType',
1057
- labelKey: 'tableHeaders.fleetBundleType',
1058
- value: 'bundleType',
1059
- sort: ['bundleType'],
1060
- width: 100,
1061
- };
1062
-
1063
- export const FLEET_REPO_CLUSTERS_READY = {
1064
- name: 'clustersReady',
1065
- labelKey: 'tableHeaders.clustersReady',
1066
- value: 'status.readyClusters',
1067
- sort: 'status.readyClusters',
1068
- search: false,
1069
- };
1070
-
1071
1101
  export const FLEET_REPO_TARGET = {
1072
1102
  name: 'target',
1073
1103
  labelKey: 'tableHeaders.target',
1074
1104
  value: 'targetInfo.modeDisplay',
1075
1105
  sort: ['targetInfo.modeDisplay', 'targetInfo.cluster', 'targetInfo.clusterGroup'],
1076
-
1077
1106
  };
1078
1107
 
1079
1108
  export const FLEET_REPO = {
1080
- name: 'repo',
1081
- labelKey: 'tableHeaders.repo',
1082
- value: 'repoDisplay',
1083
- sort: 'repoDisplay',
1084
- search: ['spec.repo', 'status.commit'],
1109
+ name: 'repo',
1110
+ labelKey: 'tableHeaders.repo',
1111
+ value: 'source.value',
1112
+ formatter: 'FleetApplicationSource',
1113
+ sort: 'source.value',
1114
+ search: ['source.value', 'sourceSub.value'],
1085
1115
  };
1086
1116
 
1087
1117
  export const UI_PLUGIN_CATALOG = [
package/config/types.js CHANGED
@@ -229,12 +229,14 @@ export const CAPI = {
229
229
  // Base: /k8s/clusters/<id>/v1/
230
230
 
231
231
  export const FLEET = {
232
+ APPLICATION: 'fleet.cattle.io.application',
232
233
  BUNDLE: 'fleet.cattle.io.bundle',
233
234
  BUNDLE_DEPLOYMENT: 'fleet.cattle.io.bundledeployment',
234
235
  CLUSTER: 'fleet.cattle.io.cluster',
235
236
  CLUSTER_GROUP: 'fleet.cattle.io.clustergroup',
236
237
  DASHBOARD: 'fleet.cattle.io.dashboard',
237
238
  GIT_REPO: 'fleet.cattle.io.gitrepo',
239
+ HELM_OP: 'fleet.cattle.io.helmop',
238
240
  WORKSPACE: 'management.cattle.io.fleetworkspace',
239
241
  TOKEN: 'fleet.cattle.io.clusterregistrationtoken',
240
242
  BUNDLE_NAMESPACE_MAPPING: 'fleet.cattle.io.bundlenamespacemapping',
@@ -32,12 +32,13 @@ function checkRouteProduct($route: RouteLocation, locationConfigParam: string) {
32
32
  return false;
33
33
  }
34
34
 
35
- function checkRouteMode({ name, query }: {name: string, query: any}, locationConfigParam: LocationConfigParams) {
35
+ function checkRouteMode({ name, query, meta }: {name: string, query: any, meta: any}, locationConfigParam: LocationConfigParams) {
36
36
  if (locationConfigParam === _EDIT && query.mode && query.mode === _EDIT && !query.as) {
37
37
  return true;
38
38
  } else if (locationConfigParam === _CONFIG && query.as && query.as === _CONFIG) {
39
39
  return true;
40
- } else if (locationConfigParam === _DETAIL && !query.as && name.includes('-id') && (!query.mode || query?.mode !== _EDIT)) {
40
+ // I don't think we should be inspecting route names to infer modes. I'm thinking we may want to move it all to route metadata at some point
41
+ } else if (locationConfigParam === _DETAIL && !query.as && (name.includes('-id') || meta.mode === 'detail') && (!query.mode || query?.mode !== _EDIT)) {
41
42
  return true;
42
43
  // alias to target all list views
43
44
  } else if (locationConfigParam === _LIST && !name.includes('-id') && name.includes('-resource')) {
@@ -1,10 +1,10 @@
1
1
  <script>
2
2
  import Loading from '@shell/components/Loading';
3
3
  import ResourcesSummary from '@shell/components/fleet/ResourcesSummary';
4
- import FleetRepos from '@shell/components/fleet/FleetRepos';
4
+ import FleetApplications from '@shell/components/fleet/FleetApplications';
5
5
  import ResourceTabs from '@shell/components/form/ResourceTabs';
6
6
  import Tab from '@shell/components/Tabbed/Tab';
7
- import { MANAGEMENT, FLEET } from '@shell/config/types';
7
+ import { MANAGEMENT, FLEET, SCHEMA } from '@shell/config/types';
8
8
  import { FLEET as FLEET_LABELS } from '@shell/config/labels-annotations';
9
9
  import { allHash } from 'utils/promise';
10
10
 
@@ -16,7 +16,7 @@ export default {
16
16
  components: {
17
17
  Loading,
18
18
  ResourcesSummary,
19
- FleetRepos,
19
+ FleetApplications,
20
20
  ResourceTabs,
21
21
  Tab,
22
22
  },
@@ -35,17 +35,27 @@ export default {
35
35
  type: MANAGEMENT.CLUSTER,
36
36
  id: managementClusterId
37
37
  }),
38
- repos: this.$store.dispatch('management/findAll', { type: FLEET.GIT_REPO }),
38
+ gitRepos: this.$store.dispatch('management/findAll', { type: FLEET.GIT_REPO }),
39
+ helmOps: this.$store.dispatch('management/findAll', { type: FLEET.HELM_OP }),
39
40
  workspaces: this.$store.dispatch('management/findAll', { type: FLEET.WORKSPACE }),
40
41
  bundleDeployments: this.$store.dispatch('management/findAll', { type: FLEET.BUNDLE_DEPLOYMENT })
41
42
  });
42
43
 
43
44
  this.rancherCluster = hash.rancherCluster;
44
- this.allRepos = hash.repos;
45
+ this.gitRepos = hash.gitRepos;
46
+ this.helmOps = hash.helmOps;
45
47
  },
46
48
 
47
49
  data() {
48
- return { rancherCluster: null, allRepos: [] };
50
+ return {
51
+ rancherCluster: null,
52
+ gitRepos: [],
53
+ helmOps: [],
54
+ appSchema: {
55
+ id: FLEET.APPLICATION,
56
+ type: SCHEMA,
57
+ },
58
+ };
49
59
  },
50
60
 
51
61
  computed: {
@@ -53,14 +63,17 @@ export default {
53
63
  return this.value.id;
54
64
  },
55
65
 
56
- repos() {
57
- return this.allRepos.filter((x) => {
66
+ rows() {
67
+ return [
68
+ ...this.gitRepos,
69
+ ...this.helmOps
70
+ ].filter((x) => {
58
71
  return x.targetClusters.includes(this.value);
59
72
  });
60
73
  },
61
74
 
62
- repoSchema() {
63
- return this.$store.getters['management/schemaFor'](FLEET.GIT_REPO);
75
+ typeLabel() {
76
+ return this.t(`typeLabel."${ FLEET.APPLICATION }"`, { count: 2 });
64
77
  },
65
78
  },
66
79
  };
@@ -82,14 +95,14 @@ export default {
82
95
  @update:value="$emit('input', $event)"
83
96
  >
84
97
  <Tab
85
- label="Git Repos"
86
- name="repos"
98
+ :label="typeLabel"
99
+ name="applications"
87
100
  :weight="19"
88
101
  >
89
- <FleetRepos
102
+ <FleetApplications
90
103
  :clusterId="clusterId"
91
- :rows="repos"
92
- :schema="repoSchema"
104
+ :rows="rows"
105
+ :schema="appSchema || {}"
93
106
  :paging="true"
94
107
  paging-label="sortableTable.paging.resource"
95
108
  />
@@ -1,4 +1,5 @@
1
1
  <script>
2
+ import { mapState } from 'vuex';
2
3
  import Loading from '@shell/components/Loading';
3
4
  import ResourceTabs from '@shell/components/form/ResourceTabs';
4
5
  import FleetSummary from '@shell/components/fleet/FleetSummary';
@@ -38,7 +39,15 @@ export default {
38
39
  allBundles: [],
39
40
  };
40
41
  },
42
+
43
+ created() {
44
+ if (this.workspace !== this.value.namespace) {
45
+ this.$store.commit('updateWorkspace', { value: this.value.namespace, getters: this.$store.getters });
46
+ }
47
+ },
48
+
41
49
  computed: {
50
+ ...mapState(['workspace']),
42
51
  gitRepoHasClusters() {
43
52
  return this.value.status?.desiredReadyClusters;
44
53
  },
@@ -119,7 +128,7 @@ export default {
119
128
  color="info"
120
129
  class="mb-20"
121
130
  >
122
- {{ t('fleet.fleetSummary.noClustersGitRepo') }}
131
+ {{ t('fleet.fleetSummary.noClusters.gitRepo') }}
123
132
  </Banner>
124
133
  <ResourceTabs
125
134
  :value="value"
@@ -0,0 +1,157 @@
1
+ <script>
2
+ import { mapState } from 'vuex';
3
+ import Loading from '@shell/components/Loading';
4
+ import ResourceTabs from '@shell/components/form/ResourceTabs';
5
+ import FleetSummary from '@shell/components/fleet/FleetSummary';
6
+ import { Banner } from '@components/Banner';
7
+ import FleetResources from '@shell/components/fleet/FleetResources';
8
+ import Tab from '@shell/components/Tabbed/Tab';
9
+ import { FLEET, MANAGEMENT } from '@shell/config/types';
10
+ import { isHarvesterCluster } from '@shell/utils/cluster';
11
+ import FleetBundles from '@shell/components/fleet/FleetBundles.vue';
12
+ import { checkSchemasForFindAllHash } from '@shell/utils/auth';
13
+
14
+ export default {
15
+ name: 'DetailsHelmOp',
16
+
17
+ emits: ['input'],
18
+
19
+ components: {
20
+ Loading,
21
+ FleetResources,
22
+ FleetSummary,
23
+ Banner,
24
+ ResourceTabs,
25
+ Tab,
26
+ FleetBundles,
27
+ },
28
+
29
+ props: {
30
+ value: {
31
+ type: Object,
32
+ required: true,
33
+ },
34
+ },
35
+
36
+ data() {
37
+ return {
38
+ allFleetClusters: [],
39
+ allBundles: [],
40
+ };
41
+ },
42
+
43
+ created() {
44
+ if (this.workspace !== this.value.namespace) {
45
+ this.$store.commit('updateWorkspace', { value: this.value.namespace, getters: this.$store.getters });
46
+ }
47
+ },
48
+
49
+ computed: {
50
+ ...mapState(['workspace']),
51
+ helmOpHasClusters() {
52
+ return this.value.status?.desiredReadyClusters;
53
+ },
54
+ clusterSchema() {
55
+ return this.$store.getters['management/schemaFor'](FLEET.CLUSTER);
56
+ },
57
+ harvesterClusters() {
58
+ const harvester = {};
59
+
60
+ this.allFleetClusters.forEach((c) => {
61
+ if (isHarvesterCluster(c)) {
62
+ harvester[c.metadata.name] = c;
63
+ }
64
+ });
65
+
66
+ return harvester;
67
+ },
68
+ bundles() {
69
+ const harvester = this.harvesterClusters;
70
+
71
+ const bundles = this.allBundles.filter((bundle) => {
72
+ const targets = bundle.spec?.targets || [];
73
+
74
+ // Filter out any bundle that has one target whose cluster is a harvester cluster
75
+ if (targets.length === 1) {
76
+ return !harvester[targets[0].clusterName];
77
+ }
78
+
79
+ return true;
80
+ });
81
+
82
+ return bundles;
83
+ },
84
+ },
85
+ async fetch() {
86
+ const allDispatches = await checkSchemasForFindAllHash({
87
+ allBundles: {
88
+ inStoreType: 'management',
89
+ type: FLEET.BUNDLE,
90
+ opt: { excludeFields: ['metadata.managedFields', 'spec.resources'] },
91
+ },
92
+
93
+ allFleetClusters: {
94
+ inStoreType: 'management',
95
+ type: FLEET.CLUSTER
96
+ },
97
+ clusterGroups: {
98
+ inStoreType: 'management',
99
+ type: FLEET.CLUSTER_GROUP
100
+ }
101
+ }, this.$store);
102
+
103
+ if (this.value.authorId && this.$store.getters['management/schemaFor'](MANAGEMENT.USER)) {
104
+ await this.$store.dispatch(`management/findAll`, { type: MANAGEMENT.USER }, { root: true });
105
+ }
106
+
107
+ this.allBundles = allDispatches.allBundles || [];
108
+ this.allFleetClusters = allDispatches.allFleetClusters || [];
109
+ },
110
+
111
+ };
112
+ </script>
113
+
114
+ <template>
115
+ <Loading v-if="$fetchState.pending" />
116
+ <div
117
+ v-else
118
+ class="mt-20"
119
+ >
120
+ <FleetSummary
121
+ v-if="helmOpHasClusters"
122
+ :value="value"
123
+ :bundles="bundles"
124
+ class="mb-20"
125
+ />
126
+ <Banner
127
+ v-else
128
+ color="info"
129
+ class="mb-20"
130
+ >
131
+ {{ t('fleet.fleetSummary.noClusters.helmOp') }}
132
+ </Banner>
133
+ <ResourceTabs
134
+ :value="value"
135
+ mode="view"
136
+ class="mt-20"
137
+ :need-related="false"
138
+ @update:value="$emit('input', $event)"
139
+ >
140
+ <Tab
141
+ v-if="!!allBundles.length"
142
+ label="Bundles"
143
+ name="bundles"
144
+ :weight="30"
145
+ >
146
+ <FleetBundles :value="value" />
147
+ </Tab>
148
+ <Tab
149
+ label="Resources"
150
+ name="resources"
151
+ :weight="20"
152
+ >
153
+ <FleetResources :rows="value.resourcesStatuses" />
154
+ </Tab>
155
+ </ResourceTabs>
156
+ </div>
157
+ </template>
@@ -0,0 +1,132 @@
1
+ <script>
2
+ import { mapGetters, mapState } from 'vuex';
3
+ import { resourceNames } from '@shell/utils/string';
4
+ import { exceptionToErrorsArray } from '@shell/utils/error';
5
+ import { Banner } from '@components/Banner';
6
+ import { Card } from '@components/Card';
7
+ import AsyncButton from '@shell/components/AsyncButton';
8
+
9
+ export default {
10
+ name: 'HelmOpForceUpdateDialog',
11
+
12
+ emits: ['close'],
13
+
14
+ components: {
15
+ AsyncButton,
16
+ Banner,
17
+ Card,
18
+ },
19
+
20
+ props: {
21
+ helmOps: {
22
+ type: Array,
23
+ required: true,
24
+ },
25
+ },
26
+
27
+ data() {
28
+ return { errors: [] };
29
+ },
30
+
31
+ computed: {
32
+ ...mapState('action-menu', ['toRemove']),
33
+ ...mapGetters({ t: 'i18n/t' }),
34
+
35
+ names() {
36
+ return this.helmOps.map((app) => app.nameDisplay);
37
+ }
38
+ },
39
+
40
+ methods: {
41
+ resourceNames,
42
+
43
+ close(buttonDone) {
44
+ if (buttonDone && typeof buttonDone === 'function') {
45
+ buttonDone(true);
46
+ }
47
+ this.$emit('close');
48
+ },
49
+
50
+ async apply(buttonDone) {
51
+ try {
52
+ await Promise.all(this.helmOps.map((app) => this.updateHelmOp(app)));
53
+
54
+ this.close();
55
+ } catch (err) {
56
+ this.errors = exceptionToErrorsArray(err);
57
+ buttonDone(false);
58
+ }
59
+ },
60
+
61
+ updateHelmOp(value) {
62
+ const now = value.spec.forceSyncGeneration || 1;
63
+
64
+ value.spec.forceSyncGeneration = now + 1;
65
+
66
+ return value.save();
67
+ },
68
+ }
69
+ };
70
+ </script>
71
+
72
+ <template>
73
+ <Card
74
+ class="prompt-force-update"
75
+ :show-highlight-border="false"
76
+ >
77
+ <template #title>
78
+ <h4
79
+ v-clean-html="t('fleet.helmOp.actions.forceUpdate.promptTitle')"
80
+ class="text-default-text"
81
+ />
82
+ </template>
83
+
84
+ <template #body>
85
+ <div class="mb-20">
86
+ {{ t('fleet.helmOp.actions.forceUpdate.promptNames') }} <span
87
+ v-clean-html="resourceNames(names, null, t)"
88
+ class="body"
89
+ />
90
+ </div>
91
+ <Banner
92
+ color="info"
93
+ label-key="fleet.helmOp.actions.forceUpdate.promptWarning"
94
+ >
95
+ <span v-clean-html="t('fleet.helmOp.actions.forceUpdate.promptWarning', { count: names.length}, true)" />
96
+ </Banner>
97
+ <Banner
98
+ v-for="(err, i) in errors"
99
+ :key="i"
100
+ color="error"
101
+ :label="err"
102
+ />
103
+ </template>
104
+
105
+ <template #actions>
106
+ <button
107
+ class="btn role-secondary"
108
+ @click="close"
109
+ >
110
+ {{ t('generic.cancel') }}
111
+ </button>
112
+ <div class="spacer" />
113
+ <AsyncButton
114
+ mode="update"
115
+ class="btn bg-info ml-10"
116
+ :data-testid="'deactivate-driver-confirm'"
117
+ @click="apply"
118
+ />
119
+ </template>
120
+ </Card>
121
+ </template>
122
+
123
+ <style lang='scss' scoped>
124
+ .card-container {
125
+ box-shadow: none;
126
+ }
127
+
128
+ :deep() .card-actions {
129
+ display: flex;
130
+ justify-content: end;
131
+ }
132
+ </style>