diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index 794efef..963d97f 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -90,6 +90,13 @@ export class AccountHelper { }); } + /** + * Get the entire list of administrators + */ + static async GetAdminsList(): Promise { + return await serverRequest("accounts/list"); + } + /** * Attempt to refresh current account information */ diff --git a/src/ui/routes/AccountSettingsRoute.tsx b/src/ui/routes/AccountSettingsRoute.tsx index 8346e75..3fb6aad 100644 --- a/src/ui/routes/AccountSettingsRoute.tsx +++ b/src/ui/routes/AccountSettingsRoute.tsx @@ -5,7 +5,6 @@ */ import { Grid } from "@material-ui/core"; -import { version } from "process"; import React from "react"; import { useParams } from "react-router-dom"; import { AccountHelper, AdminAccount } from "../../helpers/AccountHelper"; diff --git a/src/ui/routes/AccountsListRoute.tsx b/src/ui/routes/AccountsListRoute.tsx new file mode 100644 index 0000000..de56389 --- /dev/null +++ b/src/ui/routes/AccountsListRoute.tsx @@ -0,0 +1,83 @@ +/** + * Accounts list route + * + * @author Pierre Hubert + */ + +import { + TableContainer, + Paper, + Table, + TableHead, + TableRow, + TableCell, + TableBody, +} from "@material-ui/core"; +import React from "react"; +import { AccountHelper, AdminAccount } from "../../helpers/AccountHelper"; +import { AsyncWidget } from "../widgets/AsyncWidget"; +import { TimestampWidget } from "../widgets/TimestampWidget"; + +export class AccountsListRoute extends React.Component< + {}, + { version: number; list: AdminAccount[] } +> { + constructor(p: any) { + super(p); + + this.state = { + version: 1, + list: [], + }; + + this.load = this.load.bind(this); + this.build = this.build.bind(this); + } + + async load() { + const list = await AccountHelper.GetAdminsList(); + this.setState({ list: list }); + } + + render() { + return ( + + ); + } + + build() { + return ( + + + + + ID + Name + Email address + + Account creation + + + + + {this.state.list.map((row) => ( + + {row.id} + {row.name} + {row.email} + + + + + ))} + +
+
+ ); + } +} diff --git a/src/ui/routes/MainRoute.tsx b/src/ui/routes/MainRoute.tsx index c950570..a5aab9f 100644 --- a/src/ui/routes/MainRoute.tsx +++ b/src/ui/routes/MainRoute.tsx @@ -6,6 +6,7 @@ import { AppBar, + Divider, IconButton, List, ListItem, @@ -17,6 +18,7 @@ import { Typography, } from "@material-ui/core"; import { Home, Person } from "@material-ui/icons"; +import GroupIcon from "@material-ui/icons/Group"; import CloseSharpIcon from "@material-ui/icons/CloseSharp"; import React from "react"; import { @@ -30,6 +32,7 @@ import { AccountHelper } from "../../helpers/AccountHelper"; import { AccountSettingsRoute } from "./AccountSettingsRoute"; import { HomeRoute } from "./HomeRoute"; import { NotFoundRoute } from "./NotFoundRoute"; +import { AccountsListRoute } from "./AccountsListRoute"; const useStyles = makeStyles((theme) => ({ root: { @@ -85,6 +88,12 @@ function Menu() {
} uri="/" /> + } + uri="/accounts" + /> + } @@ -187,6 +196,10 @@ export function MainRoute() { + + + +