@coffre/ui 0.1.9 → 0.1.11
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/client/_coffre/assets/account-BJAdDvZf.js +2 -0
- package/dist/client/_coffre/assets/account-D0jLpk5c.js +1 -0
- package/dist/client/_coffre/assets/affordances-Bq2-oUB5.js +1 -0
- package/dist/client/_coffre/assets/audit-C-pcBgKe.js +2 -0
- package/dist/client/_coffre/assets/audit-CHGlDeBB.js +1 -0
- package/dist/client/_coffre/assets/{auth.device--rDR2F8w.js → auth.device-BndOUjse.js} +1 -1
- package/dist/client/_coffre/assets/auth.device-CWHNQn9W.js +2 -0
- package/dist/client/_coffre/assets/directory-nDExpkAz.js +1 -0
- package/dist/client/_coffre/assets/dist-QVHMLatb.js +1 -0
- package/dist/client/_coffre/assets/globals-CKBoTlyH.css +1 -0
- package/dist/client/_coffre/assets/grants-CjoOnxzz.js +1 -0
- package/dist/client/_coffre/assets/icons-BQ27Ds9u.js +1 -0
- package/dist/client/_coffre/assets/index-CUGytaO3.js +12 -0
- package/dist/client/_coffre/assets/link-DP8SVWon.js +1 -0
- package/dist/client/_coffre/assets/login-CeaxDMcr.js +2 -0
- package/dist/client/_coffre/assets/login-DrMgvqZn.js +1 -0
- package/dist/client/_coffre/assets/offboarding-CNr_1tnl.js +1 -0
- package/dist/client/_coffre/assets/page-CGmvjSy4.js +1 -0
- package/dist/client/_coffre/assets/preload-helper-ClBkJ19f.js +1 -0
- package/dist/client/_coffre/assets/principal-page-DNLb_q_e.js +1 -0
- package/dist/client/_coffre/assets/projects._project._environment-CHzbboGp.js +3 -0
- package/dist/client/_coffre/assets/projects._project._environment-DDxu_HHD.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-CIAsjvg6.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-DZ9l6d-1.js +1 -0
- package/dist/client/_coffre/assets/projects.index-4eUXreE_.js +1 -0
- package/dist/client/_coffre/assets/row-state-ByET1OKX.js +1 -0
- package/dist/client/_coffre/assets/settings-D2zp1Ssu.js +1 -0
- package/dist/client/_coffre/assets/suspense-C7KwSnTG.js +1 -0
- package/dist/client/_coffre/assets/tokens._token-DWmbqzNk.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-Dui_4KfS.js +1 -0
- package/dist/client/_coffre/assets/tokens.index-CSi5Wxwf.js +1 -0
- package/dist/client/_coffre/assets/ui-BdipqGpP.js +46 -0
- package/dist/client/_coffre/assets/unregistered-CA7B4C1m.js +1 -0
- package/dist/client/_coffre/assets/use-action-DRm9yVhV.js +1 -0
- package/dist/client/_coffre/assets/use-change-BRRMJocl.js +1 -0
- package/dist/client/_coffre/assets/use-shell-BMGlJ25Q.js +1 -0
- package/dist/client/_coffre/assets/useQuery-D__2KBOs.js +1 -0
- package/dist/client/_coffre/assets/useSuspenseQuery-CSXyDALB.js +1 -0
- package/dist/client/_coffre/assets/users._user-BkNrX7Qf.js +1 -0
- package/dist/client/_coffre/assets/users._user-jbSvtdOg.js +2 -0
- package/dist/client/_coffre/assets/users.index-CKnQ1G76.js +1 -0
- package/dist/server/.vite/manifest.json +343 -246
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-Dx-c3XVk.js +162 -0
- package/dist/server/_coffre/assets/{account-CZgVVZTf.js → account-BocTPU1J.js} +150 -117
- package/dist/server/_coffre/assets/{account-D7-ZAE2T.js → account-CL8hOGhO.js} +10 -24
- package/dist/server/_coffre/assets/{affordances-BNaXjMOb.js → affordances-CKANXDTG.js} +2 -22
- package/dist/server/_coffre/assets/{async-local-storage-C0cwgkEr.js → async-local-storage-C10uQtMM.js} +3 -2
- package/dist/server/_coffre/assets/{audit-BEbhtsEp.js → audit-Bcka4vA6.js} +46 -16
- package/dist/server/_coffre/assets/audit-CSRQYIhu.js +31 -0
- package/dist/server/_coffre/assets/{auth.device-w9N3FlNk.js → auth.device-CMcUISZY.js} +7 -5
- package/dist/server/_coffre/assets/{auth.device-CMR3csAI.js → auth.device-DqO0T-rU.js} +5 -5
- package/dist/server/_coffre/assets/{directory-Dr5X9TB5.js → directory-CyYx6Jx1.js} +87 -112
- package/dist/server/_coffre/assets/{use-action-DQUmeH-5.js → dist-CnnV3t2g.js} +3 -48
- package/dist/server/_coffre/assets/globals-CKBoTlyH.css +1 -0
- package/dist/server/_coffre/assets/grants-CRijabX0.js +158 -0
- package/dist/server/_coffre/assets/{page-BdnhpwvH.js → icons-Dy-5ccDF.js} +3 -196
- package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +480 -0
- package/dist/server/_coffre/assets/link-42ZWdjzZ.js +422 -0
- package/dist/server/_coffre/assets/{login-DUtCQju5.js → login-BI9tzJEy.js} +7 -5
- package/dist/server/_coffre/assets/{login-B2njIq_o.js → login-C-v88YwP.js} +2 -2
- package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +56 -0
- package/dist/server/_coffre/assets/{offboarding-DY5MarpG.js → offboarding-1H0LavTd.js} +6 -4
- package/dist/server/_coffre/assets/page-D_mO0-sn.js +3592 -0
- package/dist/server/_coffre/assets/{principal-page-SdG8_zcu.js → principal-page-DQDoXute.js} +51 -42
- package/dist/server/_coffre/assets/{projects._project._environment-CUS0VFUe.js → projects._project._environment-C-yVwC92.js} +168 -248
- package/dist/server/_coffre/assets/{projects._project._environment-BQIrmE3r.js → projects._project._environment-D_5R40of.js} +4 -11
- package/dist/server/_coffre/assets/{projects._project.index-D1NxvBtZ.js → projects._project.index-A2BImFIT.js} +134 -96
- package/dist/server/_coffre/assets/{projects._project.index-BjNdR4KC.js → projects._project.index-BPPKxKrt.js} +5 -4
- package/dist/server/_coffre/assets/{projects.index-BQDuuh6t.js → projects.index-543IsPzY.js} +62 -54
- package/dist/server/_coffre/assets/{react-dom-qCTiwGGR.js → react-dom-bBoJXlK2.js} +417 -51
- package/dist/server/_coffre/assets/{router-BUwZOXEH.js → router-CM3vK8QO.js} +376 -92
- package/dist/server/_coffre/assets/row-state-XBtDoIA4.js +117 -0
- package/dist/server/_coffre/assets/{settings-HOErM3pd.js → settings-BLVU74ym.js} +8 -6
- package/dist/server/_coffre/assets/suspense-CzYTwxOj.js +602 -0
- package/dist/server/_coffre/assets/tokens._token-B-hBgwBW.js +10 -0
- package/dist/server/_coffre/assets/{tokens._token-BZUArbzi.js → tokens._token-aubAUonP.js} +97 -79
- package/dist/server/_coffre/assets/{tokens.index-BReCgoV9.js → tokens.index-4D3jwp5v.js} +9 -6
- package/dist/server/_coffre/assets/{ui-D_slKpSF.js → ui-BI3Bf72q.js} +7 -836
- package/dist/server/_coffre/assets/{unregistered-Z17da4Rc.js → unregistered-CagDxMyw.js} +5 -3
- package/dist/server/_coffre/assets/use-action-tzBZvjjQ.js +47 -0
- package/dist/server/_coffre/assets/use-change-Dggqxy5y.js +1212 -0
- package/dist/server/_coffre/assets/use-shell-CwStDfzX.js +462 -0
- package/dist/server/_coffre/assets/useQuery-C6_dBjem.js +8 -0
- package/dist/server/_coffre/assets/{useStore-DWGPqzXR.js → useRouter-CaUSUNsw.js} +1 -420
- package/dist/server/_coffre/assets/useSuspenseQuery-BuapQt_P.js +117 -0
- package/dist/server/_coffre/assets/{users._user-DHTNhQ9o.js → users._user-137WNyxn.js} +4 -5
- package/dist/server/_coffre/assets/users._user-C252Iilj.js +10 -0
- package/dist/server/_coffre/assets/{users.index-Cfo3ODpX.js → users.index-DQHsfnal.js} +9 -6
- package/dist/server/index.js +6 -5
- package/package.json +5 -3
- package/src/components/directory.tsx +75 -104
- package/src/components/grants.tsx +60 -112
- package/src/components/principal-page.tsx +54 -67
- package/src/components/principal-picker.tsx +7 -16
- package/src/components/row-state.tsx +95 -0
- package/src/components/service-tokens.tsx +75 -64
- package/src/components/shell.tsx +1 -1
- package/src/components/syncs.tsx +42 -26
- package/src/lib/announce.ts +36 -0
- package/src/lib/changes.ts +498 -0
- package/src/lib/coffre.ts +3 -2
- package/src/lib/optimistic.ts +233 -0
- package/src/lib/queries.ts +393 -0
- package/src/lib/use-action.ts +20 -15
- package/src/lib/use-change.ts +42 -0
- package/src/lib/use-shell.ts +17 -0
- package/src/router.tsx +17 -9
- package/src/routes/__root.tsx +8 -38
- package/src/routes/account.tsx +163 -154
- package/src/routes/audit.tsx +51 -72
- package/src/routes/auth.device.tsx +4 -2
- package/src/routes/login.tsx +3 -2
- package/src/routes/projects.$project.$environment.tsx +226 -231
- package/src/routes/projects.$project.index.tsx +136 -118
- package/src/routes/projects.index.tsx +125 -145
- package/src/routes/settings.tsx +7 -7
- package/src/routes/tokens.$token.tsx +14 -17
- package/src/routes/tokens.index.tsx +8 -4
- package/src/routes/unregistered.tsx +3 -2
- package/src/routes/users.$user.tsx +4 -4
- package/src/routes/users.index.tsx +8 -4
- package/src/styles/globals.css +78 -1
- package/dist/client/_coffre/assets/account-C3rBPdu6.js +0 -2
- package/dist/client/_coffre/assets/account-J194gi6l.js +0 -1
- package/dist/client/_coffre/assets/affordances-CmoY-8Xf.js +0 -1
- package/dist/client/_coffre/assets/audit-BtI9em7Q.js +0 -2
- package/dist/client/_coffre/assets/audit-jURfT8Km.js +0 -1
- package/dist/client/_coffre/assets/auth.device-viDUwZRT.js +0 -2
- package/dist/client/_coffre/assets/coffre-CXkp3Efg.js +0 -1
- package/dist/client/_coffre/assets/directory-PEjdb8PS.js +0 -1
- package/dist/client/_coffre/assets/globals-Bh2x1gBM.css +0 -1
- package/dist/client/_coffre/assets/grants-4mSkXPU4.js +0 -1
- package/dist/client/_coffre/assets/index-CD7bvUCb.js +0 -12
- package/dist/client/_coffre/assets/login-C-wTm_t1.js +0 -2
- package/dist/client/_coffre/assets/login-CLLv1om9.js +0 -1
- package/dist/client/_coffre/assets/offboarding-DQ-56W0H.js +0 -1
- package/dist/client/_coffre/assets/page-DbSS7pYH.js +0 -1
- package/dist/client/_coffre/assets/preload-helper-DduCCcmc.js +0 -46
- package/dist/client/_coffre/assets/principal-page-DjH1cUyz.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-BZnNvENc.js +0 -3
- package/dist/client/_coffre/assets/projects._project._environment-CLUpTvi-.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-CWXRo307.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-Dzgf95zv.js +0 -1
- package/dist/client/_coffre/assets/projects.index-BG8W91BX.js +0 -2
- package/dist/client/_coffre/assets/projects.index-N_kCFBMq.js +0 -1
- package/dist/client/_coffre/assets/settings-CNIY0--5.js +0 -1
- package/dist/client/_coffre/assets/settings-EimGqlQL.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-CkU4dCwo.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-Df2R8TF_.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-CSf5Mlz8.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-DtiWrKVq.js +0 -1
- package/dist/client/_coffre/assets/unregistered-D5go1AfR.js +0 -1
- package/dist/client/_coffre/assets/use-action-CUvWPRTx.js +0 -1
- package/dist/client/_coffre/assets/users._user-CImGVpYj.js +0 -1
- package/dist/client/_coffre/assets/users._user-D0JK911L.js +0 -2
- package/dist/client/_coffre/assets/users.index-B-7o0KBD.js +0 -1
- package/dist/client/_coffre/assets/users.index-BoFWF3mF.js +0 -2
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-CrnrBINO.js +0 -133
- package/dist/server/_coffre/assets/audit-wjpo1BWg.js +0 -74
- package/dist/server/_coffre/assets/coffre-DMs96kfX.js +0 -280
- package/dist/server/_coffre/assets/globals-Bh2x1gBM.css +0 -1
- package/dist/server/_coffre/assets/grants-C6UmWE8b.js +0 -243
- package/dist/server/_coffre/assets/projects.index-ha7jO4nC.js +0 -54
- package/dist/server/_coffre/assets/settings-Cy__khNA.js +0 -18
- package/dist/server/_coffre/assets/tokens._token-CmpmtfB_.js +0 -18
- package/dist/server/_coffre/assets/tokens.index-B5-4dD4C.js +0 -10
- package/dist/server/_coffre/assets/users._user-BKdSQhIg.js +0 -10
- package/dist/server/_coffre/assets/users.index-dMn0tlmc.js +0 -10
package/src/routes/audit.tsx
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { AuditEntryView
|
|
1
|
+
import type { AuditEntryView } from '@coffre/client';
|
|
2
2
|
import { Fragment, useState, type ReactNode } from 'react';
|
|
3
|
+
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
|
3
4
|
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
4
|
-
import {
|
|
5
|
+
import { useCoffre } from '../lib/coffre';
|
|
6
|
+
import { queries, type AuditSearch, type ChainResult } from '../lib/queries';
|
|
5
7
|
import {
|
|
6
8
|
decidedBy,
|
|
7
9
|
describe,
|
|
@@ -9,7 +11,7 @@ import {
|
|
|
9
11
|
who,
|
|
10
12
|
type Part,
|
|
11
13
|
} from '../lib/audit-sentences';
|
|
12
|
-
import { breakAfterUnderscores, EmptyState, Notice, Timestamp, Toggletip } from '../components/ui';
|
|
14
|
+
import { breakAfterUnderscores, EmptyState, Notice, Spinner, Timestamp, Toggletip } from '../components/ui';
|
|
13
15
|
import { ClosedDoor, PageHeader } from '../components/page';
|
|
14
16
|
import {
|
|
15
17
|
Activity,
|
|
@@ -24,11 +26,6 @@ import {
|
|
|
24
26
|
X,
|
|
25
27
|
} from '../components/icons';
|
|
26
28
|
|
|
27
|
-
type AuditSearch = { decision?: 'deny'; actorId?: string; detail?: '1' };
|
|
28
|
-
|
|
29
|
-
const PAGE_SIZE = 200;
|
|
30
|
-
type ChainResult = Awaited<ReturnType<typeof verifyChain>>;
|
|
31
|
-
|
|
32
29
|
export const Route = createFileRoute('/audit')({
|
|
33
30
|
// Filters live in the URL so a finding can cite the exact view it came from.
|
|
34
31
|
validateSearch: (search: Record<string, unknown>): AuditSearch => ({
|
|
@@ -38,63 +35,19 @@ export const Route = createFileRoute('/audit')({
|
|
|
38
35
|
detail: search.detail === '1' || search.detail === 1 ? '1' : undefined,
|
|
39
36
|
}),
|
|
40
37
|
loaderDeps: ({ search }) => search,
|
|
41
|
-
// The
|
|
42
|
-
//
|
|
43
|
-
loader:
|
|
44
|
-
const [entries, chain] = await Promise.all([listEntries(client, deps), verifyChain(client)]);
|
|
45
|
-
return { entries, chain };
|
|
46
|
-
},
|
|
38
|
+
// The entries only: the verification is asked for once the page is up
|
|
39
|
+
// (`ChainStatus`), so the table never waits on it.
|
|
40
|
+
loader: ({ context: { client, queryClient }, deps }) => queryClient.fetchQuery(queries.auditEntries(client, deps)),
|
|
47
41
|
component: AuditPage,
|
|
48
42
|
});
|
|
49
43
|
|
|
50
|
-
function listEntries(client: CoffreClient, search: AuditSearch) {
|
|
51
|
-
return uiResult(async () => {
|
|
52
|
-
// Detail is left out by the server unless asked for, and counted.
|
|
53
|
-
return client.audit.list({
|
|
54
|
-
limit: PAGE_SIZE,
|
|
55
|
-
decision: search.decision,
|
|
56
|
-
actor: search.actorId,
|
|
57
|
-
detail: search.detail,
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Whether the log holds, or why that is not known. Verifying is for owners:
|
|
64
|
-
* anyone else reads their projects' part of the log, and a part cannot be
|
|
65
|
-
* checked as a chain, so for them it is a fact about the page, not a fault.
|
|
66
|
-
*/
|
|
67
|
-
async function verifyChain(client: CoffreClient) {
|
|
68
|
-
try {
|
|
69
|
-
const result = await client.audit.verify();
|
|
70
|
-
return result.ok
|
|
71
|
-
? {
|
|
72
|
-
integrity: 'intact' as const,
|
|
73
|
-
through: result.through,
|
|
74
|
-
entries: result.entries,
|
|
75
|
-
checkpoint: result.checkpoint,
|
|
76
|
-
pending: result.pending ?? 0,
|
|
77
|
-
}
|
|
78
|
-
: {
|
|
79
|
-
integrity: 'broken' as const,
|
|
80
|
-
through: result.through,
|
|
81
|
-
failedAtSeq: result.failedAtSeq,
|
|
82
|
-
author: result.author,
|
|
83
|
-
reason: result.reason,
|
|
84
|
-
};
|
|
85
|
-
} catch (error) {
|
|
86
|
-
const status = statusOf(error);
|
|
87
|
-
if (status === 403) return { integrity: 'owners-only' as const };
|
|
88
|
-
return {
|
|
89
|
-
integrity: 'unknown' as const,
|
|
90
|
-
problem: status === undefined ? 'the request never got an answer' : `the request failed with HTTP ${status}`,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
44
|
function AuditPage() {
|
|
96
|
-
const { entries: result, chain } = Route.useLoaderData();
|
|
97
45
|
const search = Route.useSearch();
|
|
46
|
+
const client = useCoffre();
|
|
47
|
+
const { data: result } = useSuspenseQuery(queries.auditEntries(client, search));
|
|
48
|
+
// Not suspended: the table shows while the log is verified.
|
|
49
|
+
const verification = useQuery(queries.auditChain(client));
|
|
50
|
+
const chain = verification.data;
|
|
98
51
|
const { decision, actorId } = search;
|
|
99
52
|
const detail = search.detail === '1';
|
|
100
53
|
const deniedOnly = decision === 'deny';
|
|
@@ -107,14 +60,22 @@ function AuditPage() {
|
|
|
107
60
|
);
|
|
108
61
|
}
|
|
109
62
|
|
|
110
|
-
const broken = chain
|
|
63
|
+
const broken = chain?.integrity === 'broken' ? chain : null;
|
|
111
64
|
const breakAt = broken?.failedAtSeq ?? null;
|
|
112
65
|
const shown = lines(result.entries);
|
|
113
66
|
const filters = { decision, actorId };
|
|
114
67
|
|
|
115
68
|
return (
|
|
116
69
|
<>
|
|
117
|
-
<PageHeader
|
|
70
|
+
<PageHeader
|
|
71
|
+
title="Audit"
|
|
72
|
+
actions={
|
|
73
|
+
// One region for every state, so each change of it is announced.
|
|
74
|
+
<div className="chain-live" aria-live="polite" aria-atomic="true">
|
|
75
|
+
<ChainStatus chain={chain} onRetry={() => void verification.refetch()} />
|
|
76
|
+
</div>
|
|
77
|
+
}
|
|
78
|
+
/>
|
|
118
79
|
|
|
119
80
|
{broken !== null && (
|
|
120
81
|
<div style={{ marginBottom: '1.25rem' }}>
|
|
@@ -454,8 +415,21 @@ function BreakMark() {
|
|
|
454
415
|
* have to ask for is reassurance rather than evidence: it is checked when
|
|
455
416
|
* someone is already feeling confident, and not on the morning it would have
|
|
456
417
|
* mattered. Recomputing on load makes the claim continuous.
|
|
418
|
+
*
|
|
419
|
+
* It is not waited for, though: verifying re-reads the whole log, so until
|
|
420
|
+
* it answers the badge says it is verifying, and a check that could not run
|
|
421
|
+
* says so and offers to run again, rather than passing for a broken log.
|
|
457
422
|
*/
|
|
458
|
-
function ChainStatus({ chain }: { chain: ChainResult }) {
|
|
423
|
+
function ChainStatus({ chain, onRetry }: { chain: ChainResult | undefined; onRetry: () => void }) {
|
|
424
|
+
if (chain === undefined) {
|
|
425
|
+
return (
|
|
426
|
+
<span className="chain-note">
|
|
427
|
+
<Spinner size={14} />
|
|
428
|
+
Verifying…
|
|
429
|
+
</span>
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
|
|
459
433
|
if (chain.integrity === 'owners-only') {
|
|
460
434
|
return (
|
|
461
435
|
<Toggletip
|
|
@@ -472,21 +446,26 @@ function ChainStatus({ chain }: { chain: ChainResult }) {
|
|
|
472
446
|
|
|
473
447
|
if (chain.integrity === 'unknown') {
|
|
474
448
|
return (
|
|
475
|
-
<
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
<
|
|
481
|
-
|
|
449
|
+
<div className="chain">
|
|
450
|
+
<Toggletip
|
|
451
|
+
align="end"
|
|
452
|
+
label={`coffre could not check the log: ${chain.problem}. The entries below loaded, but whether they are intact is unknown until it can.`}
|
|
453
|
+
>
|
|
454
|
+
<button type="button" className="chain-flag chain-flag-warn">
|
|
455
|
+
<AlertTriangle size={14} />
|
|
456
|
+
Couldn’t verify
|
|
457
|
+
</button>
|
|
458
|
+
</Toggletip>
|
|
459
|
+
<button type="button" className="btn btn-sm" onClick={onRetry}>
|
|
460
|
+
Retry
|
|
482
461
|
</button>
|
|
483
|
-
</
|
|
462
|
+
</div>
|
|
484
463
|
);
|
|
485
464
|
}
|
|
486
465
|
|
|
487
466
|
if (chain.integrity === 'broken') {
|
|
488
467
|
return (
|
|
489
|
-
<span className="chain-flag chain-flag-bad"
|
|
468
|
+
<span className="chain-flag chain-flag-bad">
|
|
490
469
|
<AlertTriangle size={14} />
|
|
491
470
|
{chain.failedAtSeq === null ? 'Log does not verify' : `Log broken at ${chain.failedAtSeq}`}
|
|
492
471
|
</span>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { createFileRoute, Link, useNavigate } from '@tanstack/react-router';
|
|
3
3
|
import { failureMessage, statusOf, uiResult, useCoffre } from '../lib/coffre';
|
|
4
|
+
import { loadShell } from '../lib/queries';
|
|
4
5
|
import { ClosedDoor } from '../components/page';
|
|
5
6
|
import { ErrorLine, Spinner, Timestamp } from '../components/ui';
|
|
6
7
|
import { CheckCircle, SlashCircle, Terminal } from '../components/icons';
|
|
@@ -17,9 +18,10 @@ export const Route = createFileRoute('/auth/device')({
|
|
|
17
18
|
return typeof code === 'string' && code.length <= 16 ? { code } : {};
|
|
18
19
|
},
|
|
19
20
|
loaderDeps: ({ search }) => ({ code: search.code }),
|
|
20
|
-
|
|
21
|
+
// Its own read, not a query: it is asked once, and nothing here refreshes it.
|
|
22
|
+
loader: async ({ context: { client, queryClient }, deps }) => {
|
|
21
23
|
if (deps.code === undefined) return null;
|
|
22
|
-
if (!(await
|
|
24
|
+
if (!(await loadShell(queryClient, client)).auth.signin) {
|
|
23
25
|
return { ok: false as const, error: 'This instance has no CLI sign-in.' };
|
|
24
26
|
}
|
|
25
27
|
const code = deps.code;
|
package/src/routes/login.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { createFileRoute
|
|
2
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
3
|
+
import { useShell } from '../lib/use-shell';
|
|
3
4
|
import { signinErrorMessage } from '../lib/signin-errors';
|
|
4
5
|
import { ErrorLine, Spinner } from '../components/ui';
|
|
5
6
|
import { ClosedDoor } from '../components/page';
|
|
@@ -28,7 +29,7 @@ export const Route = createFileRoute('/login')({
|
|
|
28
29
|
* page only explains why it is showing at all.
|
|
29
30
|
*/
|
|
30
31
|
function LoginPage() {
|
|
31
|
-
const { signin, access } =
|
|
32
|
+
const { signin, access } = useShell().auth;
|
|
32
33
|
if (signin !== null) return <ProviderLoginPage {...signin} />;
|
|
33
34
|
return access?.assertion ? <CloudflareAuthenticationFailed /> : <CloudflareAccessRequired />;
|
|
34
35
|
}
|