Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add … to actions that require confirmation #9862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: fix up group overview
  • Loading branch information
aslilac committed Sep 25, 2023
commit 245a754d6992b986986ecb56faa017c2684df50c
27 changes: 19 additions & 8 deletions site/src/pages/GroupsPage/GroupPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Button from "@mui/material/Button";
import Link from "@mui/material/Link";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
Expand Down Expand Up @@ -60,6 +59,7 @@ export const GroupPage: React.FC = () => {
const [isDeletingGroup, setIsDeletingGroup] = useState(false);
const isLoading = !groupData || !permissions;
const canUpdateGroup = permissions ? permissions.canUpdateGroup : false;
const styles = useStyles();

return (
<>
Expand All @@ -80,17 +80,22 @@ export const GroupPage: React.FC = () => {
<PageHeader
actions={
<Maybe condition={canUpdateGroup}>
<Link to="settings" component={RouterLink}>
<Button startIcon={<SettingsOutlined />}>Settings</Button>
</Link>
<Button
startIcon={<SettingsOutlined />}
to="settings"
component={RouterLink}
>
Settings
</Button>
<Button
disabled={groupData?.id === groupData?.organization_id}
onClick={() => {
setIsDeletingGroup(true);
}}
startIcon={<DeleteOutline />}
className={styles.removeButton}
>
Delete
Delete&hellip;
</Button>
</Maybe>
}
Expand Down Expand Up @@ -184,11 +189,11 @@ export const GroupPage: React.FC = () => {
</Cond>
</ChooseOne>

{group && (
{groupQuery.data && (
<DeleteDialog
isOpen={isDeletingGroup}
confirmLoading={deleteGroupMutation.isLoading}
name={group.name}
name={groupQuery.data.name}
entity="group"
onConfirm={async () => {
try {
Expand Down Expand Up @@ -303,10 +308,16 @@ const GroupMemberRow = (props: {
);
};

const useStyles = makeStyles(() => ({
const useStyles = makeStyles((theme) => ({
autoComplete: {
width: 300,
},
removeButton: {
color: theme.palette.error.main,
"&:hover": {
backgroundColor: "transparent",
},
},
}));

export default GroupPage;