@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
@@ -0,0 +1,115 @@
1
+ <script>
2
+ import ResourceTable from '@shell/components/ResourceTable';
3
+ import FleetIntro from '@shell/components/fleet/FleetIntro';
4
+
5
+ import {
6
+ AGE,
7
+ NAME,
8
+ STATE,
9
+ } from '@shell/config/table-headers';
10
+
11
+ export default {
12
+
13
+ name: 'FleetHelmOps',
14
+
15
+ components: {
16
+ ResourceTable,
17
+ FleetIntro,
18
+ },
19
+
20
+ props: {
21
+ clusterId: {
22
+ type: String,
23
+ required: false,
24
+ default: null,
25
+ },
26
+
27
+ rows: {
28
+ type: Array,
29
+ required: true,
30
+ },
31
+
32
+ schema: {
33
+ type: Object,
34
+ required: true,
35
+ },
36
+
37
+ loading: {
38
+ type: Boolean,
39
+ required: false,
40
+ },
41
+
42
+ useQueryParamsForSimpleFiltering: {
43
+ type: Boolean,
44
+ default: false
45
+ }
46
+ },
47
+
48
+ computed: {
49
+ filteredRows() {
50
+ if (!this.rows) {
51
+ return [];
52
+ }
53
+
54
+ // Returns boolean { [namespace]: true }
55
+ const selectedWorkspace = this.$store.getters['namespaces']();
56
+
57
+ return this.rows.filter((row) => {
58
+ return !!selectedWorkspace[row.metadata.namespace];
59
+ });
60
+ },
61
+
62
+ isClusterView() {
63
+ return !!this.clusterId;
64
+ },
65
+
66
+ noRows() {
67
+ return !this.filteredRows.length;
68
+ },
69
+
70
+ headers() {
71
+ return [
72
+ STATE,
73
+ NAME,
74
+ AGE
75
+ ];
76
+ },
77
+ },
78
+
79
+ methods: {},
80
+ };
81
+ </script>
82
+
83
+ <template>
84
+ <div>
85
+ <FleetIntro
86
+ v-if="noRows && !loading"
87
+ :schema="schema"
88
+ :labelKey="'helmOp'"
89
+ :icon="'icon-helm'"
90
+ />
91
+ <ResourceTable
92
+ v-if="!noRows"
93
+ v-bind="$attrs"
94
+ :schema="schema"
95
+ :headers="headers"
96
+ :rows="rows"
97
+ :loading="loading"
98
+ :use-query-params-for-simple-filtering="useQueryParamsForSimpleFiltering"
99
+ key-field="_key"
100
+ />
101
+ </div>
102
+ </template>
103
+
104
+ <style lang="scss" scoped>
105
+ .cluster-count-info {
106
+ display: flex;
107
+ align-items: center;
108
+
109
+ i {
110
+ margin-left: 5px;
111
+ font-size: 22px;
112
+ color: var(--warning);
113
+ }
114
+ }
115
+ </style>
@@ -1,65 +1,95 @@
1
1
  <script>
2
- import { FLEET } from '@shell/config/types';
3
2
  import { NAME } from '@shell/config/product/fleet';
4
3
 
