@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.
Files changed (139) hide show
  1. package/assets/styles/base/_basic.scss +6 -0
  2. package/assets/styles/global/_button.scss +1 -0
  3. package/assets/translations/en-us.yaml +38 -3
  4. package/cloud-credential/aws.vue +2 -0
  5. package/components/AssignTo.vue +25 -11
  6. package/components/AsyncButton.vue +24 -7
  7. package/components/BannerGraphic.vue +1 -0
  8. package/components/CommunityLinks.vue +3 -3
  9. package/components/CopyToClipboardText.vue +2 -1
  10. package/components/DetailText.vue +5 -0
  11. package/components/DisableAuthProviderModal.vue +1 -0
  12. package/components/ExplorerMembers.vue +1 -1
  13. package/components/ExplorerProjectsNamespaces.vue +56 -14
  14. package/components/LandingPagePreference.vue +5 -3
  15. package/components/LocaleSelector.vue +38 -94
  16. package/components/ModalWithCard.vue +1 -0
  17. package/components/MoveModal.vue +1 -0
  18. package/components/PromptRemove.vue +2 -1
  19. package/components/PromptRestore.vue +1 -0
  20. package/components/ResourceCancelModal.vue +1 -0
  21. package/components/SortableTable/index.vue +35 -10
  22. package/components/StatusBadge.vue +10 -4
  23. package/components/__tests__/AsyncButton.test.ts +2 -2
  24. package/components/auth/Principal.vue +9 -3
  25. package/components/auth/__tests__/RoleDetailEdit.test.ts +3 -2
  26. package/components/form/ArrayList.vue +75 -54
  27. package/components/form/Command.vue +6 -15
  28. package/components/form/EnvVars.vue +15 -8
  29. package/components/form/HealthCheck.vue +3 -3
  30. package/components/form/HookOption.vue +11 -16
  31. package/components/form/KeyValue.vue +1 -1
  32. package/components/form/LabeledSelect.vue +2 -1
  33. package/components/form/LifecycleHooks.vue +3 -3
  34. package/components/form/MatchExpressions.vue +10 -7
  35. package/components/form/NameNsDescription.vue +123 -103
  36. package/components/form/Networking.vue +20 -12
  37. package/components/form/NodeAffinity.vue +31 -23
  38. package/components/form/NodeScheduling.vue +13 -3
  39. package/components/form/PodAffinity.vue +43 -43
  40. package/components/form/Probe.vue +67 -66
  41. package/components/form/ResourceQuota/Project.vue +5 -1
  42. package/components/form/ResourceSelector.vue +7 -9
  43. package/components/form/SSHKnownHosts/KnownHostsEditDialog.vue +6 -3
  44. package/components/form/SSHKnownHosts/__tests__/KnownHostsEditDialog.test.ts +12 -1
  45. package/components/form/SSHKnownHosts/index.vue +16 -2
  46. package/components/form/Security.vue +54 -56
  47. package/components/form/Select.vue +31 -6
  48. package/components/form/ShellInput.vue +5 -1
  49. package/components/form/Tolerations.vue +5 -1
  50. package/components/form/ValueFromResource.vue +134 -121
  51. package/components/form/WorkloadPorts.vue +18 -18
  52. package/components/form/__tests__/ArrayList.test.ts +3 -0
  53. package/components/form/__tests__/MatchExpressions.test.ts +12 -12
  54. package/components/form/__tests__/NameNsDescription.test.ts +115 -14
  55. package/components/form/__tests__/Probe.test.ts +12 -8
  56. package/components/form/__tests__/SSHKnownHosts.test.ts +11 -0
  57. package/components/form/__tests__/Select.test.ts +37 -0
  58. package/components/formatter/InternalExternalIP.vue +2 -0
  59. package/components/formatter/SecretData.vue +20 -7
  60. package/components/nav/Group.vue +15 -1
  61. package/components/nav/Header.vue +1 -0
  62. package/components/nav/Type.vue +12 -1
  63. package/components/templates/blank.vue +4 -1
  64. package/components/templates/default.vue +2 -0
  65. package/components/templates/home.vue +4 -1
  66. package/components/templates/plain.vue +4 -1
  67. package/composables/useRuntimeFlag.ts +29 -0
  68. package/config/router/routes.js +20 -13
  69. package/core/types.ts +5 -0
  70. package/dialog/AddCustomBadgeDialog.vue +1 -0
  71. package/dialog/DeactivateDriverDialog.vue +5 -4
  72. package/dialog/ForceMachineRemoveDialog.vue +4 -1
  73. package/dialog/GitRepoForceUpdateDialog.vue +1 -1
  74. package/edit/__tests__/monitoring.coreos.com.prometheusrule.test.ts +16 -3
  75. package/edit/auth/__tests__/oidc.test.ts +152 -109
  76. package/edit/auth/azuread.vue +1 -0
  77. package/edit/auth/googleoauth.vue +4 -0
  78. package/edit/auth/oidc.vue +37 -4
  79. package/edit/cloudcredential.vue +1 -0
  80. package/edit/fleet.cattle.io.gitrepo.vue +1 -0
  81. package/edit/logging.banzaicloud.io.output/__tests__/logging.banzaicloud.io.output.test.ts +40 -9
  82. package/edit/networking.k8s.io.ingress/IngressClass.vue +7 -3
  83. package/edit/networking.k8s.io.ingress/__tests__/IngressClass.test.ts +58 -0
  84. package/edit/persistentvolume/__tests__/persistentvolume.test.ts +14 -2
  85. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +1 -0
  86. package/edit/provisioning.cattle.io.cluster/rke2.vue +25 -34
  87. package/edit/provisioning.cattle.io.cluster/tabs/AgentConfiguration.vue +6 -1
  88. package/edit/provisioning.cattle.io.cluster/tabs/MachinePool.vue +29 -1
  89. package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +2 -2
  90. package/edit/token.vue +2 -0
  91. package/edit/workload/index.vue +1 -0
  92. package/edit/workload/mixins/workload.js +0 -2
  93. package/list/management.cattle.io.feature.vue +1 -0
  94. package/list/provisioning.cattle.io.cluster.vue +20 -12
  95. package/machine-config/__tests__/vmwarevsphere.test.ts +48 -3
  96. package/machine-config/vmwarevsphere.vue +16 -0
  97. package/models/__tests__/namespace.test.ts +25 -1
  98. package/models/cloudcredential.js +5 -0
  99. package/models/kontainerdriver.js +6 -3
  100. package/models/management.cattle.io.node.js +3 -3
  101. package/models/namespace.js +4 -5
  102. package/models/nodedriver.js +6 -3
  103. package/models/workload.js +4 -1
  104. package/package.json +4 -4
  105. package/pages/about.vue +16 -8
  106. package/pages/account/index.vue +4 -1
  107. package/pages/auth/login.vue +11 -3
  108. package/pages/auth/logout.vue +4 -1
  109. package/pages/auth/setup.vue +1 -0
  110. package/pages/auth/verify.vue +4 -1
  111. package/pages/c/_cluster/apps/charts/chart.vue +1 -1
  112. package/pages/diagnostic.vue +47 -2
  113. package/pages/fail-whale.vue +6 -3
  114. package/pages/home.vue +24 -18
  115. package/pages/support/index.vue +4 -1
  116. package/promptRemove/management.cattle.io.fleetworkspace.vue +1 -1
  117. package/promptRemove/management.cattle.io.globalrole.vue +1 -1
  118. package/promptRemove/management.cattle.io.project.vue +2 -2
  119. package/promptRemove/management.cattle.io.roletemplate.vue +1 -1
  120. package/promptRemove/pod.vue +1 -1
  121. package/rancher-components/Form/Radio/RadioGroup.vue +25 -23
  122. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +3 -3
  123. package/rancher-components/RcDropdown/RcDropdown.vue +6 -5
  124. package/rancher-components/RcDropdown/RcDropdownMenu.vue +4 -2
  125. package/rancher-components/RcDropdown/RcDropdownTrigger.vue +12 -2
  126. package/rancher-components/RcDropdown/useDropdownCollection.ts +8 -0
  127. package/rancher-components/RcDropdown/useDropdownContext.ts +9 -3
  128. package/scripts/extension/publish +1 -0
  129. package/server/har-file.js +25 -3
  130. package/store/features.js +2 -1
  131. package/store/type-map.js +4 -0
  132. package/types/shell/index.d.ts +9 -2
  133. package/utils/__tests__/string.test.ts +2 -2
  134. package/utils/cluster.js +35 -0
  135. package/utils/string.js +1 -3
  136. package/utils/validators/machine-pool.ts +20 -0
  137. package/components/formatter/ExtensionCache.vue +0 -74
  138. package/components/formatter/Port.vue +0 -24
  139. package/components/formatter/SecretType.vue +0 -41
