dashboard-shell-shell 1.0.113 → 1.0.115
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/components/ActionDropdown.vue +1 -1
- package/components/ActionMenu.vue +2 -2
- package/components/ActionMenuShell.vue +0 -1
- package/components/AppModal.vue +6 -78
- package/components/AssignTo.vue +11 -25
- package/components/AsyncButton.vue +7 -24
- package/components/BannerGraphic.vue +0 -1
- package/components/ButtonDropdown.vue +4 -26
- package/components/ButtonGroup.vue +0 -4
- package/components/ButtonMultiAction.vue +0 -1
- package/components/CommunityLinks.vue +3 -3
- package/components/ConsumptionGauge.vue +5 -24
- package/components/CopyToClipboardText.vue +1 -2
- package/components/CruResource.vue +7 -12
- package/components/CruResourceFooter.vue +2 -2
- package/components/DashboardOptions.vue +15 -21
- package/components/DetailText.vue +0 -5
- package/components/DisableAuthProviderModal.vue +0 -1
- package/components/ExplorerMembers.vue +1 -1
- package/components/ExplorerProjectsNamespaces.vue +14 -56
- package/components/FixedBanner.vue +12 -19
- package/components/GlobalRoleBindings.vue +1 -5
- package/components/GrafanaDashboard.vue +4 -4
- package/components/GrowlManager.vue +1 -4
- package/components/HardwareResourceGauge.vue +3 -39
- package/components/InfoBox.vue +3 -3
- package/components/InputOrDisplay.vue +2 -28
- package/components/LabelValue.vue +1 -16
- package/components/LandingPagePreference.vue +3 -5
- package/components/LocaleSelector.vue +93 -39
- package/components/ModalWithCard.vue +0 -2
- package/components/MoveModal.vue +0 -1
- package/components/PromptChangePassword.vue +1 -1
- package/components/PromptModal.vue +2 -15
- package/components/PromptRemove.vue +8 -28
- package/components/PromptRestore.vue +0 -1
- package/components/ResourceCancelModal.vue +0 -1
- package/components/ResourceDetail/Masthead.vue +43 -188
- package/components/ResourceDetail/__tests__/Masthead.test.ts +1 -5
- package/components/ResourceDetail/index.vue +14 -49
- package/components/ResourceList/Masthead.vue +18 -80
- package/components/ResourceTable.vue +8 -3
- package/components/SideNav.vue +3 -2
- package/components/SortableTable/THead.vue +4 -10
- package/components/SortableTable/actions.js +1 -1
- package/components/SortableTable/index.vue +537 -637
- package/components/SortableTable/selection.js +11 -0
- package/components/Tabbed/Tab.vue +3 -3
- package/components/Tabbed/index.vue +26 -44
- package/components/Wizard.vue +2 -2
- package/components/__tests__/AsyncButton.test.ts +2 -2
- package/components/__tests__/FixedBanner.test.ts +3 -3
- package/components/auth/Principal.vue +3 -10
- package/components/auth/__tests__/RoleDetailEdit.test.ts +2 -3
- package/components/form/ArrayList.vue +85 -123
- package/components/form/ArrayListGrouped.vue +2 -10
- package/components/form/Command.vue +15 -6
- package/components/form/EnvVars.vue +8 -16
- package/components/form/Footer.vue +5 -8
- package/components/form/HealthCheck.vue +3 -3
- package/components/form/HookOption.vue +16 -11
- package/components/form/KeyValue.vue +7 -16
- package/components/form/LabeledSelect.vue +76 -59
- package/components/form/LifecycleHooks.vue +3 -3
- package/components/form/MatchExpressions.vue +12 -35
- package/components/form/NameNsDescription.vue +115 -147
- package/components/form/Networking.vue +12 -20
- package/components/form/NodeAffinity.vue +23 -31
- package/components/form/NodeScheduling.vue +3 -13
- package/components/form/Password.vue +5 -11
- package/components/form/PodAffinity.vue +44 -43
- package/components/form/Probe.vue +66 -68
- package/components/form/ResourceQuota/Project.vue +1 -5
- package/components/form/ResourceSelector.vue +9 -7
- package/components/form/SSHKnownHosts/KnownHostsEditDialog.vue +3 -6
- package/components/form/SSHKnownHosts/__tests__/KnownHostsEditDialog.test.ts +1 -12
- package/components/form/SSHKnownHosts/index.vue +2 -16
- package/components/form/Security.vue +56 -54
- package/components/form/Select.vue +7 -41
- package/components/form/ShellInput.vue +1 -5
- package/components/form/Tolerations.vue +1 -5
- package/components/form/UnitInput.vue +2 -2
- package/components/form/ValueFromResource.vue +121 -134
- package/components/form/WorkloadPorts.vue +18 -18
- package/components/form/__tests__/ArrayList.test.ts +2 -5
- package/components/form/__tests__/MatchExpressions.test.ts +12 -12
- package/components/form/__tests__/NameNsDescription.test.ts +14 -115
- package/components/form/__tests__/Probe.test.ts +8 -12
- package/components/form/__tests__/SSHKnownHosts.test.ts +0 -11
- package/components/form/__tests__/Select.test.ts +0 -37
- package/components/form/__tests__/UnitInput.test.ts +5 -4
- package/components/formatter/BadgeStateFormatter.vue +5 -8
- package/components/formatter/ExtensionCache.vue +74 -0
- package/components/formatter/InternalExternalIP.vue +0 -2
- package/components/formatter/Port.vue +24 -0
- package/components/formatter/SecretData.vue +7 -20
- package/components/formatter/SecretType.vue +41 -0
- package/components/nav/Favorite.vue +1 -5
- package/components/nav/Group.vue +3 -16
- package/components/nav/Header.vue +13 -39
- package/components/nav/Jump.vue +0 -7
- package/components/nav/NamespaceFilter.vue +8 -14
- package/components/nav/Pinned.vue +1 -1
- package/components/nav/TopLevelMenu.vue +17 -5
- package/components/nav/Type.vue +1 -14
- package/components/nav/__tests__/TopLevelMenu.test.ts +40 -0
- package/components/templates/blank.vue +1 -4
- package/components/templates/default.vue +0 -8
- package/components/templates/home.vue +1 -10
- package/components/templates/plain.vue +1 -10
- package/package.json +1 -1
- package/public/index.html +3 -3
- package/components/ActionDropdownShell.vue +0 -71
- package/components/DotState.vue +0 -84
- package/components/ModalManager.vue +0 -55
- package/components/SlideInPanelManager.vue +0 -126
- package/components/StatusBadge.vue +0 -77
- package/components/__tests__/ModalManager.spec.ts +0 -176
- package/components/__tests__/SlideInPanelManager.spec.ts +0 -166
|
@@ -29,10 +29,6 @@ export default {
|
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
data() {
|
|
32
|
-
return { rules: [] };
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
created() {
|
|
36
32
|
const rules = [];
|
|
37
33
|
|
|
38
34
|
// on creation in agent configuration, the backend "eats"
|
|
@@ -53,7 +49,7 @@ export default {
|
|
|
53
49
|
});
|
|
54
50
|
}
|
|
55
51
|
|
|
56
|
-
|
|
52
|
+
return { rules };
|
|
57
53
|
},
|
|
58
54
|
|
|
59
55
|
computed: {
|
|
@@ -206,7 +206,7 @@ export default {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
if (this.outputModifier) {
|
|
209
|
-
out = out === null ? null : `${
|
|
209
|
+
out = out === null ? null : `${ inputValue }${ this.unit }`;
|
|
210
210
|
} else if ( this.outputAs === 'string' ) {
|
|
211
211
|
out = out === null ? '' : `${ inputValue }`;
|
|
212
212
|
} else if (out) {
|
|
@@ -235,7 +235,7 @@ export default {
|
|
|
235
235
|
:required="required"
|
|
236
236
|
:placeholder="placeholder"
|
|
237
237
|
:hide-arrows="hideArrows"
|
|
238
|
-
@
|
|
238
|
+
@change="update($event.target.value)"
|
|
239
239
|
@blur="update($event.target.value)"
|
|
240
240
|
>
|
|
241
241
|
<template #suffix>
|
|
@@ -4,7 +4,6 @@ import { get } from '@shell/utils/object';
|
|
|
4
4
|
import { _VIEW } from '@shell/config/query-params';
|
|
5
5
|
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
|
6
6
|
import { LabeledInput } from '@components/Form/LabeledInput';
|
|
7
|
-
import { ref, watch } from 'vue';
|
|
8
7
|
|
|
9
8
|
export default {
|
|
10
9
|
emits: ['update:value', 'remove'],
|
|
@@ -45,164 +44,84 @@ export default {
|
|
|
45
44
|
},
|
|
46
45
|
|
|
47
46
|
data() {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
type.value = 'configMapRef';
|
|
70
|
-
} else if (props.value.value) {
|
|
71
|
-
type.value = 'simple';
|
|
72
|
-
} else if (props.value.valueFrom) {
|
|
73
|
-
type.value = Object.keys((props.value.valueFrom))[0] || 'simple';
|
|
47
|
+
const typeOpts = [
|
|
48
|
+
{ value: 'simple', label: 'Key/Value Pair' },
|
|
49
|
+
{ value: 'resourceFieldRef', label: 'Resource' },
|
|
50
|
+
{ value: 'configMapKeyRef', label: 'ConfigMap Key' },
|
|
51
|
+
{ value: 'secretKeyRef', label: 'Secret key' },
|
|
52
|
+
{ value: 'fieldRef', label: 'Pod Field' },
|
|
53
|
+
{ value: 'secretRef', label: 'Secret' },
|
|
54
|
+
{ value: 'configMapRef', label: 'ConfigMap' },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
const resourceKeyOpts = ['limits.cpu', 'limits.ephemeral-storage', 'limits.memory', 'requests.cpu', 'requests.ephemeral-storage', 'requests.memory'];
|
|
58
|
+
let type;
|
|
59
|
+
|
|
60
|
+
if (this.value.secretRef) {
|
|
61
|
+
type = 'secretRef';
|
|
62
|
+
} else if (this.value.configMapRef) {
|
|
63
|
+
type = 'configMapRef';
|
|
64
|
+
} else if (this.value.value) {
|
|
65
|
+
type = 'simple';
|
|
66
|
+
} else if (this.value.valueFrom) {
|
|
67
|
+
type = Object.keys((this.value.valueFrom))[0] || 'simple';
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const keys =
|
|
70
|
+
let refName;
|
|
71
|
+
let name;
|
|
72
|
+
let fieldPath;
|
|
73
|
+
let referenced;
|
|
74
|
+
let key;
|
|
75
|
+
let valStr;
|
|
76
|
+
const keys = [];
|
|
83
77
|
|
|
84
|
-
switch (type
|
|
78
|
+
switch (type) {
|
|
85
79
|
case 'resourceFieldRef':
|
|
86
|
-
name
|
|
87
|
-
refName
|
|
88
|
-
key
|
|
80
|
+
name = this.value.name;
|
|
81
|
+
refName = this.value.valueFrom[type].containerName;
|
|
82
|
+
key = this.value.valueFrom[type].resource || '';
|
|
89
83
|
break;
|
|
90
84
|
case 'configMapKeyRef':
|
|
91
|
-
name
|
|
92
|
-
key
|
|
93
|
-
refName
|
|
94
|
-
referenced
|
|
95
|
-
return resource.metadata.name === refName
|
|
85
|
+
name = this.value.name;
|
|
86
|
+
key = this.value.valueFrom[type].key || '';
|
|
87
|
+
refName = this.value.valueFrom[type].name;
|
|
88
|
+
referenced = this.allConfigMaps.filter((resource) => {
|
|
89
|
+
return resource.metadata.name === refName;
|
|
96
90
|
})[0];
|
|
97
|
-
if (referenced
|
|
98
|
-
keys.
|
|
91
|
+
if (referenced && referenced.data) {
|
|
92
|
+
keys.push(...Object.keys(referenced.data));
|
|
99
93
|
}
|
|
100
94
|
break;
|
|
101
95
|
case 'secretRef':
|
|
102
96
|
case 'configMapRef':
|
|
103
|
-
name
|
|
104
|
-
refName
|
|
97
|
+
name = this.value.prefix;
|
|
98
|
+
refName = this.value[type].name;
|
|
105
99
|
break;
|
|
106
100
|
case 'secretKeyRef':
|
|
107
|
-
name
|
|
108
|
-
key
|
|
109
|
-
refName
|
|
110
|
-
referenced
|
|
111
|
-
return resource.metadata.name === refName
|
|
101
|
+
name = this.value.name;
|
|
102
|
+
key = this.value.valueFrom[type].key || '';
|
|
103
|
+
refName = this.value.valueFrom[type].name;
|
|
104
|
+
referenced = this.allSecrets.filter((resource) => {
|
|
105
|
+
return resource.metadata.name === refName;
|
|
112
106
|
})[0];
|
|
113
|
-
if (referenced
|
|
114
|
-
keys.
|
|
107
|
+
if (referenced && referenced.data) {
|
|
108
|
+
keys.push(...Object.keys(referenced.data));
|
|
115
109
|
}
|
|
116
110
|
break;
|
|
117
111
|
case 'fieldRef':
|
|
118
|
-
fieldPath
|
|
119
|
-
name
|
|
112
|
+
fieldPath = get(this.value.valueFrom, `${ type }.fieldPath`) || '';
|
|
113
|
+
name = this.value.name;
|
|
120
114
|
break;
|
|
121
115
|
default:
|
|
122
|
-
name
|
|
123
|
-
valStr
|
|
116
|
+
name = this.value.name;
|
|
117
|
+
valStr = this.value.value;
|
|
124
118
|
break;
|
|
125
119
|
}
|
|
126
120
|
|
|
127
|
-
referenced.value = refName.value;
|
|
128
|
-
|
|
129
|
-
const updateRow = () => {
|
|
130
|
-
if (!name.value?.length && !refName.value?.length) {
|
|
131
|
-
if (type.value !== 'fieldRef') {
|
|
132
|
-
emit('update:value', null);
|
|
133
|
-
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
let out = { name: name.value || refName.value };
|
|
138
|
-
|
|
139
|
-
switch (type.value) {
|
|
140
|
-
case 'configMapKeyRef':
|
|
141
|
-
case 'secretKeyRef':
|
|
142
|
-
out.valueFrom = {
|
|
143
|
-
[type.value]: {
|
|
144
|
-
key: key.value, name: refName.value, optional: false
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
break;
|
|
148
|
-
case 'resourceFieldRef':
|
|
149
|
-
out.valueFrom = {
|
|
150
|
-
[type.value]: {
|
|
151
|
-
containerName: refName.value, divisor: 1, resource: key.value
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
break;
|
|
155
|
-
case 'fieldRef':
|
|
156
|
-
if (!fieldPath.value || !fieldPath.value.length) {
|
|
157
|
-
out = null; break;
|
|
158
|
-
}
|
|
159
|
-
out.valueFrom = { [type.value]: { apiVersion: 'v1', fieldPath: fieldPath.value } };
|
|
160
|
-
break;
|
|
161
|
-
case 'simple':
|
|
162
|
-
out.value = valStr.value;
|
|
163
|
-
break;
|
|
164
|
-
default:
|
|
165
|
-
delete out.name;
|
|
166
|
-
out.prefix = name.value;
|
|
167
|
-
out[type.value] = { name: refName.value, optional: false };
|
|
168
|
-
}
|
|
169
|
-
emit('update:value', out);
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
watch(type, () => {
|
|
173
|
-
referenced.value = null;
|
|
174
|
-
key.value = '';
|
|
175
|
-
refName.value = '';
|
|
176
|
-
keys.value = [];
|
|
177
|
-
key.value = '';
|
|
178
|
-
valStr.value = '';
|
|
179
|
-
fieldPath.value = '';
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
watch(referenced, (neu, old) => {
|
|
183
|
-
if (neu) {
|
|
184
|
-
if ((neu.type === SECRET || neu.type === CONFIG_MAP) && neu.data) {
|
|
185
|
-
keys.value = Object.keys(neu.data);
|
|
186
|
-
}
|
|
187
|
-
refName.value = neu?.metadata?.name;
|
|
188
|
-
}
|
|
189
|
-
updateRow();
|
|
190
|
-
});
|
|
191
|
-
|
|
192
121
|
return {
|
|
193
|
-
type,
|
|
194
|
-
refName,
|
|
195
|
-
referenced,
|
|
196
|
-
keys,
|
|
197
|
-
key,
|
|
198
|
-
fieldPath,
|
|
199
|
-
name,
|
|
200
|
-
valStr,
|
|
201
|
-
updateRow,
|
|
202
|
-
get,
|
|
122
|
+
typeOpts, type, refName, referenced: refName, secrets: this.allSecrets, keys, key, fieldPath, name, resourceKeyOpts, valStr
|
|
203
123
|
};
|
|
204
124
|
},
|
|
205
|
-
|
|
206
125
|
computed: {
|
|
207
126
|
isView() {
|
|
208
127
|
return this.mode === _VIEW;
|
|
@@ -270,6 +189,74 @@ export default {
|
|
|
270
189
|
return ['resourceFieldRef', 'configMapKeyRef', 'secretKeyRef'].includes(this.type);
|
|
271
190
|
},
|
|
272
191
|
},
|
|
192
|
+
|
|
193
|
+
watch: {
|
|
194
|
+
type() {
|
|
195
|
+
this.referenced = null;
|
|
196
|
+
this.key = '';
|
|
197
|
+
this.refName = '';
|
|
198
|
+
this.keys = [];
|
|
199
|
+
this.key = '';
|
|
200
|
+
this.valStr = '';
|
|
201
|
+
this.fieldPath = '';
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
referenced(neu, old) {
|
|
205
|
+
if (neu) {
|
|
206
|
+
if ((neu.type === SECRET || neu.type === CONFIG_MAP) && neu.data) {
|
|
207
|
+
this.keys = Object.keys(neu.data);
|
|
208
|
+
}
|
|
209
|
+
this.refName = neu?.metadata?.name;
|
|
210
|
+
}
|
|
211
|
+
this.updateRow();
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
methods: {
|
|
216
|
+
updateRow() {
|
|
217
|
+
if (!this.name?.length && !this.refName?.length) {
|
|
218
|
+
if (this.type !== 'fieldRef') {
|
|
219
|
+
this.$emit('update:value', null);
|
|
220
|
+
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
let out = { name: this.name || this.refName };
|
|
225
|
+
|
|
226
|
+
switch (this.type) {
|
|
227
|
+
case 'configMapKeyRef':
|
|
228
|
+
case 'secretKeyRef':
|
|
229
|
+
out.valueFrom = {
|
|
230
|
+
[this.type]: {
|
|
231
|
+
key: this.key, name: this.refName, optional: false
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
break;
|
|
235
|
+
case 'resourceFieldRef':
|
|
236
|
+
out.valueFrom = {
|
|
237
|
+
[this.type]: {
|
|
238
|
+
containerName: this.refName, divisor: 1, resource: this.key
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
break;
|
|
242
|
+
case 'fieldRef':
|
|
243
|
+
if (!this.fieldPath || !this.fieldPath.length) {
|
|
244
|
+
out = null; break;
|
|
245
|
+
}
|
|
246
|
+
out.valueFrom = { [this.type]: { apiVersion: 'v1', fieldPath: this.fieldPath } };
|
|
247
|
+
break;
|
|
248
|
+
case 'simple':
|
|
249
|
+
out.value = this.valStr;
|
|
250
|
+
break;
|
|
251
|
+
default:
|
|
252
|
+
delete out.name;
|
|
253
|
+
out.prefix = this.name;
|
|
254
|
+
out[this.type] = { name: this.refName, optional: false };
|
|
255
|
+
}
|
|
256
|
+
this.$emit('update:value', out);
|
|
257
|
+
},
|
|
258
|
+
get
|
|
259
|
+
}
|
|
273
260
|
};
|
|
274
261
|
</script>
|
|
275
262
|
|
|
@@ -44,9 +44,25 @@ export default {
|
|
|
44
44
|
},
|
|
45
45
|
|
|
46
46
|
data() {
|
|
47
|
+
const rows = clone(this.value || []).map((row) => {
|
|
48
|
+
row._showHost = false;
|
|
49
|
+
row._serviceType = row._serviceType || '';
|
|
50
|
+
row._name = row.name ? `${ row.name }` : `${ row.containerPort }${ row.protocol.toLowerCase() }${ row.hostPort || row._listeningPort || '' }`;
|
|
51
|
+
if (row.hostPort || row.hostIP) {
|
|
52
|
+
row._showHost = true;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
row._ipam = '';
|
|
56
|
+
|
|
57
|
+
return row;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// show host port column if existing port data has any host ports defined
|
|
61
|
+
const showHostPorts = !!rows.some((row) => !!row.hostPort);
|
|
62
|
+
|
|
47
63
|
return {
|
|
48
|
-
rows
|
|
49
|
-
showHostPorts
|
|
64
|
+
rows,
|
|
65
|
+
showHostPorts,
|
|
50
66
|
workloadPortOptions: ['TCP', 'UDP']
|
|
51
67
|
};
|
|
52
68
|
},
|
|
@@ -152,22 +168,6 @@ export default {
|
|
|
152
168
|
},
|
|
153
169
|
|
|
154
170
|
created() {
|
|
155
|
-
const rows = clone(this.value || []).map((row) => {
|
|
156
|
-
row._showHost = false;
|
|
157
|
-
row._serviceType = row._serviceType || '';
|
|
158
|
-
row._name = row.name ? `${ row.name }` : `${ row.containerPort }${ row.protocol.toLowerCase() }${ row.hostPort || row._listeningPort || '' }`;
|
|
159
|
-
if (row.hostPort || row.hostIP) {
|
|
160
|
-
row._showHost = true;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
row._ipam = '';
|
|
164
|
-
|
|
165
|
-
return row;
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
this.rows = rows;
|
|
169
|
-
// show host port column if existing port data has any host ports defined
|
|
170
|
-
this.showHostPorts = !!rows.some((row) => !!row.hostPort);
|
|
171
171
|
this.queueUpdate = debounce(this.update, 500);
|
|
172
172
|
this.rows.map((row) => {
|
|
173
173
|
this.setServiceType(row);
|
|
@@ -4,8 +4,6 @@ import { _EDIT, _VIEW } from '@shell/config/query-params';
|
|
|
4
4
|
import { ExtendedVue, Vue } from 'vue/types/vue';
|
|
5
5
|
import { DefaultProps } from 'vue/types/options';
|
|
6
6
|
|
|
7
|
-
jest.mock('lodash/debounce', () => jest.fn((fn) => fn));
|
|
8
|
-
|
|
9
7
|
describe('the ArrayList', () => {
|
|
10
8
|
it('is empty', () => {
|
|
11
9
|
const wrapper = mount(ArrayList, {
|
|
@@ -58,13 +56,12 @@ describe('the ArrayList', () => {
|
|
|
58
56
|
});
|
|
59
57
|
|
|
60
58
|
jest.useFakeTimers();
|
|
61
|
-
await (wrapper.get('[data-testid="
|
|
59
|
+
await (wrapper.get('[data-testid="remove-item-1"]').element as HTMLElement).click();
|
|
62
60
|
jest.advanceTimersByTime(50);
|
|
63
61
|
jest.useRealTimers();
|
|
64
62
|
|
|
65
|
-
expect(wrapper.find('[data-testid="
|
|
63
|
+
expect(wrapper.find('[data-testid="remove-item-2"]').exists()).toBe(false);
|
|
66
64
|
expect((wrapper.emitted('remove')![0][0] as any).row.value).toStrictEqual('string 1');
|
|
67
|
-
expect(wrapper.vm.rows).toStrictEqual([{ value: 'string 0' }, { value: 'string 2' }]);
|
|
68
65
|
expect(wrapper.emitted('update:value')![0][0]).toStrictEqual(['string 0', 'string 2']);
|
|
69
66
|
});
|
|
70
67
|
|
|
@@ -6,9 +6,9 @@ import { nextTick } from 'vue';
|
|
|
6
6
|
describe('component: MatchExpressions', () => {
|
|
7
7
|
it('should display all the inputs', () => {
|
|
8
8
|
const wrapper = mount(MatchExpressions, {
|
|
9
|
-
props: {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
props: { mode: _CREATE },
|
|
10
|
+
data: () => ({
|
|
11
|
+
rules: [
|
|
12
12
|
{
|
|
13
13
|
id: '123',
|
|
14
14
|
key: '123',
|
|
@@ -16,7 +16,7 @@ describe('component: MatchExpressions', () => {
|
|
|
16
16
|
values: '123'
|
|
17
17
|
}
|
|
18
18
|
]
|
|
19
|
-
}
|
|
19
|
+
})
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
const inputWraps = wrapper.findAll('[data-testid^=input-match-expression-]');
|
|
@@ -29,9 +29,9 @@ describe('component: MatchExpressions', () => {
|
|
|
29
29
|
'values',
|
|
30
30
|
])('should emit an update on %p input', async(field) => {
|
|
31
31
|
const wrapper = mount(MatchExpressions, {
|
|
32
|
-
props: {
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
props: { mode: _CREATE },
|
|
33
|
+
data: () => ({
|
|
34
|
+
rules: [
|
|
35
35
|
{
|
|
36
36
|
id: '123',
|
|
37
37
|
key: '123',
|
|
@@ -39,7 +39,7 @@ describe('component: MatchExpressions', () => {
|
|
|
39
39
|
values: '123'
|
|
40
40
|
}
|
|
41
41
|
]
|
|
42
|
-
}
|
|
42
|
+
})
|
|
43
43
|
});
|
|
44
44
|
const input = wrapper.find(`[data-testid="input-match-expression-${ field }-0"]`).find('input');
|
|
45
45
|
const newValue = 123;
|
|
@@ -54,9 +54,9 @@ describe('component: MatchExpressions', () => {
|
|
|
54
54
|
'operator',
|
|
55
55
|
])('should emit an update on %p selection change', async(field) => {
|
|
56
56
|
const wrapper = mount(MatchExpressions, {
|
|
57
|
-
props: {
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
props: { mode: _CREATE },
|
|
58
|
+
data: () => ({
|
|
59
|
+
rules: [
|
|
60
60
|
{
|
|
61
61
|
id: '123',
|
|
62
62
|
key: '123',
|
|
@@ -64,7 +64,7 @@ describe('component: MatchExpressions', () => {
|
|
|
64
64
|
values: '123'
|
|
65
65
|
}
|
|
66
66
|
]
|
|
67
|
-
}
|
|
67
|
+
})
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
const select = wrapper.find(`[data-testid="input-match-expression-${ field }-0"]`);
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils';
|
|
2
2
|
import NameNsDescription from '@shell/components/form/NameNsDescription.vue';
|
|
3
|
-
import { createStore } from 'vuex';
|
|
4
3
|
|
|
5
4
|
describe('component: NameNsDescription', () => {
|
|
6
5
|
// Accessing to computed value due code complexity
|
|
7
6
|
it('should map namespaces to options', () => {
|
|
8
7
|
const namespaceName = 'test';
|
|
9
|
-
const store = createStore({
|
|
10
|
-
getters: {
|
|
11
|
-
allowedNamespaces: () => () => ({ [namespaceName]: true }),
|
|
12
|
-
currentStore: () => () => 'cluster',
|
|
13
|
-
'cluster/schemaFor': () => jest.fn()
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
8
|
const result = [
|
|
17
9
|
{
|
|
18
10
|
label: namespaceName,
|
|
@@ -21,21 +13,20 @@ describe('component: NameNsDescription', () => {
|
|
|
21
13
|
];
|
|
22
14
|
const wrapper = mount(NameNsDescription, {
|
|
23
15
|
props: {
|
|
24
|
-
value:
|
|
25
|
-
setAnnotation: jest.fn(),
|
|
26
|
-
metadata: {}
|
|
27
|
-
},
|
|
16
|
+
value: {},
|
|
28
17
|
mode: 'create',
|
|
29
18
|
cluster: {},
|
|
30
19
|
},
|
|
31
20
|
global: {
|
|
32
|
-
|
|
33
|
-
mocks: {
|
|
21
|
+
mocks: {
|
|
34
22
|
$store: {
|
|
35
23
|
dispatch: jest.fn(),
|
|
36
24
|
getters: {
|
|
37
|
-
namespaces:
|
|
38
|
-
|
|
25
|
+
namespaces: jest.fn(),
|
|
26
|
+
allowedNamespaces: () => ({ [namespaceName]: true }),
|
|
27
|
+
currentStore: () => 'cluster',
|
|
28
|
+
'cluster/schemaFor': jest.fn(),
|
|
29
|
+
'i18n/t': jest.fn(),
|
|
39
30
|
},
|
|
40
31
|
},
|
|
41
32
|
},
|
|
@@ -47,35 +38,27 @@ describe('component: NameNsDescription', () => {
|
|
|
47
38
|
|
|
48
39
|
it('should emit in case of new namespace', () => {
|
|
49
40
|
const namespaceName = 'test';
|
|
50
|
-
const store = createStore({
|
|
51
|
-
getters: {
|
|
52
|
-
allowedNamespaces: () => () => ({ [namespaceName]: true }),
|
|
53
|
-
currentStore: () => () => 'cluster',
|
|
54
|
-
'cluster/schemaFor': () => jest.fn()
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
41
|
const newNamespaceName = 'bananas';
|
|
58
42
|
const wrapper = mount(NameNsDescription, {
|
|
59
43
|
props: {
|
|
60
|
-
value: {
|
|
61
|
-
|
|
62
|
-
metadata: {}
|
|
63
|
-
},
|
|
64
|
-
mode: 'create',
|
|
44
|
+
value: { metadata: {} },
|
|
45
|
+
mode: 'create',
|
|
65
46
|
},
|
|
66
47
|
global: {
|
|
67
|
-
|
|
68
|
-
mocks: {
|
|
48
|
+
mocks: {
|
|
69
49
|
$store: {
|
|
70
50
|
dispatch: jest.fn(),
|
|
71
51
|
getters: {
|
|
72
52
|
namespaces: jest.fn(),
|
|
53
|
+
allowedNamespaces: () => ({ [namespaceName]: true }),
|
|
73
54
|
'customizations/getPreviewCluster': {
|
|
74
55
|
ready: true,
|
|
75
56
|
isLocal: false,
|
|
76
57
|
badge: {},
|
|
77
58
|
},
|
|
78
|
-
|
|
59
|
+
currentStore: () => 'cluster',
|
|
60
|
+
'cluster/schemaFor': jest.fn(),
|
|
61
|
+
'i18n/t': jest.fn(),
|
|
79
62
|
},
|
|
80
63
|
},
|
|
81
64
|
},
|
|
@@ -86,88 +69,4 @@ describe('component: NameNsDescription', () => {
|
|
|
86
69
|
|
|
87
70
|
expect(wrapper.emitted().isNamespaceNew?.[0][0]).toBe(true);
|
|
88
71
|
});
|
|
89
|
-
|
|
90
|
-
it('renders the name input with the expected value', () => {
|
|
91
|
-
const namespaceName = 'test';
|
|
92
|
-
const store = createStore({
|
|
93
|
-
getters: {
|
|
94
|
-
allowedNamespaces: () => () => ({ [namespaceName]: true }),
|
|
95
|
-
currentStore: () => () => 'cluster',
|
|
96
|
-
'cluster/schemaFor': () => jest.fn()
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
const wrapper = mount(NameNsDescription, {
|
|
100
|
-
props: {
|
|
101
|
-
value: {
|
|
102
|
-
setAnnotation: jest.fn(),
|
|
103
|
-
metadata: { name: 'Default' }
|
|
104
|
-
},
|
|
105
|
-
mode: 'create',
|
|
106
|
-
},
|
|
107
|
-
global: {
|
|
108
|
-
provide: { store },
|
|
109
|
-
mocks: {
|
|
110
|
-
$store: {
|
|
111
|
-
dispatch: jest.fn(),
|
|
112
|
-
getters: {
|
|
113
|
-
namespaces: jest.fn(),
|
|
114
|
-
'customizations/getPreviewCluster': {
|
|
115
|
-
ready: true,
|
|
116
|
-
isLocal: false,
|
|
117
|
-
badge: {},
|
|
118
|
-
},
|
|
119
|
-
'i18n/t': jest.fn(),
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
const nameInput = wrapper.find('[data-testid="NameNsDescriptionNameInput"]');
|
|
127
|
-
|
|
128
|
-
expect(nameInput.element.value).toBe('Default');
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it('sets the name using the nameKey prop', () => {
|
|
132
|
-
const namespaceName = 'test';
|
|
133
|
-
const store = createStore({
|
|
134
|
-
getters: {
|
|
135
|
-
allowedNamespaces: () => () => ({ [namespaceName]: true }),
|
|
136
|
-
currentStore: () => () => 'cluster',
|
|
137
|
-
'cluster/schemaFor': () => jest.fn()
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
const wrapper = mount(NameNsDescription, {
|
|
141
|
-
props: {
|
|
142
|
-
value: {
|
|
143
|
-
setAnnotation: jest.fn(),
|
|
144
|
-
metadata: {},
|
|
145
|
-
spec: { displayName: 'Default' }
|
|
146
|
-
},
|
|
147
|
-
mode: 'create',
|
|
148
|
-
nameKey: 'spec.displayName'
|
|
149
|
-
},
|
|
150
|
-
global: {
|
|
151
|
-
provide: { store },
|
|
152
|
-
mocks: {
|
|
153
|
-
$store: {
|
|
154
|
-
dispatch: jest.fn(),
|
|
155
|
-
getters: {
|
|
156
|
-
namespaces: jest.fn(),
|
|
157
|
-
'customizations/getPreviewCluster': {
|
|
158
|
-
ready: true,
|
|
159
|
-
isLocal: false,
|
|
160
|
-
badge: {},
|
|
161
|
-
},
|
|
162
|
-
'i18n/t': jest.fn(),
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
const nameInput = wrapper.find('[data-testid="NameNsDescriptionNameInput"]');
|
|
170
|
-
|
|
171
|
-
expect(nameInput.element.value).toBe('Default');
|
|
172
|
-
});
|
|
173
72
|
});
|