Skip to content

Commit

Permalink
adding user service account policy edit (#1565)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex <33497058+bexsoft@users.noreply.github.com>
  • Loading branch information
adfost and bexsoft committed Feb 12, 2022
1 parent a232d73 commit dce96ec
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions portal-ui/src/screens/Console/Users/UserServiceAccountsPanel.tsx
Expand Up @@ -40,6 +40,7 @@ import PanelTitle from "../Common/PanelTitle/PanelTitle";
import RBIconButton from "../Buckets/BucketDetails/SummaryItems/RBIconButton";
import DeleteMultipleServiceAccounts from "./DeleteMultipleServiceAccounts";
import { selectSAs } from "../../Console/Configurations/utils";
import ServiceAccountPolicy from "../Account/ServiceAccountPolicy";

interface IUserServiceAccountsProps {
classes: any;
Expand Down Expand Up @@ -76,6 +77,7 @@ const UserServiceAccountsPanel = ({
useState<NewServiceAccount | null>(null);
const [selectedSAs, setSelectedSAs] = useState<string[]>([]);
const [deleteMultipleOpen, setDeleteMultipleOpen] = useState<boolean>(false);
const [policyOpen, setPolicyOpen] = useState<boolean>(false);

useEffect(() => {
fetchRecords();
Expand Down Expand Up @@ -147,12 +149,23 @@ const UserServiceAccountsPanel = ({
setNewServiceAccount(null);
};

const policyModalOpen = (selectedServiceAccount: string) => {
setSelectedServiceAccount(selectedServiceAccount);
setPolicyOpen(true);
};

const confirmDeleteServiceAccount = (selectedServiceAccount: string) => {
setSelectedServiceAccount(selectedServiceAccount);
setDeleteOpen(true);
};

const closePolicyModal = () => {
setPolicyOpen(false);
setLoading(true);
};

const tableActions = [
{ type: "view", onClick: policyModalOpen },
{ type: "delete", onClick: confirmDeleteServiceAccount },
];

Expand Down Expand Up @@ -193,6 +206,13 @@ const UserServiceAccountsPanel = ({
entity="Service Account"
/>
)}
{policyOpen && (
<ServiceAccountPolicy
open={policyOpen}
selectedAccessKey={selectedServiceAccount}
closeModalAndRefresh={closePolicyModal}
/>
)}
<div className={classes.actionsTray}>
<PanelTitle>Service Accounts</PanelTitle>
<Box>
Expand Down

0 comments on commit dce96ec

Please sign in to comment.