@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
@@ -28,18 +28,28 @@ export default {
28
28
  required: false,
29
29
  default: null,
30
30
  },
31
+ search: {
32
+ type: Boolean,
33
+ default: true
34
+ },
31
35
  },
32
36
 
33
37
  computed: {
34
- resources() {
35
- return (this.rows || []).map((r) => ({
38
+ computedResources() {
39
+ const resources = (this.rows || []).map((r) => ({
36
40
  tableKey: r.key,
37
41
  ...stateDisplayProperties(r.state),
38
42
  ...r,
39
43
  }));
44
+
45
+ if (this.clusterId) {
46
+ return resources.filter((r) => r.clusterId === this.clusterId);
47
+ }
48
+
49
+ return resources;
40
50
  },
41
51
  resourceHeaders() {
42
- return [
52
+ const out = [
43
53
  {
44
54
  name: 'state',
45
55
  value: 'state',
@@ -49,16 +59,11 @@ export default {
49
59
  width: 100,
50
60
  },
51
61
  {
52
- name: 'cluster',
53
- value: 'clusterName',
54
- sort: ['clusterName', 'stateSort'],
55
- label: 'Cluster',
56
- },
57
- {
58
- name: 'apiVersion',
59
- value: 'apiVersion',
60
- sort: 'apiVersion',
61
- label: 'API Version',
62
+ name: 'name',
63
+ value: 'name',
64
+ sort: 'name',
65
+ label: 'Name',
66
+ formatter: 'LinkDetail',
62
67
  },
63
68
  {
64
69
  name: 'kind',
@@ -66,20 +71,30 @@ export default {
66
71
  sort: 'kind',
67
72
  label: 'Kind',
68
73
  },
69
- {
70
- name: 'name',
71
- value: 'name',
72
- sort: 'name',
73
- label: 'Name',
74
- formatter: 'LinkDetail',
75
- },
76
74
  {
77
75
  name: 'namespace',
78
76
  value: 'namespace',
79
77
  sort: 'namespace',
80
78
  label: 'Namespace',
81
79
  },
80
+ {
81
+ name: 'apiVersion',
82
+ value: 'apiVersion',
83
+ sort: 'apiVersion',
84
+ label: 'API Version',
85
+ },
82
86
  ];
87
+
88
+ if (!this.clusterId) {
89
+ out.splice(3, 0, {
90
+ name: 'cluster',
91
+ value: 'clusterName',
92
+ sort: ['clusterName', 'stateSort'],
93
+ label: 'Cluster',
94
+ });
95
+ }
96
+
97
+ return out;
83
98
  },
84
99
  }
85
100
  };
@@ -87,12 +102,25 @@ export default {
87
102
 
88
103
  <template>
89
104
  <SortableTable
90
- :rows="resources"
105
+ :rows="computedResources"
91
106
  :headers="resourceHeaders"
92
107
  :table-actions="false"
93
108
  :row-actions="false"
109
+ :search="search"
94
110
  key-field="tableKey"
95
111
  default-sort-by="state"
96
112
  :paged="true"
97
- />
113
+ >
114
+ <!-- Pass down templates provided by the caller -->
115
+ <template
116
+ v-for="(_, slot) of $slots"
117
+ v-slot:[slot]="scope"
118
+ :key="slot"
119
+ >
120
+ <slot
121
+ :name="slot"
122
+ v-bind="scope"
123
+ />
124
+ </template>
125
+ </SortableTable>
98
126
  </template>
@@ -1,49 +1,8 @@
1
1
  <script>
2
- import { STATES, STATES_ENUM } from '@shell/plugins/dashboard-store/resource-class';
2
+ import { clone } from '@shell/utils/object';
3
+ import { STATES_ENUM } from '@shell/plugins/dashboard-store/resource-class';
3
4
  import FleetStatus from '@shell/components/fleet/FleetStatus';
4
-
5
- const getResourcesDefaultState = (labelGetter, stateKey) => {
6
- return [
7
- STATES_ENUM.READY,
8
- STATES_ENUM.NOT_READY,
9
- STATES_ENUM.WAIT_APPLIED,
10
- STATES_ENUM.MODIFIED,
11
- STATES_ENUM.MISSING,
12
- STATES_ENUM.ORPHANED,
13
- STATES_ENUM.UNKNOWN,
14
- ].reduce((acc, state) => {
15
- acc[state] = {
16
- count: 0,
17
- color: STATES[state].color,
18
- label: labelGetter(`${ stateKey }.${ state }`, null, STATES[state].label ),
19
- status: state
20
- };
21
-
22
- return acc;
23
- }, {});
24
- };
25
-
26
- const getBundlesDefaultState = (labelGetter, stateKey) => {
27
- return [
28
- STATES_ENUM.READY,
29
- STATES_ENUM.INFO,
30
- STATES_ENUM.WARNING,
31
- STATES_ENUM.NOT_READY,
32
- STATES_ENUM.ERROR,
33
- STATES_ENUM.ERR_APPLIED,
34
- STATES_ENUM.WAIT_APPLIED,
35
- STATES_ENUM.UNKNOWN,
36
- ].reduce((acc, state) => {
37
- acc[state] = {
38
- count: 0,
39
- color: STATES[state].color,
40
- label: labelGetter(`${ stateKey }.${ state }`, null, STATES[state].label ),
41
- status: state
42
- };
43
-
44
- return acc;
45
- }, {});
46
- };
5
+ import FleetUtils from '@shell/utils/fleet';
47
6
 
48
7
  export default {
49
8
 
@@ -67,24 +26,39 @@ export default {
67
26
  },
68
27
  },
69
28
 
29
+ data() {
30
+ let bundlesDefaultStates; let resourcesDefaultStates = {};
31
+
32
+ try {
33
+ bundlesDefaultStates = FleetUtils.getBundlesDefaultState(this.$store.getters['i18n/withFallback'], this.stateKey);
34
+ resourcesDefaultStates = FleetUtils.getResourcesDefaultState(this.$store.getters['i18n/withFallback'], this.stateKey);
35
+ } catch (error) {
36
+ }
37
+
38
+ return {
39
+ bundlesDefaultStates,
40
+ resourcesDefaultStates,
41
+ };
42
+ },
43
+
70
44
  computed: {
71
45
 
72
- repoName() {
46
+ resourceName() {
73
47
  return this.value.metadata.name;
74
48
  },
75
49
 
76
- repoNamespace() {
50
+ resourceNamespace() {
77
51
  return this.value.metadata.namespace;
78
52
  },
79
53
 
80
54
  bundleCounts() {
81
- const resources = this.bundles.filter((item) => item.namespace === this.repoNamespace && item.repoName === this.repoName);
55
+ const resources = this.bundles.filter((item) => item.namespace === this.resourceNamespace && item.appSourceName === this.resourceName);
82
56
 
83
57
  if (!resources.length) {
84
58
  return [];
85
59
  }
86
60
 
87
- const out = { ...getBundlesDefaultState(this.$store.getters['i18n/withFallback'], this.stateKey) };
61
+ const out = clone(this.bundlesDefaultStates);
88
62
 
89
63
  resources.forEach(({ status, metadata }) => {
90
64
  if (!status) {
@@ -149,7 +123,8 @@ export default {
149
123
  },
150
124
 
151
125
  resourceCounts() {
152
- const out = { ...getResourcesDefaultState(this.$store.getters['i18n/withFallback'], this.stateKey) };
126
+ const out = clone(this.resourcesDefaultStates);
127
+
153
128
  const resourceStatuses = this.value.allResourceStatuses;
154
129
 
155
130
  Object.entries(resourceStatuses.states)
@@ -183,13 +158,13 @@ export default {
183
158
  title="Bundles"
184
159
  :values="bundleCounts"
185
160
  value-key="count"
186
- data-testid="gitrepo-bundle-summary"
161
+ data-testid="resource-bundle-summary"
187
162
  />
188
163
  <FleetStatus
189
164
  title="Resources"
190
165
  :values="resourceCounts"
191
166
  value-key="count"
192
- data-testid="gitrepo-deployment-summary"
167
+ data-testid="resource-deployment-summary"
193
168
  />
194
169
  </div>
195
170
  </template>
@@ -0,0 +1,213 @@
1
+ import { mount } from '@vue/test-utils';
2
+ import flushPromises from 'flush-promises';
3
+ import { SECRET_TYPES } from '@shell/config/secret';
4
+ import { FLEET as FLEET_ANNOTATIONS } from '@shell/config/labels-annotations';
5
+ import FleetOCIStorageSecret from '@shell/components/fleet/FleetOCIStorageSecret.vue';
6
+ import { _CREATE, _EDIT } from '@shell/config/query-params';
7
+
8
+ const workspaces = [
9
+ {
10
+ id: 'fleet-local',
11
+ metadata: { annotations: { [FLEET_ANNOTATIONS.OCI_STORAGE_SECRET_DEFAULT]: 'secret-1' } }
12
+ },
13
+ {
14
+ id: 'fleet-default',
15
+ metadata: { annotations: { } }
16
+ },
17
+ {
18
+ id: 'fleet-custom-workspace',
19
+ metadata: { annotations: { [FLEET_ANNOTATIONS.OCI_STORAGE_SECRET_DEFAULT]: 'secret-6' } }
20
+ },
21
+ ];
22
+
23
+ const secrets = [
24
+ {
25
+ id: 'fleet-local/secret-1',
26
+ name: 'secret-1',
27
+ _type: SECRET_TYPES.FLEET_OCI_STORAGE,
28
+ metadata: {
29
+ namespace: 'fleet-local',
30
+ annotations: { [FLEET_ANNOTATIONS.OCI_STORAGE_SECRET_GENERATED]: false }
31
+ }
32
+ },
33
+ {
34
+ id: 'fleet-local/secret-2',
35
+ name: 'secret-2',
36
+ _type: SECRET_TYPES.FLEET_OCI_STORAGE,
37
+ metadata: {
38
+ namespace: 'fleet-local',
39
+ annotations: { [FLEET_ANNOTATIONS.OCI_STORAGE_SECRET_GENERATED]: 'true' }
40
+ }
41
+ },
42
+ {
43
+ id: 'fleet-default/secret-3',
44
+ name: 'secret-3',
45
+ _type: SECRET_TYPES.FLEET_OCI_STORAGE,
46
+ metadata: {
47
+ namespace: 'fleet-default',
48
+ annotations: { [FLEET_ANNOTATIONS.OCI_STORAGE_SECRET_GENERATED]: false }
49
+ }
50
+ },
51
+ {
52
+ id: 'fleet-default/secret-4',
53
+ name: 'secret-4',
54
+ _type: SECRET_TYPES.FLEET_OCI_STORAGE,
55
+ metadata: {
56
+ namespace: 'fleet-default',
57
+ annotations: { [FLEET_ANNOTATIONS.OCI_STORAGE_SECRET_GENERATED]: 'true' }
58
+ }
59
+ },
60
+ {
61
+ id: 'fleet-custom-workspace/secret-5',
62
+ name: 'secret-5',
63
+ _type: SECRET_TYPES.FLEET_OCI_STORAGE,
64
+ metadata: { namespace: 'fleet-custom-workspace' }
65
+ },
66
+ {
67
+ id: 'fleet-custom-workspace/secret-6',
68
+ name: 'secret-6',
69
+ _type: SECRET_TYPES.FLEET_OCI_STORAGE,
70
+ metadata: { namespace: 'fleet-custom-workspace' }
71
+ }
72
+ ];
73
+
74
+ describe('component: FleetOCIStorageSecret', () => {
75
+ describe('mode: create', () => {
76
+ const mode = _CREATE;
77
+
78
+ it('displays empty options', () => {
79
+ const wrapper = mount(FleetOCIStorageSecret, {
80
+ props: {
81
+ workspace: 'fleet-local',
82
+ secret: null,
83
+ mode,
84
+ },
85
+ data() {
86
+ return { secrets: [], workspaces };
87
+ },
88
+ });
89
+
90
+ expect(wrapper.vm.options).toHaveLength(1);
91
+ expect(wrapper.vm.options[0].label).toContain('none');
92
+ });
93
+
94
+ it('displays default and None options', () => {
95
+ const wrapper = mount(FleetOCIStorageSecret, {
96
+ props: {
97
+ workspace: 'fleet-local',
98
+ secret: null,
99
+ mode,
100
+ },
101
+ data() {
102
+ return { secrets, workspaces };
103
+ },
104
+ });
105
+
106
+ expect(wrapper.vm.options).toHaveLength(2);
107
+ expect(wrapper.vm.options[0].label).toContain('none');
108
+
109
+ expect(wrapper.vm.options[1].label).toContain('secret-1');
110
+ expect(wrapper.vm.options[1].label).toContain('default');
111
+ });
112
+
113
+ it('displays custom secrets options', () => {
114
+ const wrapper = mount(FleetOCIStorageSecret, {
115
+ props: {
116
+ workspace: 'fleet-default',
117
+ secret: null,
118
+ mode,
119
+ },
120
+ data() {
121
+ return { secrets, workspaces };
122
+ },
123
+ });
124
+
125
+ expect(wrapper.vm.options).toHaveLength(3);
126
+ expect(wrapper.vm.options[0].label).toContain('none');
127
+
128
+ expect(wrapper.vm.options[1].label).toContain('chooseCustom');
129
+ expect(wrapper.vm.options[2].label).toContain('secret-3');
130
+ expect(wrapper.vm.options[2].label).not.toContain('default');
131
+ });
132
+
133
+ it('displays all options', () => {
134
+ const wrapper = mount(FleetOCIStorageSecret, {
135
+ props: {
136
+ workspace: 'fleet-custom-workspace',
137
+ secret: null,
138
+ mode,
139
+ },
140
+ data() {
141
+ return { secrets, workspaces };
142
+ },
143
+ });
144
+
145
+ expect(wrapper.vm.options).toHaveLength(4);
146
+ expect(wrapper.vm.options[0].label).toContain('none');
147
+
148
+ expect(wrapper.vm.options[1].label).toContain('secret-6');
149
+ expect(wrapper.vm.options[1].label).toContain('default');
150
+
151
+ expect(wrapper.vm.options[2].label).toContain('chooseCustom');
152
+ expect(wrapper.vm.options[3].label).toContain('secret-5');
153
+ });
154
+
155
+ it('select default if default secret exists', async() => {
156
+ const wrapper = mount(FleetOCIStorageSecret, {
157
+ props: {
158
+ workspace: '',
159
+ secret: null,
160
+ mode,
161
+ },
162
+ data() {
163
+ return { secrets, workspaces };
164
+ },
165
+ });
166
+
167
+ wrapper.setProps({ workspace: 'fleet-local' });
168
+ await flushPromises();
169
+
170
+ expect(wrapper.emitted('update:value')?.[0][0]).toBe('secret-1');
171
+ });
172
+
173
+ it('select none if default secret not exists', async() => {
174
+ const wrapper = mount(FleetOCIStorageSecret, {
175
+ props: {
176
+ workspace: '',
177
+ secret: null,
178
+ mode,
179
+ },
180
+ data() {
181
+ return { secrets, workspaces };
182
+ },
183
+ });
184
+
185
+ wrapper.setProps({ workspace: 'fleet-default' });
186
+ await flushPromises();
187
+
188
+ expect(wrapper.emitted('update:value')).toBeUndefined();
189
+ });
190
+ });
191
+
192
+ describe('mode: edit', () => {
193
+ const mode = _EDIT;
194
+
195
+ it('displays selected secret', async() => {
196
+ const wrapper = mount(FleetOCIStorageSecret, {
197
+ props: {
198
+ workspace: 'fleet-local',
199
+ secret: 'test',
200
+ mode,
201
+ },
202
+ data() {
203
+ return { secrets, workspaces };
204
+ },
205
+ });
206
+
207
+ const secretSelector = wrapper.find('[data-testid="fleet-oci-storage-secret-list"]');
208
+
209
+ expect(wrapper.vm.selected).toBe('test');
210
+ expect(secretSelector.element.textContent).toContain('test');
211
+ });
212
+ });
213
+ });
@@ -9,13 +9,13 @@ const REPO_NAME_VARIANT = 'testrepo-again';
9
9
  const CLUSTER_NAME = 'testcluster';
10
10
 
11
11
  const mockedBundlesInRepo = [{
12
- id: `fleet-default/${ REPO_NAME }-${ CLUSTER_NAME }-1234`,
13
- type: 'fleet.cattle.io.bundle',
14
- apiVersion: 'fleet.cattle.io/v1alpha1',
15
- kind: 'Bundle',
16
- repoName: REPO_NAME,
17
- namespace: 'fleet-default',
18
- metadata: {
12
+ id: `fleet-default/${ REPO_NAME }-${ CLUSTER_NAME }-1234`,
13
+ type: 'fleet.cattle.io.bundle',
14
+ apiVersion: 'fleet.cattle.io/v1alpha1',
15
+ kind: 'Bundle',
16
+ appSourceName: REPO_NAME,
17
+ namespace: 'fleet-default',
18
+ metadata: {
19
19
  labels: {
20
20
  'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
21
21
  'fleet.cattle.io/repo-name': REPO_NAME
@@ -49,13 +49,13 @@ const mockedBundlesInRepo = [{
49
49
  }
50
50
  },
51
51
  {
52
- id: `fleet-default/${ REPO_NAME }-${ CLUSTER_NAME }-5678`,
53
- type: 'fleet.cattle.io.bundle',
54
- apiVersion: 'fleet.cattle.io/v1alpha1',
55
- kind: 'Bundle',
56
- repoName: REPO_NAME,
57
- namespace: 'fleet-default',
58
- metadata: {
52
+ id: `fleet-default/${ REPO_NAME }-${ CLUSTER_NAME }-5678`,
53
+ type: 'fleet.cattle.io.bundle',
54
+ apiVersion: 'fleet.cattle.io/v1alpha1',
55
+ kind: 'Bundle',
56
+ appSourceName: REPO_NAME,
57
+ namespace: 'fleet-default',
58
+ metadata: {
59
59
  labels: {
60
60
  'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
61
61
  'fleet.cattle.io/repo-name': REPO_NAME
@@ -90,13 +90,13 @@ const mockedBundlesInRepo = [{
90
90
  }];
91
91
 
92
92
  const mockedBundlesOutOfRepo = [{
93
- id: `fleet-default/${ REPO_NAME_VARIANT }-${ CLUSTER_NAME }-1234`,
94
- type: 'fleet.cattle.io.bundle',
95
- apiVersion: 'fleet.cattle.io/v1alpha1',
96
- kind: 'Bundle',
97
- repoName: REPO_NAME_VARIANT,
98
- namespace: 'custom-namespace',
99
- metadata: {
93
+ id: `fleet-default/${ REPO_NAME_VARIANT }-${ CLUSTER_NAME }-1234`,
94
+ type: 'fleet.cattle.io.bundle',
95
+ apiVersion: 'fleet.cattle.io/v1alpha1',
96
+ kind: 'Bundle',
97
+ appSourceName: REPO_NAME_VARIANT,
98
+ namespace: 'custom-namespace',
99
+ metadata: {
100
100
  labels: {
101
101
  'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
102
102
  'fleet.cattle.io/repo-name': REPO_NAME_VARIANT
@@ -130,13 +130,13 @@ const mockedBundlesOutOfRepo = [{
130
130
  }
131
131
  },
132
132
  {
133
- id: `fleet-default/${ REPO_NAME }-${ CLUSTER_NAME }-1234`,
134
- type: 'fleet.cattle.io.bundle',
135
- apiVersion: 'fleet.cattle.io/v1alpha1',
136
- kind: 'Bundle',
137
- repoName: REPO_NAME,
138
- namespace: 'custom-namespace',
139
- metadata: {
133
+ id: `fleet-default/${ REPO_NAME }-${ CLUSTER_NAME }-1234`,
134
+ type: 'fleet.cattle.io.bundle',
135
+ apiVersion: 'fleet.cattle.io/v1alpha1',
136
+ kind: 'Bundle',
137
+ appSourceName: REPO_NAME,
138
+ namespace: 'custom-namespace',
139
+ metadata: {
140
140
  labels: {
141
141
  'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
142
142
  'fleet.cattle.io/repo-name': REPO_NAME
@@ -170,13 +170,13 @@ const mockedBundlesOutOfRepo = [{
170
170
  }
171
171
  },
172
172
  {
173
- id: `fleet-default/${ REPO_NAME_VARIANT }-${ CLUSTER_NAME }-5678`,
174
- type: 'fleet.cattle.io.bundle',
175
- apiVersion: 'fleet.cattle.io/v1alpha1',
176
- kind: 'Bundle',
177
- repoName: REPO_NAME_VARIANT,
178
- namespace: 'custom-namespace',
179
- metadata: {
173
+ id: `fleet-default/${ REPO_NAME_VARIANT }-${ CLUSTER_NAME }-5678`,
174
+ type: 'fleet.cattle.io.bundle',
175
+ apiVersion: 'fleet.cattle.io/v1alpha1',
176
+ kind: 'Bundle',
177
+ appSourceName: REPO_NAME_VARIANT,
178
+ namespace: 'custom-namespace',
179
+ metadata: {
180
180
  labels: {
181
181
  'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
182
182
  'fleet.cattle.io/repo-name': REPO_NAME_VARIANT
@@ -337,10 +337,10 @@ describe('component: FleetSummary', () => {
337
337
  ])('displays the number of bundles associated with the current gitrepo', (bundles: any[], bundleCount: string) => {
338
338
  const wrapper = mount(FleetSummary, {
339
339
  props: { bundles, value: new GitRepo(mockRepo) },
340
- global: { mocks: { $store: mockStore } }
340
+ global: { mocks: { $store: mockStore }, directives: { 'trim-whitespace': (id: any) => id } },
341
341
  });
342
342
 
343
- const bundleCountEl = wrapper.find('[data-testid="gitrepo-bundle-summary"] .count');
343
+ const bundleCountEl = wrapper.find('[data-testid="resource-bundle-summary"] .count');
344
344
 
345
345
  expect(bundleCountEl.text()).toBe(bundleCount);
346
346
  });
@@ -352,10 +352,10 @@ describe('component: FleetSummary', () => {
352
352
  ])('displays the number of deployments associated with the current gitrepo', (bundles: any[], bundleCount: string) => {
353
353
  const wrapper = mount(FleetSummary, {
354
354
  props: { bundles, value: new GitRepo(mockRepo) },
355
- global: { mocks: { $store: mockStore } }
355
+ global: { mocks: { $store: mockStore }, directives: { 'trim-whitespace': (id: any) => id } }
356
356
  });
357
357
 
358
- const bundleCountEl = wrapper.find('[data-testid="gitrepo-deployment-summary"] .count');
358
+ const bundleCountEl = wrapper.find('[data-testid="resource-deployment-summary"] .count');
359
359
 
360
360
  expect(bundleCountEl.text()).toBe(bundleCount);
361
361
  });
@@ -0,0 +1,73 @@
1
+
2
+ <script>
3
+ export default {
4
+ name: 'FleetDashboardEmpty',
5
+
6
+ props: {
7
+ permissions: {
8
+ type: Object,
9
+ required: true
10
+ },
11
+ },
12
+
13
+ data() {
14
+ return { getStartedLink: { name: 'c-cluster-fleet-application-create' } };
15
+ }
16
+ };
17
+ </script>
18
+ <template>
19
+ <div
20
+ class="fleet-empty-dashboard"
21
+ aria-hidden="true"
22
+ :data-testid="'fleet-empty-dashboard'"
23
+ >
24
+ <i class="icon-fleet mb-30" />
25
+ <h1>{{ t('fleet.dashboard.welcome') }}</h1>
26
+ <p class="mb-30">
27
+ <span>{{ t('fleet.dashboard.gitOpsScale') }}</span>
28
+ <a
29
+ :href="t('fleet.dashboard.learnMoreLink')"
30
+ target="_blank"
31
+ rel="noopener noreferrer nofollow"
32
+ >
33
+ {{ t('fleet.dashboard.learnMore') }} <i class="icon icon-external-link" />
34
+ </a>
35
+ <span class="sr-only">{{ t('generic.opensInNewTab') }}</span>
36
+ </p>
37
+ <template v-if="permissions.gitRepos || permissions.helmOps">
38
+ <h3 class="mb-30">
39
+ {{ t('fleet.dashboard.noApplications', null, true) }}
40
+ </h3>
41
+ <router-link
42
+ :to="getStartedLink"
43
+ class="btn role-secondary"
44
+ >
45
+ {{ t('fleet.dashboard.getStarted') }}
46
+ </router-link>
47
+ </template>
48
+ </div>
49
+ </template>
50
+
51
+ <style lang="scss" scoped>
52
+ .fleet-empty-dashboard {
53
+ flex: 1;
54
+ display: flex;
55
+ align-items: center;
56
+ justify-content: center;
57
+ flex-direction: column;
58
+ min-height: 100%;
59
+
60
+ .icon-fleet {
61
+ font-size: 100px;
62
+ color: var(--disabled-text);
63
+ }
64
+
65
+ > p > span {
66
+ color: var(--disabled-text);
67
+ }
68
+
69
+ .sr-only {
70
+ visibility: hidden;
71
+ }
72
+ }
73
+ </style>