mirror of https://github.com/portainer/portainer
fix(ingress): update ingress tls after deletion EE-4387 (#7804)
* fix(ing): update tls value EE-4387pull/7830/head
parent
56087bcbb3
commit
c6ae8467c0
|
@ -190,13 +190,16 @@ export function CreateIngressView() {
|
|||
config.SecretType === 'kubernetes.io/tls' &&
|
||||
config.Namespace === namespace
|
||||
);
|
||||
const tlsOptions: Option<string>[] = [
|
||||
{ label: 'No TLS', value: '' },
|
||||
...(matchedConfigs?.map((config) => ({
|
||||
label: config.Name,
|
||||
value: config.Name,
|
||||
})) || []),
|
||||
];
|
||||
const tlsOptions: Option<string>[] = useMemo(
|
||||
() => [
|
||||
{ label: 'No TLS', value: '' },
|
||||
...(matchedConfigs?.map((config) => ({
|
||||
label: config.Name,
|
||||
value: config.Name,
|
||||
})) || []),
|
||||
],
|
||||
[matchedConfigs]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
|
@ -226,6 +229,19 @@ export function CreateIngressView() {
|
|||
params.namespace,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
// for each host, if the tls selection doesn't exist as an option, change it to the first option
|
||||
if (ingressRule?.Hosts?.length) {
|
||||
ingressRule.Hosts.forEach((host, hIndex) => {
|
||||
const secret = host.Secret || '';
|
||||
const tlsOptionVals = tlsOptions.map((o) => o.value);
|
||||
if (tlsOptions?.length && !tlsOptionVals?.includes(secret)) {
|
||||
handleTLSChange(hIndex, tlsOptionVals[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [tlsOptions, ingressRule.Hosts]);
|
||||
|
||||
useEffect(() => {
|
||||
// for each path in each host, if the service port doesn't exist as an option, change it to the first option
|
||||
if (ingressRule?.Hosts?.length) {
|
||||
|
|
Loading…
Reference in New Issue