@rancher/shell 3.0.5-rc.6 → 3.0.5-rc.8
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/brand/classic/metadata.json +3 -0
- package/assets/styles/app.scss +1 -0
- package/assets/styles/base/_color.scss +16 -0
- package/assets/styles/base/_helpers.scss +10 -0
- package/assets/styles/base/_variables.scss +18 -12
- package/assets/styles/fonts/_icons.scss +1 -32
- package/assets/styles/global/_layout.scss +1 -1
- package/assets/styles/themes/_dark.scss +262 -258
- package/assets/styles/themes/_light.scss +538 -509
- package/assets/styles/themes/_modern.scss +914 -0
- package/assets/translations/en-us.yaml +110 -29
- package/chart/__tests__/S3.test.ts +2 -1
- package/cloud-credential/generic.vue +18 -10
- package/cloud-credential/harvester.vue +1 -9
- package/components/AdvancedSection.vue +8 -0
- package/components/ChartReadme.vue +17 -7
- package/components/CodeMirror.vue +1 -1
- package/components/Drawer/Chrome.vue +0 -1
- package/components/Drawer/ResourceDetailDrawer/__tests__/composables.test.ts +27 -28
- package/components/Drawer/ResourceDetailDrawer/composables.ts +4 -24
- package/components/Drawer/ResourceDetailDrawer/index.vue +18 -4
- package/components/InstallHelmCharts.vue +656 -0
- package/components/LazyImage.vue +60 -4
- package/components/Loading.vue +1 -1
- package/components/LocaleSelector.vue +7 -2
- package/components/Markdown.vue +4 -0
- package/components/PaginatedResourceTable.vue +46 -1
- package/components/PromptRestore.vue +22 -44
- package/components/Resource/Detail/Masthead/composable.ts +16 -0
- package/components/Resource/Detail/Masthead/index.vue +37 -0
- package/components/Resource/Detail/Metadata/IdentifyingInformation/composable.ts +10 -2
- package/components/Resource/Detail/Metadata/IdentifyingInformation/identifying-fields.ts +26 -7
- package/components/Resource/Detail/Metadata/IdentifyingInformation/index.vue +8 -1
- package/components/Resource/Detail/Metadata/KeyValue.vue +12 -10
- package/components/Resource/Detail/Metadata/Rectangle.vue +3 -1
- package/components/Resource/Detail/Metadata/__tests__/composables.test.ts +10 -17
- package/components/Resource/Detail/Metadata/composables.ts +9 -7
- package/components/Resource/Detail/Metadata/index.vue +17 -2
- package/components/Resource/Detail/Page.vue +35 -21
- package/components/Resource/Detail/SpacedRow.vue +1 -1
- package/components/Resource/Detail/TitleBar/__tests__/composables.test.ts +8 -9
- package/components/Resource/Detail/TitleBar/composables.ts +5 -5
- package/components/Resource/Detail/TitleBar/index.vue +12 -3
- package/components/ResourceDetail/Masthead/legacy.vue +1 -1
- package/components/ResourceDetail/index.vue +569 -72
- package/components/ResourceList/index.vue +1 -0
- package/components/ResourceTable.vue +6 -1
- package/components/ResourceYaml.vue +1 -1
- package/components/RichTranslation.vue +106 -0
- package/components/SlideInPanelManager.vue +13 -10
- package/components/SortableTable/index.vue +5 -5
- package/components/SortableTable/selection.js +0 -1
- package/components/Tabbed/index.vue +35 -4
- package/components/__tests__/LazyImage.spec.ts +121 -0
- package/components/__tests__/PromptRestore.test.ts +1 -65
- package/components/__tests__/RichTranslation.test.ts +115 -0
- package/components/fleet/FleetStatus.vue +4 -0
- package/components/fleet/dashboard/ResourcePanel.vue +2 -1
- package/components/form/ClusterAppearance.vue +5 -0
- package/components/form/FileImageSelector.vue +1 -1
- package/components/form/Members/ClusterPermissionsEditor.vue +1 -1
- package/components/form/NameNsDescription.vue +1 -0
- package/components/form/Networking.vue +24 -19
- package/components/form/ProjectMemberEditor.vue +1 -1
- package/components/form/ResourceLabeledSelect.vue +22 -8
- package/components/form/ResourceTabs/index.vue +20 -0
- package/components/form/SecretSelector.vue +9 -0
- package/components/form/SelectOrCreateAuthSecret.vue +6 -3
- package/components/form/__tests__/Networking.test.ts +116 -0
- package/components/form/labeled-select-utils/labeled-select-pagination.ts +3 -38
- package/components/formatter/FleetApplicationSource.vue +25 -17
- package/components/formatter/PodImages.vue +1 -1
- package/components/formatter/__tests__/LiveDate.test.ts +10 -2
- package/components/google/AccountAccess.vue +44 -46
- package/components/nav/Favorite.vue +4 -0
- package/components/nav/Group.vue +4 -1
- package/components/nav/NotificationCenter/Notification.vue +1 -27
- package/components/nav/WindowManager/index.vue +3 -3
- package/composables/resources.ts +2 -2
- package/config/labels-annotations.js +3 -2
- package/config/pagination-table-headers.js +8 -1
- package/config/product/explorer.js +27 -2
- package/config/product/manager.js +0 -1
- package/config/query-params.js +10 -0
- package/config/router/routes.js +21 -1
- package/config/system-namespaces.js +1 -1
- package/config/table-headers.js +30 -1
- package/config/types.js +1 -1
- package/config/version.js +1 -1
- package/detail/__tests__/provisioning.cattle.io.cluster.test.ts +11 -0
- package/detail/__tests__/workload.test.ts +164 -0
- package/detail/configmap.vue +33 -75
- package/detail/projectsecret.vue +11 -0
- package/detail/provisioning.cattle.io.cluster.vue +351 -369
- package/detail/secret.vue +49 -308
- package/detail/workload/index.vue +38 -21
- package/dialog/InstallExtensionDialog.vue +8 -5
- package/dialog/RotateEncryptionKeyDialog.vue +10 -30
- package/edit/__tests__/fleet.cattle.io.helmop.test.ts +224 -0
- package/edit/auth/ldap/__tests__/config.test.ts +14 -0
- package/edit/auth/ldap/config.vue +24 -0
- package/edit/compliance.cattle.io.clusterscan.vue +1 -1
- package/edit/configmap.vue +4 -1
- package/edit/fleet.cattle.io.gitrepo.vue +5 -6
- package/edit/fleet.cattle.io.helmop.vue +78 -56
- package/edit/logging.banzaicloud.io.output/index.vue +1 -1
- package/edit/logging.banzaicloud.io.output/providers/awsElasticsearch.vue +5 -6
- package/edit/networking.k8s.io.ingress/Certificate.vue +20 -22
- package/edit/networking.k8s.io.ingress/DefaultBackend.vue +8 -3
- package/edit/networking.k8s.io.ingress/Rule.vue +2 -5
- package/edit/networking.k8s.io.ingress/RulePath.vue +17 -11
- package/edit/networking.k8s.io.ingress/__tests__/Certificate.test.ts +165 -0
- package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +11 -10
- package/edit/networking.k8s.io.networkpolicy/PolicyRules.vue +1 -3
- package/edit/networking.k8s.io.networkpolicy/index.vue +17 -17
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +3 -2
- package/edit/provisioning.cattle.io.cluster/rke2.vue +123 -61
- package/edit/provisioning.cattle.io.cluster/tabs/AgentConfiguration.vue +9 -7
- package/edit/provisioning.cattle.io.cluster/tabs/Basics.vue +22 -13
- package/edit/provisioning.cattle.io.cluster/tabs/DirectoryConfig.vue +10 -12
- package/edit/provisioning.cattle.io.cluster/tabs/MachinePool.vue +39 -38
- package/edit/provisioning.cattle.io.cluster/tabs/etcd/S3Config.vue +41 -19
- package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +16 -3
- package/edit/provisioning.cattle.io.cluster/tabs/registries/RegistryConfigs.vue +32 -33
- package/edit/provisioning.cattle.io.cluster/tabs/registries/RegistryMirrors.vue +9 -10
- package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +1 -3
- package/edit/provisioning.cattle.io.cluster/tabs/upgrade/DrainOptions.vue +16 -9
- package/edit/secret/basic.vue +1 -0
- package/edit/secret/index.vue +126 -15
- package/edit/workload/index.vue +5 -14
- package/list/projectsecret.vue +345 -0
- package/list/provisioning.cattle.io.cluster.vue +1 -69
- package/list/secret.vue +109 -0
- package/machine-config/__tests__/vmwarevsphere.test.ts +5 -7
- package/machine-config/google.vue +9 -1
- package/machine-config/vmwarevsphere.vue +7 -17
- package/mixins/__tests__/brand.spec.ts +2 -2
- package/mixins/chart.js +0 -2
- package/mixins/create-edit-view/impl.js +10 -1
- package/mixins/resource-fetch-api-pagination.js +11 -12
- package/mixins/resource-fetch.js +3 -1
- package/models/__tests__/chart.test.ts +111 -80
- package/models/__tests__/fleet.cattle.io.helmop.test.ts +224 -0
- package/models/__tests__/node.test.ts +7 -63
- package/models/catalog.cattle.io.app.js +1 -1
- package/models/catalog.cattle.io.operation.js +1 -1
- package/models/chart.js +36 -20
- package/models/cloudcredential.js +2 -163
- package/models/cluster/node.js +7 -7
- package/models/cluster.x-k8s.io.machine.js +3 -3
- package/models/cluster.x-k8s.io.machinedeployment.js +11 -2
- package/models/compliance.cattle.io.clusterscan.js +2 -2
- package/models/configmap.js +4 -0
- package/models/constraints.gatekeeper.sh.constraint.js +1 -1
- package/models/fleet-application.js +0 -17
- package/models/fleet.cattle.io.cluster.js +2 -2
- package/models/fleet.cattle.io.gitrepo.js +15 -1
- package/models/fleet.cattle.io.helmop.js +26 -22
- package/models/management.cattle.io.setting.js +4 -0
- package/models/persistentvolumeclaim.js +1 -1
- package/models/pod.js +2 -2
- package/models/provisioning.cattle.io.cluster.js +39 -67
- package/models/rke.cattle.io.etcdsnapshot.js +1 -1
- package/models/secret.js +161 -2
- package/models/storage.k8s.io.storageclass.js +2 -2
- package/models/workload.js +3 -3
- package/package.json +11 -10
- package/pages/c/_cluster/apps/charts/AppChartCardFooter.vue +1 -0
- package/pages/c/_cluster/apps/charts/AppChartCardSubHeader.vue +4 -1
- package/pages/c/_cluster/apps/charts/__tests__/AppChartCardFooter.spec.js +41 -0
- package/pages/c/_cluster/apps/charts/chart.vue +422 -174
- package/pages/c/_cluster/apps/charts/index.vue +46 -35
- package/pages/c/_cluster/apps/charts/install.vue +1 -1
- package/pages/c/_cluster/explorer/projectsecret.vue +24 -0
- package/pages/c/_cluster/fleet/__tests__/index.test.ts +608 -314
- package/pages/c/_cluster/fleet/index.vue +103 -45
- package/pages/c/_cluster/manager/cloudCredential/index.vue +2 -59
- package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +10 -3
- package/pages/c/_cluster/uiplugins/index.vue +36 -25
- package/plugins/dashboard-store/__tests__/normalize.test.ts +223 -0
- package/plugins/dashboard-store/__tests__/resource-class.test.ts +191 -0
- package/plugins/dashboard-store/__tests__/utils/normalize-usecases.ts +1526 -0
- package/plugins/dashboard-store/actions.js +42 -22
- package/plugins/dashboard-store/normalize.js +29 -17
- package/plugins/dashboard-store/resource-class.js +83 -17
- package/plugins/steve/__tests__/getters.test.ts +1 -1
- package/plugins/steve/__tests__/subscribe.spec.ts +259 -1
- package/plugins/steve/getters.js +8 -2
- package/plugins/steve/resourceWatcher.js +10 -3
- package/plugins/steve/steve-pagination-utils.ts +14 -3
- package/plugins/steve/subscribe.js +192 -19
- package/plugins/steve/worker/web-worker.advanced.js +2 -0
- package/rancher-components/Card/Card.vue +0 -18
- package/rancher-components/Pill/RcStatusBadge/RcStatusBadge.test.ts +15 -0
- package/rancher-components/Pill/RcStatusBadge/RcStatusBadge.vue +65 -0
- package/rancher-components/Pill/RcStatusBadge/index.ts +2 -0
- package/rancher-components/Pill/RcStatusBadge/types.ts +5 -0
- package/rancher-components/Pill/RcStatusIndicator/RcStatusIndicator.test.ts +33 -0
- package/rancher-components/Pill/RcStatusIndicator/RcStatusIndicator.vue +75 -0
- package/rancher-components/Pill/RcStatusIndicator/index.ts +2 -0
- package/rancher-components/Pill/RcStatusIndicator/types.ts +7 -0
- package/rancher-components/Pill/types.ts +2 -0
- package/rancher-components/RcButton/RcButton.vue +1 -1
- package/rancher-components/RcDropdown/RcDropdown.test.ts +98 -0
- package/rancher-components/RcDropdown/RcDropdown.vue +5 -0
- package/rancher-components/RcDropdown/RcDropdownItem.vue +7 -1
- package/rancher-components/RcDropdown/RcDropdownItemCheckbox.vue +2 -1
- package/rancher-components/RcDropdown/RcDropdownItemSelect.vue +2 -1
- package/rancher-components/RcDropdown/useDropdownContext.ts +21 -0
- package/rancher-components/RcDropdown/useDropdownItem.ts +30 -1
- package/rancher-components/RcItemCard/RcItemCard.test.ts +20 -0
- package/rancher-components/RcItemCard/RcItemCard.vue +40 -6
- package/store/__tests__/catalog.test.ts +93 -1
- package/store/aws.js +19 -8
- package/store/catalog.js +8 -3
- package/types/kube/kube-api.ts +12 -0
- package/types/resources/settings.d.ts +1 -1
- package/types/shell/index.d.ts +643 -585
- package/types/store/pagination.types.ts +16 -6
- package/types/uiplugins.ts +73 -0
- package/utils/__tests__/back-off.test.ts +354 -0
- package/utils/__tests__/create-yaml.test.ts +235 -0
- package/utils/__tests__/kontainer.test.ts +19 -0
- package/utils/__tests__/uiplugins.test.ts +84 -0
- package/utils/back-off.ts +176 -0
- package/utils/create-yaml.js +103 -9
- package/utils/dynamic-importer.js +8 -0
- package/utils/kontainer.ts +3 -5
- package/utils/pagination-utils.ts +18 -0
- package/utils/style.ts +3 -0
- package/utils/uiplugins.ts +29 -2
- package/utils/validators/__tests__/setting.test.js +92 -0
- package/utils/validators/formRules/__tests__/index.test.ts +88 -7
- package/utils/validators/formRules/index.ts +83 -8
- package/utils/validators/setting.js +17 -0
- package/cloud-credential/__tests__/harvester.test.ts +0 -18
- package/components/ResourceDetail/__tests__/index.test.ts +0 -135
- package/components/ResourceDetail/legacy.vue +0 -562
- package/components/formatter/CloudCredExpired.vue +0 -69
- package/models/etcdbackup.js +0 -45
- package/pages/explorer/resource/detail/configmap.vue +0 -42
- package/pages/explorer/resource/detail/secret.vue +0 -50
- package/utils/aws.js +0 -0
|
@@ -25,21 +25,27 @@ export default {
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
data() {
|
|
28
|
-
const defaultCert = {
|
|
29
|
-
label: this.t('ingress.certificates.defaultCertLabel'),
|
|
30
|
-
value: DEFAULT_CERT_VALUE,
|
|
31
|
-
};
|
|
32
|
-
const { hosts = [''], secretName = defaultCert.value } = this.value;
|
|
33
|
-
|
|
34
28
|
return {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
secretName,
|
|
29
|
+
hosts: this.value?.hosts ?? [''],
|
|
30
|
+
secretName: this.value?.secretName === undefined ? DEFAULT_CERT_VALUE : this.value?.secretName,
|
|
31
|
+
secretVal: this.value?.secretName ?? DEFAULT_CERT_VALUE,
|
|
38
32
|
};
|
|
39
33
|
},
|
|
34
|
+
watch: {
|
|
35
|
+
value(newVal) {
|
|
36
|
+
this.hosts = newVal.hosts;
|
|
37
|
+
this.secretName = newVal.secretName;
|
|
38
|
+
this.secretVal = this.secretName === null ? DEFAULT_CERT_VALUE : this.secretName;
|
|
39
|
+
},
|
|
40
|
+
},
|
|
40
41
|
computed: {
|
|
41
42
|
certsWithDefault() {
|
|
42
|
-
|
|
43
|
+
const defaultCert = {
|
|
44
|
+
label: this.t('ingress.certificates.defaultCertLabel'),
|
|
45
|
+
value: DEFAULT_CERT_VALUE,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return [defaultCert, ...this.certs.map((c) => ({ label: c, value: c }))];
|
|
43
49
|
},
|
|
44
50
|
certificateStatus() {
|
|
45
51
|
const isValueAnOption = !this.secretName || this.certsWithDefault.find((cert) => this.secretName === cert.value);
|
|
@@ -51,15 +57,10 @@ export default {
|
|
|
51
57
|
},
|
|
52
58
|
},
|
|
53
59
|
methods: {
|
|
54
|
-
addHost(ev) {
|
|
55
|
-
ev.preventDefault();
|
|
56
|
-
this.hosts.push('');
|
|
57
|
-
this.update();
|
|
58
|
-
},
|
|
59
60
|
update() {
|
|
60
61
|
const out = { hosts: this.hosts };
|
|
61
62
|
|
|
62
|
-
out.secretName = this.
|
|
63
|
+
out.secretName = this.secretVal;
|
|
63
64
|
|
|
64
65
|
if (out.secretName === DEFAULT_CERT_VALUE) {
|
|
65
66
|
out.secretName = null;
|
|
@@ -68,7 +69,7 @@ export default {
|
|
|
68
69
|
this.$emit('update:value', out);
|
|
69
70
|
},
|
|
70
71
|
onSecretInput(e) {
|
|
71
|
-
this.
|
|
72
|
+
this.secretVal = e && typeof e === 'object' ? e.label : e;
|
|
72
73
|
this.update();
|
|
73
74
|
},
|
|
74
75
|
onHostsInput(e) {
|
|
@@ -80,13 +81,10 @@ export default {
|
|
|
80
81
|
</script>
|
|
81
82
|
|
|
82
83
|
<template>
|
|
83
|
-
<div
|
|
84
|
-
class="cert row"
|
|
85
|
-
@update:value="update"
|
|
86
|
-
>
|
|
84
|
+
<div class="cert row">
|
|
87
85
|
<div class="col span-6">
|
|
88
86
|
<LabeledSelect
|
|
89
|
-
v-model:value="
|
|
87
|
+
v-model:value="secretVal"
|
|
90
88
|
class="secret-name"
|
|
91
89
|
:options="certsWithDefault"
|
|
92
90
|
:label="t('ingress.certificates.certificate.label')"
|
|
@@ -34,11 +34,16 @@ export default {
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
data() {
|
|
37
|
+
return {
|
|
38
|
+
serviceName: '',
|
|
39
|
+
servicePort: '',
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
created() {
|
|
37
43
|
const backend = get(this.value.spec, this.value.defaultBackendPath);
|
|
38
|
-
const serviceName = get(backend, this.value.serviceNamePath) || '';
|
|
39
|
-
const servicePort = get(backend, this.value.servicePortPath) || '';
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
this.serviceName = get(backend, this.value.serviceNamePath) || '';
|
|
46
|
+
this.servicePort = get(backend, this.value.servicePortPath) || '';
|
|
42
47
|
},
|
|
43
48
|
computed: {
|
|
44
49
|
isView() {
|
|
@@ -32,12 +32,9 @@ export default {
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
data() {
|
|
35
|
-
const { host = '', http = {} } = this.value;
|
|
36
|
-
const { paths = [{ id: random32(1) }] } = http;
|
|
37
|
-
|
|
38
35
|
return {
|
|
39
|
-
host,
|
|
40
|
-
paths,
|
|
36
|
+
host: this.value?.host ?? '',
|
|
37
|
+
paths: this.value?.http?.paths ?? [{ id: random32(1) }],
|
|
41
38
|
ruleMode: this.value.asDefault ? 'asDefault' : 'setHost',
|
|
42
39
|
};
|
|
43
40
|
},
|
|
@@ -34,24 +34,21 @@ export default {
|
|
|
34
34
|
type: Object,
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
setup() {
|
|
38
38
|
const pathTypes = [
|
|
39
39
|
'Prefix',
|
|
40
40
|
'Exact',
|
|
41
41
|
'ImplementationSpecific'
|
|
42
42
|
];
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
set(this.value.backend, this.ingress.serviceNamePath, get(this.value.backend, this.ingress.serviceNamePath) || '');
|
|
48
|
-
set(this.value.backend, this.ingress.servicePortPath, get(this.value.backend, this.ingress.servicePortPath) || '');
|
|
49
|
-
|
|
50
|
-
const serviceName = get(this.value.backend, this.ingress.serviceNamePath);
|
|
51
|
-
const servicePort = get(this.value.backend, this.ingress.servicePortPath);
|
|
52
|
-
|
|
44
|
+
return { pathTypes };
|
|
45
|
+
},
|
|
46
|
+
data() {
|
|
53
47
|
return {
|
|
54
|
-
|
|
48
|
+
serviceName: undefined,
|
|
49
|
+
servicePort: undefined,
|
|
50
|
+
pathType: this.value.pathType,
|
|
51
|
+
path: this.value.path,
|
|
55
52
|
};
|
|
56
53
|
},
|
|
57
54
|
computed: {
|
|
@@ -77,6 +74,15 @@ export default {
|
|
|
77
74
|
created() {
|
|
78
75
|
this.queueUpdate = debounce(this.update, 500);
|
|
79
76
|
this.queueUpdatePathTypeAndPath = debounce(this.updatePathTypeAndPath, 500);
|
|
77
|
+
|
|
78
|
+
set(this.value, 'backend', this.value.backend || {});
|
|
79
|
+
set(this.value, 'path', this.value.path || '');
|
|
80
|
+
set(this.value, 'pathType', this.value.pathType || this.pathTypes[0]);
|
|
81
|
+
set(this.value.backend, this.ingress.serviceNamePath, get(this.value.backend, this.ingress.serviceNamePath) || '');
|
|
82
|
+
set(this.value.backend, this.ingress.servicePortPath, get(this.value.backend, this.ingress.servicePortPath) || '');
|
|
83
|
+
|
|
84
|
+
this.serviceName = get(this.value.backend, this.ingress.serviceNamePath);
|
|
85
|
+
this.servicePort = get(this.value.backend, this.ingress.servicePortPath);
|
|
80
86
|
},
|
|
81
87
|
methods: {
|
|
82
88
|
update() {
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import Certificate from '../Certificate.vue';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_CERT_VALUE = '__[[DEFAULT_CERT]]__';
|
|
5
|
+
|
|
6
|
+
const createWrapper = (propsData = {}) => {
|
|
7
|
+
return shallowMount(Certificate, { propsData });
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
describe('networking.k8s.io.ingress/Certificate.vue', () => {
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
jest.clearAllMocks();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('initializes with default values', () => {
|
|
16
|
+
const wrapper = createWrapper();
|
|
17
|
+
|
|
18
|
+
expect(wrapper.vm.hosts).toStrictEqual(['']);
|
|
19
|
+
expect(wrapper.vm.secretVal).toStrictEqual(DEFAULT_CERT_VALUE);
|
|
20
|
+
expect(wrapper.vm.secretName).toStrictEqual(DEFAULT_CERT_VALUE);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('initializes with provided props', () => {
|
|
24
|
+
const value = { hosts: ['host1', 'host2'], secretName: 'some-secret' };
|
|
25
|
+
const certs = ['cert1', 'cert2'];
|
|
26
|
+
const rules = { host: ['rule1'] };
|
|
27
|
+
const wrapper = createWrapper({
|
|
28
|
+
value, certs, rules
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
expect(wrapper.vm.hosts).toStrictEqual(['host1', 'host2']);
|
|
32
|
+
expect(wrapper.vm.secretVal).toStrictEqual('some-secret');
|
|
33
|
+
expect(wrapper.vm.secretName).toStrictEqual('some-secret');
|
|
34
|
+
expect(wrapper.vm.certs).toStrictEqual(certs);
|
|
35
|
+
expect(wrapper.vm.rules).toStrictEqual(rules);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('emits update:value when update is called', async() => {
|
|
39
|
+
const wrapper = createWrapper();
|
|
40
|
+
|
|
41
|
+
wrapper.vm.hosts = ['host1'];
|
|
42
|
+
wrapper.vm.secretVal = 'cert1';
|
|
43
|
+
wrapper.vm.update();
|
|
44
|
+
await wrapper.vm.$nextTick();
|
|
45
|
+
expect(wrapper.emitted('update:value')).toBeTruthy();
|
|
46
|
+
expect(wrapper.emitted('update:value')[0][0]).toStrictEqual({
|
|
47
|
+
hosts: ['host1'],
|
|
48
|
+
secretName: 'cert1',
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('sets secretName to null when secretVal is DEFAULT_CERT_VALUE', async() => {
|
|
53
|
+
const wrapper = createWrapper();
|
|
54
|
+
|
|
55
|
+
wrapper.vm.hosts = ['host1'];
|
|
56
|
+
wrapper.vm.secretVal = DEFAULT_CERT_VALUE;
|
|
57
|
+
wrapper.vm.update();
|
|
58
|
+
await wrapper.vm.$nextTick();
|
|
59
|
+
expect(wrapper.emitted('update:value')[0][0].secretName).toBeNull();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('updates secretVal when onSecretInput is called with an object', async() => {
|
|
63
|
+
const wrapper = createWrapper();
|
|
64
|
+
const newCert = { label: 'cert1', value: 'cert1' };
|
|
65
|
+
|
|
66
|
+
wrapper.vm.onSecretInput(newCert);
|
|
67
|
+
await wrapper.vm.$nextTick();
|
|
68
|
+
expect(wrapper.vm.secretVal).toStrictEqual('cert1');
|
|
69
|
+
expect(wrapper.emitted('update:value')).toBeTruthy();
|
|
70
|
+
expect(wrapper.emitted('update:value')[0][0].secretName).toStrictEqual('cert1');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('updates secretVal when onSecretInput is called with a string', async() => {
|
|
74
|
+
const wrapper = createWrapper();
|
|
75
|
+
|
|
76
|
+
wrapper.vm.onSecretInput('cert1');
|
|
77
|
+
await wrapper.vm.$nextTick();
|
|
78
|
+
expect(wrapper.vm.secretVal).toStrictEqual('cert1');
|
|
79
|
+
expect(wrapper.emitted('update:value')).toBeTruthy();
|
|
80
|
+
expect(wrapper.emitted('update:value')[0][0].secretName).toStrictEqual('cert1');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('updates hosts when onHostsInput is called', async() => {
|
|
84
|
+
const wrapper = createWrapper();
|
|
85
|
+
|
|
86
|
+
wrapper.vm.onHostsInput(['host1', 'host2']);
|
|
87
|
+
await wrapper.vm.$nextTick();
|
|
88
|
+
expect(wrapper.vm.hosts).toStrictEqual(['host1', 'host2']);
|
|
89
|
+
expect(wrapper.emitted('update:value')).toBeTruthy();
|
|
90
|
+
expect(wrapper.emitted('update:value')[0][0].hosts).toStrictEqual(['host1', 'host2']);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('computes certsWithDefault correctly', () => {
|
|
94
|
+
const certs = ['cert1', 'cert2'];
|
|
95
|
+
const wrapper = createWrapper({ certs });
|
|
96
|
+
const expectedCerts = [
|
|
97
|
+
{ label: '%ingress.certificates.defaultCertLabel%', value: DEFAULT_CERT_VALUE },
|
|
98
|
+
{ label: 'cert1', value: 'cert1' },
|
|
99
|
+
{ label: 'cert2', value: 'cert2' },
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
expect(wrapper.vm.certsWithDefault).toStrictEqual(expectedCerts);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('returns warning status for non-existent certificate', () => {
|
|
106
|
+
const wrapper = createWrapper({
|
|
107
|
+
certs: ['cert1', 'cert2'],
|
|
108
|
+
value: { hosts: [''], secretName: 'non-existent-cert' },
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
expect(wrapper.vm.certificateStatus).toStrictEqual('warning');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('returns null status for existing certificate', () => {
|
|
115
|
+
const wrapper = createWrapper({
|
|
116
|
+
certs: ['cert1', 'cert2'],
|
|
117
|
+
value: { hosts: [''], secretName: 'cert1' },
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
expect(wrapper.vm.certificateStatus).toBeNull();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('returns null status for default certificate', () => {
|
|
124
|
+
const wrapper = createWrapper({
|
|
125
|
+
certs: ['cert1', 'cert2'],
|
|
126
|
+
value: { hosts: [''], secretName: null },
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
expect(wrapper.vm.certificateStatus).toBeNull();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('returns correct tooltip for non-existent certificate', () => {
|
|
133
|
+
const wrapper = createWrapper({
|
|
134
|
+
certs: ['cert1', 'cert2'],
|
|
135
|
+
value: { hosts: [''], secretName: 'non-existent-cert' },
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
expect(wrapper.vm.certificateTooltip).toStrictEqual('%ingress.certificates.certificate.doesntExist%');
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('returns null tooltip for existing certificate', () => {
|
|
142
|
+
const wrapper = createWrapper({
|
|
143
|
+
certs: ['cert1', 'cert2'],
|
|
144
|
+
value: { hosts: [''], secretName: 'cert1' },
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
expect(wrapper.vm.certificateTooltip).toBeNull();
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('watches value prop changes', async() => {
|
|
151
|
+
const wrapper = createWrapper({ value: { hosts: ['host1'], secretName: 'cert1' } });
|
|
152
|
+
|
|
153
|
+
await wrapper.setProps({ value: { hosts: ['host2'], secretName: 'cert2' } });
|
|
154
|
+
expect(wrapper.vm.hosts).toStrictEqual(['host2']);
|
|
155
|
+
expect(wrapper.vm.secretVal).toStrictEqual('cert2');
|
|
156
|
+
expect(wrapper.vm.secretName).toStrictEqual('cert2');
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('handles null secretName in value prop', async() => {
|
|
160
|
+
const wrapper = createWrapper({ value: { hosts: ['host1'], secretName: null } });
|
|
161
|
+
|
|
162
|
+
expect(wrapper.vm.secretVal).toStrictEqual(DEFAULT_CERT_VALUE);
|
|
163
|
+
expect(wrapper.vm.secretName).toBeNull();
|
|
164
|
+
});
|
|
165
|
+
});
|
|
@@ -47,16 +47,6 @@ export default {
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
data() {
|
|
50
|
-
if (!this.value[TARGET_OPTIONS.IP_BLOCK] &&
|
|
51
|
-
!this.value[TARGET_OPTIONS.POD_SELECTOR] &&
|
|
52
|
-
!this.value[TARGET_OPTIONS.NAMESPACE_SELECTOR] &&
|
|
53
|
-
!this.value[TARGET_OPTIONS.NAMESPACE_AND_POD_SELECTOR]
|
|
54
|
-
) {
|
|
55
|
-
this.$nextTick(() => {
|
|
56
|
-
this.value[TARGET_OPTIONS.IP_BLOCK] = {};
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
50
|
return {
|
|
61
51
|
portOptions: ['TCP', 'UDP'],
|
|
62
52
|
matchingPods: {
|
|
@@ -74,6 +64,17 @@ export default {
|
|
|
74
64
|
debouncedUpdateMatches: debounce(this.updateMatches, 500)
|
|
75
65
|
};
|
|
76
66
|
},
|
|
67
|
+
created() {
|
|
68
|
+
if (!this.value[TARGET_OPTIONS.IP_BLOCK] &&
|
|
69
|
+
!this.value[TARGET_OPTIONS.POD_SELECTOR] &&
|
|
70
|
+
!this.value[TARGET_OPTIONS.NAMESPACE_SELECTOR] &&
|
|
71
|
+
!this.value[TARGET_OPTIONS.NAMESPACE_AND_POD_SELECTOR]
|
|
72
|
+
) {
|
|
73
|
+
this.$nextTick(() => {
|
|
74
|
+
this.value[TARGET_OPTIONS.IP_BLOCK] = {};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
},
|
|
77
78
|
computed: {
|
|
78
79
|
/**
|
|
79
80
|
* of type matchExpression aka `KubeLabelSelectorExpression[]`
|
|
@@ -47,6 +47,23 @@ export default {
|
|
|
47
47
|
},
|
|
48
48
|
|
|
49
49
|
data() {
|
|
50
|
+
return {
|
|
51
|
+
POD,
|
|
52
|
+
matchingPods: {
|
|
53
|
+
matched: 0,
|
|
54
|
+
matches: [],
|
|
55
|
+
none: true,
|
|
56
|
+
sample: null,
|
|
57
|
+
total: 0,
|
|
58
|
+
},
|
|
59
|
+
podTableHeaders: this.$store.getters['type-map/headersFor'](
|
|
60
|
+
this.$store.getters['cluster/schemaFor'](POD)
|
|
61
|
+
),
|
|
62
|
+
inStore: this.$store.getters['currentProduct'].inStore,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
created() {
|
|
50
67
|
if ( !this.value.spec ) {
|
|
51
68
|
this.value['spec'] = {
|
|
52
69
|
policyTypes: [],
|
|
@@ -56,23 +73,6 @@ export default {
|
|
|
56
73
|
}
|
|
57
74
|
};
|
|
58
75
|
}
|
|
59
|
-
|
|
60
|
-
const matchingPods = {
|
|
61
|
-
matched: 0,
|
|
62
|
-
matches: [],
|
|
63
|
-
none: true,
|
|
64
|
-
sample: null,
|
|
65
|
-
total: 0,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
POD,
|
|
70
|
-
matchingPods,
|
|
71
|
-
podTableHeaders: this.$store.getters['type-map/headersFor'](
|
|
72
|
-
this.$store.getters['cluster/schemaFor'](POD)
|
|
73
|
-
),
|
|
74
|
-
inStore: this.$store.getters['currentProduct'].inStore,
|
|
75
|
-
};
|
|
76
76
|
},
|
|
77
77
|
|
|
78
78
|
computed: {
|
|
@@ -240,11 +240,12 @@ describe('component: rke2', () => {
|
|
|
240
240
|
|
|
241
241
|
// we need to mock the "save" method from the create-edit-view-mixin
|
|
242
242
|
// otherwise we get console errors
|
|
243
|
-
jest.spyOn(wrapper.vm, 'save').mockImplementation();
|
|
243
|
+
// jest.spyOn(wrapper.vm, 'save').mockImplementation();
|
|
244
244
|
|
|
245
245
|
await wrapper.vm._doSaveOverride(jest.fn());
|
|
246
|
+
const chartKey = wrapper.vm.chartVersionKey(HARVESTER_CLOUD_PROVIDER);
|
|
246
247
|
|
|
247
|
-
const cloudConfigPath = get(wrapper.vm.
|
|
248
|
+
const cloudConfigPath = get(wrapper.vm.userChartValues, `${ chartKey }.cloudConfigPath`);
|
|
248
249
|
|
|
249
250
|
expect(cloudConfigPath).toStrictEqual('my-k8s-distro-path/etc/config-files/cloud-provider-config');
|
|
250
251
|
});
|