@parallelworks/tandem-web 0.175.1 → 0.175.3
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/_virtual/_virtual_i18n/en/common.js +4 -1
- package/_virtual/_virtual_i18n/es/common.js +4 -1
- package/_virtual/_virtual_i18n/ja/common.js +4 -1
- package/_virtual/_virtual_i18n/ko/common.js +4 -1
- package/_virtual/_virtual_i18n/zh/common.js +4 -1
- package/components/DocTable.js +30 -19
- package/components/DocsTree.js +198 -224
- package/components/InlineCommand.js +13 -0
- package/package.json +1 -1
- package/routes/_workspace/docs/space2._space.js +134 -115
- package/routes/_workspace/settings/runners2.js +41 -43
- package/routes/_workspace/settings/tokens2.js +115 -117
- package/routes/_workspace2.js +310 -314
|
@@ -1,160 +1,158 @@
|
|
|
1
1
|
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
2
|
import { tokensQuery as n } from "../../../api/queries.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
3
|
+
import { InlineCommand as r } from "../../../components/InlineCommand.js";
|
|
4
|
+
import { KeyIcon as i } from "../../../components/icons.js";
|
|
5
|
+
import { OneTimeSecret as a } from "../../../components/OneTimeSecret.js";
|
|
6
|
+
import { SettingsPage as o, useFormError as s } from "../../../components/settings.js";
|
|
7
|
+
import { useConfirm as c } from "../../../lib/confirm.js";
|
|
8
|
+
import { copyItem as l } from "../../../lib/menus.js";
|
|
9
|
+
import { useTime as u } from "../../../lib/time.js";
|
|
10
|
+
import { Route as d } from "./tokens.js";
|
|
11
|
+
import { Button as f, ErrorText as p, Input as m, Modal as h, ModalTitle as g, PageHeaderAddButton as _, Select as v, Table as y, menuDivider as b, useOpenMenu as x } from "@parallelworks/ui";
|
|
12
|
+
import { useMemo as S, useState as C } from "react";
|
|
13
|
+
import { useTranslations as w } from "use-intl";
|
|
14
|
+
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
15
|
+
import { useMutation as D, useQueryClient as O, useSuspenseQuery as k } from "@tanstack/react-query";
|
|
16
|
+
import { ListCellText as A, ListColumns as j, ListPage as M, ListRow as N, ListToolbar as P, NameCell as F, listTableProps as I, useListNavigate as L, useListSearch as R, useListView as z } from "@parallelworks/ui/list";
|
|
16
17
|
// src/routes/$workspace/settings/tokens.tsx?tsr-split=component
|
|
17
|
-
function
|
|
18
|
-
let { workspace:
|
|
18
|
+
function B() {
|
|
19
|
+
let { workspace: s } = d.useParams(), { data: f } = k(n), p = w("account"), m = w("common"), h = u(), g = O(), v = R(), B = L(), H = x(), [U, W] = C(!1), [G, K] = C(null), q = D({
|
|
19
20
|
mutationFn: async (n) => t(await e.DELETE("/api/v1/me/tokens/{tokenId}", { params: { path: { tokenId: n } } })),
|
|
20
|
-
onSettled: () =>
|
|
21
|
-
}), { confirm:
|
|
22
|
-
title:
|
|
23
|
-
description:
|
|
24
|
-
confirmLabel:
|
|
25
|
-
onConfirm: () =>
|
|
26
|
-
}),
|
|
21
|
+
onSettled: () => g.invalidateQueries({ queryKey: n.queryKey })
|
|
22
|
+
}), { confirm: J, dialog: Y } = c(), X = (e) => J({
|
|
23
|
+
title: p("revokeTokenTitle"),
|
|
24
|
+
description: p("revokeTokenDescription", { name: e.name }),
|
|
25
|
+
confirmLabel: p("revoke"),
|
|
26
|
+
onConfirm: () => q.mutateAsync(e.id)
|
|
27
|
+
}), ee = S(() => [
|
|
27
28
|
{
|
|
28
29
|
key: "name",
|
|
29
|
-
label:
|
|
30
|
+
label: m("name"),
|
|
30
31
|
headerClassName: "py-2",
|
|
31
32
|
alwaysVisible: !0
|
|
32
33
|
},
|
|
33
34
|
{
|
|
34
35
|
key: "access",
|
|
35
|
-
label:
|
|
36
|
+
label: p("tokenAccess"),
|
|
36
37
|
headerClassName: "py-2 w-56"
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
40
|
key: "used",
|
|
40
|
-
label:
|
|
41
|
+
label: p("tokenColUsed"),
|
|
41
42
|
headerClassName: "py-2 w-40",
|
|
42
43
|
align: "end"
|
|
43
44
|
}
|
|
44
|
-
], [
|
|
45
|
+
], [p, m]), te = S(() => [{
|
|
45
46
|
value: "name",
|
|
46
|
-
label:
|
|
47
|
+
label: m("name"),
|
|
47
48
|
compare: (e, t) => e.name.localeCompare(t.name)
|
|
48
49
|
}, {
|
|
49
50
|
value: "used",
|
|
50
|
-
label:
|
|
51
|
+
label: p("tokenColUsed"),
|
|
51
52
|
compare: (e, t) => (t.lastUsedAt ?? "").localeCompare(e.lastUsedAt ?? "")
|
|
52
|
-
}], [
|
|
53
|
+
}], [p, m]), Z = z({
|
|
53
54
|
storageKey: "tandem-tokens",
|
|
54
55
|
defaultShowColumnHeaders: !1,
|
|
55
|
-
columns:
|
|
56
|
-
orderBys:
|
|
56
|
+
columns: ee,
|
|
57
|
+
orderBys: te,
|
|
57
58
|
defaultOrderBy: "name",
|
|
58
59
|
facets: []
|
|
59
|
-
}), Q =
|
|
60
|
-
return /* @__PURE__ */
|
|
60
|
+
}), Q = v.filter.trim().toLowerCase(), $ = f.filter((e) => !Q || e.name.toLowerCase().includes(Q));
|
|
61
|
+
return /* @__PURE__ */ E(o, {
|
|
61
62
|
wide: !0,
|
|
62
|
-
title:
|
|
63
|
-
description:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}) }),
|
|
67
|
-
actions: /* @__PURE__ */ w(g, {
|
|
68
|
-
label: f("newToken"),
|
|
63
|
+
title: p("tokens"),
|
|
64
|
+
description: p.rich("tokensDescription", { code: (e) => /* @__PURE__ */ T(r, { children: e }) }),
|
|
65
|
+
actions: /* @__PURE__ */ T(_, {
|
|
66
|
+
label: p("newToken"),
|
|
69
67
|
word: "create",
|
|
70
|
-
onClick: () =>
|
|
68
|
+
onClick: () => W(!0)
|
|
71
69
|
}),
|
|
72
|
-
toolbar:
|
|
70
|
+
toolbar: f.length > 0 && /* @__PURE__ */ T(P, {
|
|
73
71
|
view: Z,
|
|
74
|
-
search:
|
|
75
|
-
searchLabel:
|
|
76
|
-
searchPlaceholder:
|
|
72
|
+
search: v,
|
|
73
|
+
searchLabel: p("tokenSearch"),
|
|
74
|
+
searchPlaceholder: p("tokenSearch")
|
|
77
75
|
}),
|
|
78
76
|
children: [
|
|
79
|
-
|
|
77
|
+
G && /* @__PURE__ */ T("div", {
|
|
80
78
|
className: "px-4 pb-4",
|
|
81
|
-
children: /* @__PURE__ */
|
|
82
|
-
title:
|
|
83
|
-
secret:
|
|
84
|
-
onDismiss: () =>
|
|
79
|
+
children: /* @__PURE__ */ T(a, {
|
|
80
|
+
title: p("tokenCreated", { name: G.name }),
|
|
81
|
+
secret: G.secret,
|
|
82
|
+
onDismiss: () => K(null)
|
|
85
83
|
})
|
|
86
84
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ T("div", {
|
|
88
86
|
className: "border-t border-border",
|
|
89
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ T(M, {
|
|
90
88
|
view: Z,
|
|
91
|
-
total:
|
|
89
|
+
total: f.length,
|
|
92
90
|
matches: $.length,
|
|
93
91
|
count: {
|
|
94
|
-
filterActive:
|
|
95
|
-
noun:
|
|
96
|
-
nounPlural:
|
|
92
|
+
filterActive: v.filter.trim() !== "",
|
|
93
|
+
noun: p("tokenNoun"),
|
|
94
|
+
nounPlural: p("tokenNounPlural")
|
|
97
95
|
},
|
|
98
96
|
empty: {
|
|
99
|
-
icon: /* @__PURE__ */
|
|
100
|
-
title:
|
|
97
|
+
icon: /* @__PURE__ */ T(i, {}),
|
|
98
|
+
title: p("noTokens")
|
|
101
99
|
},
|
|
102
|
-
noMatches:
|
|
103
|
-
children: /* @__PURE__ */
|
|
104
|
-
...
|
|
105
|
-
children: [/* @__PURE__ */
|
|
100
|
+
noMatches: p("tokenNoMatches"),
|
|
101
|
+
children: /* @__PURE__ */ E(y, {
|
|
102
|
+
...I,
|
|
103
|
+
children: [/* @__PURE__ */ T(j, { view: Z }), Z.applyOrder($).map((e) => /* @__PURE__ */ E(N, {
|
|
106
104
|
href: null,
|
|
107
|
-
goTo:
|
|
108
|
-
openMenu:
|
|
105
|
+
goTo: B,
|
|
106
|
+
openMenu: H,
|
|
109
107
|
items: [
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
l(m("copyName"), e.name),
|
|
109
|
+
b,
|
|
112
110
|
{
|
|
113
|
-
label:
|
|
111
|
+
label: p("revoke"),
|
|
114
112
|
destructive: !0,
|
|
115
|
-
onClick: () =>
|
|
113
|
+
onClick: () => X(e)
|
|
116
114
|
}
|
|
117
115
|
],
|
|
118
116
|
children: [
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
icon: /* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ T(F, {
|
|
118
|
+
icon: /* @__PURE__ */ T(i, {}),
|
|
121
119
|
iconTile: !0,
|
|
122
120
|
name: e.name,
|
|
123
|
-
subtitle:
|
|
121
|
+
subtitle: p("tokenCreatedAgo", { created: h.relative(e.createdAt) }),
|
|
124
122
|
href: null
|
|
125
123
|
}),
|
|
126
|
-
Z.isVisible("access") && /* @__PURE__ */
|
|
124
|
+
Z.isVisible("access") && /* @__PURE__ */ T(y.Item, {
|
|
127
125
|
className: "py-2.5",
|
|
128
|
-
children: /* @__PURE__ */
|
|
129
|
-
e.readOnly ?
|
|
126
|
+
children: /* @__PURE__ */ E(A, { children: [
|
|
127
|
+
e.readOnly ? p("readOnly") : p("readWrite"),
|
|
130
128
|
" · ",
|
|
131
|
-
e.workspace ||
|
|
129
|
+
e.workspace || p("allWorkspaces")
|
|
132
130
|
] })
|
|
133
131
|
}),
|
|
134
|
-
Z.isVisible("used") && /* @__PURE__ */
|
|
132
|
+
Z.isVisible("used") && /* @__PURE__ */ T(y.Item, {
|
|
135
133
|
className: "py-2.5",
|
|
136
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ T(A, { children: e.lastUsedAt ? h.relative(e.lastUsedAt) : p("tokenNotUsed") })
|
|
137
135
|
})
|
|
138
136
|
]
|
|
139
137
|
}, e.id))]
|
|
140
138
|
})
|
|
141
139
|
})
|
|
142
140
|
}),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
workspace:
|
|
141
|
+
Y,
|
|
142
|
+
U && /* @__PURE__ */ T(V, {
|
|
143
|
+
workspace: s,
|
|
146
144
|
onCreated: (e) => {
|
|
147
|
-
|
|
145
|
+
W(!1), K(e);
|
|
148
146
|
},
|
|
149
|
-
onClose: () =>
|
|
147
|
+
onClose: () => W(!1)
|
|
150
148
|
})
|
|
151
149
|
]
|
|
152
150
|
});
|
|
153
151
|
}
|
|
154
|
-
function
|
|
155
|
-
let
|
|
152
|
+
function V({ workspace: r, onCreated: i, onClose: a }) {
|
|
153
|
+
let o = w("account"), c = w("common"), l = O(), u = s(), [d, _] = C(""), [y, b] = C("read"), [x, S] = C("one"), [k, A] = C("90"), j = D({
|
|
156
154
|
mutationFn: async () => t(await e.POST("/api/v1/me/tokens", { body: {
|
|
157
|
-
name:
|
|
155
|
+
name: d,
|
|
158
156
|
readOnly: y === "read",
|
|
159
157
|
...x === "one" && { workspace: r },
|
|
160
158
|
...k !== "0" && { expiresInDays: Number(k) }
|
|
@@ -167,104 +165,104 @@ function B({ workspace: r, onCreated: i, onClose: a }) {
|
|
|
167
165
|
onSettled: () => l.invalidateQueries({ queryKey: n.queryKey }),
|
|
168
166
|
onError: u.set
|
|
169
167
|
});
|
|
170
|
-
return /* @__PURE__ */
|
|
168
|
+
return /* @__PURE__ */ T(h, {
|
|
171
169
|
open: !0,
|
|
172
170
|
onClose: a,
|
|
173
171
|
className: "w-full max-w-md p-5",
|
|
174
|
-
children: /* @__PURE__ */
|
|
172
|
+
children: /* @__PURE__ */ E("form", {
|
|
175
173
|
onSubmit: (e) => {
|
|
176
174
|
e.preventDefault(), j.mutate();
|
|
177
175
|
},
|
|
178
176
|
children: [
|
|
179
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ T(g, {
|
|
180
178
|
className: "text-sm font-semibold",
|
|
181
|
-
children:
|
|
179
|
+
children: o("newToken")
|
|
182
180
|
}),
|
|
183
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ T(m, {
|
|
184
182
|
required: !0,
|
|
185
183
|
autoFocus: !0,
|
|
186
|
-
value:
|
|
187
|
-
onChange: (e) =>
|
|
188
|
-
placeholder:
|
|
189
|
-
"aria-label":
|
|
184
|
+
value: d,
|
|
185
|
+
onChange: (e) => _(e.target.value),
|
|
186
|
+
placeholder: o("tokenNamePlaceholder"),
|
|
187
|
+
"aria-label": o("tokenName"),
|
|
190
188
|
className: "mt-4 w-full"
|
|
191
189
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ E("div", {
|
|
193
191
|
className: "mt-3 flex flex-wrap gap-2",
|
|
194
192
|
children: [
|
|
195
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ T(v, {
|
|
196
194
|
value: y,
|
|
197
195
|
onValueChange: b,
|
|
198
|
-
"aria-label":
|
|
196
|
+
"aria-label": o("tokenAccess"),
|
|
199
197
|
items: [{
|
|
200
198
|
value: "read",
|
|
201
|
-
label:
|
|
199
|
+
label: o("readOnly")
|
|
202
200
|
}, {
|
|
203
201
|
value: "write",
|
|
204
|
-
label:
|
|
202
|
+
label: o("readWrite")
|
|
205
203
|
}],
|
|
206
204
|
width: "content"
|
|
207
205
|
}),
|
|
208
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ T(v, {
|
|
209
207
|
value: x,
|
|
210
|
-
onValueChange:
|
|
211
|
-
"aria-label":
|
|
208
|
+
onValueChange: S,
|
|
209
|
+
"aria-label": o("tokenWorkspace"),
|
|
212
210
|
items: [{
|
|
213
211
|
value: "one",
|
|
214
|
-
label:
|
|
212
|
+
label: o("thisWorkspace", { workspace: r })
|
|
215
213
|
}, {
|
|
216
214
|
value: "all",
|
|
217
|
-
label:
|
|
215
|
+
label: o("allWorkspaces")
|
|
218
216
|
}],
|
|
219
217
|
width: "content"
|
|
220
218
|
}),
|
|
221
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ T(v, {
|
|
222
220
|
value: k,
|
|
223
221
|
onValueChange: A,
|
|
224
|
-
"aria-label":
|
|
222
|
+
"aria-label": o("tokenExpiry"),
|
|
225
223
|
items: [
|
|
226
224
|
{
|
|
227
225
|
value: "30",
|
|
228
|
-
label:
|
|
226
|
+
label: o("expiresIn", { days: 30 })
|
|
229
227
|
},
|
|
230
228
|
{
|
|
231
229
|
value: "90",
|
|
232
|
-
label:
|
|
230
|
+
label: o("expiresIn", { days: 90 })
|
|
233
231
|
},
|
|
234
232
|
{
|
|
235
233
|
value: "365",
|
|
236
|
-
label:
|
|
234
|
+
label: o("expiresIn", { days: 365 })
|
|
237
235
|
},
|
|
238
236
|
{
|
|
239
237
|
value: "0",
|
|
240
|
-
label:
|
|
238
|
+
label: o("noExpiry")
|
|
241
239
|
}
|
|
242
240
|
],
|
|
243
241
|
width: "content"
|
|
244
242
|
})
|
|
245
243
|
]
|
|
246
244
|
}),
|
|
247
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ T(p, {
|
|
248
246
|
size: "md",
|
|
249
247
|
className: "mt-3",
|
|
250
248
|
children: u.error
|
|
251
249
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ E("div", {
|
|
253
251
|
className: "mt-5 flex justify-end gap-2",
|
|
254
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ T(f, {
|
|
255
253
|
type: "button",
|
|
256
254
|
onClick: a,
|
|
257
255
|
children: c("cancel")
|
|
258
|
-
}), /* @__PURE__ */
|
|
256
|
+
}), /* @__PURE__ */ T(f, {
|
|
259
257
|
type: "submit",
|
|
260
258
|
variant: "primary",
|
|
261
|
-
disabled: !
|
|
259
|
+
disabled: !d.trim(),
|
|
262
260
|
loading: j.isPending,
|
|
263
|
-
children:
|
|
261
|
+
children: o("createToken")
|
|
264
262
|
})]
|
|
265
263
|
})
|
|
266
264
|
]
|
|
267
265
|
})
|
|
268
266
|
});
|
|
269
267
|
}
|
|
270
|
-
export {
|
|
268
|
+
export { B as component };
|