@@ -28,23 +28,18 @@ export default {
28
28
  },
29
29
 
30
30
  data() {
31
- const selectHook = null;
32
-
33
- const defaultExec = { exec: { command: [] } };
34
- const defaultHttpGet = {
35
- httpGet: {
36
- host: '',
37
- path: '',
38
- port: null,
39
- scheme: '',
40
- httpHeaders: null
41
- }
42
- };
43
-
44
31
  return {
45
- selectHook,
46
- defaultExec,
47
- defaultHttpGet,
32
+ selectHook: null,
33
+ defaultExec: { exec: { command: [] } },
34
+ defaultHttpGet: {
35
+ httpGet: {
36
+ host: '',
37
+ path: '',
38
+ port: null,
39
+ scheme: '',
40
+ httpHeaders: null
41
+ }
42
+ },
48
43
  schemeOptions: ['HTTP', 'HTTPS']
49
44
  };
50
45
  },
@@ -823,7 +823,7 @@ export default {
823
823
  type="button"
824
824
  role="button"
825
825
  :disabled="isView || isProtected(row.key) || disabled"
826
- :aria-label="removeLabel || t('generic.remove')"
826
+ :aria-label="`${removeLabel || t('generic.remove')} ${ i+1 }`"
827
827
  class="btn role-link"
828
828
  @click="remove(i)"
829
829
  >
@@ -296,6 +296,7 @@ export default {
296
296
  }
297
297
  ]"
