diff --git a/components/dashboard/src/settings/PersonalAccessTokens.tsx b/components/dashboard/src/settings/PersonalAccessTokens.tsx
index 500bc0ad9f434c..a453f5f0b4abe3 100644
--- a/components/dashboard/src/settings/PersonalAccessTokens.tsx
+++ b/components/dashboard/src/settings/PersonalAccessTokens.tsx
@@ -18,6 +18,7 @@ import { Timestamp } from "@bufbuild/protobuf";
import Alert from "../components/Alert";
import { InputWithCopy } from "../components/InputWithCopy";
import { copyToClipboard } from "../utils";
+import TokenEntry from "./TokenEntry";
function PersonalAccessTokens() {
const { enablePersonalAccessTokens } = useContext(FeatureFlagContext);
@@ -197,14 +198,16 @@ function ListAccessTokensView() {
return (
<>
-
+
Personal Access Tokens
Create or regenerate active personal access tokens.
-
-
-
+ {tokens.length > 0 && (
+
+
+
+ )}
<>
{tokenInfo && (
@@ -251,16 +254,30 @@ function ListAccessTokensView() {
>
)}
>
- {tokens.length > 0 && (
-
+ >
)}
>
);
diff --git a/components/dashboard/src/settings/TokenEntry.tsx b/components/dashboard/src/settings/TokenEntry.tsx
new file mode 100644
index 00000000000000..721c8b606aef96
--- /dev/null
+++ b/components/dashboard/src/settings/TokenEntry.tsx
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2022 Gitpod GmbH. All rights reserved.
+ * Licensed under the GNU Affero General Public License (AGPL).
+ * See License-AGPL.txt in the project root for license information.
+ */
+
+import { PersonalAccessToken } from "@gitpod/public-api/lib/gitpod/experimental/v1/tokens_pb";
+import { ContextMenuEntry } from "../components/ContextMenu";
+import { ItemFieldContextMenu } from "../components/ItemsList";
+
+const menuEntries: ContextMenuEntry[] = [
+ {
+ title: "Edit",
+ href: "",
+ onClick: () => {},
+ },
+ {
+ title: "Regenerate",
+ href: "",
+ onClick: () => {},
+ },
+ {
+ title: "Delete",
+ href: "",
+ onClick: () => {},
+ },
+];
+
+function TokenEntry(t: { token: PersonalAccessToken }) {
+ if (!t) {
+ return <>>;
+ }
+
+ const getDate = () => {
+ if (!t.token.expirationTime) {
+ return "";
+ }
+ const date = t.token.expirationTime?.toDate();
+ return date.toDateString();
+ };
+
+ const defaultAllScope = ["function:*", "resource:default"];
+
+ const getScopes = () => {
+ if (!t.token.scopes) {
+ return "";
+ }
+ if (t.token.scopes.every((v) => defaultAllScope.includes(v))) {
+ return "Access the user's API";
+ } else {
+ return "No access";
+ }
+ };
+
+ return (
+ <>
+
+
+ {t.token.name || ""}
+
+
+ {getScopes()}
+
+
+ {getDate()}
+
+
+
+
+
+ >
+ );
+}
+
+export default TokenEntry;