Skip to content

Commit

Permalink
Add disabled filter option to access controls
Browse files Browse the repository at this point in the history
  • Loading branch information
braginini committed Jun 13, 2023
1 parent e7a7a75 commit 9e3d9f2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/views/AccessControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const AccessControl = () => {

const [showTutorial, setShowTutorial] = useState(true);
const [textToSearch, setTextToSearch] = useState("");
const [optionAllEnable, setOptionAllEnable] = useState("enabled");
const [optionAllEnable, setOptionAllEnable] = useState("all");
const [currentPage, setCurrentPage] = useState(1);
const [dataTable, setDataTable] = useState([] as PolicyDataTable[]);
const [policyToAction, setPolicyToAction] = useState(
Expand All @@ -100,8 +100,9 @@ export const AccessControl = () => {
const [groupPopupVisible, setGroupPopupVisible] = useState("");

const optionsAllEnabled = [
{ label: "Enabled", value: "enabled" },
{ label: "All", value: "all" },
{ label: "Enabled", value: "enabled" },
{ label: "Disabled", value: "disabled" },
];

const getSourceDestinationLabel = (data: Group[]): string => {
Expand Down Expand Up @@ -317,8 +318,10 @@ export const AccessControl = () => {
f.description.toLowerCase().includes(t) ||
t === ""
) as Policy[];
if (optionAllEnable !== "all") {
if (optionAllEnable == "enabled") {
f = filter(f, (f: Policy) => f.enabled);
} else if (optionAllEnable == "disabled") {
f = filter(f, (f: Policy) => !f.enabled);
}
return f;
};
Expand Down Expand Up @@ -562,7 +565,7 @@ export const AccessControl = () => {
allowClear
value={textToSearch}
onPressEnter={searchDataTable}
placeholder="Search..."
placeholder="Search by name and description..."
onChange={onChangeTextToSearch}
/>
</Col>
Expand Down

0 comments on commit 9e3d9f2

Please sign in to comment.