@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.
- package/assets/images/icons/document.svg +3 -0
- package/assets/images/vendor/cognito.svg +1 -0
- package/assets/styles/app.scss +1 -0
- package/assets/styles/base/_basic.scss +10 -0
- package/assets/styles/base/_spacing.scss +29 -0
- package/assets/styles/global/_layout.scss +1 -1
- package/assets/styles/themes/_dark.scss +25 -0
- package/assets/styles/themes/_light.scss +65 -0
- package/assets/translations/en-us.yaml +322 -24
- package/assets/translations/zh-hans.yaml +8 -5
- package/components/Certificates.vue +5 -0
- package/components/FilterPanel.vue +156 -0
- package/components/{fleet/ForceDirectedTreeChart/index.vue → ForceDirectedTreeChart.vue} +47 -41
- package/components/IconOrSvg.vue +14 -35
- package/components/PromptRemove.vue +5 -1
- package/components/Resource/Detail/Card/PodsCard/Bubble.vue +13 -0
- package/components/Resource/Detail/Card/PodsCard/composable.ts +30 -0
- package/components/Resource/Detail/Card/PodsCard/index.vue +118 -0
- package/components/Resource/Detail/Card/ResourceUsageCard/composable.ts +51 -0
- package/components/Resource/Detail/Card/ResourceUsageCard/index.vue +79 -0
- package/components/Resource/Detail/Card/Scaler.vue +89 -0
- package/components/Resource/Detail/Card/StateCard/composables.ts +112 -0
- package/components/Resource/Detail/Card/StateCard/index.vue +39 -0
- package/components/Resource/Detail/Card/VerticalGap.vue +11 -0
- package/components/Resource/Detail/Card/__tests__/Card.test.ts +36 -0
- package/components/Resource/Detail/Card/__tests__/PodsCard.test.ts +84 -0
- package/components/Resource/Detail/Card/__tests__/ResourceUsageCard.test.ts +72 -0
- package/components/Resource/Detail/Card/__tests__/Scaler.test.ts +87 -0
- package/components/Resource/Detail/Card/__tests__/StateCard.test.ts +53 -0
- package/components/Resource/Detail/Card/__tests__/VerticalGap.test.ts +14 -0
- package/components/Resource/Detail/Card/__tests__/index.test.ts +36 -0
- package/components/Resource/Detail/Card/index.vue +56 -0
- package/components/Resource/Detail/Metadata/Annotations/__tests__/index.test.ts +19 -0
- package/components/Resource/Detail/Metadata/Annotations/composable.ts +12 -0
- package/components/Resource/Detail/Metadata/Annotations/index.vue +26 -0
- package/components/Resource/Detail/Metadata/IdentifyingInformation/__tests__/index.test.ts +103 -0
- package/components/Resource/Detail/Metadata/IdentifyingInformation/composable.ts +281 -0
- package/components/Resource/Detail/Metadata/IdentifyingInformation/index.vue +111 -0
- package/components/Resource/Detail/Metadata/KeyValue.vue +130 -0
- package/components/Resource/Detail/Metadata/Labels/__tests__/index.test.ts +18 -0
- package/components/Resource/Detail/Metadata/Labels/composable.ts +12 -0
- package/components/Resource/Detail/Metadata/Labels/index.vue +27 -0
- package/components/Resource/Detail/Metadata/Rectangle.vue +32 -0
- package/components/Resource/Detail/Metadata/__tests__/KeyValue.test.ts +107 -0
- package/components/Resource/Detail/Metadata/__tests__/Rectangle.test.ts +24 -0
- package/components/Resource/Detail/Metadata/__tests__/index.test.ts +91 -0
- package/components/Resource/Detail/Metadata/composables.ts +29 -0
- package/components/Resource/Detail/Metadata/index.vue +66 -0
- package/components/Resource/Detail/Page.vue +22 -0
- package/components/Resource/Detail/PercentageBar.vue +40 -0
- package/components/Resource/Detail/ResourceRow.vue +119 -0
- package/components/Resource/Detail/SpacedRow.vue +14 -0
- package/components/Resource/Detail/StatusBar.vue +59 -0
- package/components/Resource/Detail/StatusRow.vue +61 -0
- package/components/Resource/Detail/TitleBar/Title.vue +13 -0
- package/components/Resource/Detail/TitleBar/Top.vue +14 -0
- package/components/Resource/Detail/TitleBar/__tests__/Title.test.ts +17 -0
- package/components/Resource/Detail/TitleBar/__tests__/Top.test.ts +17 -0
- package/components/Resource/Detail/TitleBar/__tests__/index.test.ts +142 -0
- package/components/Resource/Detail/TitleBar/composable.ts +31 -0
- package/components/Resource/Detail/TitleBar/index.vue +124 -0
- package/components/Resource/Detail/Top/index.vue +34 -0
- package/components/Resource/Detail/__tests__/Page.test.ts +32 -0
- package/components/ResourceDetail/__tests__/index.test.ts +114 -0
- package/components/ResourceDetail/index.vue +64 -562
- package/components/ResourceDetail/legacy.vue +545 -0
- package/components/ResourceTable.vue +41 -7
- package/components/SlideInPanelManager.vue +76 -8
- package/components/SortableTable/index.vue +13 -2
- package/components/SortableTable/selection.js +21 -8
- package/components/StatusBadge.vue +6 -4
- package/components/SubtleLink.vue +25 -0
- package/components/Wizard.vue +12 -1
- package/components/YamlEditor.vue +1 -1
- package/components/__tests__/FilterPanel.test.ts +81 -0
- package/components/auth/AuthBanner.vue +2 -3
- package/components/auth/RoleDetailEdit.vue +45 -3
- package/components/auth/login/oidc.vue +6 -1
- package/components/fleet/FleetApplications.vue +181 -0
- package/components/fleet/FleetHelmOps.vue +115 -0
- package/components/fleet/FleetIntro.vue +58 -28
- package/components/fleet/FleetNoWorkspaces.vue +5 -1
- package/components/fleet/FleetOCIStorageSecret.vue +171 -0
- package/components/fleet/FleetRepos.vue +38 -76
- package/components/fleet/FleetResources.vue +50 -22
- package/components/fleet/FleetSummary.vue +26 -51
- package/components/fleet/__tests__/FleetOCIStorageSecret.test.ts +213 -0
- package/components/fleet/__tests__/FleetSummary.test.ts +39 -39
- package/components/fleet/dashboard/Empty.vue +73 -0
- package/components/fleet/dashboard/ResourceCard.vue +183 -0
- package/components/fleet/dashboard/ResourceCardSummary.vue +199 -0
- package/components/fleet/dashboard/ResourceDetails.vue +196 -0
- package/components/fleet/dashboard/ResourcePanel.vue +376 -0
- package/components/form/ArrayList.vue +6 -0
- package/components/form/SimpleSecretSelector.vue +8 -2
- package/components/form/ValueFromResource.vue +31 -19
- package/components/formatter/FleetApplicationClustersReady.vue +77 -0
- package/components/formatter/FleetApplicationSource.vue +71 -0
- package/components/formatter/FleetSummaryGraph.vue +7 -0
- package/components/nav/Header.vue +8 -7
- package/components/nav/TopLevelMenu.helper.ts +55 -34
- package/components/nav/TopLevelMenu.vue +11 -0
- package/components/nav/Type.vue +4 -1
- package/composables/useI18n.ts +12 -11
- package/config/labels-annotations.js +14 -11
- package/config/product/auth.js +1 -0
- package/config/product/fleet.js +70 -17
- package/config/query-params.js +3 -1
- package/config/roles.ts +1 -0
- package/config/router/routes.js +20 -2
- package/config/secret.ts +15 -0
- package/config/settings.ts +3 -2
- package/config/table-headers.js +52 -22
- package/config/types.js +2 -0
- package/core/plugin-helpers.ts +3 -2
- package/detail/fleet.cattle.io.cluster.vue +28 -15
- package/detail/fleet.cattle.io.gitrepo.vue +10 -1
- package/detail/fleet.cattle.io.helmop.vue +157 -0
- package/dialog/HelmOpForceUpdateDialog.vue +132 -0
- package/dialog/RedeployWorkloadDialog.vue +164 -0
- package/edit/__tests__/fleet.cattle.io.gitrepo.test.ts +56 -67
- package/edit/auth/oidc.vue +159 -93
- package/edit/fleet.cattle.io.gitrepo.vue +26 -33
- package/edit/fleet.cattle.io.helmop.vue +997 -0
- package/edit/management.cattle.io.fleetworkspace.vue +43 -10
- package/list/fleet.cattle.io.gitrepo.vue +1 -1
- package/list/fleet.cattle.io.helmop.vue +108 -0
- package/list/namespace.vue +5 -2
- package/mixins/auth-config.js +8 -1
- package/mixins/preset.js +100 -0
- package/mixins/resource-fetch-api-pagination.js +2 -0
- package/mixins/resource-fetch.js +1 -1
- package/mixins/resource-table-watch.js +45 -0
- package/models/__tests__/chart.test.ts +273 -0
- package/models/__tests__/fleet.cattle.io.gitrepo.test.ts +1 -1
- package/models/chart.js +144 -2
- package/models/fleet-application.js +385 -0
- package/models/fleet.cattle.io.bundle.js +9 -8
- package/models/fleet.cattle.io.gitrepo.js +41 -365
- package/models/fleet.cattle.io.helmop.js +228 -0
- package/models/management.cattle.io.authconfig.js +1 -0
- package/models/management.cattle.io.fleetworkspace.js +12 -0
- package/models/workload.js +14 -18
- package/package.json +2 -1
- package/pages/auth/verify.vue +13 -1
- package/pages/c/_cluster/apps/charts/AddRepoLink.vue +37 -0
- package/pages/c/_cluster/apps/charts/AppChartCardFooter.vue +80 -0
- package/pages/c/_cluster/apps/charts/AppChartCardSubHeader.vue +54 -0
- package/pages/c/_cluster/apps/charts/StatusLabel.vue +33 -0
- package/pages/c/_cluster/apps/charts/index.vue +302 -484
- package/pages/c/_cluster/explorer/EventsTable.vue +1 -1
- package/pages/c/_cluster/fleet/__tests__/index.test.ts +426 -0
- package/pages/c/_cluster/fleet/application/_resource/_id.vue +14 -0
- package/pages/c/_cluster/fleet/application/_resource/create.vue +14 -0
- package/pages/c/_cluster/fleet/application/create.vue +340 -0
- package/pages/c/_cluster/fleet/application/index.vue +139 -0
- package/pages/c/_cluster/fleet/graph/config.js +277 -0
- package/pages/c/_cluster/fleet/index.vue +772 -330
- package/pages/explorer/resource/detail/configmap.vue +19 -0
- package/plugins/dashboard-store/actions.js +31 -9
- package/plugins/dashboard-store/getters.js +34 -21
- package/plugins/dashboard-store/mutations.js +51 -7
- package/plugins/dashboard-store/resource-class.js +14 -2
- package/plugins/steve/__tests__/subscribe.spec.ts +66 -1
- package/plugins/steve/actions.js +3 -0
- package/plugins/steve/steve-pagination-utils.ts +14 -13
- package/plugins/steve/subscribe.js +229 -42
- package/rancher-components/BadgeState/BadgeState.vue +3 -1
- package/rancher-components/Form/Checkbox/Checkbox.vue +2 -2
- package/rancher-components/RcItemCard/RcItemCard.test.ts +189 -0
- package/rancher-components/RcItemCard/RcItemCard.vue +425 -0
- package/rancher-components/RcItemCard/RcItemCardAction.vue +24 -0
- package/rancher-components/RcItemCard/index.ts +2 -0
- package/store/auth.js +1 -0
- package/store/catalog.js +62 -24
- package/store/index.js +33 -14
- package/store/slideInPanel.ts +6 -0
- package/store/type-map.js +1 -0
- package/types/fleet.d.ts +35 -0
- package/types/resources/settings.d.ts +19 -1
- package/types/shell/index.d.ts +339 -272
- package/types/store/dashboard-store.types.ts +17 -3
- package/types/store/pagination.types.ts +6 -1
- package/types/store/subscribe.types.ts +50 -0
- package/utils/auth.js +32 -3
- package/utils/fleet-types.ts +0 -0
- package/utils/fleet.ts +200 -1
- package/utils/pagination-utils.ts +26 -1
- package/utils/pagination-wrapper.ts +132 -50
- package/utils/settings.ts +4 -1
- package/utils/style.ts +39 -0
- package/utils/validators/formRules/__tests__/index.test.ts +36 -3
- package/utils/validators/formRules/index.ts +10 -3
- package/utils/window.js +11 -7
- package/components/__tests__/ApplicationCard.test.ts +0 -27
- package/components/cards/ApplicationCard.vue +0 -145
- package/components/fleet/ForceDirectedTreeChart/chartIcons.js +0 -17
- package/config/secret.js +0 -14
- package/pages/c/_cluster/fleet/GitRepoGraphConfig.js +0 -249
- /package/{components/form/SSHKnownHosts → dialog}/__tests__/KnownHostsEditDialog.test.ts +0 -0
|
@@ -1,48 +1,11 @@
|
|
|
1
|
-
import { convert, matching, convertSelectorObj } from '@shell/utils/selector';
|
|
2
|
-
import jsyaml from 'js-yaml';
|
|
3
|
-
import isEmpty from 'lodash/isEmpty';
|
|
4
|
-
import { escapeHtml } from '@shell/utils/string';
|
|
5
|
-
import { FLEET, MANAGEMENT } from '@shell/config/types';
|
|
6
|
-
import { FLEET as FLEET_ANNOTATIONS } from '@shell/config/labels-annotations';
|
|
7
|
-
import { addObject, addObjects, findBy, insertAt } from '@shell/utils/array';
|
|
8
1
|
import { set } from '@shell/utils/object';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
2
|
+
import { insertAt } from '@shell/utils/array';
|
|
3
|
+
import { FLEET } from '@shell/config/types';
|
|
4
|
+
import { FLEET as FLEET_ANNOTATIONS } from '@shell/config/labels-annotations';
|
|
5
|
+
import FleetApplication from '@shell/models/fleet-application';
|
|
11
6
|
import FleetUtils from '@shell/utils/fleet';
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
if (str.match(/^[a-f0-9]{40,}$/i)) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function normalizeStateCounts(data) {
|
|
22
|
-
if (isEmpty(data)) {
|
|
23
|
-
return {
|
|
24
|
-
total: 0,
|
|
25
|
-
states: {},
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
const { desiredReady, ...rest } = data ;
|
|
29
|
-
const states = Object.entries(rest).reduce((res, [key, value]) => {
|
|
30
|
-
res[mapStateToEnum(key)] = value;
|
|
31
|
-
|
|
32
|
-
return res;
|
|
33
|
-
}, {});
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
total: desiredReady,
|
|
37
|
-
states,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default class GitRepo extends SteveModel {
|
|
42
|
-
get currentUser() {
|
|
43
|
-
return this.$rootGetters['auth/v3User'] || {};
|
|
44
|
-
}
|
|
45
|
-
|
|
8
|
+
export default class GitRepo extends FleetApplication {
|
|
46
9
|
applyDefaults() {
|
|
47
10
|
const spec = this.spec || {};
|
|
48
11
|
const meta = this.metadata || {};
|
|
@@ -84,7 +47,7 @@ export default class GitRepo extends SteveModel {
|
|
|
84
47
|
});
|
|
85
48
|
|
|
86
49
|
insertAt(out, 2, {
|
|
87
|
-
action: '
|
|
50
|
+
action: 'enablePollingAction',
|
|
88
51
|
label: this.t('fleet.gitRepo.actions.enablePolling.label'),
|
|
89
52
|
icon: 'icon icon-endpoints_connected',
|
|
90
53
|
bulkable: true,
|
|
@@ -92,7 +55,7 @@ export default class GitRepo extends SteveModel {
|
|
|
92
55
|
});
|
|
93
56
|
|
|
94
57
|
insertAt(out, 3, {
|
|
95
|
-
action: '
|
|
58
|
+
action: 'disablePollingAction',
|
|
96
59
|
label: this.t('fleet.gitRepo.actions.disablePolling.label'),
|
|
97
60
|
icon: 'icon icon-endpoints_disconnected',
|
|
98
61
|
bulkable: true,
|
|
@@ -113,38 +76,6 @@ export default class GitRepo extends SteveModel {
|
|
|
113
76
|
return out;
|
|
114
77
|
}
|
|
115
78
|
|
|
116
|
-
pause() {
|
|
117
|
-
this.spec.paused = true;
|
|
118
|
-
this.save();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
unpause() {
|
|
122
|
-
this.spec.paused = false;
|
|
123
|
-
this.save();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
enablePolling() {
|
|
127
|
-
this.spec.disablePolling = false;
|
|
128
|
-
this.save();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
disablePolling() {
|
|
132
|
-
this.spec.disablePolling = true;
|
|
133
|
-
this.save();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
goToClone() {
|
|
137
|
-
if (this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_ID]) {
|
|
138
|
-
delete this.metadata.labels[FLEET_ANNOTATIONS.CREATED_BY_USER_ID];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_NAME]) {
|
|
142
|
-
delete this.metadata.labels[FLEET_ANNOTATIONS.CREATED_BY_USER_NAME];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
super.goToClone();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
79
|
forceUpdate(resources = [this]) {
|
|
149
80
|
this.$dispatch('promptModal', {
|
|
150
81
|
componentProps: { repositories: resources },
|
|
@@ -159,84 +90,35 @@ export default class GitRepo extends SteveModel {
|
|
|
159
90
|
});
|
|
160
91
|
}
|
|
161
92
|
|
|
162
|
-
get
|
|
163
|
-
|
|
164
|
-
return 'paused';
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return this.metadata?.state?.name || 'unknown';
|
|
93
|
+
get isWebhookConfigured() {
|
|
94
|
+
return !!this.status?.webhookCommit;
|
|
168
95
|
}
|
|
169
96
|
|
|
170
|
-
get
|
|
171
|
-
const
|
|
172
|
-
const clusters = workspace?.clusters || [];
|
|
173
|
-
const groups = workspace?.clusterGroups || [];
|
|
174
|
-
|
|
175
|
-
if (workspace?.id === 'fleet-local') {
|
|
176
|
-
// should we be getting the clusters from workspace.clusters instead of having to rely on the groups,
|
|
177
|
-
// which takes an additional request to be done on the Fleet dashboard screen?
|
|
178
|
-
const local = findBy(groups, 'id', 'fleet-local/default');
|
|
97
|
+
get github() {
|
|
98
|
+
const value = this.spec.repo || '';
|
|
179
99
|
|
|
180
|
-
|
|
181
|
-
return local.targetClusters;
|
|
182
|
-
}
|
|
100
|
+
const matchHttps = value.match(FleetUtils.GIT_HTTPS_REGEX);
|
|
183
101
|
|
|
184
|
-
|
|
102
|
+
if (matchHttps) {
|
|
103
|
+
return matchHttps[1];
|
|
185
104
|
}
|
|
186
105
|
|
|
187
|
-
|
|
188
|
-
return [];
|
|
189
|
-
}
|
|
106
|
+
const matchSSH = value.match(FleetUtils.GIT_SSH_REGEX);
|
|
190
107
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
for (const tgt of this.spec.targets) {
|
|
194
|
-
if (tgt.clusterName) {
|
|
195
|
-
const cluster = findBy(clusters, 'metadata.name', tgt.clusterName);
|
|
196
|
-
|
|
197
|
-
if (cluster) {
|
|
198
|
-
addObject(out, cluster);
|
|
199
|
-
}
|
|
200
|
-
} else if (tgt.clusterGroup) {
|
|
201
|
-
const group = findBy(groups, {
|
|
202
|
-
'metadata.namespace': this.metadata.namespace,
|
|
203
|
-
'metadata.name': tgt.clusterGroup,
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
if (group) {
|
|
207
|
-
addObjects(out, group.targetClusters);
|
|
208
|
-
}
|
|
209
|
-
} else if (tgt.clusterGroupSelector) {
|
|
210
|
-
const expressions = convertSelectorObj(tgt.clusterGroupSelector);
|
|
211
|
-
const matchingGroups = matching(groups, expressions);
|
|
212
|
-
|
|
213
|
-
for (const group of matchingGroups) {
|
|
214
|
-
addObjects(out, group.targetClusters);
|
|
215
|
-
}
|
|
216
|
-
} else if (tgt.clusterSelector) {
|
|
217
|
-
const expressions = convertSelectorObj(tgt.clusterSelector);
|
|
218
|
-
const matchingClusters = matching(clusters, expressions);
|
|
219
|
-
|
|
220
|
-
addObjects(out, matchingClusters);
|
|
221
|
-
}
|
|
108
|
+
if (matchSSH) {
|
|
109
|
+
return FleetUtils.parseSSHUrl(matchSSH[0]).repoPath;
|
|
222
110
|
}
|
|
223
111
|
|
|
224
|
-
return
|
|
112
|
+
return false;
|
|
225
113
|
}
|
|
226
114
|
|
|
227
|
-
get
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (match) {
|
|
231
|
-
return match[1];
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return false;
|
|
115
|
+
get dashboardIcon() {
|
|
116
|
+
return FleetUtils.dashboardIcons[FLEET.GIT_REPO];
|
|
235
117
|
}
|
|
236
118
|
|
|
237
|
-
get
|
|
119
|
+
get resourceIcon() {
|
|
238
120
|
if (this.github) {
|
|
239
|
-
return
|
|
121
|
+
return FleetUtils.resourceIcons[FLEET.GIT_REPO];
|
|
240
122
|
}
|
|
241
123
|
|
|
242
124
|
return '';
|
|
@@ -249,14 +131,14 @@ export default class GitRepo extends SteveModel {
|
|
|
249
131
|
return null;
|
|
250
132
|
}
|
|
251
133
|
|
|
252
|
-
repo = repo.replace(/.git$/, '');
|
|
253
|
-
repo = repo.replace(/^https:\/\//, '');
|
|
254
|
-
repo = repo.replace(/\/+$/, '');
|
|
255
|
-
|
|
256
134
|
if (this.github) {
|
|
257
135
|
return this.github;
|
|
258
136
|
}
|
|
259
137
|
|
|
138
|
+
repo = repo.replace(/.git$/, '');
|
|
139
|
+
repo = repo.replace(/^https:\/\//, '');
|
|
140
|
+
repo = repo.replace(/\/+$/, '');
|
|
141
|
+
|
|
260
142
|
return repo;
|
|
261
143
|
}
|
|
262
144
|
|
|
@@ -268,7 +150,7 @@ export default class GitRepo extends SteveModel {
|
|
|
268
150
|
return null;
|
|
269
151
|
}
|
|
270
152
|
|
|
271
|
-
if (spec.revision && quacksLikeAHash(spec.revision)) {
|
|
153
|
+
if (spec.revision && FleetUtils.quacksLikeAHash(spec.revision)) {
|
|
272
154
|
return spec.revision.substr(0, 7);
|
|
273
155
|
} else if (spec.revision) {
|
|
274
156
|
return spec.revision;
|
|
@@ -279,99 +161,6 @@ export default class GitRepo extends SteveModel {
|
|
|
279
161
|
return hash;
|
|
280
162
|
}
|
|
281
163
|
|
|
282
|
-
get targetInfo() {
|
|
283
|
-
let mode = null;
|
|
284
|
-
let cluster = null;
|
|
285
|
-
let clusterGroup = null;
|
|
286
|
-
let advanced = null;
|
|
287
|
-
|
|
288
|
-
const targets = this.spec.targets || [];
|
|
289
|
-
|
|
290
|
-
advanced = jsyaml.dump(targets);
|
|
291
|
-
|
|
292
|
-
if (advanced === '[]\n') {
|
|
293
|
-
advanced = `# - name:
|
|
294
|
-
# clusterSelector:
|
|
295
|
-
# matchLabels:
|
|
296
|
-
# foo: bar
|
|
297
|
-
# matchExpressions:
|
|
298
|
-
# - key: foo
|
|
299
|
-
# op: In
|
|
300
|
-
# values: [bar, baz]
|
|
301
|
-
# clusterGroup: foo
|
|
302
|
-
# clusterGroupSelector:
|
|
303
|
-
# matchLabels:
|
|
304
|
-
# foo: bar
|
|
305
|
-
# matchExpressions:
|
|
306
|
-
# - key: foo
|
|
307
|
-
# op: In
|
|
308
|
-
# values: [bar, baz]
|
|
309
|
-
`;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
if (this.metadata.namespace === 'fleet-local') {
|
|
313
|
-
mode = 'local';
|
|
314
|
-
} else if (!targets.length) {
|
|
315
|
-
mode = 'none';
|
|
316
|
-
} else if (targets.length === 1) {
|
|
317
|
-
const target = targets[0];
|
|
318
|
-
|
|
319
|
-
if (Object.keys(target).length > 1) {
|
|
320
|
-
// There are multiple properties in a single target, so use the 'advanced' mode
|
|
321
|
-
// (otherwise any existing content is nuked for what we provide)
|
|
322
|
-
mode = 'advanced';
|
|
323
|
-
} else if (target.clusterGroup) {
|
|
324
|
-
clusterGroup = target.clusterGroup;
|
|
325
|
-
|
|
326
|
-
if (!mode) {
|
|
327
|
-
mode = 'clusterGroup';
|
|
328
|
-
}
|
|
329
|
-
} else if (target.clusterName) {
|
|
330
|
-
mode = 'cluster';
|
|
331
|
-
cluster = target.clusterName;
|
|
332
|
-
} else if (target.clusterSelector) {
|
|
333
|
-
if (Object.keys(target.clusterSelector).length === 0) {
|
|
334
|
-
mode = 'all';
|
|
335
|
-
} else {
|
|
336
|
-
const expressions = convert(target.clusterSelector.matchLabels, target.clusterSelector.matchExpressions);
|
|
337
|
-
|
|
338
|
-
if (expressions.length === 1 &&
|
|
339
|
-
expressions[0].key === FLEET_ANNOTATIONS.CLUSTER_NAME &&
|
|
340
|
-
expressions[0].operator === 'In' &&
|
|
341
|
-
expressions[0].values.length === 1
|
|
342
|
-
) {
|
|
343
|
-
cluster = expressions[0].values[0];
|
|
344
|
-
if (!mode) {
|
|
345
|
-
mode = 'cluster';
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
if (!mode) {
|
|
353
|
-
mode = 'advanced';
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
return {
|
|
357
|
-
mode,
|
|
358
|
-
modeDisplay: this.t(`fleet.gitRepo.targetDisplay."${ mode }"`),
|
|
359
|
-
cluster,
|
|
360
|
-
clusterGroup,
|
|
361
|
-
advanced
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
get groupByLabel() {
|
|
366
|
-
const name = this.metadata.namespace;
|
|
367
|
-
|
|
368
|
-
if (name) {
|
|
369
|
-
return this.$rootGetters['i18n/t']('resourceTable.groupLabel.workspace', { name: escapeHtml(name) });
|
|
370
|
-
} else {
|
|
371
|
-
return this.$rootGetters['i18n/t']('resourceTable.groupLabel.notInAWorkspace');
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
164
|
get bundles() {
|
|
376
165
|
return this.$getters['matching'](FLEET.BUNDLE, { [FLEET_ANNOTATIONS.REPO_NAME]: this.name }, this.namespace);
|
|
377
166
|
}
|
|
@@ -380,143 +169,30 @@ export default class GitRepo extends SteveModel {
|
|
|
380
169
|
return this.$getters['matching'](FLEET.BUNDLE_DEPLOYMENT, { [FLEET_ANNOTATIONS.REPO_NAME]: this.name });
|
|
381
170
|
}
|
|
382
171
|
|
|
383
|
-
get
|
|
384
|
-
|
|
385
|
-
if (isEmpty(bundle.status?.summary)) {
|
|
386
|
-
return acc;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
const { nonReadyResources, ...summary } = bundle.status?.summary;
|
|
390
|
-
|
|
391
|
-
const bdCounts = normalizeStateCounts(summary);
|
|
392
|
-
const state = primaryDisplayStatusFromCount(bdCounts.states);
|
|
393
|
-
|
|
394
|
-
if (!acc.states[state]) {
|
|
395
|
-
acc.states[state] = 0;
|
|
396
|
-
}
|
|
397
|
-
acc.states[state]++;
|
|
398
|
-
acc.total++;
|
|
399
|
-
|
|
400
|
-
return acc;
|
|
401
|
-
}, { total: 0, states: { [STATES_ENUM.READY]: 0 } } );
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
get allResourceStatuses() {
|
|
405
|
-
return normalizeStateCounts(this.status?.resourceCounts || {});
|
|
406
|
-
}
|
|
172
|
+
get source() {
|
|
173
|
+
let value = this.spec.repo || '';
|
|
407
174
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
return {};
|
|
411
|
-
}
|
|
175
|
+
const matchHttps = value.match(FleetUtils.GIT_HTTPS_REGEX);
|
|
176
|
+
const matchSSH = value.match(FleetUtils.GIT_SSH_REGEX);
|
|
412
177
|
|
|
413
|
-
|
|
414
|
-
|
|
178
|
+
if (matchSSH) {
|
|
179
|
+
const { sshUserAndHost, repoPath } = FleetUtils.parseSSHUrl(matchSSH[0]);
|
|
415
180
|
|
|
416
|
-
|
|
417
|
-
if (isEmpty(this.status?.resources)) {
|
|
418
|
-
return [];
|
|
181
|
+
value = `https://${ sshUserAndHost.replace('git@', '') }/${ repoPath }`;
|
|
419
182
|
}
|
|
420
183
|
|
|
421
|
-
const clusters = (this.targetClusters || []).reduce((res, c) => {
|
|
422
|
-
res[c.id] = c;
|
|
423
|
-
|
|
424
|
-
return res;
|
|
425
|
-
}, {});
|
|
426
|
-
const resources = this.status?.resources?.reduce((acc, resourceInfo) => {
|
|
427
|
-
const { perClusterState, ...resource } = resourceInfo;
|
|
428
|
-
|
|
429
|
-
Object.entries(perClusterState).forEach(([state, clusterIds]) => {
|
|
430
|
-
clusterIds.filter((id) => !!clusters[id]).forEach((clusterId) => {
|
|
431
|
-
acc.push(Object.assign({}, resource, { clusterId, state }));
|
|
432
|
-
});
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
return acc;
|
|
436
|
-
}, []);
|
|
437
|
-
|
|
438
|
-
return resources.map((r) => {
|
|
439
|
-
const { namespace, name, clusterId } = r;
|
|
440
|
-
const type = FleetUtils.resourceType(r);
|
|
441
|
-
const c = clusters[clusterId];
|
|
442
|
-
|
|
443
|
-
return {
|
|
444
|
-
key: `${ clusterId }-${ type }-${ namespace }-${ name }`,
|
|
445
|
-
|
|
446
|
-
// Needed?
|
|
447
|
-
id: FleetUtils.resourceId(r),
|
|
448
|
-
type,
|
|
449
|
-
clusterId,
|
|
450
|
-
|
|
451
|
-
// columns, see FleetResources.vue
|
|
452
|
-
state: mapStateToEnum(r.state),
|
|
453
|
-
clusterName: c.nameDisplay,
|
|
454
|
-
apiVersion: r.apiVersion,
|
|
455
|
-
kind: r.kind,
|
|
456
|
-
name,
|
|
457
|
-
namespace,
|
|
458
|
-
|
|
459
|
-
// other properties
|
|
460
|
-
detailLocation: FleetUtils.detailLocation(r, c.metadata.labels[FLEET_ANNOTATIONS.CLUSTER_NAME]),
|
|
461
|
-
};
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
get clusterInfo() {
|
|
466
|
-
const ready = this.status?.readyClusters || 0;
|
|
467
|
-
const total = this.status?.desiredReadyClusters || 0;
|
|
468
|
-
|
|
469
184
|
return {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
185
|
+
value,
|
|
186
|
+
display: this.repoDisplay,
|
|
187
|
+
icon: this.resourceIcon,
|
|
188
|
+
showLink: matchHttps || matchSSH
|
|
473
189
|
};
|
|
474
190
|
}
|
|
475
191
|
|
|
476
|
-
|
|
477
|
-
const resourceCounts = this.statusResourceCountsForCluster(clusterId);
|
|
478
|
-
|
|
479
|
-
return primaryDisplayStatusFromCount(resourceCounts) || STATES_ENUM.ACTIVE;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
get clustersList() {
|
|
483
|
-
return this.$getters['all'](FLEET.CLUSTER);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
get authorId() {
|
|
487
|
-
return this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_ID];
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
get author() {
|
|
491
|
-
if (this.authorId) {
|
|
492
|
-
return this.$rootGetters['management/byId'](MANAGEMENT.USER, this.authorId);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
return null;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
get createdBy() {
|
|
499
|
-
const displayName = this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_NAME];
|
|
500
|
-
|
|
501
|
-
if (!displayName) {
|
|
502
|
-
return null;
|
|
503
|
-
}
|
|
504
|
-
|
|
192
|
+
get sourceSub() {
|
|
505
193
|
return {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
name: 'c-cluster-product-resource-id',
|
|
509
|
-
params: {
|
|
510
|
-
cluster: '_',
|
|
511
|
-
product: 'auth',
|
|
512
|
-
resource: MANAGEMENT.USER,
|
|
513
|
-
id: this.author.id,
|
|
514
|
-
}
|
|
515
|
-
}
|
|
194
|
+
value: this.status?.commit,
|
|
195
|
+
display: this.commitDisplay
|
|
516
196
|
};
|
|
517
197
|
}
|
|
518
|
-
|
|
519
|
-
get showCreatedBy() {
|
|
520
|
-
return !!this.createdBy;
|
|
521
|
-
}
|
|
522
198
|
}
|