5
4
  export default {
6
5
 
7
6
  name: 'FleetIntro',
8
7
 
8
+ props: {
9
+ schema: {
10
+ type: Object,
11
+ required: true,
12
+ },
13
+
14
+ route: {
15
+ type: Object,
16
+ default: null,
17
+ },
18
+
19
+ isCreatable: {
20
+ type: Boolean,
21
+ default: false,
22
+ },
23
+
24
+ icon: {
25
+ type: String,
26
+ default: 'icon-repository'
27
+ },
28
+
29
+ labelKey: {
30
+ type: String,
31
+ required: true,
32
+ },
33
+ },
34
+
9
35
  data() {
10
- const gitRepoRoute = {
36
+ const to = this.route || {
11
37
  name: 'c-cluster-product-resource-create',
12
38
  params: {
13
39
  product: NAME,
14
- resource: FLEET.GIT_REPO
40
+ resource: this.schema?.id,
15
41
  },
16
42
  };
17
43
 
18
- const gitRepoSchema = this.$store.getters['management/schemaFor'](FLEET.GIT_REPO);
19
- const canCreateRepos = gitRepoSchema && gitRepoSchema.resourceMethods.includes('PUT');
44
+ const canCreate = this.isCreatable || this.schema?.resourceMethods?.includes('PUT');
20
45
 
21
46
  return {
22
- gitRepoRoute,
23
- canCreateRepos
47
+ to,
48
+ canCreate,
24
49
  };
25
50
  },
26
51
  };
27
52
  </script>
28
53
  <template>
29
54
  <div class="intro-box">
30
- <i class="icon icon-repository" />
55
+ <i
56
+ class="icon"
57
+ :class="icon"
58
+ />
31
59
  <div class="title">
32
- {{ t('fleet.gitRepo.repo.noRepos') }}
60
+ {{ t(`fleet.${ labelKey }.intro.empty`) }}
33
61
  </div>
34
62
  <div
35
- v-if="canCreateRepos"
63
+ v-if="canCreate"
36
64
  class="actions"
37
65
  >
38
66
  <router-link
39
- :to="gitRepoRoute"
67
+ :to="to"
40
68
  class="btn role-secondary"
41
69
  >
42
- {{ t('fleet.gitRepo.repo.addRepo') }}
70
+ {{ t(`fleet.${ labelKey }.intro.add`) }}
43
71
  </router-link>
44
72
  </div>
45
73
  </div>
46
74
  </template>
47
75
  <style lang="scss" scoped>
48
- .intro-box {
49
- flex: 0 0 100%;
50
- height: calc(100vh - 246px); // 2(48 content header + 20 padding + 55 pageheader)
51
- display: flex;
52
- align-items: center;
53
- justify-content: center;
54
- flex-direction: column;
55
- }
56
76
 
57
- .title {
58
- margin-bottom: 15px;
59
- font-size: $font-size-h2;
60
- }
61
- .icon-repository {
62
- font-size: 96px;
63
- margin-bottom: 32px;
64
- }
77
+ .intro-box {
78
+ flex: 0 0 100%;
79
+ height: calc(100vh - 246px); // 2(48 content header + 20 padding + 55 pageheader)
80
+ display: flex;
81
+ align-items: center;
82
+ justify-content: center;
83
+ flex-direction: column;
84
+ }
85
+
86
+ .title {
87
+ margin-bottom: 15px;
88
+ font-size: $font-size-h2;
89
+ }
90
+
91
+ .icon {
92
+ font-size: 96px;
93
+ margin-bottom: 32px;
94
+ }
65
95
  </style>
@@ -22,7 +22,10 @@ export default {
22
22
  };
23
23
  </script>
24
24
  <template>
25
- <div class="intro-box">
25
+ <div
26
+ class="intro-box"
27
+ :data-testid="'fleet-no-workspaces'"
28
+ >
26
29
  <i class="icon icon-repository" />
27
30
  <div class="title">
28
31
  <span v-clean-html="t('fleet.gitRepo.repo.noWorkspaces', null, true)" />
@@ -55,6 +58,7 @@ export default {
55
58
  text-align: center;
56
59
  max-width: 600px;
57
60
  }
61
+
58
62
  .icon-repository {
59
63
  font-size: 96px;
60
64
  margin-bottom: 32px;
@@ -0,0 +1,171 @@
1
+ <script>
2
+ import { checkSchemasForFindAllHash } from '@shell/utils/auth';
3
+ import { SECRET_TYPES } from '@shell/config/secret';
4
+ import { FLEET, SECRET } from '@shell/config/types';
5
+ import { FLEET as FLEET_ANNOTATIONS } from '@shell/config/labels-annotations';
6
+ import { _CREATE, _EDIT } from '@shell/config/query-params';
7
+ import LabeledSelect from '@shell/components/form/LabeledSelect';
8
+
9
+ const OPTIONS = { _NONE: '_none' };
10
+
11
+ export default {
12
+
13
+ name: 'FleetOCIStorageSecret',
14
+
15
+ emits: ['update:value'],
16
+
17
+ components: { LabeledSelect },
18
+
19
+ props: {
20
+ secret: {
21
+ type: String,
22
+ default: '',
23
+ },
24
+
25
+ workspace: {
26
+ type: String,
27
+ default: '',
28
+ },
29
+
30
+ mode: {
31
+ type: String,
32
+ default: _EDIT
33
+ },
34
+
35
+ allowDefault: {
36
+ type: Boolean,
37
+ default: true
38
+ },
39
+
40
+ inStore: {
41
+ type: String,
42
+ default: 'management',
43
+ },
44
+ },
45
+
46
+ async fetch() {
47
+ const hash = await checkSchemasForFindAllHash({
48
+ workspaces: {
49
+ inStoreType: 'management',
50
+ type: FLEET.WORKSPACE,
51
+ schemaValidator: (schema) => {
52
+ return !!schema?.links?.collection;
53
+ }
54
+ },
55
+ secrets: {
56
+ inStoreType: 'management',
57
+ type: SECRET
58
+ },
59
+ }, this.$store);
60
+
61
+ this.workspaces = hash.workspaces || [];
62
+ this.secrets = hash.secrets || [];
63
+ },
64
+
65
+ data() {
66
+ return {
67
+ workspaces: [],
68
+ secrets: [],
69
+ };
70
+ },
71
+
72
+ computed: {
73
+ ociSecrets() {
74
+ return this.secrets.filter((secret) => secret._type === SECRET_TYPES.FLEET_OCI_STORAGE &&
75
+ secret.metadata?.annotations?.[FLEET_ANNOTATIONS.OCI_STORAGE_SECRET_GENERATED] !== 'true' &&
76
+ secret.metadata?.namespace === this.workspace
77
+ );
78
+ },
79
+
80
+ defaultSecret() {
81
+ if (!this.allowDefault) {
82
+ return null;
83
+ }
84
+
85
+ const workspace = this.workspaces.find((ws) => ws.id === this.workspace);
86
+
87
+ const defaultSecretName = workspace?.metadata?.annotations?.[FLEET_ANNOTATIONS.OCI_STORAGE_SECRET_DEFAULT];
88
+
89
+ return this.ociSecrets.find((secret) => secret.name === defaultSecretName);
90
+ },
91
+
92
+ options() {
93
+ const out = [{
94
+ label: this.t('generic.none'),
95
+ value: OPTIONS._NONE
96
+ }];
97
+
98
+ if (this.defaultSecret) {
99
+ out.push({
100
+ label: `${ this.defaultSecret.name } (${ this.t('generic.default') })`,
101
+ value: this.defaultSecret
102
+ });
103
+ }
104
+
105
+ const customSecrets = this.defaultSecret ? this.ociSecrets.filter((secret) => secret.id !== this.defaultSecret.id) : this.ociSecrets;
106
+
107
+ if (customSecrets.length > 0) {
108
+ out.push({
109
+ kind: 'title',
110
+ label: this.t(`fleet.gitRepo.ociStorageSecret.options.${ this.allowDefault ? 'chooseCustom' : 'chooseExisting' }`),
111
+ disabled: true
112
+ });
113
+
114
+ customSecrets.forEach((secret) => {
115
+ out.push({
116
+ label: secret.name,
117
+ value: secret
118
+ });
119
+ });
120
+ }
121
+
122
+ return out;
123
+ },
124
+
125
+ selected() {
126
+ if (this.secret === this.defaultSecret?.name) {
127
+ return this.defaultSecret;
128
+ }
129
+
130
+ return this.secret || OPTIONS._NONE;
131
+ },
132
+
133
+ tooltip() {
134
+ if (this.allowDefault) {
135
+ return this.t('fleet.gitRepo.ociStorageSecret.tooltip', { workspace: this.workspace }, { raw: true });
136
+ }
137
+
138
+ return null;
139
+ }
140
+ },
141
+
142
+ watch: {
143
+ defaultSecret(neu) {
144
+ if (this.mode === _CREATE) {
145
+ this.update(neu);
146
+ }
147
+ }
148
+ },
149
+
150
+ methods: {
151
+ update(value) {
152
+ this.$emit('update:value', value?.name);
153
+ },
154
+ }
155
+ };
156
+ </script>
157
+
158
+ <template>
159
+ <LabeledSelect
160
+ data-testid="fleet-oci-storage-secret-list"
161
+ :label="t('fleet.gitRepo.ociStorageSecret.label')"
162
+ :mode="mode"
163
+ :value="selected"
164
+ :options="options"
165
+ :tooltip="tooltip"
166
+ @update:value="update"
167
+ />
168
+ </template>
169
+
170
+ <style lang="scss" scoped>
171
+ </style>
@@ -1,14 +1,12 @@
1
1
  <script>
2
2
  import ResourceTable from '@shell/components/ResourceTable';
3
- import Link from '@shell/components/formatter/Link';
4
- import Shortened from '@shell/components/formatter/Shortened';
5
3
  import FleetIntro from '@shell/components/fleet/FleetIntro';
6
4
 
7
5
  import {
8
6
  AGE,
9
7
  FLEET_REPO,
10
8
  FLEET_REPO_CLUSTER_SUMMARY,
11
- FLEET_REPO_CLUSTERS_READY,
9
+ FLEET_APPLICATION_CLUSTERS_READY,
12
10
  FLEET_REPO_PER_CLUSTER_STATE,
13
11
  FLEET_REPO_TARGET,
14
12
  FLEET_SUMMARY,
@@ -16,24 +14,30 @@ import {
16
14
  STATE,
17
15
  } from '@shell/config/table-headers';
18
16
 
19
- // i18n-ignore repoDisplay
20
17
  export default {
21
18
 
22
19
  name: 'FleetRepos',
23
20
 
24
21
  components: {
25
- ResourceTable, Link, Shortened, FleetIntro
22
+ FleetIntro,
23
+ ResourceTable,
26
24
  },
27
25
  props: {
26
+ rows: {
27
+ type: Array,
28
+ required: true,
29
+ },
30
+
31
+ workspace: {
32
+ type: String,
33
+ default: ''
34
+ },
35
+
28
36
  clusterId: {
29
37
  type: String,
30
38
  required: false,
31
39
  default: null,
32
40
  },
33
- rows: {
34
- type: Array,
35
- required: true,
36
- },
37
41
 
38
42
  schema: {
39
43
  type: Object,
@@ -48,6 +52,11 @@ export default {
48
52
  useQueryParamsForSimpleFiltering: {
49
53
  type: Boolean,
50
54
  default: false
55
+ },
56
+
57
+ showIntro: {
58
+ type: Boolean,
59
+ default: true,
51
60
  }
52
61
  },
53
62
 
@@ -57,11 +66,14 @@ export default {
57
66
  return [];
58
67
  }
59
68
 
60
- // Returns boolean { [namespace]: true }
61
- const selectedWorkspace = this.$store.getters['namespaces']();
69
+ const selectedNamespaces = this.$store.getters['namespaces']();
62
70
 
63
71
  return this.rows.filter((row) => {
64
- return !!selectedWorkspace[row.metadata.namespace];
72
+ if (this.workspace) {
73
+ return this.workspace === row.metadata.namespace;
74
+ }
75
+
76
+ return !!selectedNamespaces[row.metadata.namespace];
65
77
  });
66
78
  },
67
79
 
@@ -78,7 +90,7 @@ export default {
78
90
  const summary = this.isClusterView ? [{
79
91
  ...FLEET_REPO_CLUSTER_SUMMARY,
80
92
  formatterOpts: { clusterId: this.clusterId },
81
- }] : [FLEET_REPO_CLUSTERS_READY, FLEET_SUMMARY];
93
+ }] : [FLEET_APPLICATION_CLUSTERS_READY, FLEET_SUMMARY];
82
94
 
83
95
  // if hasPerClusterState then use the repo state
84
96
  const state = this.isClusterView ? {
@@ -95,6 +107,10 @@ export default {
95
107
  AGE
96
108
  ];
97
109
  },
110
+
111
+ shouldShowIntro() {
112
+ return this.showIntro && !this.filteredRows.length;
113
+ },
98
114
  },
99
115
  methods: {
100
116
  parseTargetMode(row) {
@@ -106,79 +122,25 @@ export default {
106
122
 
107
123
  <template>
108
124
  <div>
109
- <FleetIntro v-if="noRows && !loading" />
125
+ <FleetIntro
126
+ v-if="shouldShowIntro && !loading"
127
+ :schema="schema"
128
+ :labelKey="'gitRepo'"
129
+ :icon="'icon-github'"
130
+ />
110
131
  <ResourceTable
111
- v-if="!noRows"
132
+ v-if="!shouldShowIntro"
112
133
  v-bind="$attrs"
113
134
  :schema="schema"
114
135
  :headers="headers"
115
136
  :rows="rows"
116
137
  :loading="loading"
117
138
  :use-query-params-for-simple-filtering="useQueryParamsForSimpleFiltering"
139
+ :namespaced="!workspace"
118
140
  key-field="_key"
119
- >
120
- <template #cell:repo="{ row }">
121
- <Link
122
- :row="row"
123
- :value="row.spec.repo || ''"
124
- label-key="repoDisplay"
125
- before-icon-key="repoIcon"
126
- url-key="spec.repo"
127
- />
128
- {{ row.cluster }}
129
- <template v-if="row.commitDisplay">
130
- <div class="text-muted">
131
- <Shortened
132
- long-value-key="status.commit"
133
- :row="row"
134
- :value="row.commitDisplay"
135
- />
136
- </div>
137
- </template>
138
- </template>
139
-
140
- <template
141
- v-if="!isClusterView"
142
- #cell:clustersReady="{ row }"
143
- >
144
- <span
145
- v-if="!row.clusterInfo"
146
- class="text-muted"
147
- >&mdash;</span>
148
- <span
149
- v-else-if="row.clusterInfo.unready"
150
- class="text-warning"
151
- >{{ row.clusterInfo.ready }}/{{
152
- row.clusterInfo.total }}</span>
153
- <span
154
- v-else
155
- class="cluster-count-info"
156
- >
157
- {{ row.clusterInfo.ready }}/{{ row.clusterInfo.total }}
158
- <i
159
- v-if="!row.clusterInfo.total"
160
- v-clean-tooltip.bottom="parseTargetMode(row)"
161
- class="icon icon-warning"
162
- />
163
- </span>
164
- </template>
165
-
166
- <template #cell:target="{ row }">
167
- {{ row.targetInfo.modeDisplay }}
168
- </template>
169
- </ResourceTable>
141
+ />
170
142
  </div>
171
143
  </template>
172
144
 
173
145
  <style lang="scss" scoped>
174
- .cluster-count-info {
175
- display: flex;
176
- align-items: center;
177
-
178
- i {
179
- margin-left: 5px;
180
- font-size: 22px;
181
- color: var(--warning);
182
- }
183
- }
184
146
  </style>