Skip to content

Commit

Permalink
fix: code-review
Browse files Browse the repository at this point in the history
  • Loading branch information
Raubzeug committed Jul 2, 2024
1 parent 9aabcf1 commit 019352f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/containers/Tenant/Acl/Acl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,28 @@ export const Acl = ({path}: {path: string}) => {
const normalizedAcl = normalizeAcl(acl);

const items = normalizedAcl.map(({Subject, ...data}) => {
const definedDataEntries = Object.entries(data).filter(([_key, value]) => value) as [
AclParameter,
string | string[],
][];
const definedDataEntries = Object.entries(data).filter(([_key, value]) =>
Boolean(value),
) as [AclParameter, string | string[]][];

if (definedDataEntries.length === 1 && definedDataEntries[0][0] === 'access') {
return {
name: Subject,
content: <DefinitionValue value={definedDataEntries[0][1]} />,
};
}
const definedData = Object.fromEntries(definedDataEntries);
return {
label: Subject,
items: aclParams
.map((key) => {
const value = definedData[key];
return {
name: aclParamToName[key],
content: <DefinitionValue value={value} />,
};
const value = data[key];
if (value) {
return {
name: aclParamToName[key],
content: <DefinitionValue value={value} />,
};
}
return undefined;
})
.filter(Boolean),
};
Expand Down

0 comments on commit 019352f

Please sign in to comment.