mirror of https://github.com/portainer/portainer
parent
ff1f549590
commit
bb61723ba1
|
@ -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) => {
|
||||||
|
|
|
@ -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 '
|
No ingress hostnames are available for the namespace '
|
||||||
{namespace}'. Please update the namespace or{' '}
|
{namespace}'. Please select another namespace or{' '}
|
||||||
<Link
|
<Link
|
||||||
to="kubernetes.ingresses.create"
|
to="kubernetes.ingresses.create"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|
|
@ -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 = `${
|
||||||
|
|
Loading…
Reference in New Issue