@coffre/ui 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/audit-sentence-BhHmvQX_.js +660 -0
- package/dist/chunks/audit-sentence-BhHmvQX_.js.map +1 -0
- package/dist/chunks/connected-apps-CUOyEZXR.js +146 -0
- package/dist/chunks/connected-apps-CUOyEZXR.js.map +1 -0
- package/dist/chunks/delete-place-CRX7ntE8.js +206 -0
- package/dist/chunks/delete-place-CRX7ntE8.js.map +1 -0
- package/dist/chunks/{directory-CSjWWUQ1.js → directory-CxxrnGUL.js} +177 -60
- package/dist/chunks/directory-CxxrnGUL.js.map +1 -0
- package/dist/chunks/folders-DoBmCwOi.js +207 -0
- package/dist/chunks/folders-DoBmCwOi.js.map +1 -0
- package/dist/chunks/grants-CXcmhujY.js +669 -0
- package/dist/chunks/grants-CXcmhujY.js.map +1 -0
- package/dist/chunks/offboarding-6eAduCsM.js +305 -0
- package/dist/chunks/offboarding-6eAduCsM.js.map +1 -0
- package/dist/chunks/one-time-DXEl9hbg.js +35 -0
- package/dist/chunks/one-time-DXEl9hbg.js.map +1 -0
- package/dist/chunks/page-DvsgZ2Hd.js +391 -0
- package/dist/chunks/page-DvsgZ2Hd.js.map +1 -0
- package/dist/chunks/principal-BIN-xwZw.js +42 -0
- package/dist/chunks/principal-BIN-xwZw.js.map +1 -0
- package/dist/chunks/{principal-page-D_91OA0l.js → principal-page-B9R2zPlp.js} +259 -251
- package/dist/chunks/principal-page-B9R2zPlp.js.map +1 -0
- package/dist/chunks/project-page-SRCtRe2g.js +17 -0
- package/dist/chunks/project-page-SRCtRe2g.js.map +1 -0
- package/dist/chunks/{queries-CQ81o4so.js → queries-DVR_i3rA.js} +132 -30
- package/dist/chunks/queries-DVR_i3rA.js.map +1 -0
- package/dist/chunks/references-B6pLT1uQ.js +343 -0
- package/dist/chunks/references-B6pLT1uQ.js.map +1 -0
- package/dist/chunks/{row-state-0PsrEzOL.js → row-state-DOPUsjQK.js} +3 -3
- package/dist/chunks/{row-state-0PsrEzOL.js.map → row-state-DOPUsjQK.js.map} +1 -1
- package/dist/chunks/signin-errors--ykMFuqN.js +57 -0
- package/dist/chunks/signin-errors--ykMFuqN.js.map +1 -0
- package/dist/chunks/tabs-BmwKfUeK.js +22 -0
- package/dist/chunks/tabs-BmwKfUeK.js.map +1 -0
- package/dist/chunks/{theme-B2vQolVR.js → theme-DJuz-xLM.js} +3 -3
- package/dist/chunks/{theme-B2vQolVR.js.map → theme-DJuz-xLM.js.map} +1 -1
- package/dist/chunks/{ui-DixXLQvQ.js → ui-DJje3gST.js} +6 -3
- package/dist/chunks/ui-DJje3gST.js.map +1 -0
- package/dist/chunks/{use-change-c6CeLRin.js → use-change-CZdI2MJG.js} +75 -21
- package/dist/chunks/use-change-CZdI2MJG.js.map +1 -0
- package/dist/chunks/{use-shell-jxd7Tzd-.js → use-shell-rNKfGjdj.js} +3 -3
- package/dist/chunks/{use-shell-jxd7Tzd-.js.map → use-shell-rNKfGjdj.js.map} +1 -1
- package/dist/chunks/validation-D312_NLf.js +87 -0
- package/dist/chunks/validation-D312_NLf.js.map +1 -0
- package/dist/index.d.ts +385 -31
- package/dist/index.js +188 -102
- package/dist/index.js.map +1 -1
- package/dist/pages/account.d.ts +2 -2
- package/dist/pages/account.js +174 -135
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/approval.d.ts +9 -0
- package/dist/pages/approval.js +207 -0
- package/dist/pages/approval.js.map +1 -0
- package/dist/pages/audit.js +17 -542
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +2 -3
- package/dist/pages/device-login.js.map +1 -1
- package/dist/pages/environment.js +647 -257
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +18 -7
- package/dist/pages/login.js.map +1 -1
- package/dist/pages/oauth-authorize.d.ts +10 -0
- package/dist/pages/oauth-authorize.js +249 -0
- package/dist/pages/oauth-authorize.js.map +1 -0
- package/dist/pages/project-access.d.ts +6 -0
- package/dist/pages/project-access.js +370 -0
- package/dist/pages/project-access.js.map +1 -0
- package/dist/pages/project-environments.d.ts +4 -0
- package/dist/pages/project-environments.js +593 -0
- package/dist/pages/project-environments.js.map +1 -0
- package/dist/pages/project-settings.d.ts +4 -0
- package/dist/pages/project-settings.js +242 -0
- package/dist/pages/project-settings.js.map +1 -0
- package/dist/pages/project.d.ts +10 -2
- package/dist/pages/project.js +57 -934
- package/dist/pages/project.js.map +1 -1
- package/dist/pages/projects.js +53 -21
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.d.ts +10 -0
- package/dist/pages/{token.js → service-account.js} +112 -54
- package/dist/pages/service-account.js.map +1 -0
- package/dist/pages/service-accounts.d.ts +3 -0
- package/dist/pages/service-accounts.js +38 -0
- package/dist/pages/service-accounts.js.map +1 -0
- package/dist/pages/settings.d.ts +1 -0
- package/dist/pages/settings.js +104 -42
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.js +2 -3
- package/dist/pages/unregistered.js.map +1 -1
- package/dist/pages/user.d.ts +6 -1
- package/dist/pages/user.js +18 -6
- package/dist/pages/user.js.map +1 -1
- package/dist/pages/users.js +6 -10
- package/dist/pages/users.js.map +1 -1
- package/package.json +3 -3
- package/src/components/actions-log.tsx +117 -0
- package/src/components/audit-sentence.tsx +55 -0
- package/src/components/command-palette.tsx +4 -4
- package/src/components/connected-apps.tsx +138 -0
- package/src/components/delete-place.tsx +180 -0
- package/src/components/directory.tsx +266 -110
- package/src/components/every-project.tsx +287 -0
- package/src/components/expiry-field.tsx +42 -0
- package/src/components/folders.tsx +219 -0
- package/src/components/grants.tsx +11 -4
- package/src/components/icons.tsx +2 -0
- package/src/components/missing.tsx +110 -0
- package/src/components/offboarding.tsx +62 -34
- package/src/components/page.tsx +4 -1
- package/src/components/principal-page.tsx +154 -108
- package/src/components/principal-picker.tsx +5 -5
- package/src/components/principal.tsx +4 -4
- package/src/components/references.tsx +323 -0
- package/src/components/service-tokens.tsx +112 -93
- package/src/components/shell.tsx +11 -32
- package/src/components/tabs.tsx +18 -0
- package/src/components/trusted-workloads.tsx +97 -79
- package/src/components/ui.tsx +8 -1
- package/src/index.ts +13 -3
- package/src/layout.tsx +2 -2
- package/src/lib/access-plan.ts +2 -2
- package/src/lib/audit-sentences.ts +161 -77
- package/src/lib/changes.ts +77 -5
- package/src/lib/coffre.ts +3 -2
- package/src/lib/one-time.ts +32 -0
- package/src/lib/project-access.ts +11 -23
- package/src/lib/project-page.ts +14 -0
- package/src/lib/queries.ts +126 -32
- package/src/lib/search.ts +25 -0
- package/src/lib/signin-errors.ts +45 -1
- package/src/lib/validation.ts +14 -0
- package/src/options.ts +187 -42
- package/src/pages/account.tsx +176 -133
- package/src/pages/approval.tsx +197 -0
- package/src/pages/audit.tsx +9 -61
- package/src/pages/environment.tsx +585 -286
- package/src/pages/login.tsx +8 -2
- package/src/pages/oauth-authorize.tsx +233 -0
- package/src/pages/project-access.tsx +219 -0
- package/src/pages/project-environments.tsx +582 -0
- package/src/pages/project-settings.tsx +259 -0
- package/src/pages/project.tsx +52 -879
- package/src/pages/projects.tsx +55 -18
- package/src/pages/service-account.tsx +50 -0
- package/src/pages/{tokens.tsx → service-accounts.tsx} +9 -6
- package/src/pages/settings.tsx +62 -8
- package/src/pages/user.tsx +16 -4
- package/src/pages/users.tsx +2 -2
- package/src/parity.ts +160 -0
- package/src/register.ts +57 -10
- package/src/router.tsx +4 -0
- package/src/shared/models.ts +6 -2
- package/src/styles/globals.css +536 -31
- package/dist/chunks/directory-CSjWWUQ1.js.map +0 -1
- package/dist/chunks/grants-saMQagmG.js +0 -160
- package/dist/chunks/grants-saMQagmG.js.map +0 -1
- package/dist/chunks/icons-D-PfAfnH.js +0 -203
- package/dist/chunks/icons-D-PfAfnH.js.map +0 -1
- package/dist/chunks/offboarding-C6l30DZR.js +0 -263
- package/dist/chunks/offboarding-C6l30DZR.js.map +0 -1
- package/dist/chunks/page-C5HcNqf2.js +0 -190
- package/dist/chunks/page-C5HcNqf2.js.map +0 -1
- package/dist/chunks/principal-page-D_91OA0l.js.map +0 -1
- package/dist/chunks/queries-CQ81o4so.js.map +0 -1
- package/dist/chunks/signin-errors-BEFlVDbQ.js +0 -30
- package/dist/chunks/signin-errors-BEFlVDbQ.js.map +0 -1
- package/dist/chunks/ui-DixXLQvQ.js.map +0 -1
- package/dist/chunks/use-action-CWsg_YWU.js +0 -49
- package/dist/chunks/use-action-CWsg_YWU.js.map +0 -1
- package/dist/chunks/use-change-c6CeLRin.js.map +0 -1
- package/dist/chunks/validation-BQtqPe2V.js +0 -29
- package/dist/chunks/validation-BQtqPe2V.js.map +0 -1
- package/dist/pages/token.d.ts +0 -3
- package/dist/pages/token.js.map +0 -1
- package/dist/pages/tokens.d.ts +0 -3
- package/dist/pages/tokens.js +0 -39
- package/dist/pages/tokens.js.map +0 -1
- package/dist/project-BqIy8gYR.d.ts +0 -5
- package/src/lib/instance.ts +0 -13
- package/src/pages/token.tsx +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","names":[],"sources":["../../src/pages/settings.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query';\nimport { Link } from '@tanstack/react-router';\nimport { useCoffre } from '../lib/coffre';\nimport { queries } from '../lib/queries';\nimport { useShell } from '../lib/use-shell';\nimport { Card, Fact, PageHeader } from '../components/page';\n\n/** The instance's settings. Your own are under Account, at the sidebar's foot. */\n\
|
|
1
|
+
{"version":3,"file":"settings.js","names":[],"sources":["../../src/pages/settings.tsx"],"sourcesContent":["import type { RouteOutput } from '@coffre/client';\nimport { useSuspenseQuery } from '@tanstack/react-query';\nimport { Link } from '@tanstack/react-router';\nimport { useCoffre } from '../lib/coffre';\nimport { queries } from '../lib/queries';\nimport { useShell } from '../lib/use-shell';\nimport { Card, Fact, PageHeader } from '../components/page';\nimport { Toggletip } from '../components/ui';\nimport { Info } from '../components/icons';\n\n/** The instance's settings. Your own are under Account, at the sidebar's foot. */\n\nexport function SettingsPage() {\n const { auth, capabilities } = useShell();\n const client = useCoffre();\n const { data: directory } = useSuspenseQuery(queries.directory(client, capabilities.canManageGrants));\n const { data: keys } = useSuspenseQuery(queries.auditKeys(client, capabilities.canManageGrants));\n const providers = auth?.signin?.providers.map((provider) => provider.label) ?? [];\n\n const principals = directory?.ok === true ? directory.principals : null;\n const rootAdmins = principals?.filter((entry) => entry.isRootAdmin) ?? [];\n const users = principals?.filter((entry) => entry.principalType === 'user').length ?? 0;\n const tokens = principals?.filter((entry) => entry.principalType === 'service').length ?? 0;\n\n return (\n <>\n <PageHeader title=\"Settings\" />\n\n <Card\n labelledBy=\"instance\"\n title=\"Instance\"\n description=\"Set in the deployment's configuration, so shown here rather than edited.\"\n >\n <dl className=\"facts\">\n <Fact label=\"Sign-in\">\n <span>\n {auth?.signin ? providers.join(', ') : 'Cloudflare Access'}\n <Toggletip\n label={\n auth?.signin\n ? 'coffre’s own sign-in. Only invited members get in.'\n : 'coffre has no sign-in of its own: every request carries an Access assertion, verified at the origin.'\n }\n >\n <button type=\"button\" className=\"fact-tip\" aria-label=\"About sign-in\">\n <Info size={14} />\n </button>\n </Toggletip>\n </span>\n </Fact>\n {principals !== null && (\n <>\n <Fact label=\"Root admins\">\n <span className=\"fact-list\">\n {rootAdmins.map((admin) => (\n <span key={admin.principalId} className=\"mono\">\n {admin.principalId}\n </span>\n ))}\n </span>\n </Fact>\n <Fact label=\"Directory\">\n <span>\n <Link to=\"/users\">\n {users} user{users === 1 ? '' : 's'}\n </Link>\n {' · '}\n <Link to=\"/service-accounts\">\n {tokens} service account{tokens === 1 ? '' : 's'}\n </Link>\n </span>\n </Fact>\n </>\n )}\n </dl>\n </Card>\n\n {keys?.ok === true && <Keys keys={keys} />}\n </>\n );\n}\n\n/**\n * What the keys you keep are checked against: no secret, so shown. The keys\n * themselves are checked by `coffre verify keys`, on your machine: a vault\n * key typed into a web page would be within reach of everything running in it.\n */\nfunction Keys({ keys }: { keys: RouteOutput<'GET /audit/keys'> }) {\n const { current, checks } = keys.vault;\n const replaced = new Set(checks.map((check) => check.vaultId).filter((id) => id !== current.vaultId)).size;\n return (\n <Card\n labelledBy=\"keys\"\n title=\"Keys\"\n description={\n <>\n What the vault key and app key you keep are checked against. Check the keys themselves\n with <code>coffre verify keys</code>, which reads them on your machine and sends neither.\n </>\n }\n >\n <dl className=\"facts\">\n <Fact label=\"Vault ID\">\n <span className=\"mono\">{current.vaultId}</span>\n </Fact>\n <Fact label=\"Vault key\">\n <span>\n Held by <span className=\"mono\">{current.provider}</span>\n {replaced > 0 && `; ${replaced} earlier vault key${replaced === 1 ? '' : 's'} still checkable`}\n </span>\n </Fact>\n <Fact label=\"App key\">\n <span className=\"mono\">{keys.app.keyId}</span>\n </Fact>\n </dl>\n </Card>\n );\n}\n\n"],"mappings":";;;;;;;;;AAYA,SAAgB,eAAe;CAC7B,MAAM,EAAE,MAAM,iBAAiB,SAAS;CACxC,MAAM,SAAS,UAAU;CACzB,MAAM,EAAE,MAAM,cAAc,iBAAiB,QAAQ,UAAU,QAAQ,aAAa,eAAe,CAAC;CACpG,MAAM,EAAE,MAAM,SAAS,iBAAiB,QAAQ,UAAU,QAAQ,aAAa,eAAe,CAAC;CAC/F,MAAM,YAAY,MAAM,QAAQ,UAAU,KAAK,aAAa,SAAS,KAAK,KAAK,CAAC;CAEhF,MAAM,aAAa,WAAW,OAAO,OAAO,UAAU,aAAa;CACnE,MAAM,aAAa,YAAY,QAAQ,UAAU,MAAM,WAAW,KAAK,CAAC;CACxE,MAAM,QAAQ,YAAY,QAAQ,UAAU,MAAM,kBAAkB,MAAM,CAAC,CAAC,UAAU;CACtF,MAAM,SAAS,YAAY,QAAQ,UAAU,MAAM,kBAAkB,SAAS,CAAC,CAAC,UAAU;CAE1F,OACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,YAAD,EAAY,OAAM,WAAY,CAAA;EAE9B,oBAAC,MAAD;GACE,YAAW;GACX,OAAM;GACN,aAAY;aAEZ,qBAAC,MAAD;IAAI,WAAU;cAAd,CACE,oBAAC,MAAD;KAAM,OAAM;eACV,qBAAC,QAAD,EAAA,UAAA,CACG,MAAM,SAAS,UAAU,KAAK,IAAI,IAAI,qBACvC,oBAAC,WAAD;MACE,OACE,MAAM,SACF,uDACA;gBAGN,oBAAC,UAAD;OAAQ,MAAK;OAAS,WAAU;OAAW,cAAW;iBACpD,oBAAC,MAAD,EAAM,MAAM,GAAK,CAAA;MACX,CAAA;KACC,CAAA,CACP,EAAA,CAAA;IACF,CAAA,GACL,eAAe,QACd,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,MAAD;KAAM,OAAM;eACV,oBAAC,QAAD;MAAM,WAAU;gBACb,WAAW,KAAK,UACf,oBAAC,QAAD;OAA8B,WAAU;iBACrC,MAAM;MACH,GAFK,MAAM,WAEX,CACP;KACG,CAAA;IACF,CAAA,GACN,oBAAC,MAAD;KAAM,OAAM;eACV,qBAAC,QAAD,EAAA,UAAA;MACE,qBAAC,MAAD;OAAM,IAAG;iBAAT;QACG;QAAM;QAAM,UAAU,IAAI,KAAK;OAC5B;;MACL;MACD,qBAAC,MAAD;OAAM,IAAG;iBAAT;QACG;QAAO;QAAiB,WAAW,IAAI,KAAK;OACzC;;KACF,EAAA,CAAA;IACF,CAAA,CACN,EAAA,CAAA,CAEF;;EACA,CAAA;EAEL,MAAM,OAAO,QAAQ,oBAAC,MAAD,EAAY,KAAO,CAAA;CACzC,EAAA,CAAA;AAEN;;;;;;AAOA,SAAS,KAAK,EAAE,QAAkD;CAChE,MAAM,EAAE,SAAS,WAAW,KAAK;CACjC,MAAM,WAAW,IAAI,IAAI,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,QAAQ,OAAO,OAAO,QAAQ,OAAO,CAAC,CAAC,CAAC;CACtG,OACE,oBAAC,MAAD;EACE,YAAW;EACX,OAAM;EACN,aACE,qBAAA,UAAA,EAAA,UAAA;GAAE;GAEK,oBAAC,QAAD,EAAA,UAAM,qBAAwB,CAAA;GAAC;EACpC,EAAA,CAAA;YAGJ,qBAAC,MAAD;GAAI,WAAU;aAAd;IACE,oBAAC,MAAD;KAAM,OAAM;eACV,oBAAC,QAAD;MAAM,WAAU;gBAAQ,QAAQ;KAAc,CAAA;IAC1C,CAAA;IACN,oBAAC,MAAD;KAAM,OAAM;eACV,qBAAC,QAAD,EAAA,UAAA;MAAM;MACI,oBAAC,QAAD;OAAM,WAAU;iBAAQ,QAAQ;MAAe,CAAA;MACtD,WAAW,KAAK,KAAK,SAAS,oBAAoB,aAAa,IAAI,KAAK,IAAI;KACzE,EAAA,CAAA;IACF,CAAA;IACN,oBAAC,MAAD;KAAM,OAAM;eACV,oBAAC,QAAD;MAAM,WAAU;gBAAQ,KAAK,IAAI;KAAY,CAAA;IACzC,CAAA;GACJ;;CACA,CAAA;AAEV"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as useShell } from "../chunks/use-shell-jxd7Tzd-.js";
|
|
1
|
+
import { n as ClosedDoor, tt as User } from "../chunks/page-DvsgZ2Hd.js";
|
|
2
|
+
import { t as useShell } from "../chunks/use-shell-rNKfGjdj.js";
|
|
4
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
//#region src/pages/unregistered.tsx
|
|
6
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unregistered.js","names":[],"sources":["../../src/pages/unregistered.tsx"],"sourcesContent":["import { useShell } from '../lib/use-shell';\n\nimport { ClosedDoor } from '../components/page';\nimport { User } from '../components/icons';\n\n/**\n * Cloudflare Access has authenticated this person, but Coffre has not\n * registered them as a member. Keep this deliberately actionless: registration is\n * an owner decision, not a self-service privilege escalation path.\n */\nexport function UnregisteredPage() {\n const { principal, accessTampered } = useShell();\n\n if (accessTampered) {\n return (\n <ClosedDoor icon={<User size={18} />} label=\"Integrity check failed\" title=\"Your access is on hold\">\n <p>\n Your access record\n {principal !== null && (\n <>\n {' '}\n (<span className=\"mono\">{principal.id}</span>)\n </>\n )}{' '}\n was changed outside coffre, so its vault refuses it until someone looks. Nothing you\n held is available meanwhile.\n </p>\n <p>Ask a coffre owner to remove you under Users and add you again, which starts your access over.</p>\n </ClosedDoor>\n );\n }\n\n return (\n <ClosedDoor\n icon={<User size={18} />}\n label=\"Registration required\"\n title=\"You are not a member yet\"\n >\n <p>\n Cloudflare Access knows who you are\n {principal !== null && (\n <>\n {' '}\n (<span className=\"mono\">{principal.id}</span>)\n </>\n )}\n , but this coffre instance has not registered that identity. Until it does, no\n projects, secrets, audit entries or API operations are available to you.\n </p>\n <p>\n Ask a coffre owner or root admin to add your Access email under Users.\n </p>\n </ClosedDoor>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unregistered.js","names":[],"sources":["../../src/pages/unregistered.tsx"],"sourcesContent":["import { useShell } from '../lib/use-shell';\n\nimport { ClosedDoor } from '../components/page';\nimport { User } from '../components/icons';\n\n/**\n * Cloudflare Access has authenticated this person, but Coffre has not\n * registered them as a member. Keep this deliberately actionless: registration is\n * an owner decision, not a self-service privilege escalation path.\n */\nexport function UnregisteredPage() {\n const { principal, accessTampered } = useShell();\n\n if (accessTampered) {\n return (\n <ClosedDoor icon={<User size={18} />} label=\"Integrity check failed\" title=\"Your access is on hold\">\n <p>\n Your access record\n {principal !== null && (\n <>\n {' '}\n (<span className=\"mono\">{principal.id}</span>)\n </>\n )}{' '}\n was changed outside coffre, so its vault refuses it until someone looks. Nothing you\n held is available meanwhile.\n </p>\n <p>Ask a coffre owner to remove you under Users and add you again, which starts your access over.</p>\n </ClosedDoor>\n );\n }\n\n return (\n <ClosedDoor\n icon={<User size={18} />}\n label=\"Registration required\"\n title=\"You are not a member yet\"\n >\n <p>\n Cloudflare Access knows who you are\n {principal !== null && (\n <>\n {' '}\n (<span className=\"mono\">{principal.id}</span>)\n </>\n )}\n , but this coffre instance has not registered that identity. Until it does, no\n projects, secrets, audit entries or API operations are available to you.\n </p>\n <p>\n Ask a coffre owner or root admin to add your Access email under Users.\n </p>\n </ClosedDoor>\n );\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgB,mBAAmB;CACjC,MAAM,EAAE,WAAW,mBAAmB,SAAS;CAE/C,IAAI,gBACF,OACE,qBAAC,YAAD;EAAY,MAAM,oBAAC,MAAD,EAAM,MAAM,GAAK,CAAA;EAAG,OAAM;EAAyB,OAAM;YAA3E,CACE,qBAAC,KAAD,EAAA,UAAA;GAAG;GAEA,cAAc,QACb,qBAAA,UAAA,EAAA,UAAA;IACG;IAAI;IACJ,oBAAC,QAAD;KAAM,WAAU;eAAQ,UAAU;IAAS,CAAA;IAAC;GAC7C,EAAA,CAAA;GACD;GAAI;EAGN,EAAA,CAAA,GACH,oBAAC,KAAD,EAAA,UAAG,iGAAiG,CAAA,CAC1F;;CAIhB,OACE,qBAAC,YAAD;EACE,MAAM,oBAAC,MAAD,EAAM,MAAM,GAAK,CAAA;EACvB,OAAM;EACN,OAAM;YAHR,CAKE,qBAAC,KAAD,EAAA,UAAA;GAAG;GAEA,cAAc,QACb,qBAAA,UAAA,EAAA,UAAA;IACG;IAAI;IACJ,oBAAC,QAAD;KAAM,WAAU;eAAQ,UAAU;IAAS,CAAA;IAAC;GAC7C,EAAA,CAAA;GACF;EAGD,EAAA,CAAA,GACH,oBAAC,KAAD,EAAA,UAAG,yEAEA,CAAA,CACO;;AAEhB"}
|
package/dist/pages/user.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
//#region src/pages/user.d.ts
|
|
2
|
-
|
|
2
|
+
/** A user's page, around its tabs. */
|
|
3
|
+
export declare function UserLayout(): import("react").JSX.Element;
|
|
4
|
+
/** Their first tab: their access, or once removed, their offboarding. */
|
|
5
|
+
export declare function UserAccessPage(): import("react").JSX.Element;
|
|
6
|
+
/** Everything they did, from the audit log. */
|
|
7
|
+
export declare function UserActivityPage(): import("react").JSX.Element;
|
|
3
8
|
//#endregion
|
package/dist/pages/user.js
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
+
import { s as memberRef } from "../chunks/page-DvsgZ2Hd.js";
|
|
1
2
|
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
2
|
-
import { t as
|
|
3
|
+
import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-B9R2zPlp.js";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/pages/user.tsx
|
|
5
6
|
var Route = pageRoute();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return /* @__PURE__ */ jsx(
|
|
7
|
+
/** A user's page, around its tabs. */
|
|
8
|
+
function UserLayout() {
|
|
9
|
+
return /* @__PURE__ */ jsx(PrincipalLayout, {
|
|
9
10
|
principalType: "user",
|
|
10
|
-
principalId: user
|
|
11
|
+
principalId: Route.useParams().user
|
|
11
12
|
});
|
|
12
13
|
}
|
|
14
|
+
/** Their first tab: their access, or once removed, their offboarding. */
|
|
15
|
+
function UserAccessPage() {
|
|
16
|
+
return /* @__PURE__ */ jsx(PrincipalAccess, {
|
|
17
|
+
principalType: "user",
|
|
18
|
+
principalId: Route.useParams().user
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** Everything they did, from the audit log. */
|
|
22
|
+
function UserActivityPage() {
|
|
23
|
+
return /* @__PURE__ */ jsx(ActionsLog, { member: memberRef("user", Route.useParams().user) });
|
|
24
|
+
}
|
|
13
25
|
//#endregion
|
|
14
|
-
export {
|
|
26
|
+
export { UserAccessPage, UserActivityPage, UserLayout };
|
|
15
27
|
|
|
16
28
|
//# sourceMappingURL=user.js.map
|
package/dist/pages/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","names":[],"sources":["../../src/pages/user.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"user.js","names":[],"sources":["../../src/pages/user.tsx"],"sourcesContent":["import { ActionsLog } from '../components/actions-log';\nimport { PrincipalAccess, PrincipalLayout } from '../components/principal-page';\nimport { memberRef } from '../lib/coffre';\nimport { pageRoute } from '../lib/page-route';\nimport type { user } from '../options';\n\nconst Route = pageRoute<typeof user>();\n\n/** A user's page, around its tabs. */\nexport function UserLayout() {\n return <PrincipalLayout principalType=\"user\" principalId={Route.useParams().user} />;\n}\n\n/** Their first tab: their access, or once removed, their offboarding. */\nexport function UserAccessPage() {\n return <PrincipalAccess principalType=\"user\" principalId={Route.useParams().user} />;\n}\n\n/** Everything they did, from the audit log. */\nexport function UserActivityPage() {\n return <ActionsLog member={memberRef('user', Route.useParams().user)} />;\n}\n"],"mappings":";;;;;AAMA,IAAM,QAAQ,UAAuB;;AAGrC,SAAgB,aAAa;CAC3B,OAAO,oBAAC,iBAAD;EAAiB,eAAc;EAAO,aAAa,MAAM,UAAU,CAAC,CAAC;CAAO,CAAA;AACrF;;AAGA,SAAgB,iBAAiB;CAC/B,OAAO,oBAAC,iBAAD;EAAiB,eAAc;EAAO,aAAa,MAAM,UAAU,CAAC,CAAC;CAAO,CAAA;AACrF;;AAGA,SAAgB,mBAAmB;CACjC,OAAO,oBAAC,YAAD,EAAY,QAAQ,UAAU,QAAQ,MAAM,UAAU,CAAC,CAAC,IAAI,EAAI,CAAA;AACzE"}
|
package/dist/pages/users.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
6
|
-
import { n as RemovedList } from "../chunks/offboarding-C6l30DZR.js";
|
|
1
|
+
import { i as PageHeader, n as ClosedDoor, rt as Users, u as useCoffre } from "../chunks/page-DvsgZ2Hd.js";
|
|
2
|
+
import { p as queries } from "../chunks/queries-DVR_i3rA.js";
|
|
3
|
+
import { t as useShell } from "../chunks/use-shell-rNKfGjdj.js";
|
|
4
|
+
import { t as DirectoryTable } from "../chunks/directory-CxxrnGUL.js";
|
|
5
|
+
import { n as RemovedList } from "../chunks/offboarding-6eAduCsM.js";
|
|
7
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
9
8
|
//#region src/pages/users.tsx
|
|
@@ -18,10 +17,7 @@ function UsersPage() {
|
|
|
18
17
|
});
|
|
19
18
|
const users = result.principals.filter((principal) => principal.principalType === "user");
|
|
20
19
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
-
/* @__PURE__ */ jsx(PageHeader, {
|
|
22
|
-
title: "Users",
|
|
23
|
-
actions: /* @__PURE__ */ jsx(AddPrincipal, { principalType: "user" })
|
|
24
|
-
}),
|
|
20
|
+
/* @__PURE__ */ jsx(PageHeader, { title: "Users" }),
|
|
25
21
|
/* @__PURE__ */ jsx(DirectoryTable, {
|
|
26
22
|
principalType: "user",
|
|
27
23
|
principals: users,
|
package/dist/pages/users.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.js","names":[],"sources":["../../src/pages/users.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query';\n\nimport {
|
|
1
|
+
{"version":3,"file":"users.js","names":[],"sources":["../../src/pages/users.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query';\n\nimport { DirectoryTable } from '../components/directory';\nimport { useCoffre } from '../lib/coffre';\nimport { queries } from '../lib/queries';\nimport { useShell } from '../lib/use-shell';\nimport { ClosedDoor, PageHeader } from '../components/page';\nimport { RemovedList } from '../components/offboarding';\nimport { Users } from '../components/icons';\n\nexport function UsersPage() {\n const { capabilities } = useShell();\n const { data: result } = useSuspenseQuery(queries.directory(useCoffre(), capabilities.canManageGrants));\n\n if (!result.ok) {\n return (\n <ClosedDoor icon={<Users size={18} />} label=\"Users\" title=\"Users are closed to you\">\n {result.error}\n </ClosedDoor>\n );\n }\n\n const users = result.principals.filter((principal) => principal.principalType === 'user');\n\n return (\n <>\n <PageHeader title=\"Users\" />\n <DirectoryTable\n principalType=\"user\"\n principals={users}\n hasRemoved={result.removed.some((principal) => principal.principalType === 'user')}\n />\n <RemovedList principalType=\"user\" removed={result.removed} />\n </>\n );\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,YAAY;CAC1B,MAAM,EAAE,iBAAiB,SAAS;CAClC,MAAM,EAAE,MAAM,WAAW,iBAAiB,QAAQ,UAAU,UAAU,GAAG,aAAa,eAAe,CAAC;CAEtG,IAAI,CAAC,OAAO,IACV,OACE,oBAAC,YAAD;EAAY,MAAM,oBAAC,OAAD,EAAO,MAAM,GAAK,CAAA;EAAG,OAAM;EAAQ,OAAM;YACxD,OAAO;CACE,CAAA;CAIhB,MAAM,QAAQ,OAAO,WAAW,QAAQ,cAAc,UAAU,kBAAkB,MAAM;CAExF,OACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,YAAD,EAAY,OAAM,QAAS,CAAA;EAC3B,oBAAC,gBAAD;GACE,eAAc;GACd,YAAY;GACZ,YAAY,OAAO,QAAQ,MAAM,cAAc,UAAU,kBAAkB,MAAM;EAClF,CAAA;EACD,oBAAC,aAAD;GAAa,eAAc;GAAO,SAAS,OAAO;EAAU,CAAA;CAC5D,EAAA,CAAA;AAEN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffre/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "coffre's pages, for a deployment's own TanStack Start app: its router, and a Vite plugin for its build.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@tanstack/router-core": "1.171.15",
|
|
45
45
|
"lucide-react": "1.47.0",
|
|
46
46
|
"sonner": "2.0.7",
|
|
47
|
-
"@coffre/core": "0.
|
|
48
|
-
"@coffre/client": "0.
|
|
47
|
+
"@coffre/core": "0.4.1",
|
|
48
|
+
"@coffre/client": "0.4.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@tanstack/react-query": "5.103.1",
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
2
|
+
import { uiResult, useCoffre } from '../lib/coffre';
|
|
3
|
+
import { keys } from '../lib/queries';
|
|
4
|
+
import { describe, lines } from '../lib/audit-sentences';
|
|
5
|
+
import { Sentence } from './audit-sentence';
|
|
6
|
+
import { EmptyState, Notice, Spinner, Timestamp } from './ui';
|
|
7
|
+
import { Activity, Clock, ShieldCheck, SlashCircle } from './icons';
|
|
8
|
+
|
|
9
|
+
const PAGE_SIZE = 50;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Everything one member did, newest first, from the audit log: the same
|
|
13
|
+
* entries `coffre audit --actor` lists, said as the audit page says them.
|
|
14
|
+
* Older pages come on request.
|
|
15
|
+
*/
|
|
16
|
+
export function ActionsLog({ member }: { member: string }) {
|
|
17
|
+
const client = useCoffre();
|
|
18
|
+
const log = useInfiniteQuery({
|
|
19
|
+
queryKey: [...keys.audit, 'actor', member],
|
|
20
|
+
staleTime: 0,
|
|
21
|
+
initialPageParam: undefined as number | undefined,
|
|
22
|
+
queryFn: ({ pageParam }) =>
|
|
23
|
+
uiResult(() => client.audit.list({ actor: member, limit: PAGE_SIZE, before: pageParam })),
|
|
24
|
+
getNextPageParam: (page) =>
|
|
25
|
+
page.ok && page.entries.length === PAGE_SIZE ? page.entries.at(-1)!.seq : undefined,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (log.isPending) {
|
|
29
|
+
return (
|
|
30
|
+
<p className="hint">
|
|
31
|
+
<Spinner size={13} /> Reading the log…
|
|
32
|
+
</p>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
const failed = log.data?.pages.find((page) => !page.ok);
|
|
36
|
+
if (failed !== undefined && !failed.ok) return <Notice tone="bad">{failed.error}</Notice>;
|
|
37
|
+
const entries = (log.data?.pages ?? []).flatMap((page) => (page.ok ? page.entries : []));
|
|
38
|
+
const shown = lines(entries);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
<section className="card" aria-label="Actions log">
|
|
43
|
+
{shown.length === 0 ? (
|
|
44
|
+
<EmptyState title="Nothing done yet">Every read, write and change they make is listed here.</EmptyState>
|
|
45
|
+
) : (
|
|
46
|
+
<div className="dt-wrap">
|
|
47
|
+
<table className="dt actions-log stacks stacks-inline">
|
|
48
|
+
<thead>
|
|
49
|
+
<tr>
|
|
50
|
+
<th className="col-shrink">
|
|
51
|
+
<span className="th">
|
|
52
|
+
<Clock size={14} />
|
|
53
|
+
When
|
|
54
|
+
</span>
|
|
55
|
+
</th>
|
|
56
|
+
<th>
|
|
57
|
+
<span className="th">
|
|
58
|
+
<Activity size={14} />
|
|
59
|
+
Action
|
|
60
|
+
</span>
|
|
61
|
+
</th>
|
|
62
|
+
<th className="col-shrink">
|
|
63
|
+
<span className="th">
|
|
64
|
+
<ShieldCheck size={14} />
|
|
65
|
+
Outcome
|
|
66
|
+
</span>
|
|
67
|
+
</th>
|
|
68
|
+
</tr>
|
|
69
|
+
</thead>
|
|
70
|
+
<tbody>
|
|
71
|
+
{shown.map((batch) => {
|
|
72
|
+
const lead = batch[0]!;
|
|
73
|
+
const sentence = describe(batch);
|
|
74
|
+
return (
|
|
75
|
+
<tr key={lead.seq} className={sentence.refused ? 'is-denied' : undefined}>
|
|
76
|
+
<td className="nowrap cell-muted" title={lead.occurredAt}>
|
|
77
|
+
<Timestamp iso={lead.occurredAt} display="relative" />
|
|
78
|
+
</td>
|
|
79
|
+
<td className="cell-sentence">
|
|
80
|
+
<span className="sentence">
|
|
81
|
+
<Sentence parts={sentence.parts} />
|
|
82
|
+
</span>
|
|
83
|
+
</td>
|
|
84
|
+
<td className="nowrap" data-label="Outcome">
|
|
85
|
+
{sentence.refused ? (
|
|
86
|
+
<span className="decided decided-refused">
|
|
87
|
+
<SlashCircle size={13} />
|
|
88
|
+
Refused
|
|
89
|
+
</span>
|
|
90
|
+
) : (
|
|
91
|
+
<span className="cell-muted">Allowed</span>
|
|
92
|
+
)}
|
|
93
|
+
</td>
|
|
94
|
+
</tr>
|
|
95
|
+
);
|
|
96
|
+
})}
|
|
97
|
+
</tbody>
|
|
98
|
+
</table>
|
|
99
|
+
</div>
|
|
100
|
+
)}
|
|
101
|
+
</section>
|
|
102
|
+
{log.hasNextPage && (
|
|
103
|
+
<div className="table-actions">
|
|
104
|
+
<button
|
|
105
|
+
type="button"
|
|
106
|
+
className="btn"
|
|
107
|
+
disabled={log.isFetchingNextPage}
|
|
108
|
+
onClick={() => void log.fetchNextPage()}
|
|
109
|
+
>
|
|
110
|
+
{log.isFetchingNextPage && <Spinner />}
|
|
111
|
+
Show older
|
|
112
|
+
</button>
|
|
113
|
+
</div>
|
|
114
|
+
)}
|
|
115
|
+
</>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { serviceName, shownMember } from '@coffre/client';
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { Link } from '@tanstack/react-router';
|
|
4
|
+
import type { Part } from '../lib/audit-sentences';
|
|
5
|
+
import { breakAfterUnderscores } from './ui';
|
|
6
|
+
|
|
7
|
+
/** A sentence, its people and places links to their pages. */
|
|
8
|
+
export function Sentence({ parts }: { parts: Part[] }) {
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
{parts.map((part, index) => (
|
|
12
|
+
<Fragment key={index}>
|
|
13
|
+
{typeof part === 'string' ? (
|
|
14
|
+
part
|
|
15
|
+
) : 'place' in part ? (
|
|
16
|
+
<PlaceLink path={part.place} />
|
|
17
|
+
) : (
|
|
18
|
+
<MemberLink member={part.member} />
|
|
19
|
+
)}
|
|
20
|
+
</Fragment>
|
|
21
|
+
))}
|
|
22
|
+
</>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function PlaceLink({ path }: { path: string }) {
|
|
27
|
+
const [project, environment] = path.split('/') as [string, string | undefined];
|
|
28
|
+
const text = <span className="mono">{breakAfterUnderscores(path)}</span>;
|
|
29
|
+
return environment === undefined ? (
|
|
30
|
+
<Link to="/projects/$project" params={{ project }}>
|
|
31
|
+
{text}
|
|
32
|
+
</Link>
|
|
33
|
+
) : (
|
|
34
|
+
<Link to="/projects/$project/$environment" params={{ project, environment }}>
|
|
35
|
+
{text}
|
|
36
|
+
</Link>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A member from the log, which keeps `token:<name>`, shown as people read it: `service:<name>`, to its page. */
|
|
41
|
+
function MemberLink({ member }: { member: string }) {
|
|
42
|
+
return member.startsWith('token:') ? (
|
|
43
|
+
<Link to="/service-accounts/$account" params={{ account: serviceName(member) }}>
|
|
44
|
+
{shownMember(member)}
|
|
45
|
+
</Link>
|
|
46
|
+
) : (
|
|
47
|
+
<Link to="/users/$user" params={{ user: memberName(member) }}>
|
|
48
|
+
{memberName(member)}
|
|
49
|
+
</Link>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function memberName(member: string): string {
|
|
54
|
+
return member.startsWith('user:') ? member.slice('user:'.length) : shownMember(member);
|
|
55
|
+
}
|
|
@@ -145,11 +145,11 @@ export function CommandPalette({
|
|
|
145
145
|
run: closing(() => navigate({ to: '/users' })),
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
|
-
value: '
|
|
148
|
+
value: 'service accounts tokens machines ci oidc directory',
|
|
149
149
|
icon: <Key size={15} />,
|
|
150
|
-
label: '
|
|
151
|
-
path: '/
|
|
152
|
-
run: closing(() => navigate({ to: '/
|
|
150
|
+
label: 'Service accounts',
|
|
151
|
+
path: '/service-accounts',
|
|
152
|
+
run: closing(() => navigate({ to: '/service-accounts' })),
|
|
153
153
|
},
|
|
154
154
|
],
|
|
155
155
|
audit: [
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { ConnectedApp } from '@coffre/client';
|
|
2
|
+
import { MCP_SCOPE_INFO } from '@coffre/core/mcp';
|
|
3
|
+
import { Fragment, type ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import type { Change } from '../lib/optimistic';
|
|
6
|
+
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
7
|
+
import { Link as LinkIcon, X } from './icons';
|
|
8
|
+
import { Card } from './page';
|
|
9
|
+
import { RowFailure, RowPending, rowClass } from './row-state';
|
|
10
|
+
import { ConfirmButton, EmptyState, ErrorLine, Timestamp } from './ui';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* MCP clients connected as someone: your own on your account page, or a
|
|
14
|
+
* person's on theirs, for an owner. Each row says what the app is, what it
|
|
15
|
+
* may do, and when it was last used; Disconnect stops it at its next request.
|
|
16
|
+
*/
|
|
17
|
+
export function ConnectedAppsCard<TData>({
|
|
18
|
+
apps,
|
|
19
|
+
change,
|
|
20
|
+
description,
|
|
21
|
+
empty,
|
|
22
|
+
}: {
|
|
23
|
+
apps: ConnectedApp[] | { error: string };
|
|
24
|
+
change: Change<TData, ConnectedApp, ConnectedApp, unknown>;
|
|
25
|
+
description: ReactNode;
|
|
26
|
+
empty: ReactNode;
|
|
27
|
+
}) {
|
|
28
|
+
const disconnect = useChange(change);
|
|
29
|
+
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
30
|
+
return (
|
|
31
|
+
<Card
|
|
32
|
+
labelledBy="apps"
|
|
33
|
+
title="Connected apps"
|
|
34
|
+
description={description}
|
|
35
|
+
>
|
|
36
|
+
{'error' in apps ? (
|
|
37
|
+
<div className="card-body">
|
|
38
|
+
<ErrorLine error={apps.error} />
|
|
39
|
+
</div>
|
|
40
|
+
) : apps.length === 0 ? (
|
|
41
|
+
<EmptyState title="No connected apps">{empty}</EmptyState>
|
|
42
|
+
) : (
|
|
43
|
+
<div className="dt-wrap">
|
|
44
|
+
<table className="dt stacks stacks-inline">
|
|
45
|
+
<thead>
|
|
46
|
+
<tr>
|
|
47
|
+
<th>App</th>
|
|
48
|
+
<th>May</th>
|
|
49
|
+
<th className="col-shrink">Last used</th>
|
|
50
|
+
<th className="col-shrink">Expires</th>
|
|
51
|
+
<th className="col-actions">
|
|
52
|
+
<span className="visually-hidden">Actions</span>
|
|
53
|
+
</th>
|
|
54
|
+
</tr>
|
|
55
|
+
</thead>
|
|
56
|
+
<tbody>
|
|
57
|
+
{apps.map((app) => {
|
|
58
|
+
const state = status(app.id);
|
|
59
|
+
return (
|
|
60
|
+
<Fragment key={app.id}>
|
|
61
|
+
<tr className={rowClass(state)}>
|
|
62
|
+
<td>
|
|
63
|
+
<span className="cell-account">
|
|
64
|
+
<LinkIcon size={15} />
|
|
65
|
+
<span className="cell-stack">
|
|
66
|
+
<span>
|
|
67
|
+
{app.name}{' '}
|
|
68
|
+
{app.registration === 'dcr' && (
|
|
69
|
+
<span className="tag tag-amber" title="It registered itself: its name is its own claim">
|
|
70
|
+
Unverified
|
|
71
|
+
</span>
|
|
72
|
+
)}
|
|
73
|
+
</span>
|
|
74
|
+
<small>
|
|
75
|
+
{app.host === null ? 'no website' : <span className="mono">{app.host}</span>}
|
|
76
|
+
{' · connected '}
|
|
77
|
+
<Timestamp iso={app.createdAt} display="relative" />
|
|
78
|
+
</small>
|
|
79
|
+
</span>
|
|
80
|
+
</span>
|
|
81
|
+
</td>
|
|
82
|
+
<td data-label="May">{scopeLabels(app)}</td>
|
|
83
|
+
<td className="nowrap cell-muted" data-label="Last used">
|
|
84
|
+
{app.lastUsedAt === null ? 'Never' : <Timestamp iso={app.lastUsedAt} display="relative" />}
|
|
85
|
+
</td>
|
|
86
|
+
<td className="nowrap cell-muted" data-label="Expires">
|
|
87
|
+
<Timestamp iso={app.expiresAt} display="relative" />
|
|
88
|
+
</td>
|
|
89
|
+
<td className="col-actions">
|
|
90
|
+
{state.state === 'pending' ? (
|
|
91
|
+
<RowPending status={state} />
|
|
92
|
+
) : (
|
|
93
|
+
<ConfirmButton
|
|
94
|
+
trigger={
|
|
95
|
+
<button className="act">
|
|
96
|
+
<X size={13} />
|
|
97
|
+
Disconnect
|
|
98
|
+
</button>
|
|
99
|
+
}
|
|
100
|
+
title={`Disconnect ${app.name}?`}
|
|
101
|
+
body={
|
|
102
|
+
<>
|
|
103
|
+
{app.name}
|
|
104
|
+
{app.host !== null && (
|
|
105
|
+
<>
|
|
106
|
+
{' '}at <span className="mono">{app.host}</span>
|
|
107
|
+
</>
|
|
108
|
+
)}
|
|
109
|
+
, last used{' '}
|
|
110
|
+
{app.lastUsedAt === null ? 'never' : <Timestamp iso={app.lastUsedAt} display="relative" />},
|
|
111
|
+
stops at its next request. To use it again, connect it again.
|
|
112
|
+
</>
|
|
113
|
+
}
|
|
114
|
+
confirmLabel="Disconnect"
|
|
115
|
+
onConfirm={() => disconnect(app)}
|
|
116
|
+
/>
|
|
117
|
+
)}
|
|
118
|
+
</td>
|
|
119
|
+
</tr>
|
|
120
|
+
<RowFailure
|
|
121
|
+
status={state}
|
|
122
|
+
columns={5}
|
|
123
|
+
onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}
|
|
124
|
+
/>
|
|
125
|
+
</Fragment>
|
|
126
|
+
);
|
|
127
|
+
})}
|
|
128
|
+
</tbody>
|
|
129
|
+
</table>
|
|
130
|
+
</div>
|
|
131
|
+
)}
|
|
132
|
+
</Card>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function scopeLabels(app: ConnectedApp): string {
|
|
137
|
+
return app.scopes.map((scope) => MCP_SCOPE_INFO[scope].label).join(', ');
|
|
138
|
+
}
|