Skip to content

Commit

Permalink
Fix/blank page on empty policy groups (#292)
Browse files Browse the repository at this point in the history
validate null sources and destinations fields
  • Loading branch information
mlsmaycon authored Nov 1, 2023
1 parent a9354d3 commit 2fc7b73
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/views/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,20 @@ export const Settings = () => {
const createSingleArrayForPolicy: any = [];
policies.map((aControl: any) => {
const cSingleAccessArray = aControl.allGroups ? aControl.allGroups : [];
aControl.rules[0].destinations.forEach((destination: any) => {
if (cSingleAccessArray.indexOf(destination.id) === -1) {
cSingleAccessArray.push(destination.id);
}
});

aControl.rules[0].sources.forEach((source: any) => {
if (cSingleAccessArray.indexOf(source.id) === -1) {
cSingleAccessArray.push(source.id);
}
});
if (aControl.rules[0].destinations) {
aControl.rules[0].destinations.forEach((destination: any) => {
if (cSingleAccessArray.indexOf(destination.id) === -1) {
cSingleAccessArray.push(destination.id);
}
});
}
if (aControl.rules[0].sources) {
aControl.rules[0].sources.forEach((source: any) => {
if (cSingleAccessArray.indexOf(source.id) === -1) {
cSingleAccessArray.push(source.id);
}
});
}

aControl["cSingleAccessArray"] = cSingleAccessArray;
createSingleArrayForPolicy.push(aControl);
Expand Down

0 comments on commit 2fc7b73

Please sign in to comment.