1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 06:49:40 +02:00

fix(ing): nodeport validate and show errors [EE-4373] (#7801)

This commit is contained in:
Ali 2022-10-12 10:06:57 +13:00 committed by GitHub
parent fd91de3571
commit 7a6ff10268
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 135 additions and 62 deletions

View file

@ -13,14 +13,24 @@ class KubernetesFormValidationHelper {
}
static getDuplicates(names) {
const groupped = _.groupBy(names);
const grouped = _.groupBy(names);
const res = {};
_.forEach(names, (name, index) => {
if (name && groupped[name].length > 1) {
if (name && grouped[name].length > 1) {
res[index] = name;
}
});
return res;
}
static getDuplicateNodePorts(serviceNodePorts, allOtherNodePorts) {
const res = {};
serviceNodePorts.forEach((sNodePort, index) => {
if (allOtherNodePorts.includes(sNodePort) || serviceNodePorts.filter((snp) => snp === sNodePort).length > 1) {
res[index] = sNodePort;
}
});
return res;
}
}
export default KubernetesFormValidationHelper;