Skip to content

Commit b965dc3

Browse files
committed
Complete frontend
1 parent 72d074a commit b965dc3

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

site/src/api/typesGenerated.ts

+1
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ export interface User {
509509
readonly username: string
510510
readonly email: string
511511
readonly created_at: string
512+
readonly last_seen_at: string
512513
readonly status: UserStatus
513514
readonly organization_ids: string[]
514515
readonly roles: Role[]

site/src/components/WorkspacesTable/WorkspaceLastUsed.tsx renamed to site/src/components/LastUsed/LastUsed.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import { colors } from "theme/colors"
88

99
dayjs.extend(relativeTime)
1010

11-
interface WorkspaceLastUsedProps {
11+
interface LastUsedProps {
1212
lastUsedAt: string
1313
}
1414

15-
export const WorkspaceLastUsed: FC<WorkspaceLastUsedProps> = ({ lastUsedAt }) => {
15+
export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
1616
const theme: Theme = useTheme()
1717
const styles = useStyles()
1818

site/src/components/UsersTable/UsersTable.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const Language = {
1414
usernameLabel: "User",
1515
rolesLabel: "Roles",
1616
statusLabel: "Status",
17+
lastSeenLabel: "Last Seen",
1718
}
1819

1920
export interface UsersTableProps {
@@ -50,6 +51,7 @@ export const UsersTable: FC<React.PropsWithChildren<UsersTableProps>> = ({
5051
<TableRow>
5152
<TableCell width="50%">{Language.usernameLabel}</TableCell>
5253
<TableCell width="25%">{Language.statusLabel}</TableCell>
54+
<TableCell width="50%">{Language.lastSeenLabel}</TableCell>
5355
<TableCell width="25%">
5456
<Stack direction="row" spacing={1} alignItems="center">
5557
<span>{Language.rolesLabel}</span>

site/src/components/UsersTable/UsersTableBody.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Box from "@material-ui/core/Box"
22
import { makeStyles } from "@material-ui/core/styles"
33
import TableCell from "@material-ui/core/TableCell"
44
import TableRow from "@material-ui/core/TableRow"
5+
import { LastUsed } from "components/LastUsed/LastUsed"
56
import { FC } from "react"
67
import * as TypesGen from "../../api/typesGenerated"
78
import { combineClasses } from "../../util/combineClasses"
@@ -101,6 +102,9 @@ export const UsersTableBody: FC<React.PropsWithChildren<UsersTableBodyProps>> =
101102
>
102103
{user.status}
103104
</TableCell>
105+
<TableCell>
106+
<LastUsed lastUsedAt={user.last_seen_at} />
107+
</TableCell>
104108
<TableCell>
105109
{canEditUsers ? (
106110
<RoleSelect

site/src/components/WorkspacesTable/WorkspacesRow.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { WorkspaceStatusBadge } from "components/WorkspaceStatusBadge/WorkspaceS
88
import { FC } from "react"
99
import { useNavigate } from "react-router-dom"
1010
import { WorkspaceItemMachineRef } from "../../xServices/workspaces/workspacesXService"
11+
import { LastUsed } from "../LastUsed/LastUsed"
1112
import { TableCellData, TableCellDataPrimary } from "../TableCellData/TableCellData"
1213
import { TableCellLink } from "../TableCellLink/TableCellLink"
1314
import { OutdatedHelpTooltip } from "../Tooltips"
14-
import { WorkspaceLastUsed } from "./WorkspaceLastUsed"
1515

1616
const Language = {
1717
upToDateLabel: "Up to date",
@@ -61,7 +61,7 @@ export const WorkspacesRow: FC<
6161
</TableCellLink>
6262
<TableCellLink to={workspacePageLink}>
6363
<TableCellData>
64-
<WorkspaceLastUsed lastUsedAt={workspace.last_used_at} />
64+
<LastUsed lastUsedAt={workspace.last_used_at} />
6565
</TableCellData>
6666
</TableCellLink>
6767

site/src/testHelpers/entities.ts

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export const MockUser: TypesGen.User = {
7171
organization_ids: ["fc0774ce-cc9e-48d4-80ae-88f7a4d4a8b0"],
7272
roles: [MockOwnerRole],
7373
avatar_url: "https://github.com/coder.png",
74+
last_seen_at: "",
7475
}
7576

7677
export const MockUserAdmin: TypesGen.User = {
@@ -82,6 +83,7 @@ export const MockUserAdmin: TypesGen.User = {
8283
organization_ids: ["fc0774ce-cc9e-48d4-80ae-88f7a4d4a8b0"],
8384
roles: [MockUserAdminRole],
8485
avatar_url: "",
86+
last_seen_at: "",
8587
}
8688

8789
export const MockUser2: TypesGen.User = {
@@ -93,6 +95,7 @@ export const MockUser2: TypesGen.User = {
9395
organization_ids: ["fc0774ce-cc9e-48d4-80ae-88f7a4d4a8b0"],
9496
roles: [],
9597
avatar_url: "",
98+
last_seen_at: "2022-09-14T19:12:21Z",
9699
}
97100

98101
export const SuspendedMockUser: TypesGen.User = {
@@ -104,6 +107,7 @@ export const SuspendedMockUser: TypesGen.User = {
104107
organization_ids: ["fc0774ce-cc9e-48d4-80ae-88f7a4d4a8b0"],
105108
roles: [],
106109
avatar_url: "",
110+
last_seen_at: "",
107111
}
108112

109113
export const MockOrganization: TypesGen.Organization = {

0 commit comments

Comments
 (0)