apply changes from EE (#9232)

Co-authored-by: testa113 <testa113>
pull/9233/head
Ali 2023-07-20 13:48:48 +12:00 committed by GitHub
parent ff1f549590
commit bb61723ba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 6 deletions

View File

@ -1001,9 +1001,11 @@ class KubernetesCreateApplicationController {
if (updatedService.Ingress && numberOfPortsInOldService && numberOfPortsInOldService <= updatedService.Ports.length) { if (updatedService.Ingress && numberOfPortsInOldService && numberOfPortsInOldService <= updatedService.Ports.length) {
const updatedOldPorts = updatedService.Ports.slice(0, numberOfPortsInOldService); const updatedOldPorts = updatedService.Ports.slice(0, numberOfPortsInOldService);
const ingressesForService = fullIngresses.filter((ing) => { const ingressesForService = fullIngresses.filter((ing) => {
const ingServiceNames = ing.Paths.map((path) => path.ServiceName); if (ing.Paths) {
if (ingServiceNames.includes(updatedService.Name)) { const ingServiceNames = ing.Paths.map((path) => path.ServiceName);
return true; if (ingServiceNames.includes(updatedService.Name)) {
return true;
}
} }
}); });
ingressesForService.forEach((ingressForService) => { ingressesForService.forEach((ingressForService) => {

View File

@ -87,8 +87,16 @@ export function AppIngressPathForm({
Host: newIngressHostValue, Host: newIngressHostValue,
IngressName: newIngressNameValue, IngressName: newIngressNameValue,
}; };
// the selected option should match the new ingress path
const newIngressOption = newIngressPath.Host
? {
ingressName: newIngressPath.IngressName,
value: newIngressPath.Host ?? '',
label: `${newIngressPath.Host} (${newIngressPath.IngressName})`,
}
: null;
onChangeIngressPath(newIngressPath); onChangeIngressPath(newIngressPath);
setSelectedIngress(ingressHostOptionsWithCurrentValue[0] ?? null); setSelectedIngress(newIngressOption);
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [ingressHostOptionsWithCurrentValue]); }, [ingressHostOptionsWithCurrentValue]);
@ -129,7 +137,7 @@ export function AppIngressPathForm({
{ingressHostOptions.length === 0 && !ingressPath?.Host && ( {ingressHostOptions.length === 0 && !ingressPath?.Host && (
<FormError> <FormError>
No ingress hostnames are available for the namespace &apos; No ingress hostnames are available for the namespace &apos;
{namespace}&apos;. Please update the namespace or{' '} {namespace}&apos;. Please select another namespace or{' '}
<Link <Link
to="kubernetes.ingresses.create" to="kubernetes.ingresses.create"
target="_blank" target="_blank"

View File

@ -229,7 +229,11 @@ export function kubeServicesValidation(
'path-is-unique', 'path-is-unique',
'Ingress path is already in use for this hostname.', 'Ingress path is already in use for this hostname.',
(path, context) => { (path, context) => {
if (path === undefined || validationData === undefined) { if (
path === undefined ||
validationData === undefined ||
!context.parent.Host
) {
return true; return true;
} }
const ingressHostAndPath = `${ const ingressHostAndPath = `${