298
298
  :tabindex="isView || disabled ? -1 : 0"
299
+ role="listbox"
299
300
  @click="focusSearch"
300
301
  @keydown.enter="focusSearch"
301
302
  @keydown.down.prevent="focusSearch"
@@ -344,7 +345,7 @@ export default {
344
345
  :modelValue="value != null && !loading ? value : ''"
345
346
  :dropdown-should-open="dropdownShouldOpen"
346
347
  :tabindex="-1"
347
- role="listbox"
348
+ role="listitem"
348
349
  @update:modelValue="$emit('selecting', $event); $emit('update:value', $event)"
349
350
  @search:blur="onBlur"
350
351
  @search:focus="onFocus"
@@ -24,10 +24,10 @@ export default {
24
24
  },
25
25
 
26
26
  data() {
27
- const { postStart, preStop } = this.value;
28
-
29
27
  return {
30
- postStart, preStop, hookOptions: ['postStart', 'preStop']
28
+ postStart: this.value.postStart,
29
+ preStop: this.value.preStop,
30
+ hookOptions: ['postStart', 'preStop']
31
31
  };
32
32
  },
33
33
 
@@ -70,6 +70,14 @@ export default {
70
70
  },
71
71
 
72
72
  data() {
73
+ return {
74
+ ops: [],
75
+ rules: [],
76
+ custom: []
77
+ };
78
+ },
79
+
80
+ created() {
73
81
  const t = this.$store.getters['i18n/t'];
74
82
 
75
83
  const podOptions = [
@@ -88,8 +96,6 @@ export default {
88
96
  { label: t('workload.scheduling.affinity.matchExpressions.greaterThan'), value: 'Gt' },
89
97
  ];
90
98
 
91
- const ops = this.type === NODE ? nodeOptions : podOptions;
92
-
93
99
  let rules;
94
100
 
95
101
  // special case for matchFields and matchExpressions
@@ -127,11 +133,8 @@ export default {
127
133
  rules.push(newRule);
128
134
  }
129
135
 
130
- return {
131
- ops,
132
- rules,
133
- custom: []
134
- };
136
+ this.rules = rules;
137
+ this.ops = this.type === NODE ? nodeOptions : podOptions;
135
138
  },
136
139
 
137
140
  computed: {
@@ -1,5 +1,7 @@
1
1
  <script>
2
- import { mapGetters, mapActions } from 'vuex';
2
+ import { computed, ref, toRef, watch } from 'vue';
3
+ import { mapActions, useStore } from 'vuex';
4
+
3
5
  import { get, set } from '@shell/utils/object';
4
6
  import { sortBy } from '@shell/utils/sort';
5
7
  import { NAMESPACE } from '@shell/config/types';
@@ -8,6 +10,7 @@ import { _VIEW, _EDIT, _CREATE } from '@shell/config/query-params';
8
10
  import { LabeledInput } from '@components/Form/LabeledInput';
9
11
  import LabeledSelect from '@shell/components/form/LabeledSelect';
10
12
  import { normalizeName } from '@shell/utils/kube';
13
+ import { useI18n } from '@shell/composables/useI18n';
11
14
 
12
15
  export default {
13
16
  name: 'NameNsDescription',
@@ -169,81 +172,74 @@ export default {
169
172
  },
170
173
 
171
174
  data() {
172
- const v = this.value;
173
- const metadata = v.metadata;
174
- let namespace, name, description;
175
+ return { createNamespace: false };
176
+ },
175
177
 
176
- if (this.nameKey) {
177
- name = get(v, this.nameKey);
178
- } else {
179
- name = metadata?.name;
180
- }
178
+ setup(props, { emit }) {
179
+ const v = toRef(props.value);
180
+ const metadata = v.value.metadata;
181
+ const namespace = ref(null);
182
+ const name = ref(null);
183
+ const description = ref(null);
181
184
 
182
- if (this.namespaced) {
183
- if (this.forceNamespace) {
184
- namespace = this.forceNamespace;
185
- this.updateNamespace(namespace);
186
- } else if (this.namespaceKey) {
187
- namespace = get(v, this.namespaceKey);
188
- } else {
189
- namespace = metadata?.namespace;
185
+ watch(name, (val) => {
186
+ if (props.normalizeName) {
187
+ val = normalizeName(val);
190
188
  }
191
189
 
192
- if (!namespace && !this.noDefaultNamespace) {
193
- namespace = this.$store.getters['defaultNamespace'];
194
- if (metadata) {
195
- metadata.namespace = namespace;
196
- }
190
+ if (props.nameKey) {
191
+ set(props.value, props.nameKey, val);
192
+ } else {
193
+ props.value.metadata['name'] = val;
197
194
  }
198
- }
195
+ emit('update:value', props.value);
196
+ });
199
197
 
200
- if (this.descriptionKey) {
201
- description = get(v, this.descriptionKey);
198
+ if (props.nameKey) {
199
+ name.value = get(v.value, props.nameKey);
202
200
  } else {
203
- description = metadata?.annotations?.[DESCRIPTION];
201
+ name.value = metadata?.name || '';
204
202
  }
205
203
 
206
- const inStore = this.$store.getters['currentStore']();
207
- const nsSchema = this.$store.getters[`${ inStore }/schemaFor`](NAMESPACE);
204
+ const isCreate = computed(() => {
205
+ return props.mode === _CREATE;
206
+ });
208
207
 
209
- return {
210
- namespace,
211
- name,
212
- description,
213
- createNamespace: false,
214
- nsSchema
215
- };
216
- },
208
+ const store = useStore();
209
+ const { t } = useI18n(store);
210
+ const allowedNamespaces = computed(() => store.getters.allowedNamespaces());
211
+ const storeNamespaces = computed(() => store.getters.namespaces());
212
+ const currentCluster = computed(() => store.getters.currentCluster);
217
213
 
218
- computed: {
219
- ...mapGetters(['currentProduct', 'currentCluster', 'namespaces', 'allowedNamespaces']),
220
- ...mapActions('cru-resource', ['setCreateNamespace']),
221
- namespaceReallyDisabled() {
222
- return (
223
- !!this.forceNamespace || this.namespaceDisabled || this.mode === _EDIT
224
- ); // namespace is never editable
225
- },
214
+ const inStore = computed(() => {
215
+ return store.getters['currentStore']();
216
+ });
226
217
 
227
- nameReallyDisabled() {
228
- return this.nameDisabled || (this.mode === _EDIT && !this.nameEditable);
229
- },
218
+ const nsSchema = computed(() => {
219
+ return store.getters[`${ inStore.value }/schemaFor`](NAMESPACE);
220
+ });
221
+
222
+ const canCreateNamespace = computed(() => {
223
+ // Check if user can push to namespaces... and as the ns is outside of a project restrict to admins and cluster owners
224
+ return (nsSchema.value?.collectionMethods || []).includes('POST') && currentCluster.value?.canUpdate;
225
+ });
230
226
 
231
227
  /**
232
228
  * Map namespaces from the store to options, adding divider and create button
233
229
  */
234
- options() {
230
+ const options = computed(() => {
235
231
  let namespaces;
236
232
 
237
- if (this.namespacesOverride) {
233
+ if (props.namespacesOverride) {
238
234
  // Use the resources provided
239
- namespaces = this.namespacesOverride;
235
+ namespaces = props.namespacesOverride;
240
236
  } else {
241
- if (this.namespaceOptions) {
237
+ if (props.namespaceOptions) {
242
238
  // Use the namespaces provided
243
- namespaces = (this.namespaceOptions.map((ns) => ns.name) || []).sort();
239
+ namespaces = (props.namespaceOptions.map((ns) => ns.name) || []).sort();
244
240
  } else {
245
241
  // Determine the namespaces
246
- const namespaceObjs = this.isCreate ? this.allowedNamespaces() : this.namespaces();
242
+ const namespaceObjs = isCreate.value ? allowedNamespaces.value : storeNamespaces.value;
247
243
 
248
244
  namespaces = Object.keys(namespaceObjs);
249
245
  }
@@ -251,22 +247,22 @@ export default {
251
247
 
252
248
  const options = namespaces
253
249
  .map((namespace) => ({ nameDisplay: namespace, id: namespace }))
254
- .map(this.namespaceMapper || ((obj) => ({
250
+ .map(props.namespaceMapper || ((obj) => ({
255
251
  label: obj.nameDisplay,
256
252
  value: obj.id,
257
253
  })));
258
254
 
259
255
  const sortedByLabel = sortBy(options, 'label');
260
256
 
261
- if (this.forceNamespace) {
257
+ if (props.forceNamespace) {
262
258
  sortedByLabel.unshift({
263
- label: this.forceNamespace,
264
- value: this.forceNamespace,
259
+ label: props.forceNamespace,
260
+ value: props.forceNamespace,
265
261
  });
266
262
  }
267
263
 
268
264
  const createButton = {
269
- label: this.t('namespace.createNamespace'),
265
+ label: t('namespace.createNamespace'),
270
266
  value: '',
271
267
  kind: 'highlighted'
272
268
  };
@@ -276,20 +272,78 @@ export default {
276
272
  kind: 'divider'
277
273
  };
278
274
 
279
- const createOverhead = this.canCreateNamespace || this.createNamespaceOverride ? [createButton, divider] : [];
275
+ const createOverhead = canCreateNamespace.value || props.createNamespaceOverride ? [createButton, divider] : [];
280
276
 
281
277
  return [
282
278
  ...createOverhead,
283
279
  ...sortedByLabel
284
280
  ];
281
+ });
282
+
283
+ const updateNamespace = (val) => {
284
+ if (props.forceNamespace) {
285
+ val = props.forceNamespace;
286
+ }
287
+
288
+ if (props.namespaced) {
289
+ emit('isNamespaceNew', !val || (options.value && !options.value.find((n) => n.value === val)));
290
+ }
291
+
292
+ if (props.namespaceKey) {
293
+ set(props.value, props.namespaceKey, val);
294
+ } else {
295
+ props.value.metadata.namespace = val;
296
+ }
297
+ };
298
+
299
+ if (props.namespaced) {
300
+ if (props.forceNamespace) {
301
+ namespace.value = toRef(props.forceNamespace);
302
+ updateNamespace(namespace);
303
+ } else if (props.namespaceKey) {
304
+ namespace.value = get(v, props.namespaceKey);
305
+ } else {
306
+ namespace.value = metadata?.namespace;
307
+ }
308
+
309
+ if (!namespace.value && !props.noDefaultNamespace) {
310
+ namespace.value = store.getters['defaultNamespace'];
311
+ if (metadata) {
312
+ metadata.namespace = namespace;
313
+ }
314
+ }
315
+ }
316
+
317
+ if (props.descriptionKey) {
318
+ description.value = get(v, props.descriptionKey);
319
+ } else {
320
+ description.value = metadata?.annotations?.[DESCRIPTION];
321
+ }
322
+
323
+ return {
324
+ namespace,
325
+ name,
326
+ description,
327
+ isCreate,
328
+ options,
329
+ updateNamespace,
330
+ };
331
+ },
332
+
333
+ computed: {
334
+ ...mapActions('cru-resource', ['setCreateNamespace']),
335
+ namespaceReallyDisabled() {
336
+ return (
337
+ !!this.forceNamespace || this.namespaceDisabled || this.mode === _EDIT
338
+ ); // namespace is never editable
285
339
  },
286
340
 
287
- isView() {
288
- return this.mode === _VIEW;
341
+ nameReallyDisabled() {
342
+ return this.nameDisabled || (this.mode === _EDIT && !this.nameEditable);
289
343
  },
290
344
 
291
- isCreate() {
292
- return this.mode === _CREATE;
345
+ isView() {
346
+ return this.mode === _VIEW;
293
347
  },
294
348
 
295
349
  showCustomize() {
@@ -308,27 +362,9 @@ export default {
308
362
 
309
363
  return `span-${ span }`;
310
364
  },
311
-
312
- canCreateNamespace() {
313
- // Check if user can push to namespaces... and as the ns is outside of a project restrict to admins and cluster owners
314
- return (this.nsSchema?.collectionMethods || []).includes('POST') && this.currentCluster?.canUpdate;
315
- }
316
365
  },
317
366
 
318
367
  watch: {
319
- name(val) {
320
- if (this.normalizeName) {
321
- val = normalizeName(val);
322
- }
323
-
324
- if (this.nameKey) {
325
- set(this.value, this.nameKey, val);
326
- } else {
327
- this.value.metadata['name'] = val;
328
- }
329
- this.$emit('update:value', this.value);
330
- },
331
-
332
368
  namespace(val) {
333
369
  this.updateNamespace(val);
334
370
  this.$emit('update:value', this.value);
@@ -346,29 +382,13 @@ export default {
346
382
 
347
383
  mounted() {
348
384
  this.$nextTick(() => {
349
- if (this.$refs.name) {
350
- this.$refs.name.focus();
385
+ if (this.$refs.nameInput) {
386
+ this.$refs.nameInput.focus();
351
387
  }
352
388
  });
353
389
  },
354
390
 
355
391
  methods: {
356
- updateNamespace(val) {
357
- if (this.forceNamespace) {
358
- val = this.forceNamespace;
359
- }
360
-
361
- if (this.namespaced) {
362
- this.$emit('isNamespaceNew', !val || (this.options && !this.options.find((n) => n.value === val)));
363
- }
364
-
365
- if (this.namespaceKey) {
366
- set(this.value, this.namespaceKey, val);
367
- } else {
368
- this.value.metadata.namespace = val;
369
- }
370
- },
371
-
372
392
  changeNameAndNamespace(e) {
373
393
  this.name = (e.text || '').toLowerCase();
374
394
  this.namespace = e.selected;
@@ -389,7 +409,7 @@ export default {
389
409
  true,
390
410
  );
391
411
  this.$emit('isNamespaceNew', true);
392
- this.$nextTick(() => this.$refs.namespace.focus());
412
+ this.$nextTick(() => this.$refs.namespaceInput.focus());
393
413
  } else {
394
414
  this.createNamespace = false;
395
415
  this.$store.dispatch(
@@ -411,7 +431,7 @@ export default {
411
431
  class="col span-3"
412
432
  >
413
433
  <LabeledInput
414
- ref="namespace"
434
+ ref="namespaceInput"
415
435
  v-model:value="namespace"
416
436
  :label="t('namespace.label')"
417
437
  :placeholder="t('namespace.createNamespace')"
@@ -459,9 +479,10 @@ export default {
459
479
  class="col span-3"
460
480
  >
461
481
  <LabeledInput
462
- ref="name"
482
+ ref="nameInput"
463
483
  key="name"
464
484
  v-model:value="name"
485
+ data-testid="NameNsDescriptionNameInput"
465
486
  :label="t(nameLabel)"
466
487
  :placeholder="t(namePlaceholder)"
467
488
  :disabled="nameReallyDisabled"
@@ -473,7 +494,6 @@ export default {
473
494
  </div>
474
495
 
475
496
  <slot name="customize" />
476
- <!-- // TODO: here goes the custom component -->
477
497
  <div
478
498
  v-show="!descriptionHidden"
479
499
  :data-testid="componentTestid + '-description'"
@@ -29,6 +29,20 @@ export default {
29
29
 
30
30
  data() {
31
31
  const t = this.$store.getters['i18n/t'];
32
+
33
+ return {
34
+ dnsPolicy: this.value.dnsPolicy || 'ClusterFirst',
35
+ networkMode: this.value.hostNetwork ? { label: t('workload.networking.networkMode.options.hostNetwork'), value: true } : { label: t('workload.networking.networkMode.options.normal'), value: false },
36
+ hostAliases: [],
37
+ nameservers: null,
38
+ searches: null,
39
+ hostname: null,
40
+ subdomain: null,
41
+ options: null,
42
+ };
43
+ },
44
+
45
+ created() {
32
46
  const hostAliases = (this.value.hostAliases || []).map((entry) => {
33
47
  return {
34
48
  ip: entry.ip,
@@ -38,18 +52,12 @@ export default {
38
52
  const { dnsConfig = {}, hostname, subdomain } = this.value;
39
53
  const { nameservers, searches, options } = dnsConfig;
40
54
 
41
- const out = {
42
- dnsPolicy: this.value.dnsPolicy || 'ClusterFirst',
43
- networkMode: this.value.hostNetwork ? { label: t('workload.networking.networkMode.options.hostNetwork'), value: true } : { label: t('workload.networking.networkMode.options.normal'), value: false },
44
- hostAliases,
45
- nameservers,
46
- searches,
47
- hostname,
48
- subdomain,
49
- options
50
- };
51
-
52
- return out;
55
+ this.hostAliases = hostAliases;
56
+ this.nameservers = nameservers;
57
+ this.searches = searches;
58
+ this.hostname = hostname;
59
+ this.subdomain = subdomain;
60
+ this.options = options;
53
61
  },
54
62
 
55
63
  computed: {
@@ -42,31 +42,18 @@ export default {
42
42
  data() {
43
43
  // VolumeNodeAffinity only has 'required' field
44
44
  if (this.value.required) {
45
- return { nodeSelectorTerms: this.value.required.nodeSelectorTerms };
46
45
  } else {
47
- const { preferredDuringSchedulingIgnoredDuringExecution = [], requiredDuringSchedulingIgnoredDuringExecution = {} } = this.value;
48
- const { nodeSelectorTerms = [] } = requiredDuringSchedulingIgnoredDuringExecution;
49
- const allSelectorTerms = [...preferredDuringSchedulingIgnoredDuringExecution, ...nodeSelectorTerms].map((term) => {
50
- const neu = clone(term);
51
-
52
- neu._id = randomStr(4);
53
- if (term.preference) {
54
- Object.assign(neu, term.preference);
55
- delete neu.preference;
56
- }
57
-
58
- return neu;
59
- });
60
-
61
- return {
62
- allSelectorTerms,
63
- weightedNodeSelectorTerms: preferredDuringSchedulingIgnoredDuringExecution,
64
- defaultWeight: 1,
65
- // rules in MatchExpressions.vue can not catch changes what happens on parent component
66
- // we need re-render it via key changing
67
- rerenderNums: randomStr(4)
68
- };
69
46
  }
47
+
48
+ return {
49
+ nodeSelectorTerms: null,
50
+ allSelectorTerms: null,
51
+ weightedNodeSelectorTerms: null,
52
+ defaultWeight: 1,
53
+ // rules in MatchExpressions.vue can not catch changes what happens on parent component
54
+ // we need re-render it via key changing
55
+ rerenderNums: randomStr(4)
56
+ };
70
57
  },
71
58
 
72
59
  computed: {
@@ -88,6 +75,27 @@ export default {
88
75
  },
89
76
 
90
77
  created() {
78
+ if (this.value.required) {
79
+ this.nodeSelectorTerms = this.value.required.nodeSelectorTerms;
80
+ } else {
81
+ const { preferredDuringSchedulingIgnoredDuringExecution = [], requiredDuringSchedulingIgnoredDuringExecution = {} } = this.value;
82
+ const { nodeSelectorTerms = [] } = requiredDuringSchedulingIgnoredDuringExecution;
83
+ const allSelectorTerms = [...preferredDuringSchedulingIgnoredDuringExecution, ...nodeSelectorTerms].map((term) => {
84
+ const neu = clone(term);
85
+
86
+ neu._id = randomStr(4);
87
+ if (term.preference) {
88
+ Object.assign(neu, term.preference);
89
+ delete neu.preference;
90
+ }
91
+
92
+ return neu;
93
+ });
94
+
95
+ this.allSelectorTerms = allSelectorTerms;
96
+ this.weightedNodeSelectorTerms = preferredDuringSchedulingIgnoredDuringExecution;
97
+ }
98
+
91
99
  this.queueUpdate = debounce(this.update, 500);
92
100
  },
93
101
 
@@ -40,6 +40,15 @@ export default {
40
40
  },
41
41
 
42
42
  data() {
43
+ return {
44
+ selectNode: null,
45
+ nodeName: '',
46
+ nodeAffinity: {},
47
+ nodeSelector: {},
48
+ };
49
+ },
50
+
51
+ created() {
43
52
  const isHarvester = this.$store.getters['currentProduct'].inStore === VIRTUAL;
44
53
 
45
54
  let { nodeName = '' } = this.value;
@@ -65,9 +74,10 @@ export default {
65
74
  nodeAffinity['preferredDuringSchedulingIgnoredDuringExecution'] = [];
66
75
  }
67
76
 
68
- return {
69
- selectNode, nodeName, nodeAffinity, nodeSelector
70
- };
77
+ this.selectNode = selectNode;
78
+ this.nodeName = nodeName;
79
+ this.nodeAffinity = nodeAffinity;
80
+ this.nodeSelector = nodeSelector;
71
81
  },
72
82
 
73
83
  computed: {