@coffre/ui 0.1.14 → 0.1.16
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-DqjL4kP9.js → account-BoLGAxbD.js} +2 -2
- package/dist/client/_coffre/assets/{account-DGGcVkqt.js → account-CnnuRTDB.js} +1 -1
- package/dist/client/_coffre/assets/{affordances-B9nFwqIv.js → affordances-CEafRJcN.js} +1 -1
- package/dist/client/_coffre/assets/audit-CHSvKLWX.js +1 -0
- package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +2 -0
- package/dist/client/_coffre/assets/{auth.device-CHHcm089.js → auth.device-Co5vrpaA.js} +2 -2
- package/dist/client/_coffre/assets/{auth.device-CFCn1DXA.js → auth.device-DAlqWacc.js} +1 -1
- package/dist/client/_coffre/assets/{directory-skRBmF1Y.js → directory-H8Eh3MnS.js} +1 -1
- package/dist/client/_coffre/assets/{dist-BHhATf1q.js → dist-Braunv_x.js} +1 -1
- package/dist/client/_coffre/assets/globals-CpMrgkV6.css +1 -0
- package/dist/client/_coffre/assets/{grants-BEmVXYg5.js → grants-DPDxJXU1.js} +1 -1
- package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +1 -0
- package/dist/client/_coffre/assets/{index-Bo6udWLL.js → index-sUCIXRgJ.js} +3 -3
- package/dist/client/_coffre/assets/{link-Bg_PHv45.js → link-DBINMwm6.js} +1 -1
- package/dist/client/_coffre/assets/{login-GV0ZjCQy.js → login-BZFYfL1Y.js} +1 -1
- package/dist/client/_coffre/assets/login-CYCKWTOD.js +2 -0
- package/dist/client/_coffre/assets/{offboarding-CXV0KyMt.js → offboarding-Bwpftp3g.js} +1 -1
- package/dist/client/_coffre/assets/page-C_hnzdaR.js +1 -0
- package/dist/client/_coffre/assets/{preload-helper-CYFH1xAV.js → preload-helper-CLkO85Nq.js} +1 -1
- package/dist/client/_coffre/assets/{principal-page-BmgkTnAl.js → principal-page-DLho8TSJ.js} +1 -1
- package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +3 -0
- package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +2 -0
- package/dist/client/_coffre/assets/{projects._project.index-wjtfc8E6.js → projects._project.index-DGl921dP.js} +1 -1
- package/dist/client/_coffre/assets/{projects.index-dl7dfnGW.js → projects.index-BDn7Bhoo.js} +1 -1
- package/dist/client/_coffre/assets/{row-state-BzGdu73b.js → row-state-DJ-KLamZ.js} +1 -1
- package/dist/client/_coffre/assets/{settings-DnENNWn8.js → settings-q9G1QvR_.js} +1 -1
- package/dist/client/_coffre/assets/{suspense-Cnh1cNc1.js → suspense-O8sP0mEC.js} +1 -1
- package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +2 -0
- package/dist/client/_coffre/assets/{tokens.index-D4HYaFJl.js → tokens.index-CcXSZnAG.js} +1 -1
- package/dist/client/_coffre/assets/{ui-Ch0beQy-.js → ui-BXP2IqrW.js} +2 -2
- package/dist/client/_coffre/assets/{unregistered-wV1yqr9t.js → unregistered-D2JXJ90x.js} +1 -1
- package/dist/client/_coffre/assets/{use-action-cgaBRBBH.js → use-action-BpzKWhgg.js} +1 -1
- package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +1 -0
- package/dist/client/_coffre/assets/{use-shell-BJwawvkh.js → use-shell-W0SusPkz.js} +1 -1
- package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +1 -0
- package/dist/client/_coffre/assets/{useSuspenseQuery-BfnNEmf7.js → useSuspenseQuery-BZ-nzHST.js} +1 -1
- package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +1 -0
- package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +2 -0
- package/dist/client/_coffre/assets/{users.index-C7_aZ0jb.js → users.index-BvzP3qwW.js} +1 -1
- package/dist/server/.vite/manifest.json +205 -205
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +162 -0
- package/dist/server/_coffre/assets/{account-BJtaf5d7.js → account-CV-a2IU2.js} +8 -8
- package/dist/server/_coffre/assets/{account-CL3AX6kY.js → account-hk6wcIXU.js} +4 -4
- package/dist/server/_coffre/assets/{audit-DiHTzVVe.js → audit-C1_Ej6YB.js} +2 -2
- package/dist/server/_coffre/assets/{audit-BtjuffEH.js → audit-qB9G2AQJ.js} +37 -9
- package/dist/server/_coffre/assets/{auth.device-8RMD0nyz.js → auth.device-6JRrWbSV.js} +4 -4
- package/dist/server/_coffre/assets/{auth.device-dUMx6Srl.js → auth.device-CLoAxC2T.js} +2 -2
- package/dist/server/_coffre/assets/{directory-9Jc5MEra.js → directory-B-_rqsPx.js} +5 -5
- package/dist/server/_coffre/assets/globals-CpMrgkV6.css +1 -0
- package/dist/server/_coffre/assets/{grants-D5-q8fXB.js → grants-DdKT11Ny.js} +5 -5
- package/dist/server/_coffre/assets/{icons-CWsTEfpn.js → icons-DOFT-eWB.js} +3 -2
- package/dist/server/_coffre/assets/{login-C80ImEsO.js → login-DRKUKkaW.js} +1 -1
- package/dist/server/_coffre/assets/{login-DmpfrcPB.js → login-DnwxVl4Y.js} +5 -5
- package/dist/server/_coffre/assets/{offboarding-CXIgvZbO.js → offboarding-CRz-K82H.js} +4 -4
- package/dist/server/_coffre/assets/{page-x4nICC9d.js → page-D6n45dcK.js} +28 -0
- package/dist/server/_coffre/assets/{principal-page-BO6Ijpqv.js → principal-page-C-EFwJQw.js} +11 -11
- package/dist/server/_coffre/assets/{projects._project._environment-BMqZsCfi.js → projects._project._environment-C6uybzeU.js} +9 -9
- package/dist/server/_coffre/assets/{projects._project._environment-BeXpetmJ.js → projects._project._environment-CS8DdSMY.js} +2 -2
- package/dist/server/_coffre/assets/{projects._project.index-B74-XdI3.js → projects._project.index-3CXwkyTh.js} +12 -12
- package/dist/server/_coffre/assets/{projects._project.index-DZ1KZvHR.js → projects._project.index-BGfcNpj0.js} +2 -2
- package/dist/server/_coffre/assets/{projects.index-D7F7hiVe.js → projects.index-iSoBpRFz.js} +7 -7
- package/dist/server/_coffre/assets/{router-fxr2e6Ht.js → router-9BTgJhWG.js} +20 -20
- package/dist/server/_coffre/assets/{row-state-CAItu3n_.js → row-state-C2P57xT1.js} +2 -2
- package/dist/server/_coffre/assets/{settings-DO8wvTmo.js → settings-BDQTF5XW.js} +3 -3
- package/dist/server/_coffre/assets/{suspense-WsBv84ga.js → suspense-C-2QfDd2.js} +1 -1
- package/dist/server/_coffre/assets/tokens._token-CrBMpcbN.js +988 -0
- package/dist/server/_coffre/assets/{tokens._token-DhcJxsf3.js → tokens._token-rY86Cjgp.js} +2 -2
- package/dist/server/_coffre/assets/{tokens.index-hvPM5IjY.js → tokens.index-Bq5qDW9q.js} +6 -6
- package/dist/server/_coffre/assets/{ui-DvlGkmaH.js → ui-Cc0CGMtr.js} +1 -1
- package/dist/server/_coffre/assets/{unregistered-DKdzrjVr.js → unregistered-D9ZKLOPJ.js} +3 -3
- package/dist/server/_coffre/assets/{use-action-D6KlY-sv.js → use-action-B-xpvVRO.js} +2 -2
- package/dist/server/_coffre/assets/{use-change-CAcOZo-a.js → use-change-C8BCf3oU.js} +20 -4
- package/dist/server/_coffre/assets/{use-shell-C-yuQ1hA.js → use-shell-DwOzEi87.js} +2 -2
- package/dist/server/_coffre/assets/{useQuery-MqmaAeUF.js → useQuery-CTe86qFq.js} +2 -2
- package/dist/server/_coffre/assets/{useSuspenseQuery-BDvlOPB7.js → useSuspenseQuery-CSoHzrMb.js} +2 -2
- package/dist/server/_coffre/assets/{users._user-dCIYuxyZ.js → users._user-BmLKYeo_.js} +2 -2
- package/dist/server/_coffre/assets/{users._user-pLdzKe1F.js → users._user-BmiHwQx3.js} +2 -2
- package/dist/server/_coffre/assets/{users.index-CDCDlQxN.js → users.index-BiEax90r.js} +6 -6
- package/dist/server/index.js +2 -2
- package/package.json +3 -3
- package/src/components/trusted-workloads.tsx +379 -0
- package/src/lib/audit-sentences.ts +26 -0
- package/src/lib/bindings.ts +111 -0
- package/src/lib/changes.ts +16 -0
- package/src/lib/queries.ts +16 -0
- package/src/routes/audit.tsx +7 -0
- package/src/routes/tokens.$token.tsx +3 -0
- package/src/styles/globals.css +43 -0
- package/dist/client/_coffre/assets/audit-CcQmaSan.js +0 -1
- package/dist/client/_coffre/assets/audit-XwuBA4r9.js +0 -2
- package/dist/client/_coffre/assets/globals-DCrHjrpD.css +0 -1
- package/dist/client/_coffre/assets/icons-BFziRUf9.js +0 -1
- package/dist/client/_coffre/assets/login-pzHGDqU5.js +0 -2
- package/dist/client/_coffre/assets/page-CDuo3uft.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-5PA9NHET.js +0 -2
- package/dist/client/_coffre/assets/projects._project._environment-B-5I0ZFP.js +0 -3
- package/dist/client/_coffre/assets/projects._project.index-BzJQojbd.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-BJiMX2TJ.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-C2s6HHWK.js +0 -2
- package/dist/client/_coffre/assets/use-change-DIpkq9iI.js +0 -1
- package/dist/client/_coffre/assets/useQuery-BHCBwHtH.js +0 -1
- package/dist/client/_coffre/assets/users._user--OY2srG0.js +0 -1
- package/dist/client/_coffre/assets/users._user-Cj4NY0p5.js +0 -2
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-C-_y9u60.js +0 -162
- package/dist/server/_coffre/assets/globals-DCrHjrpD.css +0 -1
- package/dist/server/_coffre/assets/tokens._token-CVWTFOM-.js +0 -286
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import { i as require_react, r as require_jsx_runtime, s as __toESM } from "./useRouter-CaUSUNsw.js";
|
|
2
|
-
import { C as useCoffre, b as memberRef, h as queries, o as affects, t as Card } from "./page-x4nICC9d.js";
|
|
3
|
-
import { n as useChangeStatus, t as useChange, y as revokeCredential } from "./use-change-CAcOZo-a.js";
|
|
4
|
-
import { t as useShell } from "./use-shell-C-yuQ1hA.js";
|
|
5
|
-
import { t as useSuspenseQuery } from "./useSuspenseQuery-BDvlOPB7.js";
|
|
6
|
-
import { a as ErrorLine, c as Spinner, i as EmptyState, l as Timestamp, o as Modal, r as CopyButton, s as Notice, t as ConfirmButton } from "./ui-DvlGkmaH.js";
|
|
7
|
-
import { A as Plus, W as X, v as Key } from "./icons-CWsTEfpn.js";
|
|
8
|
-
import { a as rowClass, i as RowPending, r as RowFailure } from "./row-state-CAItu3n_.js";
|
|
9
|
-
import { t as Route } from "./tokens._token-DhcJxsf3.js";
|
|
10
|
-
import { t as useAction } from "./use-action-D6KlY-sv.js";
|
|
11
|
-
import { t as PrincipalPage } from "./principal-page-BO6Ijpqv.js";
|
|
12
|
-
//#region src/components/service-tokens.tsx
|
|
13
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
14
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
15
|
-
var LIFETIMES = [
|
|
16
|
-
30,
|
|
17
|
-
90,
|
|
18
|
-
180,
|
|
19
|
-
365
|
|
20
|
-
];
|
|
21
|
-
/**
|
|
22
|
-
* The bearer tokens a service presents to the API. A value exists in exactly
|
|
23
|
-
* one place, this dialog, for as long as it stays open: coffre keeps a hash.
|
|
24
|
-
*/
|
|
25
|
-
function ServiceTokens({ serviceId, tokens }) {
|
|
26
|
-
const change = revokeCredential(useCoffre(), serviceId);
|
|
27
|
-
const revoke = useChange(change);
|
|
28
|
-
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
29
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
30
|
-
labelledBy: "service-tokens",
|
|
31
|
-
title: "Credentials",
|
|
32
|
-
description: "Bearer tokens this service presents to the API. Each is shown once, when it is issued; coffre keeps only a hash.",
|
|
33
|
-
actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IssueToken, { serviceId }),
|
|
34
|
-
children: tokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {
|
|
35
|
-
title: "No live credentials",
|
|
36
|
-
children: "Nothing can act as this service until a token is issued."
|
|
37
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
38
|
-
className: "dt-wrap",
|
|
39
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
40
|
-
className: "dt",
|
|
41
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
42
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Token" }),
|
|
43
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
44
|
-
className: "col-shrink",
|
|
45
|
-
children: "Issued (UTC)"
|
|
46
|
-
}),
|
|
47
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
48
|
-
className: "col-shrink",
|
|
49
|
-
children: "Last used"
|
|
50
|
-
}),
|
|
51
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
52
|
-
className: "col-shrink",
|
|
53
|
-
children: "Expires"
|
|
54
|
-
}),
|
|
55
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
56
|
-
className: "col-actions",
|
|
57
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
58
|
-
className: "visually-hidden",
|
|
59
|
-
children: "Actions"
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: tokens.map((token) => {
|
|
63
|
-
const state = status(token.id);
|
|
64
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
|
|
65
|
-
className: rowClass(state),
|
|
66
|
-
children: [
|
|
67
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
68
|
-
className: "cell-account",
|
|
69
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 15 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
70
|
-
className: "cell-stack",
|
|
71
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: token.label ?? "Unlabelled" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
|
|
72
|
-
className: "mono",
|
|
73
|
-
children: token.hint
|
|
74
|
-
})]
|
|
75
|
-
})]
|
|
76
|
-
}) }),
|
|
77
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
78
|
-
className: "nowrap",
|
|
79
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
80
|
-
className: "cell-stack",
|
|
81
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, { iso: token.createdAt }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: ["by ", token.createdBy] })]
|
|
82
|
-
})
|
|
83
|
-
}),
|
|
84
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
85
|
-
className: "nowrap cell-muted",
|
|
86
|
-
children: token.lastUsedAt === null ? "Never" : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
87
|
-
className: "cell-stack",
|
|
88
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
|
|
89
|
-
iso: token.lastUsedAt,
|
|
90
|
-
display: "relative"
|
|
91
|
-
}), token.lastUsedIp !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
|
|
92
|
-
className: "mono",
|
|
93
|
-
children: token.lastUsedIp
|
|
94
|
-
})]
|
|
95
|
-
})
|
|
96
|
-
}),
|
|
97
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
98
|
-
className: "nowrap cell-muted",
|
|
99
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
|
|
100
|
-
iso: token.expiresAt,
|
|
101
|
-
display: "relative"
|
|
102
|
-
})
|
|
103
|
-
}),
|
|
104
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
105
|
-
className: "col-actions",
|
|
106
|
-
children: state.state === "pending" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowPending, { status: state }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmButton, {
|
|
107
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
108
|
-
className: "act",
|
|
109
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 13 }), "Revoke"]
|
|
110
|
-
}),
|
|
111
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
112
|
-
"Revoke ",
|
|
113
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
114
|
-
className: "mono",
|
|
115
|
-
children: token.hint
|
|
116
|
-
}),
|
|
117
|
-
"?"
|
|
118
|
-
] }),
|
|
119
|
-
body: "Whatever uses it is refused from its next request. Issue a new token first if the service should keep working.",
|
|
120
|
-
confirmLabel: "Revoke token",
|
|
121
|
-
onConfirm: () => revoke(token)
|
|
122
|
-
})
|
|
123
|
-
})
|
|
124
|
-
]
|
|
125
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowFailure, {
|
|
126
|
-
status: state,
|
|
127
|
-
columns: 5,
|
|
128
|
-
onDismiss: () => state.state === "failed" && dismiss(state.mutationId)
|
|
129
|
-
})] }, token.id);
|
|
130
|
-
}) })]
|
|
131
|
-
})
|
|
132
|
-
})
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function IssueToken({ serviceId }) {
|
|
136
|
-
const [open, setOpen] = (0, import_react.useState)(false);
|
|
137
|
-
const [label, setLabel] = (0, import_react.useState)("");
|
|
138
|
-
const [days, setDays] = (0, import_react.useState)(90);
|
|
139
|
-
const [issued, setIssued] = (0, import_react.useState)(null);
|
|
140
|
-
const coffre = useCoffre();
|
|
141
|
-
const { pending, error, setError, run } = useAction();
|
|
142
|
-
function close() {
|
|
143
|
-
setOpen(false);
|
|
144
|
-
setIssued(null);
|
|
145
|
-
setLabel("");
|
|
146
|
-
setError(null);
|
|
147
|
-
}
|
|
148
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
149
|
-
className: "btn btn-sm",
|
|
150
|
-
onClick: () => setOpen(true),
|
|
151
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { size: 14 }), "Issue token"]
|
|
152
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, {
|
|
153
|
-
open,
|
|
154
|
-
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
155
|
-
title: issued === null ? "Issue a token" : "Copy the token now",
|
|
156
|
-
children: issued === null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
157
|
-
className: "form",
|
|
158
|
-
onSubmit: (event) => {
|
|
159
|
-
event.preventDefault();
|
|
160
|
-
run(() => coffre.tokens.issue(memberRef("service", serviceId), {
|
|
161
|
-
label: label.trim() === "" ? null : label.trim(),
|
|
162
|
-
expiresInDays: days
|
|
163
|
-
}), {
|
|
164
|
-
affects: affects.credentials(memberRef("service", serviceId)),
|
|
165
|
-
onSuccess: (credential) => setIssued(credential)
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
children: [
|
|
169
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
170
|
-
className: "form-row",
|
|
171
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
172
|
-
className: "field",
|
|
173
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
174
|
-
className: "label",
|
|
175
|
-
children: "Label"
|
|
176
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
177
|
-
className: "input",
|
|
178
|
-
value: label,
|
|
179
|
-
maxLength: 120,
|
|
180
|
-
placeholder: "GitHub Actions deploy",
|
|
181
|
-
onChange: (event) => setLabel(event.target.value)
|
|
182
|
-
})]
|
|
183
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
184
|
-
className: "field",
|
|
185
|
-
style: { flex: "0 0 9rem" },
|
|
186
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
187
|
-
className: "label",
|
|
188
|
-
children: "Expires after"
|
|
189
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", {
|
|
190
|
-
className: "select",
|
|
191
|
-
value: days,
|
|
192
|
-
onChange: (event) => setDays(Number(event.target.value)),
|
|
193
|
-
children: LIFETIMES.map((lifetime) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("option", {
|
|
194
|
-
value: lifetime,
|
|
195
|
-
children: [lifetime, " days"]
|
|
196
|
-
}, lifetime))
|
|
197
|
-
})]
|
|
198
|
-
})]
|
|
199
|
-
}),
|
|
200
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error }),
|
|
201
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
202
|
-
className: "dialog-actions",
|
|
203
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
204
|
-
className: "btn",
|
|
205
|
-
type: "button",
|
|
206
|
-
onClick: close,
|
|
207
|
-
children: "Cancel"
|
|
208
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
209
|
-
className: "btn btn-primary",
|
|
210
|
-
type: "submit",
|
|
211
|
-
disabled: pending,
|
|
212
|
-
children: [pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), "Issue token"]
|
|
213
|
-
})]
|
|
214
|
-
})
|
|
215
|
-
]
|
|
216
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
217
|
-
className: "form",
|
|
218
|
-
children: [
|
|
219
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Notice, {
|
|
220
|
-
tone: "info",
|
|
221
|
-
children: [
|
|
222
|
-
"This is the only time the value is shown. Store it where the service reads its configuration, as ",
|
|
223
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
224
|
-
className: "mono",
|
|
225
|
-
children: "COFFRE_TOKEN"
|
|
226
|
-
}),
|
|
227
|
-
"."
|
|
228
|
-
]
|
|
229
|
-
}),
|
|
230
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
231
|
-
className: "token-once",
|
|
232
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
|
|
233
|
-
className: "mono",
|
|
234
|
-
children: issued.token
|
|
235
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyButton, {
|
|
236
|
-
value: issued.token,
|
|
237
|
-
label: "Copy token"
|
|
238
|
-
})]
|
|
239
|
-
}),
|
|
240
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
241
|
-
className: "hint",
|
|
242
|
-
children: [
|
|
243
|
-
"Expires ",
|
|
244
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, { iso: issued.expiresAt }),
|
|
245
|
-
". Send it as",
|
|
246
|
-
" ",
|
|
247
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
248
|
-
className: "mono",
|
|
249
|
-
children: "Authorization: Bearer …"
|
|
250
|
-
})
|
|
251
|
-
]
|
|
252
|
-
}),
|
|
253
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
254
|
-
className: "dialog-actions",
|
|
255
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
256
|
-
className: "btn btn-primary",
|
|
257
|
-
type: "button",
|
|
258
|
-
onClick: close,
|
|
259
|
-
children: "Done"
|
|
260
|
-
})
|
|
261
|
-
})
|
|
262
|
-
]
|
|
263
|
-
})
|
|
264
|
-
})] });
|
|
265
|
-
}
|
|
266
|
-
//#endregion
|
|
267
|
-
//#region src/routes/tokens.$token.tsx?tsr-split=component
|
|
268
|
-
function TokenPage() {
|
|
269
|
-
const { token } = Route.useParams();
|
|
270
|
-
const client = useCoffre();
|
|
271
|
-
const { auth, capabilities } = useShell();
|
|
272
|
-
const member = memberRef("service", token);
|
|
273
|
-
const owner = capabilities.canManageGrants;
|
|
274
|
-
const { data: report } = useSuspenseQuery(queries.report(client, member, owner));
|
|
275
|
-
const { data: credentials } = useSuspenseQuery(queries.credentials(client, member, owner && auth.signin !== null));
|
|
276
|
-
const active = report?.ok === true && report.report?.status === "active";
|
|
277
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrincipalPage, {
|
|
278
|
-
principalType: "service",
|
|
279
|
-
principalId: token
|
|
280
|
-
}), active && credentials?.ok === true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ServiceTokens, {
|
|
281
|
-
serviceId: token,
|
|
282
|
-
tokens: credentials.tokens
|
|
283
|
-
})] });
|
|
284
|
-
}
|
|
285
|
-
//#endregion
|
|
286
|
-
export { TokenPage as component };
|