Skip to content

feat: add flag to see all tokens if owner #6227

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 16 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
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
added ttoken translations
  • Loading branch information
Kira-Pilot committed Feb 17, 2023
commit c8c4821b31b448d23ff19ab742f7a3de4819a2e3
2 changes: 2 additions & 0 deletions site/src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import starterTemplatesPage from "./starterTemplatesPage.json"
import starterTemplatePage from "./starterTemplatePage.json"
import createTemplatePage from "./createTemplatePage.json"
import userSettingsPage from "./userSettingsPage.json"
import tokensPage from "./tokensPage.json"

export const en = {
common,
Expand All @@ -42,4 +43,5 @@ export const en = {
starterTemplatePage,
createTemplatePage,
userSettingsPage,
tokensPage,
}
10 changes: 10 additions & 0 deletions site/src/i18n/en/tokensPage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"emptyState": "No tokens found",
"deleteToken": "Delete Token",
"table": {
"id": "ID",
"createdAt": "Created At",
"lastUsed": "Last Used",
"expiresAt": "Expires At"
}
}
23 changes: 8 additions & 15 deletions site/src/pages/UserSettingsPage/TokensPage/TokensPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@ import dayjs from "dayjs"
import { FC } from "react"
import { AlertBanner } from "components/AlertBanner/AlertBanner"
import IconButton from "@material-ui/core/IconButton/IconButton"

export const Language = {
idLabel: "ID",
createdAtLabel: "Created At",
lastUsedLabel: "Last Used",
expiresAtLabel: "Expires At",
emptyMessage: "No tokens found",
ariaDeleteLabel: "Delete Token",
}
import { useTranslation } from "react-i18next"

const lastUsedOrNever = (lastUsed: string) => {
const t = dayjs(lastUsed)
Expand Down Expand Up @@ -51,6 +43,7 @@ export const TokensPageView: FC<
deleteTokenError,
}) => {
const theme = useTheme()
const { t } = useTranslation("tokensPage")

return (
<Stack>
Expand All @@ -64,10 +57,10 @@ export const TokensPageView: FC<
<Table>
<TableHead>
<TableRow>
<TableCell width="25%">{Language.idLabel}</TableCell>
<TableCell width="25%">{Language.createdAtLabel}</TableCell>
<TableCell width="25%">{Language.lastUsedLabel}</TableCell>
<TableCell width="25%">{Language.expiresAtLabel}</TableCell>
<TableCell width="25%">{t("table.id")}</TableCell>
<TableCell width="25%">{t("table.createdAt")}</TableCell>
<TableCell width="25%">{t("table.lastUsed")}</TableCell>
<TableCell width="25%">{t("table.expiresAt")}</TableCell>
<TableCell width="0%"></TableCell>
</TableRow>
</TableHead>
Expand All @@ -77,7 +70,7 @@ export const TokensPageView: FC<
<TableLoader />
</Cond>
<Cond condition={hasLoaded && tokens?.length === 0}>
<TableEmpty message={Language.emptyMessage} />
<TableEmpty message={t("emptyState")} />
</Cond>
<Cond>
{tokens?.map((token) => {
Expand Down Expand Up @@ -116,7 +109,7 @@ export const TokensPageView: FC<
onDelete(token.id)
}}
size="medium"
aria-label={Language.ariaDeleteLabel}
aria-label={t("deleteToken")}
>
<DeleteOutlineIcon />
</IconButton>
Expand Down