@rancher/shell 3.0.7 → 3.0.8-rc.10
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/suse/banner.svg +1 -0
- package/assets/brand/suse/dark/banner.svg +1 -0
- package/assets/brand/suse/dark/login-landscape.svg +1 -0
- package/assets/brand/suse/dark/rancher-logo.svg +1 -1
- package/assets/brand/suse/favicon.png +0 -0
- package/assets/brand/suse/login-landscape.svg +1 -0
- package/assets/brand/suse/metadata.json +11 -1
- package/assets/brand/suse/rancher-logo.svg +1 -1
- package/assets/fonts/suse/suse-v2-latin-300.woff +0 -0
- package/assets/fonts/suse/suse-v2-latin-300.woff2 +0 -0
- package/assets/fonts/suse/suse-v2-latin-600.woff +0 -0
- package/assets/fonts/suse/suse-v2-latin-600.woff2 +0 -0
- package/assets/fonts/suse/suse-v2-latin-700.woff +0 -0
- package/assets/fonts/suse/suse-v2-latin-700.woff2 +0 -0
- package/assets/fonts/suse/suse-v2-latin-800.woff +0 -0
- package/assets/fonts/suse/suse-v2-latin-800.woff2 +0 -0
- package/assets/fonts/suse/suse-v2-latin-regular.woff +0 -0
- package/assets/fonts/suse/suse-v2-latin-regular.woff2 +0 -0
- package/assets/images/content/README.md +5 -0
- package/assets/images/content/cloud-native.svg +84 -0
- package/assets/images/content/dark/cloud-native.svg +21 -0
- package/assets/images/content/dark/shield.svg +59 -0
- package/assets/images/content/dark/suse.svg +10 -0
- package/assets/images/content/shield.svg +59 -0
- package/assets/images/content/suse.svg +10 -0
- package/assets/images/vendor/githubapp.svg +13 -0
- package/assets/styles/base/_typography.scss +2 -1
- package/assets/styles/fonts/_fontstack.scss +53 -1
- package/assets/styles/global/_cards.scss +0 -3
- package/assets/styles/global/_layout.scss +21 -35
- package/assets/styles/themes/_dark.scss +1 -1
- package/assets/styles/themes/_light.scss +1 -1
- package/assets/styles/themes/_modern.scss +16 -8
- package/assets/styles/themes/_suse.scss +116 -24
- package/assets/translations/en-us.yaml +185 -21
- package/assets/translations/zh-hans.yaml +0 -4
- package/components/AutoscalerCard.vue +113 -0
- package/components/AutoscalerTab.vue +94 -0
- package/components/BackLink.vue +8 -0
- package/components/BannerGraphic.vue +36 -21
- package/components/BrandImage.vue +17 -6
- package/components/ClusterIconMenu.vue +1 -1
- package/components/ClusterProviderIcon.vue +1 -1
- package/components/Cron/CronExpressionEditor.vue +1 -1
- package/components/Cron/CronExpressionEditorModal.vue +1 -1
- package/components/Drawer/Chrome.vue +2 -6
- package/components/Drawer/ResourceDetailDrawer/ConfigTab.vue +4 -9
- package/components/Drawer/ResourceDetailDrawer/YamlTab.vue +3 -8
- package/components/Drawer/ResourceDetailDrawer/composables.ts +3 -4
- package/components/Drawer/ResourceDetailDrawer/index.vue +4 -9
- package/components/Drawer/ResourceDetailDrawer/types.ts +17 -0
- package/components/Drawer/types.ts +3 -0
- package/components/DynamicContent/DynamicContentBanner.vue +102 -0
- package/components/DynamicContent/DynamicContentCloseButton.vue +42 -0
- package/components/DynamicContent/DynamicContentIcon.vue +132 -0
- package/components/DynamicContent/DynamicContentPanel.vue +112 -0
- package/components/DynamicContent/content.ts +78 -0
- package/components/EmberPage.vue +1 -1
- package/components/IconOrSvg.vue +2 -2
- package/components/Inactivity.vue +222 -106
- package/components/InstallHelmCharts.vue +2 -2
- package/components/PaginatedResourceTable.vue +2 -6
- package/components/PopoverCard.vue +192 -0
- package/components/Questions/__tests__/index.test.ts +159 -0
- package/components/Resource/Detail/CopyToClipboard.vue +4 -1
- package/components/Resource/Detail/FetchLoader/composables.ts +18 -4
- package/components/Resource/Detail/Metadata/Annotations/index.vue +2 -2
- package/components/Resource/Detail/Metadata/IdentifyingInformation/__tests__/identifying-fields.test.ts +1 -1
- package/components/Resource/Detail/Metadata/IdentifyingInformation/identifying-fields.ts +4 -0
- package/components/Resource/Detail/Metadata/KeyValueRow.vue +1 -1
- package/components/Resource/Detail/Metadata/Labels/index.vue +2 -2
- package/components/Resource/Detail/Metadata/composables.ts +9 -9
- package/components/Resource/Detail/Metadata/index.vue +3 -3
- package/components/Resource/Detail/ResourcePopover/ResourcePopoverCard.vue +2 -19
- package/components/Resource/Detail/ResourcePopover/__tests__/ResourcePopoverCard.test.ts +0 -29
- package/components/Resource/Detail/ResourcePopover/__tests__/index.test.ts +132 -150
- package/components/Resource/Detail/ResourcePopover/index.vue +54 -159
- package/components/Resource/Detail/TitleBar/__tests__/index.test.ts +0 -2
- package/components/Resource/Detail/TitleBar/composables.ts +2 -1
- package/components/Resource/Detail/TitleBar/index.vue +10 -6
- package/components/Resource/Detail/composables.ts +12 -0
- package/components/ResourceDetail/Masthead/latest.vue +29 -0
- package/components/ResourceDetail/index.vue +5 -2
- package/components/ResourceList/Masthead.vue +1 -1
- package/components/SortableTable/index.vue +18 -2
- package/components/Tabbed/__tests__/index.test.ts +86 -0
- package/components/{nav/WindowManager → Window}/ContainerLogs.vue +1 -1
- package/components/{nav/WindowManager → Window}/ContainerLogsActions.vue +1 -0
- package/components/{nav/WindowManager → Window}/__tests__/ContainerLogs.test.ts +1 -1
- package/components/{nav/WindowManager → Window}/__tests__/ContainerShell.test.ts +2 -2
- package/components/__tests__/AutoscalerCard.test.ts +154 -0
- package/components/__tests__/AutoscalerTab.test.ts +125 -0
- package/components/__tests__/PopoverCard.test.ts +204 -0
- package/components/auth/SelectPrincipal.vue +24 -6
- package/components/auth/__tests__/SelectPrincipal.test.ts +119 -0
- package/components/fleet/FleetConfigMapSelector.vue +117 -0
- package/components/fleet/FleetSecretSelector.vue +127 -0
- package/components/fleet/__tests__/FleetConfigMapSelector.test.ts +125 -0
- package/components/fleet/__tests__/FleetSecretSelector.test.ts +82 -0
- package/components/form/FileImageSelector.vue +13 -4
- package/components/form/FileSelector.vue +11 -2
- package/components/form/ResourceLabeledSelect.vue +1 -0
- package/components/form/__tests__/ResourceLabeledSelect.test.ts +90 -0
- package/components/formatter/Autoscaler.vue +97 -0
- package/components/formatter/InternalExternalIP.vue +198 -24
- package/components/formatter/__tests__/Autoscaler.test.ts +156 -0
- package/components/formatter/__tests__/InternalExternalIP.test.ts +133 -0
- package/components/google/util/__tests__/formatter.test.ts +47 -0
- package/components/google/util/formatter.ts +5 -2
- package/components/nav/Group.vue +12 -3
- package/components/nav/Header.vue +37 -16
- package/components/nav/NamespaceFilter.vue +13 -1
- package/components/nav/NotificationCenter/index.vue +2 -1
- package/components/nav/TopLevelMenu.helper.ts +16 -6
- package/components/nav/TopLevelMenu.vue +4 -2
- package/components/{DraggableZone.vue → nav/WindowManager/PinArea.vue} +47 -80
- package/components/nav/WindowManager/composables/useComponentsMount.ts +70 -0
- package/components/nav/WindowManager/composables/useDimensionsHandler.ts +105 -0
- package/components/nav/WindowManager/composables/useDragHandler.ts +99 -0
- package/components/nav/WindowManager/composables/usePanelHandler.ts +72 -0
- package/components/nav/WindowManager/composables/usePanelsHandler.ts +14 -0
- package/components/nav/WindowManager/composables/useResizeHandler.ts +167 -0
- package/components/nav/WindowManager/composables/useTabsHandler.ts +51 -0
- package/components/nav/WindowManager/constants.ts +23 -0
- package/components/nav/WindowManager/index.vue +61 -575
- package/components/nav/WindowManager/panels/HorizontalPanel.vue +265 -0
- package/components/nav/WindowManager/panels/TabBodyContainer.vue +39 -0
- package/components/nav/WindowManager/panels/VerticalPanel.vue +308 -0
- package/components/templates/default.vue +4 -40
- package/components/templates/home.vue +31 -5
- package/components/templates/plain.vue +30 -4
- package/components/templates/standalone.vue +1 -1
- package/composables/useI18n.ts +10 -1
- package/composables/useInterval.ts +15 -0
- package/config/__test__/uiplugins.test.ts +309 -0
- package/config/labels-annotations.js +9 -1
- package/config/product/auth.js +1 -0
- package/config/product/explorer.js +3 -1
- package/config/product/manager.js +20 -9
- package/config/query-params.js +1 -0
- package/config/router/routes.js +10 -2
- package/config/settings.ts +10 -2
- package/config/store.js +4 -2
- package/config/table-headers.js +8 -0
- package/config/types.js +11 -0
- package/config/uiplugins.js +46 -2
- package/config/version.js +1 -1
- package/core/__test__/extension-manager-impl.test.js +236 -0
- package/core/extension-manager-impl.js +23 -6
- package/core/plugin-helpers.ts +2 -0
- package/core/types-provisioning.ts +4 -1
- package/detail/pod.vue +1 -0
- package/detail/provisioning.cattle.io.cluster.vue +13 -1
- package/dialog/AddonConfigConfirmationDialog.vue +45 -1
- package/dialog/DeveloperLoadExtensionDialog.vue +12 -3
- package/dialog/RollbackWorkloadDialog.vue +2 -5
- package/directives/ui-context.ts +103 -0
- package/edit/__tests__/fleet.cattle.io.helmop.test.ts +52 -11
- package/edit/auth/AuthProviderWarningBanners.vue +14 -1
- package/edit/auth/__tests__/oidc.test.ts +26 -0
- package/edit/auth/github-app-steps.vue +97 -0
- package/edit/auth/github-steps.vue +75 -0
- package/edit/auth/github.vue +99 -65
- package/edit/auth/oidc.vue +5 -1
- package/edit/autoscaling.horizontalpodautoscaler/index.vue +1 -0
- package/edit/cloudcredential.vue +1 -1
- package/edit/configmap.vue +1 -0
- package/edit/constraints.gatekeeper.sh.constraint/index.vue +1 -0
- package/edit/fleet.cattle.io.gitrepo.vue +0 -10
- package/edit/fleet.cattle.io.helmop.vue +51 -2
- package/edit/helm.cattle.io.projecthelmchart.vue +1 -0
- package/edit/k8s.cni.cncf.io.networkattachmentdefinition.vue +1 -0
- package/edit/logging-flow/index.vue +1 -0
- package/edit/logging.banzaicloud.io.output/index.vue +1 -0
- package/edit/management.cattle.io.fleetworkspace.vue +1 -1
- package/edit/management.cattle.io.project.vue +1 -0
- package/edit/monitoring.coreos.com.alertmanagerconfig/index.vue +4 -1
- package/edit/monitoring.coreos.com.alertmanagerconfig/receiverConfig.vue +2 -1
- package/edit/monitoring.coreos.com.prometheusrule/index.vue +1 -0
- package/edit/monitoring.coreos.com.receiver/index.vue +2 -1
- package/edit/monitoring.coreos.com.route.vue +1 -1
- package/edit/namespace.vue +1 -0
- package/edit/networking.istio.io.destinationrule/index.vue +1 -0
- package/edit/networking.k8s.io.ingress/index.vue +1 -0
- package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +15 -5
- package/edit/networking.k8s.io.networkpolicy/PolicyRules.vue +1 -0
- package/edit/networking.k8s.io.networkpolicy/index.vue +1 -0
- package/edit/node.vue +1 -0
- package/edit/persistentvolume/index.vue +27 -22
- package/edit/persistentvolume/plugins/awsElasticBlockStore.vue +13 -14
- package/edit/persistentvolume/plugins/azureDisk.vue +49 -48
- package/edit/persistentvolume/plugins/azureFile.vue +15 -14
- package/edit/persistentvolume/plugins/cephfs.vue +15 -14
- package/edit/persistentvolume/plugins/cinder.vue +15 -14
- package/edit/persistentvolume/plugins/csi.vue +18 -16
- package/edit/persistentvolume/plugins/fc.vue +13 -14
- package/edit/persistentvolume/plugins/flexVolume.vue +15 -14
- package/edit/persistentvolume/plugins/flocker.vue +1 -3
- package/edit/persistentvolume/plugins/gcePersistentDisk.vue +13 -14
- package/edit/persistentvolume/plugins/glusterfs.vue +15 -14
- package/edit/persistentvolume/plugins/hostPath.vue +40 -39
- package/edit/persistentvolume/plugins/iscsi.vue +13 -14
- package/edit/persistentvolume/plugins/local.vue +1 -3
- package/edit/persistentvolume/plugins/longhorn.vue +23 -22
- package/edit/persistentvolume/plugins/nfs.vue +15 -14
- package/edit/persistentvolume/plugins/photonPersistentDisk.vue +1 -14
- package/edit/persistentvolume/plugins/portworxVolume.vue +15 -14
- package/edit/persistentvolume/plugins/quobyte.vue +15 -14
- package/edit/persistentvolume/plugins/rbd.vue +15 -14
- package/edit/persistentvolume/plugins/scaleIO.vue +15 -14
- package/edit/persistentvolume/plugins/storageos.vue +15 -14
- package/edit/persistentvolume/plugins/vsphereVolume.vue +1 -3
- package/edit/provisioning.cattle.io.cluster/CustomCommand.vue +32 -5
- package/edit/provisioning.cattle.io.cluster/__tests__/CustomCommand.test.ts +35 -0
- package/edit/provisioning.cattle.io.cluster/__tests__/Networking.test.ts +155 -0
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +11 -9
- package/edit/provisioning.cattle.io.cluster/index.vue +25 -15
- package/edit/provisioning.cattle.io.cluster/rke2.vue +98 -17
- package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +28 -2
- package/edit/provisioning.cattle.io.cluster/tabs/MachinePool.vue +107 -5
- package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +92 -4
- package/edit/secret/index.vue +1 -1
- package/edit/service.vue +9 -4
- package/edit/serviceaccount.vue +1 -0
- package/edit/storage.k8s.io.storageclass/index.vue +1 -0
- package/edit/workload/index.vue +2 -1
- package/edit/workload/mixins/workload.js +1 -1
- package/initialize/App.vue +4 -4
- package/initialize/install-directives.js +2 -0
- package/initialize/install-plugins.js +19 -2
- package/list/projectsecret.vue +1 -1
- package/list/provisioning.cattle.io.cluster.vue +15 -2
- package/machine-config/amazonec2.vue +42 -135
- package/machine-config/azure.vue +1 -1
- package/machine-config/components/EC2Networking.vue +490 -0
- package/machine-config/components/__tests__/EC2Networking.test.ts +148 -0
- package/machine-config/components/__tests__/utils/vpcSubnetMockData.js +294 -0
- package/machine-config/digitalocean.vue +11 -0
- package/machine-config/google.vue +1 -1
- package/mixins/__tests__/brand.spec.ts +2 -2
- package/mixins/__tests__/chart.test.ts +21 -0
- package/mixins/brand.js +1 -7
- package/mixins/chart.js +8 -2
- package/mixins/create-edit-view/index.js +5 -0
- package/models/__tests__/chart.test.ts +49 -12
- package/models/__tests__/compliance.cattle.io.clusterscanprofile.spec.js +30 -0
- package/models/__tests__/provisioning.cattle.io.cluster.test.ts +112 -5
- package/models/catalog.cattle.io.app.js +1 -1
- package/models/chart.js +28 -14
- package/models/cluster/node.js +13 -6
- package/models/cluster.x-k8s.io.machine.js +10 -20
- package/models/cluster.x-k8s.io.machinedeployment.js +5 -1
- package/models/compliance.cattle.io.clusterscanprofile.js +1 -1
- package/models/management.cattle.io.authconfig.js +1 -0
- package/models/management.cattle.io.cluster.js +21 -3
- package/models/management.cattle.io.kontainerdriver.js +1 -0
- package/models/provisioning.cattle.io.cluster.js +249 -33
- package/package.json +6 -5
- package/pages/auth/login.vue +43 -4
- package/pages/auth/verify.vue +1 -1
- package/pages/c/_cluster/apps/charts/AppChartCardSubHeader.vue +3 -2
- package/pages/c/_cluster/apps/charts/__tests__/chart.test.ts +135 -0
- package/pages/c/_cluster/apps/charts/chart.vue +35 -17
- package/pages/c/_cluster/apps/charts/index.vue +11 -13
- package/pages/c/_cluster/apps/charts/install.vue +1 -1
- package/pages/c/_cluster/explorer/EventsTable.vue +89 -3
- package/pages/c/_cluster/explorer/index.vue +8 -6
- package/pages/c/_cluster/explorer/tools/index.vue +3 -3
- package/pages/c/_cluster/manager/hostedprovider/index.vue +220 -0
- package/pages/c/_cluster/settings/brand.vue +1 -1
- package/pages/c/_cluster/settings/performance.vue +12 -25
- package/pages/c/_cluster/uiplugins/__tests__/index.test.ts +7 -0
- package/pages/c/_cluster/uiplugins/catalogs.vue +147 -0
- package/pages/c/_cluster/uiplugins/index.vue +126 -184
- package/pages/home.vue +327 -16
- package/pkg/dynamic-importer.lib.js +4 -0
- package/plugins/axios.js +2 -1
- package/plugins/dashboard-client-init.js +3 -0
- package/plugins/dashboard-store/actions.js +1 -1
- package/plugins/dashboard-store/getters.js +18 -1
- package/plugins/dashboard-store/resource-class.js +21 -6
- package/plugins/dynamic-content.js +13 -0
- package/plugins/i18n.js +8 -0
- package/plugins/steve/__tests__/steve-pagination-utils.test.ts +333 -0
- package/plugins/steve/steve-pagination-utils.ts +41 -22
- package/plugins/steve/subscribe.js +17 -9
- package/plugins/subscribe-events.ts +4 -2
- package/rancher-components/Form/Checkbox/Checkbox.vue +1 -1
- package/rancher-components/Pill/RcStatusBadge/RcStatusBadge.vue +6 -34
- package/rancher-components/Pill/RcStatusBadge/index.ts +0 -1
- package/rancher-components/Pill/RcStatusBadge/types.ts +1 -1
- package/rancher-components/Pill/RcStatusIndicator/RcStatusIndicator.vue +5 -28
- package/rancher-components/Pill/RcStatusIndicator/types.ts +2 -1
- package/rancher-components/Pill/types.ts +0 -1
- package/rancher-components/RcDropdown/RcDropdownItem.vue +1 -0
- package/rancher-components/RcDropdown/RcDropdownItemSelect.vue +5 -1
- package/rancher-components/RcIcon/RcIcon.test.ts +51 -0
- package/rancher-components/RcIcon/RcIcon.vue +46 -0
- package/rancher-components/RcIcon/index.ts +1 -0
- package/rancher-components/RcIcon/types.ts +160 -0
- package/rancher-components/utils/status.test.ts +67 -0
- package/rancher-components/utils/status.ts +77 -0
- package/scripts/extension/publish +1 -1
- package/scripts/typegen.sh +1 -0
- package/store/action-menu.js +8 -0
- package/store/auth.js +11 -6
- package/store/aws.js +8 -6
- package/store/catalog.js +6 -0
- package/store/features.js +2 -0
- package/store/index.js +45 -20
- package/store/notifications.ts +51 -4
- package/store/plugins.js +7 -3
- package/store/prefs.js +12 -6
- package/store/type-map.js +3 -3
- package/store/ui-context.ts +86 -0
- package/store/wm.ts +244 -0
- package/types/kube/kube-api.ts +2 -1
- package/types/notifications/index.ts +27 -3
- package/types/rancher/index.d.ts +1 -0
- package/types/resources/settings.d.ts +29 -7
- package/types/shell/index.d.ts +138 -4
- package/types/store/__tests__/pagination.types.spec.ts +137 -0
- package/types/store/pagination.types.ts +157 -9
- package/types/store/subscribe-events.types.ts +8 -1
- package/types/store/subscribe.types.ts +1 -0
- package/types/window-manager.ts +24 -0
- package/utils/__tests__/cluster.test.ts +379 -1
- package/utils/__tests__/object.test.ts +19 -0
- package/utils/__tests__/provider.test.ts +98 -0
- package/utils/__tests__/selector-typed.test.ts +263 -0
- package/utils/__tests__/version.test.ts +19 -1
- package/utils/autoscaler-utils.ts +7 -0
- package/utils/back-off.ts +3 -3
- package/utils/brand.ts +29 -0
- package/utils/chart.js +18 -0
- package/utils/cluster.js +157 -3
- package/utils/color.js +1 -1
- package/utils/dynamic-content/__tests__/announcement.test.ts +498 -0
- package/utils/dynamic-content/__tests__/config.test.ts +187 -0
- package/utils/dynamic-content/__tests__/index.test.ts +390 -0
- package/utils/dynamic-content/__tests__/info.test.ts +275 -0
- package/utils/dynamic-content/__tests__/new-release.test.ts +216 -0
- package/utils/dynamic-content/__tests__/support-notice.test.ts +262 -0
- package/utils/dynamic-content/__tests__/util.test.ts +235 -0
- package/utils/dynamic-content/announcement.ts +142 -0
- package/utils/dynamic-content/config.ts +55 -0
- package/utils/dynamic-content/example.json +40 -0
- package/utils/dynamic-content/index.ts +277 -0
- package/utils/dynamic-content/info.ts +261 -0
- package/utils/dynamic-content/new-release.ts +126 -0
- package/utils/dynamic-content/notification-handler.ts +48 -0
- package/utils/dynamic-content/support-notice.ts +169 -0
- package/utils/dynamic-content/types.d.ts +153 -0
- package/utils/dynamic-content/util.ts +122 -0
- package/utils/dynamic-importer.js +2 -2
- package/utils/favicon.js +4 -4
- package/utils/inactivity.ts +104 -0
- package/utils/object.js +20 -2
- package/utils/pagination-utils.ts +19 -4
- package/utils/pagination-wrapper.ts +12 -8
- package/utils/provider.ts +14 -0
- package/utils/release-notes.ts +1 -1
- package/utils/scroll.js +7 -0
- package/utils/selector-typed.ts +6 -2
- package/utils/settings.ts +15 -0
- package/utils/validators/machine-pool.ts +13 -3
- package/utils/version.js +15 -0
- package/assets/images/icons/document.svg +0 -3
- package/plugins/nuxt-client-init.js +0 -3
- package/store/wm.js +0 -95
- /package/components/{nav/WindowManager → Window}/ChartReadme.vue +0 -0
- /package/components/{nav/WindowManager → Window}/ContainerShell.vue +0 -0
- /package/components/{nav/WindowManager → Window}/KubectlShell.vue +0 -0
- /package/components/{nav/WindowManager → Window}/MachineSsh.vue +0 -0
- /package/components/{nav/WindowManager → Window}/Window.vue +0 -0
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
|
|
3
|
+
import { Checkbox } from '@components/Form/Checkbox';
|
|
4
|
+
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
|
5
|
+
import { sortBy } from '@shell/utils/sort';
|
|
6
|
+
import { addObject, addObjects, findBy } from '@shell/utils/array';
|
|
7
|
+
import { isEmpty } from '@shell/utils/object';
|
|
8
|
+
import { LabeledInput } from '@components/Form/LabeledInput';
|
|
9
|
+
import { Banner } from '@components/Banner';
|
|
10
|
+
import { scrollToBottom } from '@shell/utils/scroll';
|
|
11
|
+
import { _CREATE } from '@shell/config/query-params';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
name: 'Ec2MachinePoolNetworking',
|
|
15
|
+
|
|
16
|
+
components: {
|
|
17
|
+
Checkbox, LabeledSelect, LabeledInput, Banner
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
emits: ['update:enablePrimaryIpv6', 'update:ipv6AddressCount', 'update:ipv6AddressOnly', 'update:httpProtocolIpv6', 'update:vpcId', 'update:subnetId', 'update:hasIpv6', 'validationChanged'],
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
mode: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: _CREATE
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
disabled: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: true
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
region: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
zone: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ''
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
vpcInfo: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: () => {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
subnetInfo: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
enablePrimaryIpv6: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
ipv6AddressCount: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '0'
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
ipv6AddressOnly: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
httpProtocolIpv6: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: 'disabled'
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
vpcId: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: ''
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
subnetId: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: ''
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
hasIpv6: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: false
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
machinePools: {
|
|
93
|
+
type: Array,
|
|
94
|
+
default: () => []
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
isNew: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: true
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
created() {
|
|
104
|
+
const subnets = this.subnetInfo?.Subnets || [];
|
|
105
|
+
const vpcs = this.vpcInfo?.Vpcs || [];
|
|
106
|
+
|
|
107
|
+
this.selectedNetwork = this.subnetId || this.vpcId;
|
|
108
|
+
if (this.subnetId) {
|
|
109
|
+
const subnetObj = subnets.find((sn) => sn.SubnetId === this.subnetId);
|
|
110
|
+
|
|
111
|
+
this.enableIpv6 = !!subnetObj?.Ipv6CidrBlockAssociationSet && !isEmpty(subnetObj?.Ipv6CidrBlockAssociationSet);
|
|
112
|
+
} else if (this.vpcId) {
|
|
113
|
+
this.enableIpv6 = !!vpcs.find((vpc) => vpc.VpcId === this.vpcId && vpc.Ipv6CidrBlockAssociationSet && !isEmpty(vpc.Ipv6CidrBlockAssociationSet));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (this.isNew && this.somePoolHasIpv6OrDual) {
|
|
117
|
+
this.enableIpv6 = true;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
data() {
|
|
122
|
+
return { selectedNetwork: {}, enableIpv6: false };
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
watch: {
|
|
126
|
+
region() {
|
|
127
|
+
if (this.isNew) {
|
|
128
|
+
this.updateNetwork();
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
enableIpv6(neu) {
|
|
133
|
+
if (this.isNew) {
|
|
134
|
+
this.updateNetwork();
|
|
135
|
+
}
|
|
136
|
+
this.$emit('update:hasIpv6', neu);
|
|
137
|
+
|
|
138
|
+
if (neu) {
|
|
139
|
+
this.$emit('update:ipv6AddressCount', '1');
|
|
140
|
+
} else {
|
|
141
|
+
this.$emit('update:ipv6AddressCount', '0');
|
|
142
|
+
this.$emit('update:ipv6AddressOnly', false);
|
|
143
|
+
this.$emit('update:enablePrimaryIpv6', false);
|
|
144
|
+
this.$emit('update:httpProtocolIpv6', 'disabled');
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
ipv6Selected(neu) {
|
|
149
|
+
if (neu) {
|
|
150
|
+
this.$emit('update:ipv6AddressOnly', neu);
|
|
151
|
+
} else if (!this.dualStackSelected) {
|
|
152
|
+
this.$emit('update:ipv6AddressOnly', false);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
ipv6AddressOnly(neu) {
|
|
157
|
+
this.$emit('update:hasIpv6', neu);
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
allValid: {
|
|
161
|
+
handler(neu) {
|
|
162
|
+
this.$emit('validationChanged', neu);
|
|
163
|
+
},
|
|
164
|
+
immediate: true
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
computed: {
|
|
169
|
+
allNetworkOptions() {
|
|
170
|
+
if ( !this.vpcInfo || !this.subnetInfo ) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
let vpcs = [];
|
|
174
|
+
const subnetsByVpc = {};
|
|
175
|
+
|
|
176
|
+
for ( const obj of this.vpcInfo.Vpcs ) {
|
|
177
|
+
const name = obj.Tags && obj.Tags?.length ? obj.Tags.find((t) => t.Key === 'Name')?.Value : null;
|
|
178
|
+
const hasIpv6 = !!obj.Ipv6CidrBlockAssociationSet && !isEmpty(obj.Ipv6CidrBlockAssociationSet);
|
|
179
|
+
const hasIpv4 = !!obj.CidrBlock;
|
|
180
|
+
|
|
181
|
+
vpcs.push({
|
|
182
|
+
label: name || obj.VpcId,
|
|
183
|
+
subLabel: name ? obj.VpcId : obj.CidrBlock,
|
|
184
|
+
isDefault: obj.IsDefault || false,
|
|
185
|
+
kind: 'vpc',
|
|
186
|
+
value: obj.VpcId,
|
|
187
|
+
disabled: this.enableIpv6 !== hasIpv6,
|
|
188
|
+
hasIpv6,
|
|
189
|
+
hasIpv4
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
vpcs = sortBy(vpcs, ['isDefault:desc', 'label']);
|
|
194
|
+
|
|
195
|
+
for ( const obj of this.subnetInfo.Subnets ) {
|
|
196
|
+
if ( obj.AvailabilityZone !== `${ this.region }${ this.zone }` ) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const hasIpv6 = !!obj.Ipv6CidrBlockAssociationSet && !isEmpty(obj.Ipv6CidrBlockAssociationSet);
|
|
201
|
+
const hasIpv4 = !!obj.CidrBlock;
|
|
202
|
+
|
|
203
|
+
if (this.enableIpv6 !== hasIpv6) {
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
let entry = subnetsByVpc[obj.VpcId];
|
|
208
|
+
|
|
209
|
+
if ( !entry ) {
|
|
210
|
+
entry = [];
|
|
211
|
+
subnetsByVpc[obj.VpcId] = entry;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const name = obj.Tags && obj.Tags?.length ? obj.Tags.find((t) => t.Key === 'Name')?.Value : null;
|
|
215
|
+
|
|
216
|
+
entry.push({
|
|
217
|
+
label: name || obj.SubnetId,
|
|
218
|
+
subLabel: name ? obj.SubnetId : obj.CidrBlock,
|
|
219
|
+
kind: 'subnet',
|
|
220
|
+
isDefault: obj.DefaultForAz || false,
|
|
221
|
+
value: obj.SubnetId,
|
|
222
|
+
vpcId: obj.VpcId,
|
|
223
|
+
hasIpv6,
|
|
224
|
+
hasIpv4
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const out = [];
|
|
229
|
+
|
|
230
|
+
for ( const obj of vpcs ) {
|
|
231
|
+
if (!obj.disabled || subnetsByVpc[obj.value]) {
|
|
232
|
+
addObject(out, obj);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if ( subnetsByVpc[obj.value] ) {
|
|
236
|
+
addObjects(out, sortBy(subnetsByVpc[obj.value], ['isDefault:desc', 'label']));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return out;
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
// ipv4-only subnets and vpcs
|
|
244
|
+
ipv4OnlyNetworkOptions() {
|
|
245
|
+
return this.allNetworkOptions.reduce((opts, opt) => {
|
|
246
|
+
if (opt.kind === 'vpc') {
|
|
247
|
+
opts.push({ ...opt, disabled: opt.hasIpv6 });
|
|
248
|
+
} else if (!opt.hasIpv6) {
|
|
249
|
+
opts.push(opt);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return opts;
|
|
253
|
+
}, []);
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
// ipv6-enabled subnets and vpcs - some of these may be both ipv4 and ipv6 (dual-stack)
|
|
257
|
+
ipv6NetworkOptions() {
|
|
258
|
+
return this.allNetworkOptions.filter((opt) => {
|
|
259
|
+
return opt.hasIpv6;
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
networkOptions() {
|
|
264
|
+
return this.enableIpv6 ? this.ipv6NetworkOptions : this.ipv4OnlyNetworkOptions;
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
// ipv4 and ipv6 subnet or vpc selected
|
|
268
|
+
dualStackSelected() {
|
|
269
|
+
const opt = this.allNetworkOptions.find((o) => o.value === this.selectedNetwork);
|
|
270
|
+
|
|
271
|
+
return opt?.hasIpv4 && opt?.hasIpv6;
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
// ipv6-only subnet selected (vpc are never ipv6-only)
|
|
275
|
+
ipv6Selected() {
|
|
276
|
+
const opt = this.allNetworkOptions.find((o) => o.value === this.selectedNetwork);
|
|
277
|
+
|
|
278
|
+
return opt && opt.hasIpv6 && !opt.hasIpv4;
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
somePoolHasIpv6OrDual() {
|
|
282
|
+
return !!this.machinePools.find((p) => p.hasIpv6);
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
showIpv6Options() {
|
|
286
|
+
return this.mode === _CREATE || (this.isNew && this.somePoolHasIpv6OrDual) || this.enableIpv6;
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
poolsInvalid() {
|
|
290
|
+
const somePoolHasIpv4 = !!this.machinePools.find((p) => !p.hasIpv6);
|
|
291
|
+
|
|
292
|
+
return this.somePoolHasIpv6OrDual && somePoolHasIpv4;
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
addressCountInvalid() {
|
|
296
|
+
return !!this.ipv6AddressCountValidator(this.ipv6AddressCount);
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
allValid() {
|
|
300
|
+
return !this.poolsInvalid && !this.addressCountInvalid;
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
methods: {
|
|
305
|
+
updateNetwork(value) {
|
|
306
|
+
let obj;
|
|
307
|
+
|
|
308
|
+
if ( value ) {
|
|
309
|
+
obj = findBy(this.allNetworkOptions, 'value', value);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if ( obj?.kind === 'subnet' ) {
|
|
313
|
+
this.$emit('update:subnetId', value);
|
|
314
|
+
this.$emit('update:vpcId', obj.vpcId);
|
|
315
|
+
this.selectedNetwork = value;
|
|
316
|
+
} else if ( obj ) {
|
|
317
|
+
this.$emit('update:subnetId', null);
|
|
318
|
+
this.$emit('update:vpcId', value);
|
|
319
|
+
this.selectedNetwork = value;
|
|
320
|
+
} else {
|
|
321
|
+
this.$emit('update:subnetId', null);
|
|
322
|
+
this.$emit('update:vpcId', null);
|
|
323
|
+
this.selectedNetwork = null;
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
|
|
327
|
+
ipv6AddressCountValidator(val = '0') {
|
|
328
|
+
const value = parseInt(val);
|
|
329
|
+
// 0 or undefined are both acceptable if ipv6 is disabled
|
|
330
|
+
const isValid = this.enableIpv6 ? value > 0 : !value;
|
|
331
|
+
|
|
332
|
+
return isValid ? null : this.t('cluster.machineConfig.amazonEc2.ipv6AddressCount.error');
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
scrollDown(e) {
|
|
336
|
+
if (e?.target?.localName === 'a') {
|
|
337
|
+
setTimeout(() => {
|
|
338
|
+
scrollToBottom();
|
|
339
|
+
}, 3); // timeout allows the networking tab to render, changing the length of the page, before scrolling
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
</script>
|
|
345
|
+
|
|
346
|
+
<template>
|
|
347
|
+
<Banner
|
|
348
|
+
v-if="poolsInvalid"
|
|
349
|
+
color="error"
|
|
350
|
+
:label="t('cluster.machineConfig.amazonEc2.ipv6ValidationWarning')"
|
|
351
|
+
data-testid="amazonEc2__ipv6Warning"
|
|
352
|
+
/>
|
|
353
|
+
<div
|
|
354
|
+
v-if="showIpv6Options"
|
|
355
|
+
class="row mb-20"
|
|
356
|
+
>
|
|
357
|
+
<div
|
|
358
|
+
|
|
359
|
+
class="col span-6"
|
|
360
|
+
>
|
|
361
|
+
<Checkbox
|
|
362
|
+
v-model:value="enableIpv6"
|
|
363
|
+
:disabled="!isNew"
|
|
364
|
+
:label="t('cluster.machineConfig.amazonEc2.enableIpv6.label')"
|
|
365
|
+
data-testid="amazonEc2__enableIpv6"
|
|
366
|
+
:mode="mode"
|
|
367
|
+
/>
|
|
368
|
+
<div
|
|
369
|
+
class="text-muted"
|
|
370
|
+
@click="scrollDown"
|
|
371
|
+
>
|
|
372
|
+
<t
|
|
373
|
+
raw
|
|
374
|
+
k="cluster.machineConfig.amazonEc2.enableIpv6.description"
|
|
375
|
+
/>
|
|
376
|
+
</div>
|
|
377
|
+
</div>
|
|
378
|
+
</div>
|
|
379
|
+
<div class="row mb-20 ipv6-row">
|
|
380
|
+
<div class="col span-6">
|
|
381
|
+
<LabeledSelect
|
|
382
|
+
:mode="mode"
|
|
383
|
+
:value="selectedNetwork"
|
|
384
|
+
:options="allNetworkOptions"
|
|
385
|
+
:searchable="true"
|
|
386
|
+
:required="true"
|
|
387
|
+
:disabled="disabled"
|
|
388
|
+
:placeholder="t('cluster.machineConfig.amazonEc2.selectedNetwork.placeholder')"
|
|
389
|
+
:label="t('cluster.machineConfig.amazonEc2.selectedNetwork.label')"
|
|
390
|
+
data-testid="amazonEc2__selectedNetwork"
|
|
391
|
+
option-key="value"
|
|
392
|
+
@update:value="updateNetwork($event)"
|
|
393
|
+
>
|
|
394
|
+
<template v-slot:option="opt">
|
|
395
|
+
<div :class="{'vpc': opt.kind === 'vpc', 'vpc-subnet': opt.kind !== 'vpc'}">
|
|
396
|
+
<span class="vpc-name">{{ opt.label }}</span><span class="vpc-info">{{ opt.subLabel }}</span>
|
|
397
|
+
</div>
|
|
398
|
+
</template>
|
|
399
|
+
</LabeledSelect>
|
|
400
|
+
</div>
|
|
401
|
+
<div
|
|
402
|
+
v-if="enableIpv6"
|
|
403
|
+
class="col span-3"
|
|
404
|
+
>
|
|
405
|
+
<Checkbox
|
|
406
|
+
:disabled="!isNew || !dualStackSelected"
|
|
407
|
+
:value="ipv6AddressOnly"
|
|
408
|
+
:label="t('cluster.machineConfig.amazonEc2.ipv6AddressOnly.label')"
|
|
409
|
+
:mode="mode"
|
|
410
|
+
data-testid="amazonEc2__ipv6AddressOnly"
|
|
411
|
+
@update:value="e=>$emit('update:ipv6AddressOnly', e)"
|
|
412
|
+
/>
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
<div
|
|
416
|
+
v-if="enableIpv6"
|
|
417
|
+
class="row mb-10 ipv6-row"
|
|
418
|
+
>
|
|
419
|
+
<div class="col span-6">
|
|
420
|
+
<Checkbox
|
|
421
|
+
:value="httpProtocolIpv6==='enabled'"
|
|
422
|
+
:disabled="!isNew"
|
|
423
|
+
:label="t('cluster.machineConfig.amazonEc2.httpProtocolIpv6.label')"
|
|
424
|
+
data-testid="amazonEc2__enableIpv6"
|
|
425
|
+
:mode="mode"
|
|
426
|
+
@update:value="e=>$emit('update:httpProtocolIpv6', e ? 'enabled' : 'disabled')"
|
|
427
|
+
/>
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
<div
|
|
431
|
+
v-if="enableIpv6"
|
|
432
|
+
class="row mb-10 ipv6-row"
|
|
433
|
+
>
|
|
434
|
+
<div class="col span-3">
|
|
435
|
+
<LabeledInput
|
|
436
|
+
:disabled="!isNew"
|
|
437
|
+
min="1"
|
|
438
|
+
:mode="mode"
|
|
439
|
+
:value="ipv6AddressCount"
|
|
440
|
+
label-key="cluster.machineConfig.amazonEc2.ipv6AddressCount.label"
|
|
441
|
+
data-testid="amazonEc2__ipv6AddressCount"
|
|
442
|
+
:rules="[ipv6AddressCountValidator]"
|
|
443
|
+
@update:value="e=>$emit('update:ipv6AddressCount', e)"
|
|
444
|
+
/>
|
|
445
|
+
</div>
|
|
446
|
+
<div class="col span-9">
|
|
447
|
+
<Checkbox
|
|
448
|
+
:disabled="!isNew"
|
|
449
|
+
:value="enablePrimaryIpv6"
|
|
450
|
+
:label="t('cluster.machineConfig.amazonEc2.enablePrimaryIpv6.label')"
|
|
451
|
+
:mode="mode"
|
|
452
|
+
data-testid="amazonEc2__enablePrimaryIpv6"
|
|
453
|
+
@update:value="e=>$emit('update:enablePrimaryIpv6', e)"
|
|
454
|
+
/>
|
|
455
|
+
<div class="text-muted">
|
|
456
|
+
<t
|
|
457
|
+
|
|
458
|
+
k="cluster.machineConfig.amazonEc2.enablePrimaryIpv6.description"
|
|
459
|
+
/>
|
|
460
|
+
</div>
|
|
461
|
+
</div>
|
|
462
|
+
</div>
|
|
463
|
+
</template>
|
|
464
|
+
|
|
465
|
+
<style scoped lang="scss">
|
|
466
|
+
.vpc, .vpc-subnet {
|
|
467
|
+
display: flex;
|
|
468
|
+
line-height: 30px;
|
|
469
|
+
|
|
470
|
+
.vpc-name {
|
|
471
|
+
font-weight: bold;
|
|
472
|
+
flex: 1;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.vpc-info {
|
|
476
|
+
font-size: 12px;
|
|
477
|
+
opacity: 0.7;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.vpc-subnet .vpc-name {
|
|
482
|
+
font-weight: normal;
|
|
483
|
+
padding-left: 15px;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.ipv6-row {
|
|
487
|
+
display: flex;
|
|
488
|
+
align-items: center;
|
|
489
|
+
}
|
|
490
|
+
</style>
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { mount, shallowMount } from '@vue/test-utils';
|
|
2
|
+
import EC2Networking from '@shell/machine-config/components/EC2Networking.vue';
|
|
3
|
+
|
|
4
|
+
import { vpcInfo, subnetInfo } from './utils/vpcSubnetMockData';
|
|
5
|
+
|
|
6
|
+
describe('component: EC2Networking', () => {
|
|
7
|
+
const defaultGetters = { 'i18n/t': jest.fn().mockImplementation((key: string) => key) };
|
|
8
|
+
const baseSetup = {
|
|
9
|
+
propsData: {
|
|
10
|
+
region: '',
|
|
11
|
+
zone: 'us-west-2a',
|
|
12
|
+
machinePools: [],
|
|
13
|
+
vpcInfo,
|
|
14
|
+
subnetInfo
|
|
15
|
+
|
|
16
|
+
},
|
|
17
|
+
global: {
|
|
18
|
+
mocks: {
|
|
19
|
+
$fetchState: { pending: false },
|
|
20
|
+
$store: { getters: defaultGetters },
|
|
21
|
+
},
|
|
22
|
+
stubs: { CodeMirror: true },
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const defaultCreateSetup = {
|
|
26
|
+
...baseSetup,
|
|
27
|
+
propsData: {
|
|
28
|
+
...baseSetup.propsData,
|
|
29
|
+
mode: 'create',
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
it('should render a dropdown containing ipv4-only subnets and vpcs', () => {
|
|
34
|
+
const wrapper = shallowMount(EC2Networking, defaultCreateSetup);
|
|
35
|
+
const expectedValues = ['vpc-1234', 'vpc-123'];
|
|
36
|
+
const networkOptionValues = wrapper.vm.networkOptions.map((o:any) => o.value);
|
|
37
|
+
|
|
38
|
+
expect(networkOptionValues).toStrictEqual(expectedValues);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should update the network dropdown to contain ipv6 and dual stack vpcs/subnets when the ipv6 checkbox is checked', async() => {
|
|
42
|
+
const wrapper = shallowMount(EC2Networking, defaultCreateSetup);
|
|
43
|
+
|
|
44
|
+
const ipv6Checkbox = wrapper.findComponent('[data-testid="amazonEc2__enableIpv6"]');
|
|
45
|
+
|
|
46
|
+
ipv6Checkbox.vm.$emit('update:value', true);
|
|
47
|
+
await wrapper.vm.$nextTick();
|
|
48
|
+
const expectedValues = ['vpc-12345', 'subnet-4321'];
|
|
49
|
+
const networkOptionValues = wrapper.vm.networkOptions.map((o:any) => o.value);
|
|
50
|
+
|
|
51
|
+
expect(networkOptionValues).toStrictEqual(expectedValues);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should render the ipv6 address count input when the enable ipv6 checkbox is checked', async() => {
|
|
55
|
+
const wrapper = shallowMount(EC2Networking, defaultCreateSetup);
|
|
56
|
+
const ipv6Checkbox = wrapper.findComponent('[data-testid="amazonEc2__enableIpv6"]');
|
|
57
|
+
|
|
58
|
+
ipv6Checkbox.vm.$emit('update:value', true);
|
|
59
|
+
await wrapper.vm.$nextTick();
|
|
60
|
+
|
|
61
|
+
const ipv6AddressCountInput = wrapper.findComponent('[data-testid="amazonEc2__ipv6AddressCount"]');
|
|
62
|
+
|
|
63
|
+
expect(wrapper.vm.enableIpv6).toBe(true);
|
|
64
|
+
expect(ipv6AddressCountInput.exists()).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should render the ipv6 only checkbox when the selected network is dual-stack', async() => {
|
|
68
|
+
const wrapper = mount(EC2Networking, defaultCreateSetup);
|
|
69
|
+
const ipv6Checkbox = wrapper.findComponent('[data-testid="amazonEc2__enableIpv6"]');
|
|
70
|
+
|
|
71
|
+
ipv6Checkbox.vm.$emit('update:value', true);
|
|
72
|
+
await wrapper.vm.$nextTick();
|
|
73
|
+
|
|
74
|
+
const networkDropdown = wrapper.findComponent('[data-testid="amazonEc2__selectedNetwork"]');
|
|
75
|
+
|
|
76
|
+
networkDropdown.vm.$emit('selecting', 'subnet-321');
|
|
77
|
+
await wrapper.vm.$nextTick();
|
|
78
|
+
|
|
79
|
+
const ipv6OnlyCheckbox = wrapper.findComponent('[data-testid="amazonEc2__ipv6AddressOnly"]');
|
|
80
|
+
|
|
81
|
+
expect(ipv6OnlyCheckbox.exists()).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it.each([
|
|
85
|
+
[[{ hasIpv6: true }, { hasIpv6: false }], true],
|
|
86
|
+
[[{ hasIpv6: false }, { hasIpv6: false }], false],
|
|
87
|
+
[[{ hasIpv6: true }, { hasIpv6: true }], false],
|
|
88
|
+
])('should show an error banner if pools do not either all have ipv6 or all have ipv4', (pools, shouldShowError) => {
|
|
89
|
+
const wrapper = shallowMount(EC2Networking, { ...defaultCreateSetup, propsData: { ...defaultCreateSetup.propsData, machinePools: pools } });
|
|
90
|
+
const ipv6Warning = wrapper.findComponent('[data-testid="amazonEc2__ipv6Warning"]');
|
|
91
|
+
|
|
92
|
+
expect(ipv6Warning.exists()).toBe(shouldShowError);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('should show ipv6 inputs and automatically check the enable ipv6 checkbox when adding a new pool if some other pool in the cluster is using ipv6 or dual stack', () => {
|
|
96
|
+
const wrapper = shallowMount(EC2Networking, {
|
|
97
|
+
...defaultCreateSetup,
|
|
98
|
+
propsData: {
|
|
99
|
+
...defaultCreateSetup.propsData,
|
|
100
|
+
machinePools: [{ hasIpv6: true }],
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const ipv6AddressCountInput = wrapper.findComponent('[data-testid="amazonEc2__ipv6AddressCount"]');
|
|
105
|
+
|
|
106
|
+
expect(wrapper.vm.enableIpv6).toBe(true);
|
|
107
|
+
expect(ipv6AddressCountInput.exists()).toBe(true);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should not show ipv6 inputs or automatically check the enable ipv6 checkbox when adding a new pool to a cluster that does not have existing ipv6 or dual stack pools', () => {
|
|
111
|
+
const wrapper = shallowMount(EC2Networking, {
|
|
112
|
+
...defaultCreateSetup,
|
|
113
|
+
propsData: {
|
|
114
|
+
...defaultCreateSetup.propsData,
|
|
115
|
+
machinePools: [{ hasIpv6: false }],
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const ipv6AddressCountInput = wrapper.findComponent('[data-testid="amazonEc2__ipv6AddressCount"]');
|
|
120
|
+
|
|
121
|
+
expect(wrapper.vm.enableIpv6).toBe(false);
|
|
122
|
+
expect(ipv6AddressCountInput.exists()).toBe(false);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should emit a validationChanged: false event when created with ipv6 enabled while some other pools have ipv6 disabled', async() => {
|
|
126
|
+
const wrapper = shallowMount(EC2Networking, {
|
|
127
|
+
...defaultCreateSetup,
|
|
128
|
+
propsData: {
|
|
129
|
+
...defaultCreateSetup.propsData,
|
|
130
|
+
machinePools: [{ hasIpv6: true }, { hasIpv6: false }],
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
expect(wrapper.emitted('validationChanged')?.[0][0]).toBe(false);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('should emit a validationChanged: true event when created with ipv6 enabled while all other pools also have ipv6 enabled', async() => {
|
|
138
|
+
const wrapper = shallowMount(EC2Networking, {
|
|
139
|
+
...defaultCreateSetup,
|
|
140
|
+
propsData: {
|
|
141
|
+
...defaultCreateSetup.propsData,
|
|
142
|
+
machinePools: [{ hasIpv6: true }, { hasIpv6: true }],
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
expect(wrapper.emitted('validationChanged')?.[0][0]).toBe(true);
|
|
147
|
+
});
|
|
148
|
+
});
|