@parallelworks/tandem-web 0.143.0 → 0.145.0
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 +94 -1
- package/_virtual/_virtual_i18n/es/common.js +94 -1
- package/_virtual/_virtual_i18n/ja/common.js +94 -1
- package/_virtual/_virtual_i18n/ko/common.js +94 -1
- package/_virtual/_virtual_i18n/zh/common.js +94 -1
- package/api/queries.js +107 -74
- package/components/SettingsNav.js +52 -42
- package/components/icons.js +8 -8
- package/package.json +1 -1
- package/routeTree.gen.js +177 -165
- package/routes/_workspace/settings/import.js +6 -0
- package/routes/_workspace/settings/import2.js +330 -0
- package/routes/_workspace/settings/import3.js +4 -0
- package/routes/_workspace/settings/parallelworks.js +6 -0
- package/routes/_workspace/settings/parallelworks2.js +230 -0
- package/routes/_workspace/settings/parallelworks3.js +8 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
|
+
import { linearImportQuery as n, teamsQuery as r } from "../../../api/queries.js";
|
|
3
|
+
import { useConfirm as i } from "../../../lib/confirm.js";
|
|
4
|
+
import { MigrationIcon as a } from "../../../components/icons.js";
|
|
5
|
+
import { Route as o } from "./import.js";
|
|
6
|
+
import { useCan as s } from "../../../lib/roles.js";
|
|
7
|
+
import { AdminOnly as c, SettingsPage as l, useFormError as u } from "../../../components/settings.js";
|
|
8
|
+
import { Button as d, Checkbox as f, Disclosure as p, ErrorText as m, Field as h, Input as g, ProgressBar as _, Select as v, SettingsCard as y, StatusLabel as b } from "@parallelworks/ui";
|
|
9
|
+
import { useState as x } from "react";
|
|
10
|
+
import { useFormatter as S, useTranslations as C } from "use-intl";
|
|
11
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
12
|
+
import { useMutation as D, useQueryClient as O, useSuspenseQuery as k } from "@tanstack/react-query";
|
|
13
|
+
// src/routes/$workspace/settings/import.tsx?tsr-split=component
|
|
14
|
+
function A() {
|
|
15
|
+
let { workspace: e } = o.useParams(), { data: t } = k(n(e)), r = s(e, "manage_workspace"), i = C("settingsNav"), a = C("linearImport"), u = t.import?.status === "running";
|
|
16
|
+
return /* @__PURE__ */ E(l, {
|
|
17
|
+
title: i("import"),
|
|
18
|
+
description: a("pageDescription"),
|
|
19
|
+
children: [/* @__PURE__ */ T(c, { workspace: e }), t.enabled ? /* @__PURE__ */ E("div", {
|
|
20
|
+
className: "space-y-6",
|
|
21
|
+
children: [
|
|
22
|
+
t.import && /* @__PURE__ */ T(M, {
|
|
23
|
+
workspace: e,
|
|
24
|
+
im: t.import
|
|
25
|
+
}),
|
|
26
|
+
r && !u && /* @__PURE__ */ T(P, {
|
|
27
|
+
workspace: e,
|
|
28
|
+
again: !!t.import
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ E("section", {
|
|
31
|
+
className: "space-y-2 text-sm",
|
|
32
|
+
children: [/* @__PURE__ */ T("h2", {
|
|
33
|
+
className: "font-medium",
|
|
34
|
+
children: a("howTitle")
|
|
35
|
+
}), /* @__PURE__ */ E("ul", {
|
|
36
|
+
className: "list-disc space-y-1.5 pl-5 text-muted-foreground",
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ T("li", { children: a("howIssues") }),
|
|
39
|
+
/* @__PURE__ */ T("li", { children: a("howWorkflow") }),
|
|
40
|
+
/* @__PURE__ */ T("li", { children: a("howProjects") }),
|
|
41
|
+
/* @__PURE__ */ T("li", { children: a("howPeople") })
|
|
42
|
+
]
|
|
43
|
+
})]
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
}) : /* @__PURE__ */ T(y, { children: /* @__PURE__ */ T("p", {
|
|
47
|
+
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
48
|
+
children: a("notConfigured")
|
|
49
|
+
}) })]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
var j = {
|
|
53
|
+
running: "info",
|
|
54
|
+
done: "success",
|
|
55
|
+
failed: "error",
|
|
56
|
+
canceled: "muted"
|
|
57
|
+
};
|
|
58
|
+
function M({ workspace: r, im: o }) {
|
|
59
|
+
let c = C("linearImport"), l = S(), f = s(r, "manage_workspace"), h = O(), g = u(), { confirm: v, dialog: x } = i(), w = D({
|
|
60
|
+
mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/linear/import/cancel", { params: { path: { workspace: r } } })),
|
|
61
|
+
onMutate: g.clear,
|
|
62
|
+
onSuccess: () => h.invalidateQueries({ queryKey: n(r).queryKey }),
|
|
63
|
+
onError: g.set
|
|
64
|
+
}), k = o.status === "running";
|
|
65
|
+
return /* @__PURE__ */ E(y, { children: [x, /* @__PURE__ */ E("div", {
|
|
66
|
+
className: "space-y-3 px-3 py-3",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ E("div", {
|
|
69
|
+
className: "flex flex-wrap items-center gap-3",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ T(a, { className: "size-5 text-muted-foreground" }),
|
|
72
|
+
/* @__PURE__ */ E("div", {
|
|
73
|
+
className: "min-w-0 flex-1",
|
|
74
|
+
children: [/* @__PURE__ */ T("p", {
|
|
75
|
+
className: "text-sm font-medium",
|
|
76
|
+
children: c("lastImport", { organization: o.organization })
|
|
77
|
+
}), /* @__PURE__ */ T("p", {
|
|
78
|
+
className: "text-xs text-muted-foreground",
|
|
79
|
+
children: c("startedAt", { date: l.dateTime(new Date(o.startedAt), {
|
|
80
|
+
dateStyle: "medium",
|
|
81
|
+
timeStyle: "short"
|
|
82
|
+
}) })
|
|
83
|
+
})]
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ T(b, {
|
|
86
|
+
variant: j[o.status],
|
|
87
|
+
pulse: k,
|
|
88
|
+
children: c(`status.${o.status}`)
|
|
89
|
+
}),
|
|
90
|
+
f && k && /* @__PURE__ */ T(d, {
|
|
91
|
+
type: "button",
|
|
92
|
+
size: "sm",
|
|
93
|
+
variant: "outline",
|
|
94
|
+
loading: w.isPending,
|
|
95
|
+
onClick: () => v({
|
|
96
|
+
title: c("cancelTitle"),
|
|
97
|
+
description: c("cancelDescription"),
|
|
98
|
+
confirmLabel: c("cancel"),
|
|
99
|
+
onConfirm: () => w.mutateAsync()
|
|
100
|
+
}),
|
|
101
|
+
children: c("cancel")
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ T(_, {
|
|
106
|
+
value: o.total > 0 ? Math.min(o.processed, o.total) : k ? null : 1,
|
|
107
|
+
max: o.total > 0 ? o.total : 1,
|
|
108
|
+
label: c("issuesLabel"),
|
|
109
|
+
valueText: () => c("progress", {
|
|
110
|
+
processed: o.processed,
|
|
111
|
+
total: o.total
|
|
112
|
+
})
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ T("ul", {
|
|
115
|
+
className: "space-y-1 text-sm",
|
|
116
|
+
children: o.teams.map((e) => /* @__PURE__ */ T("li", {
|
|
117
|
+
className: "text-muted-foreground",
|
|
118
|
+
children: c("teamRow", {
|
|
119
|
+
source: `${e.sourceName} (${e.sourceKey})`,
|
|
120
|
+
team: e.teamKey ?? ""
|
|
121
|
+
})
|
|
122
|
+
}, e.sourceKey))
|
|
123
|
+
}),
|
|
124
|
+
o.error && /* @__PURE__ */ T("p", {
|
|
125
|
+
className: `text-sm ${k ? "text-muted-foreground" : "text-danger"}`,
|
|
126
|
+
children: c(k ? "retrying" : "stopped", { error: o.error })
|
|
127
|
+
}),
|
|
128
|
+
o.skipped > 0 && /* @__PURE__ */ T(p, {
|
|
129
|
+
summary: c("skipped", { count: o.skipped }),
|
|
130
|
+
children: /* @__PURE__ */ T("ul", {
|
|
131
|
+
className: "space-y-1 pt-2 text-sm",
|
|
132
|
+
children: o.skips.map((e, t) => /* @__PURE__ */ E("li", { children: [
|
|
133
|
+
/* @__PURE__ */ T("span", {
|
|
134
|
+
className: "font-medium",
|
|
135
|
+
children: e.item
|
|
136
|
+
}),
|
|
137
|
+
" ",
|
|
138
|
+
/* @__PURE__ */ T("span", {
|
|
139
|
+
className: "text-muted-foreground",
|
|
140
|
+
children: c(`skipReason.${e.reason}`, { field: e.field ?? "" })
|
|
141
|
+
})
|
|
142
|
+
] }, t))
|
|
143
|
+
})
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ T(m, {
|
|
146
|
+
size: "md",
|
|
147
|
+
children: g.error
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
})] });
|
|
151
|
+
}
|
|
152
|
+
var N = "__new__";
|
|
153
|
+
function P({ workspace: i, again: a }) {
|
|
154
|
+
let o = C("linearImport"), s = O(), { data: c } = k(r(i)), [l, p] = x(""), [_, b] = x(null), [S, A] = x({}), j = u(), M = c.filter((e) => !e.archivedAt), P = D({
|
|
155
|
+
mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/linear/teams", {
|
|
156
|
+
params: { path: { workspace: i } },
|
|
157
|
+
body: { apiKey: l }
|
|
158
|
+
})),
|
|
159
|
+
onMutate: j.clear,
|
|
160
|
+
onSuccess: (e) => {
|
|
161
|
+
b(e), A(Object.fromEntries(e.teams.map((e) => {
|
|
162
|
+
let t = M.find((t) => t.key === e.key);
|
|
163
|
+
return [e.id, {
|
|
164
|
+
on: !0,
|
|
165
|
+
target: t?.key ?? N,
|
|
166
|
+
newKey: e.key,
|
|
167
|
+
newName: e.name
|
|
168
|
+
}];
|
|
169
|
+
})));
|
|
170
|
+
},
|
|
171
|
+
onError: j.set
|
|
172
|
+
}), F = D({
|
|
173
|
+
mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/linear/import", {
|
|
174
|
+
params: { path: { workspace: i } },
|
|
175
|
+
body: {
|
|
176
|
+
apiKey: l,
|
|
177
|
+
teams: Object.entries(S).filter(([, e]) => e.on).map(([e, t]) => t.target === N ? {
|
|
178
|
+
sourceId: e,
|
|
179
|
+
newKey: t.newKey,
|
|
180
|
+
newName: t.newName
|
|
181
|
+
} : {
|
|
182
|
+
sourceId: e,
|
|
183
|
+
teamKey: t.target
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
})),
|
|
187
|
+
onMutate: j.clear,
|
|
188
|
+
onSuccess: () => {
|
|
189
|
+
p(""), b(null), s.invalidateQueries({ queryKey: n(i).queryKey }), s.invalidateQueries({ queryKey: r(i).queryKey });
|
|
190
|
+
},
|
|
191
|
+
onError: j.set
|
|
192
|
+
}), I = Object.values(S).filter((e) => e.on).length, L = (e, t) => A((n) => ({
|
|
193
|
+
...n,
|
|
194
|
+
[e]: {
|
|
195
|
+
...n[e],
|
|
196
|
+
...t
|
|
197
|
+
}
|
|
198
|
+
}));
|
|
199
|
+
return /* @__PURE__ */ T(y, { children: /* @__PURE__ */ E("form", {
|
|
200
|
+
className: "space-y-4 px-3 py-3",
|
|
201
|
+
onSubmit: (e) => {
|
|
202
|
+
e.preventDefault(), _ ? F.mutate() : P.mutate();
|
|
203
|
+
},
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("h2", {
|
|
206
|
+
className: "text-sm font-medium",
|
|
207
|
+
children: o(a ? "again" : "startTitle")
|
|
208
|
+
}), a && /* @__PURE__ */ T("p", {
|
|
209
|
+
className: "text-xs text-muted-foreground",
|
|
210
|
+
children: o("againHelp")
|
|
211
|
+
})] }),
|
|
212
|
+
/* @__PURE__ */ T(h, {
|
|
213
|
+
label: o("keyLabel"),
|
|
214
|
+
description: o("keyHelp"),
|
|
215
|
+
children: /* @__PURE__ */ T(g, {
|
|
216
|
+
type: "password",
|
|
217
|
+
autoComplete: "off",
|
|
218
|
+
required: !0,
|
|
219
|
+
value: l,
|
|
220
|
+
onChange: (e) => {
|
|
221
|
+
p(e.target.value), b(null);
|
|
222
|
+
},
|
|
223
|
+
placeholder: "lin_api_…"
|
|
224
|
+
})
|
|
225
|
+
}),
|
|
226
|
+
_ && /* @__PURE__ */ E("fieldset", {
|
|
227
|
+
className: "space-y-2",
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ T("legend", {
|
|
230
|
+
className: "text-sm font-medium",
|
|
231
|
+
children: o("teamsFrom", { organization: _.organization })
|
|
232
|
+
}),
|
|
233
|
+
_.teams.length === 0 && /* @__PURE__ */ T("p", {
|
|
234
|
+
className: "text-sm text-muted-foreground",
|
|
235
|
+
children: o("noTeams")
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ T("ul", {
|
|
238
|
+
className: "divide-y divide-border rounded-md border border-border",
|
|
239
|
+
children: _.teams.map((e) => {
|
|
240
|
+
let t = S[e.id];
|
|
241
|
+
return t ? /* @__PURE__ */ E("li", {
|
|
242
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-2 px-3 py-2",
|
|
243
|
+
children: [/* @__PURE__ */ E("label", {
|
|
244
|
+
className: "flex min-w-0 flex-1 items-center gap-2 text-sm",
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ T(f, {
|
|
247
|
+
checked: t.on,
|
|
248
|
+
onCheckedChange: (t) => L(e.id, { on: t })
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ E("span", {
|
|
251
|
+
className: "truncate",
|
|
252
|
+
children: [
|
|
253
|
+
e.name,
|
|
254
|
+
" ",
|
|
255
|
+
/* @__PURE__ */ E("span", {
|
|
256
|
+
className: "text-muted-foreground",
|
|
257
|
+
children: [
|
|
258
|
+
"(",
|
|
259
|
+
e.key,
|
|
260
|
+
")"
|
|
261
|
+
]
|
|
262
|
+
})
|
|
263
|
+
]
|
|
264
|
+
}),
|
|
265
|
+
/* @__PURE__ */ T("span", {
|
|
266
|
+
className: "text-xs text-muted-foreground",
|
|
267
|
+
children: o("issues", { count: e.issueCount })
|
|
268
|
+
})
|
|
269
|
+
]
|
|
270
|
+
}), t.on && /* @__PURE__ */ E("div", {
|
|
271
|
+
className: "flex basis-full flex-wrap items-center gap-2 pl-6 sm:basis-auto sm:pl-0",
|
|
272
|
+
children: [/* @__PURE__ */ T(v, {
|
|
273
|
+
"aria-label": o("into", { team: e.name }),
|
|
274
|
+
value: t.target,
|
|
275
|
+
onValueChange: (t) => t && L(e.id, { target: t }),
|
|
276
|
+
items: [{
|
|
277
|
+
value: N,
|
|
278
|
+
label: o("newTeam")
|
|
279
|
+
}, ...M.map((e) => ({
|
|
280
|
+
value: e.key,
|
|
281
|
+
label: `${e.name} (${e.key})`
|
|
282
|
+
}))],
|
|
283
|
+
size: "sm",
|
|
284
|
+
width: "content"
|
|
285
|
+
}), t.target === N && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(g, {
|
|
286
|
+
"aria-label": o("newKey"),
|
|
287
|
+
value: t.newKey,
|
|
288
|
+
onChange: (t) => L(e.id, { newKey: t.target.value.toUpperCase() }),
|
|
289
|
+
className: "w-24",
|
|
290
|
+
maxLength: 10,
|
|
291
|
+
required: !0
|
|
292
|
+
}), /* @__PURE__ */ T(g, {
|
|
293
|
+
"aria-label": o("newName"),
|
|
294
|
+
value: t.newName,
|
|
295
|
+
onChange: (t) => L(e.id, { newName: t.target.value }),
|
|
296
|
+
className: "w-44",
|
|
297
|
+
required: !0
|
|
298
|
+
})] })]
|
|
299
|
+
})]
|
|
300
|
+
}, e.id) : null;
|
|
301
|
+
})
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
}),
|
|
305
|
+
/* @__PURE__ */ E("div", {
|
|
306
|
+
className: "flex flex-wrap items-center gap-3",
|
|
307
|
+
children: [_ ? /* @__PURE__ */ T(d, {
|
|
308
|
+
type: "submit",
|
|
309
|
+
variant: "primary",
|
|
310
|
+
loading: F.isPending,
|
|
311
|
+
disabled: I === 0,
|
|
312
|
+
children: o("start", { count: I })
|
|
313
|
+
}) : /* @__PURE__ */ T(d, {
|
|
314
|
+
type: "submit",
|
|
315
|
+
variant: "primary",
|
|
316
|
+
loading: P.isPending,
|
|
317
|
+
children: o("findTeams")
|
|
318
|
+
}), _ && /* @__PURE__ */ T("span", {
|
|
319
|
+
className: "text-xs text-muted-foreground",
|
|
320
|
+
children: o("total", { count: _.teams.filter((e) => S[e.id]?.on).reduce((e, t) => e + t.issueCount, 0) })
|
|
321
|
+
})]
|
|
322
|
+
}),
|
|
323
|
+
/* @__PURE__ */ T(m, {
|
|
324
|
+
size: "md",
|
|
325
|
+
children: j.error
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
}) });
|
|
329
|
+
}
|
|
330
|
+
export { A as component };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { linearImportQuery as e, teamsQuery as t } from "../../../api/queries.js";
|
|
2
|
+
// src/routes/$workspace/settings/import.tsx?tsr-split=loader
|
|
3
|
+
var n = ({ context: { queryClient: n }, params: { workspace: r } }) => Promise.all([n.ensureQueryData(e(r)), n.ensureQueryData(t(r))]);
|
|
4
|
+
export { n as loader };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createFileRoute as e, lazyFn as t, lazyRouteComponent as n } from "@tanstack/react-router";
|
|
2
|
+
var r = e("/$workspace/settings/parallelworks")({
|
|
3
|
+
loader: t(() => import("./parallelworks3.js"), "loader"),
|
|
4
|
+
component: n(() => import("./parallelworks2.js"), "component")
|
|
5
|
+
});
|
|
6
|
+
export { r as Route };
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
|
+
import { meQuery as n, parallelWorksBucketsQuery as r, parallelWorksQuery as i } from "../../../api/queries.js";
|
|
3
|
+
import { useConfirm as a } from "../../../lib/confirm.js";
|
|
4
|
+
import { BucketIcon as o } from "../../../components/icons.js";
|
|
5
|
+
import { Route as s } from "./parallelworks.js";
|
|
6
|
+
import { useCan as c } from "../../../lib/roles.js";
|
|
7
|
+
import { AdminOnly as l, SettingsPage as u, useFormError as d } from "../../../components/settings.js";
|
|
8
|
+
import { Button as f, Callout as p, Input as m, Select as h, SettingRow as g, SettingsCard as _ } from "@parallelworks/ui";
|
|
9
|
+
import { useState as v } from "react";
|
|
10
|
+
import { useFormatter as y, useTranslations as b } from "use-intl";
|
|
11
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
12
|
+
import { useMutation as C, useQuery as w, useQueryClient as T, useSuspenseQuery as E } from "@tanstack/react-query";
|
|
13
|
+
// src/routes/$workspace/settings/parallelworks.tsx?tsr-split=component
|
|
14
|
+
function D() {
|
|
15
|
+
let { workspace: e } = s.useParams(), t = b("parallelWorks"), n = c(e, "manage_workspace");
|
|
16
|
+
return /* @__PURE__ */ S(u, {
|
|
17
|
+
title: t("title"),
|
|
18
|
+
description: t("description"),
|
|
19
|
+
children: [/* @__PURE__ */ x(l, { workspace: e }), n && /* @__PURE__ */ x(O, { workspace: e })]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function O({ workspace: e }) {
|
|
23
|
+
let { data: t } = E(i(e));
|
|
24
|
+
return t.connected ? /* @__PURE__ */ S("div", {
|
|
25
|
+
className: "space-y-10",
|
|
26
|
+
children: [/* @__PURE__ */ x(A, {
|
|
27
|
+
workspace: e,
|
|
28
|
+
conn: t
|
|
29
|
+
}), /* @__PURE__ */ x(M, {
|
|
30
|
+
workspace: e,
|
|
31
|
+
conn: t
|
|
32
|
+
})]
|
|
33
|
+
}) : /* @__PURE__ */ x(k, {
|
|
34
|
+
workspace: e,
|
|
35
|
+
conn: t
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function k({ workspace: r, conn: a }) {
|
|
39
|
+
let o = b("parallelWorks"), s = T(), c = d(), { data: l } = w(n), [u, h] = v(a.url ?? (l?.mode === "platform" ? window.location.origin : "https://cloud.parallel.works")), [y, E] = v(""), D = C({
|
|
40
|
+
mutationFn: async () => t(await e.PUT("/api/v1/workspaces/{workspace}/parallelworks", {
|
|
41
|
+
params: { path: { workspace: r } },
|
|
42
|
+
body: {
|
|
43
|
+
url: u.trim(),
|
|
44
|
+
apiKey: y.trim()
|
|
45
|
+
}
|
|
46
|
+
})),
|
|
47
|
+
onMutate: c.clear,
|
|
48
|
+
onError: c.set,
|
|
49
|
+
onSuccess: (e) => s.setQueryData(i(r).queryKey, e)
|
|
50
|
+
});
|
|
51
|
+
return /* @__PURE__ */ S("form", {
|
|
52
|
+
onSubmit: (e) => {
|
|
53
|
+
e.preventDefault(), D.mutate();
|
|
54
|
+
},
|
|
55
|
+
children: [!a.canConnect && /* @__PURE__ */ x(p, {
|
|
56
|
+
tone: "warning",
|
|
57
|
+
className: "mb-6",
|
|
58
|
+
children: o("noKey")
|
|
59
|
+
}), /* @__PURE__ */ S(_, {
|
|
60
|
+
title: o("connect"),
|
|
61
|
+
description: o("connectDescription"),
|
|
62
|
+
action: /* @__PURE__ */ x(f, {
|
|
63
|
+
type: "submit",
|
|
64
|
+
variant: "primary",
|
|
65
|
+
loading: D.isPending,
|
|
66
|
+
disabled: !a.canConnect,
|
|
67
|
+
children: o("connectButton")
|
|
68
|
+
}),
|
|
69
|
+
actionAlign: "end",
|
|
70
|
+
error: c.error,
|
|
71
|
+
children: [/* @__PURE__ */ x(g, {
|
|
72
|
+
label: o("url"),
|
|
73
|
+
htmlFor: "pw-url",
|
|
74
|
+
helpText: o("urlHelp"),
|
|
75
|
+
fill: !0,
|
|
76
|
+
children: /* @__PURE__ */ x(m, {
|
|
77
|
+
id: "pw-url",
|
|
78
|
+
type: "url",
|
|
79
|
+
required: !0,
|
|
80
|
+
value: u,
|
|
81
|
+
onChange: (e) => h(e.target.value),
|
|
82
|
+
mono: !0
|
|
83
|
+
})
|
|
84
|
+
}), /* @__PURE__ */ x(g, {
|
|
85
|
+
label: o("apiKey"),
|
|
86
|
+
htmlFor: "pw-key",
|
|
87
|
+
helpText: o("apiKeyHelp"),
|
|
88
|
+
fill: !0,
|
|
89
|
+
children: /* @__PURE__ */ x(m, {
|
|
90
|
+
id: "pw-key",
|
|
91
|
+
type: "password",
|
|
92
|
+
autoComplete: "off",
|
|
93
|
+
required: !0,
|
|
94
|
+
placeholder: "pwt_…",
|
|
95
|
+
value: y,
|
|
96
|
+
onChange: (e) => E(e.target.value),
|
|
97
|
+
mono: !0
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
})]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function A({ workspace: n, conn: r }) {
|
|
104
|
+
let o = b("parallelWorks"), s = y(), c = T(), { confirm: l, dialog: u } = a(), d = C({
|
|
105
|
+
mutationFn: async () => t(await e.DELETE("/api/v1/workspaces/{workspace}/parallelworks", { params: { path: { workspace: n } } })),
|
|
106
|
+
onSettled: () => c.invalidateQueries({ queryKey: i(n).queryKey })
|
|
107
|
+
});
|
|
108
|
+
return /* @__PURE__ */ S(_, {
|
|
109
|
+
title: o("account"),
|
|
110
|
+
action: /* @__PURE__ */ x(f, {
|
|
111
|
+
variant: "danger",
|
|
112
|
+
onClick: () => l({
|
|
113
|
+
title: o("disconnectTitle"),
|
|
114
|
+
description: o("disconnectDescription"),
|
|
115
|
+
confirmLabel: o("disconnect"),
|
|
116
|
+
onConfirm: () => d.mutateAsync()
|
|
117
|
+
}),
|
|
118
|
+
children: o("disconnect")
|
|
119
|
+
}),
|
|
120
|
+
actionAlign: "end",
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ x(g, {
|
|
123
|
+
label: o("platform"),
|
|
124
|
+
children: /* @__PURE__ */ x("a", {
|
|
125
|
+
href: r.url,
|
|
126
|
+
className: "font-mono text-sm text-link hover:underline",
|
|
127
|
+
children: r.url
|
|
128
|
+
})
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ x(g, {
|
|
131
|
+
label: o("signedInAs"),
|
|
132
|
+
helpText: r.connectedAt && o("connectedBy", { date: s.dateTime(new Date(r.connectedAt), {
|
|
133
|
+
dateStyle: "medium",
|
|
134
|
+
timeStyle: "short"
|
|
135
|
+
}) }),
|
|
136
|
+
children: /* @__PURE__ */ x("span", {
|
|
137
|
+
className: "text-sm font-medium",
|
|
138
|
+
children: o("user", {
|
|
139
|
+
user: r.username ?? "",
|
|
140
|
+
organization: r.organization ?? ""
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
}),
|
|
144
|
+
u
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
var j = (e) => `${e.user}/${e.name}`;
|
|
149
|
+
function M({ workspace: n, conn: a }) {
|
|
150
|
+
let s = b("parallelWorks"), c = T(), l = d(), u = w(r(n)), [p, m] = v(a.bucket ? j(a.bucket) : null), y = (e) => {
|
|
151
|
+
e ? c.setQueryData(i(n).queryKey, e) : c.invalidateQueries({ queryKey: i(n).queryKey });
|
|
152
|
+
}, E = C({
|
|
153
|
+
mutationFn: async (r) => t(await e.PUT("/api/v1/workspaces/{workspace}/parallelworks/bucket", {
|
|
154
|
+
params: { path: { workspace: n } },
|
|
155
|
+
body: {
|
|
156
|
+
user: r.user,
|
|
157
|
+
name: r.name
|
|
158
|
+
}
|
|
159
|
+
})),
|
|
160
|
+
onMutate: l.clear,
|
|
161
|
+
onError: l.set,
|
|
162
|
+
onSuccess: y
|
|
163
|
+
}), D = C({
|
|
164
|
+
mutationFn: async () => t(await e.DELETE("/api/v1/workspaces/{workspace}/parallelworks/bucket", { params: { path: { workspace: n } } })),
|
|
165
|
+
onMutate: l.clear,
|
|
166
|
+
onError: l.set,
|
|
167
|
+
onSuccess: () => {
|
|
168
|
+
m(null), y();
|
|
169
|
+
}
|
|
170
|
+
}), O = u.data?.find((e) => j(e) === p), k = a.bucket ? j(a.bucket) : null;
|
|
171
|
+
return /* @__PURE__ */ S(_, {
|
|
172
|
+
title: s("storage"),
|
|
173
|
+
description: s("storageDescription"),
|
|
174
|
+
error: l.error ?? (u.error && s("bucketsFailed")),
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ x(g, {
|
|
177
|
+
label: s("filesGoTo"),
|
|
178
|
+
helpText: a.bucket ? s("filesInBucket") : s("filesOnServer"),
|
|
179
|
+
children: /* @__PURE__ */ S("span", {
|
|
180
|
+
className: "flex items-center gap-1.5 text-sm font-medium",
|
|
181
|
+
children: [a.bucket && /* @__PURE__ */ x(o, { className: "size-4 text-muted-foreground" }), a.bucket ? a.bucket.displayName || a.bucket.name : s("server")]
|
|
182
|
+
})
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ x(g, {
|
|
185
|
+
label: s("bucket"),
|
|
186
|
+
helpText: s("bucketHelp"),
|
|
187
|
+
children: /* @__PURE__ */ S("div", {
|
|
188
|
+
className: "flex items-center gap-2",
|
|
189
|
+
children: [/* @__PURE__ */ x("div", {
|
|
190
|
+
className: "w-60",
|
|
191
|
+
children: /* @__PURE__ */ x(h, {
|
|
192
|
+
width: "fill",
|
|
193
|
+
"aria-label": s("bucket"),
|
|
194
|
+
value: p,
|
|
195
|
+
placeholder: u.isPending ? s("loading") : s("pickBucket"),
|
|
196
|
+
disabled: !u.data?.length,
|
|
197
|
+
onValueChange: m,
|
|
198
|
+
items: (u.data ?? []).map((e) => ({
|
|
199
|
+
value: j(e),
|
|
200
|
+
label: e.displayName || e.name,
|
|
201
|
+
description: [
|
|
202
|
+
e.user,
|
|
203
|
+
e.type,
|
|
204
|
+
...e.canWrite ? [] : [s("readOnly")]
|
|
205
|
+
].join(" · "),
|
|
206
|
+
disabled: !e.canWrite,
|
|
207
|
+
icon: /* @__PURE__ */ x(o, {})
|
|
208
|
+
}))
|
|
209
|
+
})
|
|
210
|
+
}), /* @__PURE__ */ x(f, {
|
|
211
|
+
loading: E.isPending,
|
|
212
|
+
disabled: !O || p === k,
|
|
213
|
+
onClick: () => O && E.mutate(O),
|
|
214
|
+
children: s("use")
|
|
215
|
+
})]
|
|
216
|
+
})
|
|
217
|
+
}),
|
|
218
|
+
a.bucket && /* @__PURE__ */ x(g, {
|
|
219
|
+
label: s("stop"),
|
|
220
|
+
helpText: s("stopHelp"),
|
|
221
|
+
children: /* @__PURE__ */ x(f, {
|
|
222
|
+
loading: D.isPending,
|
|
223
|
+
onClick: () => D.mutate(),
|
|
224
|
+
children: s("stopButton")
|
|
225
|
+
})
|
|
226
|
+
})
|
|
227
|
+
]
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
export { D as component };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { meQuery as e, parallelWorksQuery as t } from "../../../api/queries.js";
|
|
2
|
+
import { may as n } from "../../../lib/roles.js";
|
|
3
|
+
// src/routes/$workspace/settings/parallelworks.tsx?tsr-split=loader
|
|
4
|
+
var r = async ({ context: { queryClient: r }, params: { workspace: i } }) => {
|
|
5
|
+
let a = await r.ensureQueryData(e);
|
|
6
|
+
n(a, i, "manage_workspace") && await r.ensureQueryData(t(i));
|
|
7
|
+
};
|
|
8
|
+
export { r as loader };
|