From deecbadce13e777bd5a2871c2f498e84f790de26 Mon Sep 17 00:00:00 2001
From: Richard Wei <54336863+WaysonWei@users.noreply.github.com>
Date: Tue, 21 Sep 2021 16:20:22 +1200
Subject: [PATCH] fix(k8s):fix difficulties selecting mixed protocols when
creating k8s application EE-1073 (#5591)
* fix difficulties selecting mixed protocols when creating k8s application
---
.../views/applications/create/createApplication.html | 2 +-
.../views/applications/create/createApplicationController.js | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html
index ef6916c59..7b559ad2d 100644
--- a/app/kubernetes/views/applications/create/createApplication.html
+++ b/app/kubernetes/views/applications/create/createApplication.html
@@ -1304,7 +1304,7 @@
When publishing a port in cluster mode, the node port is optional. If left empty Kubernetes will use a random port number. If you wish to specify a port, use a
port number inside the default range 30000-32767
.
-
+
At least one published port must be defined.
diff --git a/app/kubernetes/views/applications/create/createApplicationController.js b/app/kubernetes/views/applications/create/createApplicationController.js
index 064486f04..ae32bc2de 100644
--- a/app/kubernetes/views/applications/create/createApplicationController.js
+++ b/app/kubernetes/views/applications/create/createApplicationController.js
@@ -790,15 +790,14 @@ class KubernetesCreateApplicationController {
}
isEditLBWithPorts() {
- return this.formValues.PublishingType === KubernetesApplicationPublishingTypes.LOAD_BALANCER && _.filter(this.formValues.PublishedPorts, { IsNew: false }).length;
+ return this.formValues.PublishingType === KubernetesApplicationPublishingTypes.LOAD_BALANCER && _.filter(this.formValues.PublishedPorts, { IsNew: false }).length === 0;
}
isProtocolOptionDisabled(index, protocol) {
return (
this.disableLoadBalancerEdit() ||
(this.isEditAndNotNewPublishedPort(index) && this.formValues.PublishedPorts[index].Protocol !== protocol) ||
- (this.isEditLBWithPorts() && this.formValues.PublishedPorts[index].Protocol !== protocol) ||
- (this.isNewAndNotFirst(index) && this.formValues.PublishedPorts[index].Protocol !== protocol)
+ (this.isEditLBWithPorts() && this.formValues.PublishedPorts[index].Protocol !== protocol && this.isNewAndNotFirst(index))
);
}