Skip to content
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

User Management Page #771

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

User Management Page #771

wants to merge 3 commits into from

Conversation

jabbate19
Copy link
Collaborator

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds a User Management page. Instead of needing to use the GraphQL Playground, you can approve/promote users in the website.

Which issue(s) this PR fixes:

N/A

@jabbate19
Copy link
Collaborator Author

image

@jabbate19 jabbate19 requested a review from cmp5987 May 5, 2024 23:10
Copy link
Collaborator

@cmp5987 cmp5987 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments based on what you currently have written.

@@ -21,6 +22,7 @@ const navigation = [
{ name: PageNavItem.createQuest, href: '/createQuest', icon: CommandLineIcon, internal: true },
{ name: PageNavItem.dashboard, href: '/dashboard', icon: PresentationChartBarIcon, internal: true },
{ name: PageNavItem.hosts, href: '/hosts', icon: BugAntIcon, internal: true },
{ name: PageNavItem.users, href: '/users', icon: UserIcon, internal: true },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only want to display this view if a user is an Admin.

Also we should change the endpoint to something like /admin-settings

@@ -0,0 +1,92 @@
import { Badge, Image, Button } from "@chakra-ui/react";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use tavern-ui version of badge and button instead of chakra-ui

</div>
</Badge>}
{!rowData?.isActivated && <Badge>
<div className="flex flex-row gap-1 justify-center items-center p-1" >
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nested div doesn't seem needed

const rowData = cellData.getValue();
return (
<div className="flex flex-row flex-wrap gap-1">
{!rowData?.isActivated && <Button size={"sm"}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you are missing onClick for something to occur with these buttons?

import { convertArrayOfObjectsToObject, getOfflineOnlineStatus } from "../../../utils/utils";

export const useUserTable = () => {
const [users, setUsers] = useState([]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you need this.

Instead you could just return data?.users || []

@@ -16,6 +16,7 @@ export enum PageNavItem {
tasks='Tasks',
createQuest= 'Create new quest',
hosts="Hosts",
users="User Management",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change these to be related to admin settings since we expect more kinds of admin controls on this page in the future.

];

return (
<div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you need this extra div?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants