@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
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { markRaw, PropType } from 'vue';
|
|
3
|
+
import { mapGetters } from 'vuex';
|
|
4
|
+
import { lcFirst } from '@shell/utils/string';
|
|
5
|
+
import {
|
|
6
|
+
Chart, ChartOptions, ChartEvent, TooltipItem, registerables
|
|
7
|
+
} from 'chart.js';
|
|
8
|
+
import { BadgeState } from '@components/BadgeState';
|
|
9
|
+
import FleetUtils from '@shell/utils/fleet';
|
|
10
|
+
import { FleetDashboardResourceStates, FleetDashboardState } from '@shell/types/fleet';
|
|
11
|
+
|
|
12
|
+
type ChartOptionsType = ChartOptions<'doughnut'>;
|
|
13
|
+
type ChartType = Chart<'doughnut', any[], ChartOptionsType>;
|
|
14
|
+
|
|
15
|
+
interface DataType {
|
|
16
|
+
chartId: string,
|
|
17
|
+
chart: ChartType | null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type StatePanel = FleetDashboardState & { count: number }
|
|
21
|
+
|
|
22
|
+
Chart.register(...registerables);
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
|
|
26
|
+
name: 'FleetDashboardResourcePanel',
|
|
27
|
+
|
|
28
|
+
emits: ['click:state'],
|
|
29
|
+
|
|
30
|
+
components: { BadgeState },
|
|
31
|
+
|
|
32
|
+
props: {
|
|
33
|
+
states: {
|
|
34
|
+
type: Array as PropType<FleetDashboardResourceStates[]>,
|
|
35
|
+
default: () => []
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
workspace: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ''
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
type: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: ''
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
showChart: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
selectable: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
selectedStates: {
|
|
59
|
+
type: Object as PropType<Record<string, boolean>>,
|
|
60
|
+
default: () => ({})
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
data(): DataType {
|
|
65
|
+
return {
|
|
66
|
+
chartId: `${ this.workspace }-${ this.type }`,
|
|
67
|
+
chart: null,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
mounted() {
|
|
72
|
+
if (this.showChart) {
|
|
73
|
+
const container = document.getElementById(`${ this.chartId }-container`);
|
|
74
|
+
|
|
75
|
+
if (!container) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const canvas = document.createElement('canvas');
|
|
80
|
+
|
|
81
|
+
canvas.id = this.chartId;
|
|
82
|
+
canvas.className = 'chart';
|
|
83
|
+
|
|
84
|
+
container.append(canvas);
|
|
85
|
+
|
|
86
|
+
const data = this.buildChartData();
|
|
87
|
+
const options: ChartOptionsType = {
|
|
88
|
+
responsive: true,
|
|
89
|
+
elements: {
|
|
90
|
+
arc: {
|
|
91
|
+
borderWidth: 4,
|
|
92
|
+
borderColor: this.bgColor,
|
|
93
|
+
hoverBorderColor: this.bgColor,
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
plugins: {
|
|
97
|
+
legend: { display: false },
|
|
98
|
+
title: { display: false },
|
|
99
|
+
tooltip: {
|
|
100
|
+
yAlign: 'bottom',
|
|
101
|
+
callbacks: {
|
|
102
|
+
title: (ctx: TooltipItem<'doughnut'>[]) => {
|
|
103
|
+
const v = ctx[0];
|
|
104
|
+
|
|
105
|
+
return `${ v?.formattedValue } ${ lcFirst(v.label) }`;
|
|
106
|
+
},
|
|
107
|
+
label: () => '',
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
cutout: 13,
|
|
112
|
+
onHover: (event: any) => {
|
|
113
|
+
if (this.selectable && event?.native?.target?.style) {
|
|
114
|
+
event.native.target.style.cursor = 'pointer';
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
onClick: (_: ChartEvent, element?: { index: number }[]) => {
|
|
118
|
+
const idx = element?.[0]?.index;
|
|
119
|
+
|
|
120
|
+
if (idx === undefined) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const state = this.statePanels.find(({ index }) => idx === index);
|
|
125
|
+
|
|
126
|
+
this.selectState(state);
|
|
127
|
+
},
|
|
128
|
+
animations: { borderColor: { duration: 0 } }
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const chart = new Chart(canvas, {
|
|
132
|
+
type: 'doughnut',
|
|
133
|
+
data,
|
|
134
|
+
options,
|
|
135
|
+
}) as ChartType;
|
|
136
|
+
|
|
137
|
+
this.chart = markRaw(chart);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
computed: {
|
|
142
|
+
...mapGetters({ theme: 'prefs/theme' }),
|
|
143
|
+
|
|
144
|
+
statePanels() {
|
|
145
|
+
const out: StatePanel[] = [];
|
|
146
|
+
|
|
147
|
+
this.states.forEach((state) => {
|
|
148
|
+
const {
|
|
149
|
+
statePanel,
|
|
150
|
+
resources
|
|
151
|
+
} = state;
|
|
152
|
+
|
|
153
|
+
const exists = out.find((s) => s.id === statePanel.id);
|
|
154
|
+
|
|
155
|
+
if (exists) {
|
|
156
|
+
exists.count += resources.length;
|
|
157
|
+
} else {
|
|
158
|
+
out.push({
|
|
159
|
+
...statePanel,
|
|
160
|
+
count: resources.length
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
return out;
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
count() {
|
|
169
|
+
return this.statePanels.reduce((acc, state) => acc + state.count, 0);
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
typeLabel() {
|
|
173
|
+
return this.t(`typeLabel."${ this.type }"`, { count: this.count });
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
watch: {
|
|
178
|
+
statePanels: {
|
|
179
|
+
handler: 'updateStates',
|
|
180
|
+
deep: true,
|
|
181
|
+
},
|
|
182
|
+
theme() {
|
|
183
|
+
if (this.chart) {
|
|
184
|
+
this.chart.update();
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
methods: {
|
|
190
|
+
buildChartData() {
|
|
191
|
+
const chartStates = FleetUtils.dashboardStates;
|
|
192
|
+
|
|
193
|
+
const labels = chartStates.map(({ label }) => label);
|
|
194
|
+
const backgroundColor = chartStates.map(({ color }) => color);
|
|
195
|
+
|
|
196
|
+
const data = this.getChartStates(this.statePanels);
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
labels,
|
|
200
|
+
datasets: [
|
|
201
|
+
{
|
|
202
|
+
data,
|
|
203
|
+
backgroundColor,
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
updateStates(value: StatePanel[]) {
|
|
210
|
+
if (this.chart) {
|
|
211
|
+
this.chart.data.datasets.forEach((dataset) => {
|
|
212
|
+
dataset.data = this.getChartStates(value);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
this.chart.update();
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
getChartStates(states: StatePanel[]) {
|
|
220
|
+
return FleetUtils.dashboardStates.map(({ id }) => states.find((s) => s.id === id)?.count || 0);
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
selectState(state?: StatePanel) {
|
|
224
|
+
if (!this.selectable) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
this.$emit('click:state', state?.id);
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
onClickBadge(state: StatePanel) {
|
|
232
|
+
this.selectState(state);
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
bgColor() {
|
|
236
|
+
return getComputedStyle(document.body).getPropertyValue('--body-bg');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
<template>
|
|
243
|
+
<div class="panel">
|
|
244
|
+
<div
|
|
245
|
+
v-if="showChart"
|
|
246
|
+
:id="chartId + '-container'"
|
|
247
|
+
:data-testid="'chart-container'"
|
|
248
|
+
class="panel-chart-container"
|
|
249
|
+
/>
|
|
250
|
+
<div class="details">
|
|
251
|
+
<div
|
|
252
|
+
class="description"
|
|
253
|
+
:data-testid="'description'"
|
|
254
|
+
>
|
|
255
|
+
<span class="count">{{ count }}</span>
|
|
256
|
+
<span class="label">{{ typeLabel }}</span>
|
|
257
|
+
</div>
|
|
258
|
+
<div class="states">
|
|
259
|
+
<BadgeState
|
|
260
|
+
v-for="(state, i) in statePanels"
|
|
261
|
+
:key="i"
|
|
262
|
+
class="badge"
|
|
263
|
+
:tabindex="selectable ? 0 : undefined"
|
|
264
|
+
:role="selectable ? 'button' : undefined"
|
|
265
|
+
:aria-label="selectable ? t('fleet.dashboard.state') + '-' + state.id : undefined"
|
|
266
|
+
:class="{
|
|
267
|
+
['selectable']: selectable,
|
|
268
|
+
['selected']: selectable && selectedStates?.[state.id]
|
|
269
|
+
}"
|
|
270
|
+
:color="state.stateBackground"
|
|
271
|
+
:label="` ${ state.count } `"
|
|
272
|
+
:icon="state.icon"
|
|
273
|
+
@click="onClickBadge(state)"
|
|
274
|
+
@keydown.space.enter.stop.prevent="onClickBadge(state)"
|
|
275
|
+
>
|
|
276
|
+
<template
|
|
277
|
+
v-if="selectable && selectedStates?.[state.id]"
|
|
278
|
+
#content-right
|
|
279
|
+
>
|
|
280
|
+
<i class="icon icon-close ml-5" />
|
|
281
|
+
</template>
|
|
282
|
+
</BadgeState>
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
</template>
|
|
287
|
+
|
|
288
|
+
<style lang="scss" scoped>
|
|
289
|
+
.panel {
|
|
290
|
+
display: flex;
|
|
291
|
+
align-items: center;
|
|
292
|
+
gap: 5px;
|
|
293
|
+
|
|
294
|
+
.panel-chart-container {
|
|
295
|
+
padding: 3px;
|
|
296
|
+
min-width: 80px;
|
|
297
|
+
width: 80px;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.details {
|
|
301
|
+
padding: 5px;
|
|
302
|
+
|
|
303
|
+
.description {
|
|
304
|
+
.count {
|
|
305
|
+
font-size: 25px;
|
|
306
|
+
font-weight: bold;
|
|
307
|
+
margin-right: 4px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.label {
|
|
311
|
+
font-size: 20px;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.states {
|
|
316
|
+
display: flex;
|
|
317
|
+
align-items: center;
|
|
318
|
+
margin-top: 4px;
|
|
319
|
+
|
|
320
|
+
.badge {
|
|
321
|
+
margin: 2px 5px 2px 2px;
|
|
322
|
+
border: 0;
|
|
323
|
+
|
|
324
|
+
&:focus-visible {
|
|
325
|
+
@include focus-outline;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
&.selectable {
|
|
329
|
+
cursor: pointer;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
&.bg-error {
|
|
333
|
+
background: var(--click-badge-error-bg);
|
|
334
|
+
color: var(--click-badge-error);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
&.bg-warning {
|
|
338
|
+
background: var(--click-badge-warning-bg);
|
|
339
|
+
color: var(--click-badge-warning);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
&.bg-success {
|
|
343
|
+
background: var(--click-badge-success-bg);
|
|
344
|
+
color: var(--click-badge-success);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
&.bg-info {
|
|
348
|
+
background: var(--click-badge-info-bg);
|
|
349
|
+
color: var(--click-badge-info);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
&.selected {
|
|
353
|
+
margin: 0 5px 0 0;
|
|
354
|
+
|
|
355
|
+
&.bg-error {
|
|
356
|
+
border: 2px solid var(--click-badge-error-border);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&.bg-warning {
|
|
360
|
+
border: 2px solid var(--click-badge-warning-border);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
&.bg-success {
|
|
364
|
+
border: 2px solid var(--click-badge-success-border);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
&.bg-info {
|
|
368
|
+
border: 2px solid var(--click-badge-info-border);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
</style>
|
|
@@ -75,8 +75,11 @@ export default {
|
|
|
75
75
|
key: props.initialKey,
|
|
76
76
|
none: NONE,
|
|
77
77
|
SECRET,
|
|
78
|
+
/**
|
|
79
|
+
* Of type @ResourceLabeledSelectSettings
|
|
80
|
+
*/
|
|
78
81
|
allSecretsSettings: {
|
|
79
|
-
|
|
82
|
+
updateResources: (secrets) => {
|
|
80
83
|
const allSecretsInNamespace = secrets.filter((secret) => this.types.includes(secret._type) && secret.namespace === this.namespace);
|
|
81
84
|
const mappedSecrets = this.mapSecrets(allSecretsInNamespace.sort((a, b) => a.name.localeCompare(b.name)));
|
|
82
85
|
|
|
@@ -85,9 +88,12 @@ export default {
|
|
|
85
88
|
return mappedSecrets;
|
|
86
89
|
}
|
|
87
90
|
},
|
|
91
|
+
/**
|
|
92
|
+
* Of type @ResourceLabeledSelectPaginateSettings
|
|
93
|
+
*/
|
|
88
94
|
paginateSecretsSetting: {
|
|
89
95
|
requestSettings: this.paginatePageOptions,
|
|
90
|
-
|
|
96
|
+
updateResources: (secrets) => {
|
|
91
97
|
const mappedSecrets = this.mapSecrets(secrets);
|
|
92
98
|
|
|
93
99
|
this.secrets = secrets; // We need the key from the selected secret. When paginating we won't touch the store, so just pass back here
|
|
@@ -25,6 +25,20 @@ export default {
|
|
|
25
25
|
return { valueFrom: {} };
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
+
options: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => {
|
|
31
|
+
return [
|
|
32
|
+
{ value: 'simple', label: 'Key/Value Pair' },
|
|
33
|
+
{ value: 'resourceFieldRef', label: 'Resource' },
|
|
34
|
+
{ value: 'configMapKeyRef', label: 'ConfigMap Key' },
|
|
35
|
+
{ value: 'secretKeyRef', label: 'Secret key' },
|
|
36
|
+
{ value: 'fieldRef', label: 'Pod Field' },
|
|
37
|
+
{ value: 'secretRef', label: 'Secret' },
|
|
38
|
+
{ value: 'configMapRef', label: 'ConfigMap' },
|
|
39
|
+
];
|
|
40
|
+
},
|
|
41
|
+
},
|
|
28
42
|
allConfigMaps: {
|
|
29
43
|
type: Array,
|
|
30
44
|
default: () => []
|
|
@@ -46,15 +60,6 @@ export default {
|
|
|
46
60
|
|
|
47
61
|
data() {
|
|
48
62
|
return {
|
|
49
|
-
typeOpts: [
|
|
50
|
-
{ value: 'simple', label: 'Key/Value Pair' },
|
|
51
|
-
{ value: 'resourceFieldRef', label: 'Resource' },
|
|
52
|
-
{ value: 'configMapKeyRef', label: 'ConfigMap Key' },
|
|
53
|
-
{ value: 'secretKeyRef', label: 'Secret key' },
|
|
54
|
-
{ value: 'fieldRef', label: 'Pod Field' },
|
|
55
|
-
{ value: 'secretRef', label: 'Secret' },
|
|
56
|
-
{ value: 'configMapRef', label: 'ConfigMap' },
|
|
57
|
-
],
|
|
58
63
|
secrets: this.allSecrets,
|
|
59
64
|
resourceKeyOpts: ['limits.cpu', 'limits.ephemeral-storage', 'limits.memory', 'requests.cpu', 'requests.ephemeral-storage', 'requests.memory'],
|
|
60
65
|
};
|
|
@@ -70,7 +75,7 @@ export default {
|
|
|
70
75
|
} else if (props.value.value) {
|
|
71
76
|
type.value = 'simple';
|
|
72
77
|
} else if (props.value.valueFrom) {
|
|
73
|
-
type.value = Object.keys((props.value.valueFrom))[0] || 'simple';
|
|
78
|
+
type.value = Object.keys((props.value.valueFrom))[0] || props.options[0].value || 'simple';
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
const refName = ref('');
|
|
@@ -84,13 +89,13 @@ export default {
|
|
|
84
89
|
switch (type.value) {
|
|
85
90
|
case 'resourceFieldRef':
|
|
86
91
|
name.value = props.value.name;
|
|
87
|
-
refName.value = props.value.valueFrom[type.value]
|
|
88
|
-
key.value = props.value.valueFrom[type.value]
|
|
92
|
+
refName.value = props.value.valueFrom?.[type.value]?.containerName;
|
|
93
|
+
key.value = props.value.valueFrom?.[type.value]?.resource || '';
|
|
89
94
|
break;
|
|
90
95
|
case 'configMapKeyRef':
|
|
91
96
|
name.value = props.value.name;
|
|
92
|
-
key.value = props.value.valueFrom[type.value]
|
|
93
|
-
refName.value = props.value.valueFrom[type.value]
|
|
97
|
+
key.value = props.value.valueFrom?.[type.value]?.key || '';
|
|
98
|
+
refName.value = props.value.valueFrom?.[type.value]?.name;
|
|
94
99
|
referenced.value = props.allConfigMaps.filter((resource) => {
|
|
95
100
|
return resource.metadata.name === refName.value;
|
|
96
101
|
})[0];
|
|
@@ -101,12 +106,12 @@ export default {
|
|
|
101
106
|
case 'secretRef':
|
|
102
107
|
case 'configMapRef':
|
|
103
108
|
name.value = props.value.prefix;
|
|
104
|
-
refName.value = props.value[type.value]
|
|
109
|
+
refName.value = props.value[type.value]?.name;
|
|
105
110
|
break;
|
|
106
111
|
case 'secretKeyRef':
|
|
107
112
|
name.value = props.value.name;
|
|
108
|
-
key.value = props.value.valueFrom[type.value]
|
|
109
|
-
refName.value = props.value.valueFrom[type.value]
|
|
113
|
+
key.value = props.value.valueFrom?.[type.value]?.key || '';
|
|
114
|
+
refName.value = props.value.valueFrom?.[type.value]?.name;
|
|
110
115
|
referenced.value = props.allSecrets.filter((resource) => {
|
|
111
116
|
return resource.metadata.name === refName.value;
|
|
112
117
|
})[0];
|
|
@@ -269,6 +274,10 @@ export default {
|
|
|
269
274
|
extraColumn() {
|
|
270
275
|
return ['resourceFieldRef', 'configMapKeyRef', 'secretKeyRef'].includes(this.type);
|
|
271
276
|
},
|
|
277
|
+
|
|
278
|
+
hideVariableName() {
|
|
279
|
+
return this.options?.find((opt) => opt.value === this.type)?.hideVariableName || false;
|
|
280
|
+
}
|
|
272
281
|
},
|
|
273
282
|
};
|
|
274
283
|
</script>
|
|
@@ -280,7 +289,7 @@ export default {
|
|
|
280
289
|
v-model:value="type"
|
|
281
290
|
:mode="mode"
|
|
282
291
|
:multiple="false"
|
|
283
|
-
:options="
|
|
292
|
+
:options="options"
|
|
284
293
|
option-label="label"
|
|
285
294
|
:searchable="false"
|
|
286
295
|
:reduce="e=>e.value"
|
|
@@ -289,7 +298,10 @@ export default {
|
|
|
289
298
|
/>
|
|
290
299
|
</div>
|
|
291
300
|
|
|
292
|
-
<div
|
|
301
|
+
<div
|
|
302
|
+
v-if="!hideVariableName"
|
|
303
|
+
class="name"
|
|
304
|
+
>
|
|
293
305
|
<LabeledInput
|
|
294
306
|
v-model:value="name"
|
|
295
307
|
:label="nameLabel"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'FleetApplicationClustersReady',
|
|
5
|
+
|
|
6
|
+
components: {},
|
|
7
|
+
|
|
8
|
+
props: {
|
|
9
|
+
value: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 0
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
row: {
|
|
15
|
+
type: Object,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
col: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => {}
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
rowKey: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: '',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
getCustomDetailLink: {
|
|
30
|
+
type: Function,
|
|
31
|
+
default: null
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
methods: {
|
|
36
|
+
parseTargetMode(row) {
|
|
37
|
+
return row.targetInfo?.mode === 'clusterGroup' ? this.t('fleet.application.warningTooltip.clusterGroup') : this.t('fleet.application.warningTooltip.cluster');
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<span
|
|
45
|
+
v-if="!row.clusterInfo"
|
|
46
|
+
class="text-muted"
|
|
47
|
+
>—</span>
|
|
48
|
+
<span
|
|
49
|
+
v-else-if="row.clusterInfo.unready"
|
|
50
|
+
class="text-warning"
|
|
51
|
+
>{{ row.clusterInfo.ready }}/{{
|
|
52
|
+
row.clusterInfo.total }}</span>
|
|
53
|
+
<span
|
|
54
|
+
v-else
|
|
55
|
+
class="cluster-count-info"
|
|
56
|
+
>
|
|
57
|
+
{{ row.clusterInfo.ready }}/{{ row.clusterInfo.total }}
|
|
58
|
+
<i
|
|
59
|
+
v-if="!row.clusterInfo.total"
|
|
60
|
+
v-clean-tooltip.bottom="parseTargetMode(row)"
|
|
61
|
+
class="icon icon-warning"
|
|
62
|
+
/>
|
|
63
|
+
</span>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<style lang="scss" scoped>
|
|
67
|
+
.cluster-count-info {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
|
|
71
|
+
i {
|
|
72
|
+
margin-left: 5px;
|
|
73
|
+
font-size: 22px;
|
|
74
|
+
color: var(--warning);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</style>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Link from '@shell/components/formatter/Link';
|
|
3
|
+
import Shortened from '@shell/components/formatter/Shortened';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: 'FleetApplicationSource',
|
|
7
|
+
|
|
8
|
+
components: {
|
|
9
|
+
Link,
|
|
10
|
+
Shortened,
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
props: {
|
|
14
|
+
value: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
row: {
|
|
20
|
+
type: Object,
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
col: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => {}
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
rowKey: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '',
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
getCustomDetailLink: {
|
|
35
|
+
type: Function,
|
|
36
|
+
default: null
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<template v-if="row.source.showLink">
|
|
44
|
+
<Link
|
|
45
|
+
class="source-link"
|
|
46
|
+
label-key="source.display"
|
|
47
|
+
before-icon-key="source.icon"
|
|
48
|
+
url-key="source.value"
|
|
49
|
+
:row="row"
|
|
50
|
+
:value="row.source.value || ''"
|
|
51
|
+
/>
|
|
52
|
+
<template v-if="row.source.value && row.sourceSub.value">
|
|
53
|
+
<div class="text-muted">
|
|
54
|
+
<Shortened
|
|
55
|
+
long-value-key="sourceSub.value"
|
|
56
|
+
:row="row"
|
|
57
|
+
:value="row.sourceSub.display"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
</template>
|
|
62
|
+
<span v-else>
|
|
63
|
+
{{ row.source.value }}
|
|
64
|
+
</span>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<style lang="scss" scoped>
|
|
68
|
+
.source-link {
|
|
69
|
+
width: fit-content;
|
|
70
|
+
}
|
|
71
|
+
</style>
|