@rancher/shell 3.0.3 → 3.0.5-rc.1
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/styles/base/_basic.scss +6 -0
- package/assets/styles/global/_button.scss +1 -0
- package/assets/translations/en-us.yaml +38 -3
- package/cloud-credential/aws.vue +2 -0
- package/components/AssignTo.vue +25 -11
- package/components/AsyncButton.vue +24 -7
- package/components/BannerGraphic.vue +1 -0
- package/components/CommunityLinks.vue +3 -3
- package/components/CopyToClipboardText.vue +2 -1
- package/components/DetailText.vue +5 -0
- package/components/DisableAuthProviderModal.vue +1 -0
- package/components/ExplorerMembers.vue +1 -1
- package/components/ExplorerProjectsNamespaces.vue +56 -14
- package/components/LandingPagePreference.vue +5 -3
- package/components/LocaleSelector.vue +38 -94
- package/components/ModalWithCard.vue +1 -0
- package/components/MoveModal.vue +1 -0
- package/components/PromptRemove.vue +2 -1
- package/components/PromptRestore.vue +1 -0
- package/components/ResourceCancelModal.vue +1 -0
- package/components/SortableTable/index.vue +35 -10
- package/components/StatusBadge.vue +10 -4
- package/components/__tests__/AsyncButton.test.ts +2 -2
- package/components/auth/Principal.vue +9 -3
- package/components/auth/__tests__/RoleDetailEdit.test.ts +3 -2
- package/components/form/ArrayList.vue +75 -54
- package/components/form/Command.vue +6 -15
- package/components/form/EnvVars.vue +15 -8
- package/components/form/HealthCheck.vue +3 -3
- package/components/form/HookOption.vue +11 -16
- package/components/form/KeyValue.vue +1 -1
- package/components/form/LabeledSelect.vue +2 -1
- package/components/form/LifecycleHooks.vue +3 -3
- package/components/form/MatchExpressions.vue +10 -7
- package/components/form/NameNsDescription.vue +123 -103
- package/components/form/Networking.vue +20 -12
- package/components/form/NodeAffinity.vue +31 -23
- package/components/form/NodeScheduling.vue +13 -3
- package/components/form/PodAffinity.vue +43 -43
- package/components/form/Probe.vue +67 -66
- package/components/form/ResourceQuota/Project.vue +5 -1
- package/components/form/ResourceSelector.vue +7 -9
- package/components/form/SSHKnownHosts/KnownHostsEditDialog.vue +6 -3
- package/components/form/SSHKnownHosts/__tests__/KnownHostsEditDialog.test.ts +12 -1
- package/components/form/SSHKnownHosts/index.vue +16 -2
- package/components/form/Security.vue +54 -56
- package/components/form/Select.vue +31 -6
- package/components/form/ShellInput.vue +5 -1
- package/components/form/Tolerations.vue +5 -1
- package/components/form/ValueFromResource.vue +134 -121
- package/components/form/WorkloadPorts.vue +18 -18
- package/components/form/__tests__/ArrayList.test.ts +3 -0
- package/components/form/__tests__/MatchExpressions.test.ts +12 -12
- package/components/form/__tests__/NameNsDescription.test.ts +115 -14
- package/components/form/__tests__/Probe.test.ts +12 -8
- package/components/form/__tests__/SSHKnownHosts.test.ts +11 -0
- package/components/form/__tests__/Select.test.ts +37 -0
- package/components/formatter/InternalExternalIP.vue +2 -0
- package/components/formatter/SecretData.vue +20 -7
- package/components/nav/Group.vue +15 -1
- package/components/nav/Header.vue +1 -0
- package/components/nav/Type.vue +12 -1
- package/components/templates/blank.vue +4 -1
- package/components/templates/default.vue +2 -0
- package/components/templates/home.vue +4 -1
- package/components/templates/plain.vue +4 -1
- package/composables/useRuntimeFlag.ts +29 -0
- package/config/router/routes.js +20 -13
- package/core/types.ts +5 -0
- package/dialog/AddCustomBadgeDialog.vue +1 -0
- package/dialog/DeactivateDriverDialog.vue +5 -4
- package/dialog/ForceMachineRemoveDialog.vue +4 -1
- package/dialog/GitRepoForceUpdateDialog.vue +1 -1
- package/edit/__tests__/monitoring.coreos.com.prometheusrule.test.ts +16 -3
- package/edit/auth/__tests__/oidc.test.ts +152 -109
- package/edit/auth/azuread.vue +1 -0
- package/edit/auth/googleoauth.vue +4 -0
- package/edit/auth/oidc.vue +37 -4
- package/edit/cloudcredential.vue +1 -0
- package/edit/fleet.cattle.io.gitrepo.vue +1 -0
- package/edit/logging.banzaicloud.io.output/__tests__/logging.banzaicloud.io.output.test.ts +40 -9
- package/edit/networking.k8s.io.ingress/IngressClass.vue +7 -3
- package/edit/networking.k8s.io.ingress/__tests__/IngressClass.test.ts +58 -0
- package/edit/persistentvolume/__tests__/persistentvolume.test.ts +14 -2
- package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +1 -0
- package/edit/provisioning.cattle.io.cluster/rke2.vue +25 -34
- package/edit/provisioning.cattle.io.cluster/tabs/AgentConfiguration.vue +6 -1
- package/edit/provisioning.cattle.io.cluster/tabs/MachinePool.vue +29 -1
- package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +2 -2
- package/edit/token.vue +2 -0
- package/edit/workload/index.vue +1 -0
- package/edit/workload/mixins/workload.js +0 -2
- package/list/management.cattle.io.feature.vue +1 -0
- package/list/provisioning.cattle.io.cluster.vue +20 -12
- package/machine-config/__tests__/vmwarevsphere.test.ts +48 -3
- package/machine-config/vmwarevsphere.vue +16 -0
- package/models/__tests__/namespace.test.ts +25 -1
- package/models/cloudcredential.js +5 -0
- package/models/kontainerdriver.js +6 -3
- package/models/management.cattle.io.node.js +3 -3
- package/models/namespace.js +4 -5
- package/models/nodedriver.js +6 -3
- package/models/workload.js +4 -1
- package/package.json +4 -4
- package/pages/about.vue +16 -8
- package/pages/account/index.vue +4 -1
- package/pages/auth/login.vue +11 -3
- package/pages/auth/logout.vue +4 -1
- package/pages/auth/setup.vue +1 -0
- package/pages/auth/verify.vue +4 -1
- package/pages/c/_cluster/apps/charts/chart.vue +1 -1
- package/pages/diagnostic.vue +47 -2
- package/pages/fail-whale.vue +6 -3
- package/pages/home.vue +24 -18
- package/pages/support/index.vue +4 -1
- package/promptRemove/management.cattle.io.fleetworkspace.vue +1 -1
- package/promptRemove/management.cattle.io.globalrole.vue +1 -1
- package/promptRemove/management.cattle.io.project.vue +2 -2
- package/promptRemove/management.cattle.io.roletemplate.vue +1 -1
- package/promptRemove/pod.vue +1 -1
- package/rancher-components/Form/Radio/RadioGroup.vue +25 -23
- package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +3 -3
- package/rancher-components/RcDropdown/RcDropdown.vue +6 -5
- package/rancher-components/RcDropdown/RcDropdownMenu.vue +4 -2
- package/rancher-components/RcDropdown/RcDropdownTrigger.vue +12 -2
- package/rancher-components/RcDropdown/useDropdownCollection.ts +8 -0
- package/rancher-components/RcDropdown/useDropdownContext.ts +9 -3
- package/scripts/extension/publish +1 -0
- package/server/har-file.js +25 -3
- package/store/features.js +2 -1
- package/store/type-map.js +4 -0
- package/types/shell/index.d.ts +9 -2
- package/utils/__tests__/string.test.ts +2 -2
- package/utils/cluster.js +35 -0
- package/utils/string.js +1 -3
- package/utils/validators/machine-pool.ts +20 -0
- package/components/formatter/ExtensionCache.vue +0 -74
- package/components/formatter/Port.vue +0 -24
- package/components/formatter/SecretType.vue +0 -41
|
@@ -4,6 +4,7 @@ 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, toRef, watch } from 'vue';
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
emits: ['update:value', 'remove'],
|
|
@@ -44,84 +45,164 @@ export default {
|
|
|
44
45
|
},
|
|
45
46
|
|
|
46
47
|
data() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
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
|
+
secrets: this.allSecrets,
|
|
59
|
+
resourceKeyOpts: ['limits.cpu', 'limits.ephemeral-storage', 'limits.memory', 'requests.cpu', 'requests.ephemeral-storage', 'requests.memory'],
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
setup(props, { emit }) {
|
|
64
|
+
const type = ref(null);
|
|
65
|
+
|
|
66
|
+
if (props.value.secretRef) {
|
|
67
|
+
type.value = 'secretRef';
|
|
68
|
+
} else if (props.value.configMapRef) {
|
|
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';
|
|
68
74
|
}
|
|
69
75
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const keys = [];
|
|
76
|
+
const refName = ref('');
|
|
77
|
+
const name = ref('');
|
|
78
|
+
const fieldPath = ref('');
|
|
79
|
+
const referenced = ref(null);
|
|
80
|
+
const key = ref(null);
|
|
81
|
+
const valStr = ref('');
|
|
82
|
+
const keys = ref([]);
|
|
77
83
|
|
|
78
|
-
switch (type) {
|
|
84
|
+
switch (type.value) {
|
|
79
85
|
case 'resourceFieldRef':
|
|
80
|
-
name =
|
|
81
|
-
refName =
|
|
82
|
-
key =
|
|
86
|
+
name.value = toRef(props.value.name);
|
|
87
|
+
refName.value = toRef(props.value.valueFrom[type.value].containerName);
|
|
88
|
+
key.value = props.value.valueFrom[type.value].resource || '';
|
|
83
89
|
break;
|
|
84
90
|
case 'configMapKeyRef':
|
|
85
|
-
name =
|
|
86
|
-
key =
|
|
87
|
-
refName =
|
|
88
|
-
referenced =
|
|
89
|
-
return resource.metadata.name === refName;
|
|
91
|
+
name.value = toRef(props.value.name);
|
|
92
|
+
key.value = props.value.valueFrom[type.value].key || '';
|
|
93
|
+
refName.value = toRef(props.value.valueFrom[type.value].name);
|
|
94
|
+
referenced.value = props.allConfigMaps.filter((resource) => {
|
|
95
|
+
return resource.metadata.name === refName.value;
|
|
90
96
|
})[0];
|
|
91
|
-
if (referenced && referenced.data) {
|
|
92
|
-
keys.push(...Object.keys(referenced.data));
|
|
97
|
+
if (referenced.value && referenced.value.data) {
|
|
98
|
+
keys.value.push(...Object.keys(referenced.value.data));
|
|
93
99
|
}
|
|
94
100
|
break;
|
|
95
101
|
case 'secretRef':
|
|
96
102
|
case 'configMapRef':
|
|
97
|
-
name =
|
|
98
|
-
refName =
|
|
103
|
+
name.value = toRef(props.value.prefix);
|
|
104
|
+
refName.value = toRef(props.value[type.value].name);
|
|
99
105
|
break;
|
|
100
106
|
case 'secretKeyRef':
|
|
101
|
-
name =
|
|
102
|
-
key =
|
|
103
|
-
refName =
|
|
104
|
-
referenced =
|
|
105
|
-
return resource.metadata.name === refName;
|
|
107
|
+
name.value = toRef(props.value.name);
|
|
108
|
+
key.value = props.value.valueFrom[type.value].key || '';
|
|
109
|
+
refName.value = toRef(props.value.valueFrom[type.value].name);
|
|
110
|
+
referenced.value = props.allSecrets.filter((resource) => {
|
|
111
|
+
return resource.metadata.name === refName.value;
|
|
106
112
|
})[0];
|
|
107
|
-
if (referenced && referenced.data) {
|
|
108
|
-
keys.push(...Object.keys(referenced.data));
|
|
113
|
+
if (referenced.value && referenced.value.data) {
|
|
114
|
+
keys.value.push(...Object.keys(referenced.value.data));
|
|
109
115
|
}
|
|
110
116
|
break;
|
|
111
117
|
case 'fieldRef':
|
|
112
|
-
fieldPath = get(
|
|
113
|
-
name =
|
|
118
|
+
fieldPath.value = get(props.value.valueFrom, `${ type.value }.fieldPath`) || '';
|
|
119
|
+
name.value = toRef(props.value.name);
|
|
114
120
|
break;
|
|
115
121
|
default:
|
|
116
|
-
name =
|
|
117
|
-
valStr =
|
|
122
|
+
name.value = toRef(props.value.name);
|
|
123
|
+
valStr.value = toRef(props.value.value);
|
|
118
124
|
break;
|
|
119
125
|
}
|
|
120
126
|
|
|
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
|
+
|
|
121
192
|
return {
|
|
122
|
-
|
|
193
|
+
type,
|
|
194
|
+
refName,
|
|
195
|
+
referenced,
|
|
196
|
+
keys,
|
|
197
|
+
key,
|
|
198
|
+
fieldPath,
|
|
199
|
+
name,
|
|
200
|
+
valStr,
|
|
201
|
+
updateRow,
|
|
202
|
+
get,
|
|
123
203
|
};
|
|
124
204
|
},
|
|
205
|
+
|
|
125
206
|
computed: {
|
|
126
207
|
isView() {
|
|
127
208
|
return this.mode === _VIEW;
|
|
@@ -189,74 +270,6 @@ export default {
|
|
|
189
270
|
return ['resourceFieldRef', 'configMapKeyRef', 'secretKeyRef'].includes(this.type);
|
|
190
271
|
},
|
|
191
272
|
},
|
|
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
|
-
}
|
|
260
273
|
};
|
|
261
274
|
</script>
|
|
262
275
|
|
|
@@ -44,25 +44,9 @@ 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
|
-
|
|
63
47
|
return {
|
|
64
|
-
rows,
|
|
65
|
-
showHostPorts,
|
|
48
|
+
rows: [],
|
|
49
|
+
showHostPorts: false,
|
|
66
50
|
workloadPortOptions: ['TCP', 'UDP']
|
|
67
51
|
};
|
|
68
52
|
},
|
|
@@ -168,6 +152,22 @@ export default {
|
|
|
168
152
|
},
|
|
169
153
|
|
|
170
154
|
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,6 +4,8 @@ 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
|
+
|
|
7
9
|
describe('the ArrayList', () => {
|
|
8
10
|
it('is empty', () => {
|
|
9
11
|
const wrapper = mount(ArrayList, {
|
|
@@ -62,6 +64,7 @@ describe('the ArrayList', () => {
|
|
|
62
64
|
|
|
63
65
|
expect(wrapper.find('[data-testid="remove-item-2"]').exists()).toBe(false);
|
|
64
66
|
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' }]);
|
|
65
68
|
expect(wrapper.emitted('update:value')![0][0]).toStrictEqual(['string 0', 'string 2']);
|
|
66
69
|
});
|
|
67
70
|
|
|
@@ -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: {
|
|
10
|
+
mode: _CREATE,
|
|
11
|
+
value: [
|
|
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: {
|
|
33
|
+
mode: _CREATE,
|
|
34
|
+
value: [
|
|
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: {
|
|
58
|
+
mode: _CREATE,
|
|
59
|
+
value: [
|
|
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,10 +1,18 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils';
|
|
2
2
|
import NameNsDescription from '@shell/components/form/NameNsDescription.vue';
|
|
3
|
+
import { createStore } from 'vuex';
|
|
3
4
|
|
|
4
5
|
describe('component: NameNsDescription', () => {
|
|
5
6
|
// Accessing to computed value due code complexity
|
|
6
7
|
it('should map namespaces to options', () => {
|
|
7
8
|
const namespaceName = 'test';
|
|
9
|
+
const store = createStore({
|
|
10
|
+
getters: {
|
|
11
|
+
allowedNamespaces: () => () => ({ [namespaceName]: true }),
|
|
12
|
+
currentStore: () => () => 'cluster',
|
|
13
|
+
'cluster/schemaFor': () => jest.fn()
|
|
14
|
+
}
|
|
15
|
+
});
|
|
8
16
|
const result = [
|
|
9
17
|
{
|
|
10
18
|
label: namespaceName,
|
|
@@ -13,20 +21,21 @@ describe('component: NameNsDescription', () => {
|
|
|
13
21
|
];
|
|
14
22
|
const wrapper = mount(NameNsDescription, {
|
|
15
23
|
props: {
|
|
16
|
-
value:
|
|
24
|
+
value: {
|
|
25
|
+
setAnnotation: jest.fn(),
|
|
26
|
+
metadata: {}
|
|
27
|
+
},
|
|
17
28
|
mode: 'create',
|
|
18
29
|
cluster: {},
|
|
19
30
|
},
|
|
20
31
|
global: {
|
|
21
|
-
|
|
32
|
+
provide: { store },
|
|
33
|
+
mocks: {
|
|
22
34
|
$store: {
|
|
23
35
|
dispatch: jest.fn(),
|
|
24
36
|
getters: {
|
|
25
|
-
namespaces:
|
|
26
|
-
|
|
27
|
-
currentStore: () => 'cluster',
|
|
28
|
-
'cluster/schemaFor': jest.fn(),
|
|
29
|
-
'i18n/t': jest.fn(),
|
|
37
|
+
namespaces: jest.fn(),
|
|
38
|
+
'i18n/t': jest.fn(),
|
|
30
39
|
},
|
|
31
40
|
},
|
|
32
41
|
},
|
|
@@ -38,27 +47,35 @@ describe('component: NameNsDescription', () => {
|
|
|
38
47
|
|
|
39
48
|
it('should emit in case of new namespace', () => {
|
|
40
49
|
const namespaceName = 'test';
|
|
50
|
+
const store = createStore({
|
|
51
|
+
getters: {
|
|
52
|
+
allowedNamespaces: () => () => ({ [namespaceName]: true }),
|
|
53
|
+
currentStore: () => () => 'cluster',
|
|
54
|
+
'cluster/schemaFor': () => jest.fn()
|
|
55
|
+
}
|
|
56
|
+
});
|
|
41
57
|
const newNamespaceName = 'bananas';
|
|
42
58
|
const wrapper = mount(NameNsDescription, {
|
|
43
59
|
props: {
|
|
44
|
-
value: {
|
|
45
|
-
|
|
60
|
+
value: {
|
|
61
|
+
setAnnotation: jest.fn(),
|
|
62
|
+
metadata: {}
|
|
63
|
+
},
|
|
64
|
+
mode: 'create',
|
|
46
65
|
},
|
|
47
66
|
global: {
|
|
48
|
-
|
|
67
|
+
provide: { store },
|
|
68
|
+
mocks: {
|
|
49
69
|
$store: {
|
|
50
70
|
dispatch: jest.fn(),
|
|
51
71
|
getters: {
|
|
52
72
|
namespaces: jest.fn(),
|
|
53
|
-
allowedNamespaces: () => ({ [namespaceName]: true }),
|
|
54
73
|
'customizations/getPreviewCluster': {
|
|
55
74
|
ready: true,
|
|
56
75
|
isLocal: false,
|
|
57
76
|
badge: {},
|
|
58
77
|
},
|
|
59
|
-
|
|
60
|
-
'cluster/schemaFor': jest.fn(),
|
|
61
|
-
'i18n/t': jest.fn(),
|
|
78
|
+
'i18n/t': jest.fn(),
|
|
62
79
|
},
|
|
63
80
|
},
|
|
64
81
|
},
|
|
@@ -69,4 +86,88 @@ describe('component: NameNsDescription', () => {
|
|
|
69
86
|
|
|
70
87
|
expect(wrapper.emitted().isNamespaceNew?.[0][0]).toBe(true);
|
|
71
88
|
});
|
|
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
|
+
});
|
|
72
173
|
});
|
|
@@ -6,18 +6,20 @@ import { DefaultProps } from 'vue/types/options';
|
|
|
6
6
|
|
|
7
7
|
describe('component: Probe', () => {
|
|
8
8
|
describe.each([
|
|
9
|
-
['
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
])('given kind %p', (
|
|
9
|
+
[{ httpGet: { scheme: 'https' } }, ['port', 'path']],
|
|
10
|
+
[{ tcpSocket: {} }, ['socket']],
|
|
11
|
+
[{ exec: {} }, ['command']],
|
|
12
|
+
])('given kind %p', (value, extraFields) => {
|
|
13
13
|
it.each([
|
|
14
14
|
...extraFields,
|
|
15
15
|
'successThreshold',
|
|
16
16
|
'failureThreshold',
|
|
17
17
|
])('should emit an update on %p input', (field) => {
|
|
18
18
|
const wrapper = mount(Probe as unknown as ExtendedVue<Vue, {}, {}, {}, DefaultProps>, {
|
|
19
|
-
props: {
|
|
20
|
-
|
|
19
|
+
props: {
|
|
20
|
+
mode: _EDIT,
|
|
21
|
+
value,
|
|
22
|
+
},
|
|
21
23
|
});
|
|
22
24
|
const input = wrapper.find(`[data-testid="input-probe-${ field }"]`).find('input');
|
|
23
25
|
const newValue = 123;
|
|
@@ -33,8 +35,10 @@ describe('component: Probe', () => {
|
|
|
33
35
|
'timeoutSeconds',
|
|
34
36
|
])('should emit an update on %p input and blur', (field) => {
|
|
35
37
|
const wrapper = mount(Probe as unknown as ExtendedVue<Vue, {}, {}, {}, DefaultProps>, {
|
|
36
|
-
props: {
|
|
37
|
-
|
|
38
|
+
props: {
|
|
39
|
+
mode: _EDIT,
|
|
40
|
+
value
|
|
41
|
+
},
|
|
38
42
|
});
|
|
39
43
|
const input = wrapper.find(`[data-testid="input-probe-${ field }"]`).find('input');
|
|
40
44
|
const newValue = 123;
|
|
@@ -2,6 +2,17 @@ import { mount } from '@vue/test-utils';
|
|
|
2
2
|
import { _EDIT, _VIEW } from '@shell/config/query-params';
|
|
3
3
|
import SSHKnownHosts from '@shell/components/form/SSHKnownHosts/index.vue';
|
|
4
4
|
|
|
5
|
+
jest.mock('focus-trap', () => {
|
|
6
|
+
return {
|
|
7
|
+
createFocusTrap: jest.fn().mockImplementation(() => {
|
|
8
|
+
return {
|
|
9
|
+
activate: jest.fn(),
|
|
10
|
+
deactivate: jest.fn(),
|
|
11
|
+
};
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
|
|
5
16
|
describe('component: SSHKnownHosts', () => {
|
|
6
17
|
it.each([
|
|
7
18
|
['0 entities', '', 0],
|