Skip to content

Commit

Permalink
RANGER-4010 : [addendum] Update policy UI to support multiple resourc…
Browse files Browse the repository at this point in the history
…e-sets for react ranger.

Signed-off-by: Dineshkumar Yadav <[email protected]>
  • Loading branch information
dhavaljrajpara authored and dineshkumar-yadav committed Dec 4, 2023
1 parent ac76738 commit 2e4a8c1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const CustomCondition = (props) => {
return (
<>
{conditionDefVal?.length > 0 &&
conditionDefVal.map((m, index) => {
conditionDefVal.map((m) => {
let uiHintAttb =
m.uiHint != undefined && m.uiHint != "" ? JSON.parse(m.uiHint) : "";
if (uiHintAttb != "") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ export default function PolicyPermissionItem(props) {
}
}
multiplePermissionItem = [...multiplePermissionItem, ...op];
} else {
multiplePermissionItem = [...srcOp];
}
break;
}
Expand Down Expand Up @@ -498,6 +500,7 @@ export default function PolicyPermissionItem(props) {
</td>
);
} else {
let accessTypeOptions = getAccessTypeOptions();
return (
<td key={colName} className="align-middle">
<Field
Expand All @@ -509,18 +512,39 @@ export default function PolicyPermissionItem(props) {
index
)
}
render={({ input }) => (
<div className="table-editable">
<Editable
{...input}
placement="auto"
type="checkbox"
options={getAccessTypeOptions()}
showSelectAll={true}
selectAllLabel="Select All"
/>
</div>
)}
render={({ input, meta }) => {
if (
formValues[attrName][index]?.accesses &&
isArray(
formValues[attrName][index].accesses
) &&
changePolicyItemPermissions
) {
let accTypeVal = filter(
formValues[attrName][index].accesses,
(m) => {
if (some(accessTypeOptions, m)) {
return m;
}
}
);
if (!isEqual(input.value, accTypeVal)) {
input.onChange(accTypeVal);
}
}
return (
<div className="table-editable">
<Editable
{...input}
placement="auto"
type="checkbox"
options={accessTypeOptions}
showSelectAll={true}
selectAllLabel="Select All"
/>
</div>
);
}}
/>
</td>
);
Expand Down

0 comments on commit 2e4a8c1

Please sign in to comment.