@parallelworks/tandem-web 0.152.0 → 0.153.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 +123 -16
- package/_virtual/_virtual_i18n/es/common.js +123 -16
- package/_virtual/_virtual_i18n/ja/common.js +123 -16
- package/_virtual/_virtual_i18n/ko/common.js +123 -16
- package/_virtual/_virtual_i18n/zh/common.js +123 -16
- package/api/queries.js +71 -79
- package/components/DashboardPanel.js +433 -0
- package/components/ShareDialog.js +71 -125
- package/components/SharedViewer.js +82 -155
- package/lib/issueList.js +1 -1
- package/package.json +1 -1
- package/pages/issues.js +1 -1
- package/routeTree.gen.js +216 -210
- package/routes/_workspace/dashboards/_dashboardId.js +6 -0
- package/routes/_workspace/dashboards/_dashboardId2.js +368 -0
- package/routes/_workspace/dashboards/_dashboardId3.js +4 -0
- package/routes/_workspace/dashboards/index.js +6 -0
- package/routes/_workspace/dashboards/index2.js +151 -0
- package/routes/_workspace/dashboards/index3.js +4 -0
- package/routes/_workspace/issues/index.js +1 -1
- package/routes/_workspace2.js +236 -230
- package/routes/sites._workspace._site.js +0 -6
- package/routes/sites2._workspace._site.js +0 -15
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
|
+
import { usePageTitle as n } from "../../../lib/pageTitle.js";
|
|
3
|
+
import { Link as r } from "../../../lib/router.js";
|
|
4
|
+
import { dashboardQuery as i, dashboardsQuery as a, labelsQuery as o, panelQuery as s, teamsQuery as c, viewsQuery as l } from "../../../api/queries.js";
|
|
5
|
+
import { useConfirm as u } from "../../../lib/confirm.js";
|
|
6
|
+
import { useFormError as d } from "../../../components/settings.js";
|
|
7
|
+
import { Route as f } from "./_dashboardId.js";
|
|
8
|
+
import { DashboardPanel as p, PanelChart as m, sharingItems as h, sharingOf as g } from "../../../components/DashboardPanel.js";
|
|
9
|
+
import { Button as _, Field as v, Input as y, Modal as b, Select as x } from "@parallelworks/ui";
|
|
10
|
+
import { useNavigate as S } from "@tanstack/react-router";
|
|
11
|
+
import { useState as C } from "react";
|
|
12
|
+
import { useTranslations as w } from "use-intl";
|
|
13
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
14
|
+
import { useMutation as O, useQuery as k, useQueryClient as A, useSuspenseQuery as j } from "@tanstack/react-query";
|
|
15
|
+
// src/routes/$workspace/dashboards/$dashboardId.tsx?tsr-split=component
|
|
16
|
+
function M() {
|
|
17
|
+
let o = w("dashboards"), { workspace: s, dashboardId: l } = f.useParams(), { data: m } = j(i(s, l)), { data: v } = j(c(s));
|
|
18
|
+
n(m.name);
|
|
19
|
+
let y = A(), b = S(), { confirm: k, dialog: M } = u(), N = d(), [P, F] = C(null), I = O({
|
|
20
|
+
mutationFn: async (n) => t(await e.PATCH("/api/v1/workspaces/{workspace}/dashboards/{dashboardId}", {
|
|
21
|
+
params: { path: {
|
|
22
|
+
workspace: s,
|
|
23
|
+
dashboardId: l
|
|
24
|
+
} },
|
|
25
|
+
body: n
|
|
26
|
+
})),
|
|
27
|
+
onMutate: N.clear,
|
|
28
|
+
onSuccess: (e) => {
|
|
29
|
+
y.setQueryData(i(s, l).queryKey, e), y.invalidateQueries({ queryKey: a(s).queryKey });
|
|
30
|
+
},
|
|
31
|
+
onError: N.set
|
|
32
|
+
}), L = O({
|
|
33
|
+
mutationFn: async () => t(await e.DELETE("/api/v1/workspaces/{workspace}/dashboards/{dashboardId}", { params: { path: {
|
|
34
|
+
workspace: s,
|
|
35
|
+
dashboardId: l
|
|
36
|
+
} } })),
|
|
37
|
+
onSuccess: () => {
|
|
38
|
+
y.invalidateQueries({ queryKey: a(s).queryKey }), b({
|
|
39
|
+
to: "/$workspace/dashboards",
|
|
40
|
+
params: { workspace: s }
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
onError: N.set
|
|
44
|
+
}), z = m.shared ? m.team ? `team:${m.team}` : "workspace" : "private", B = (e) => I.mutate({ panels: e });
|
|
45
|
+
return /* @__PURE__ */ D("div", {
|
|
46
|
+
className: "w-full space-y-6 px-4 py-6 md:px-8 md:py-8",
|
|
47
|
+
children: [
|
|
48
|
+
M,
|
|
49
|
+
/* @__PURE__ */ D("div", {
|
|
50
|
+
className: "flex flex-wrap items-end justify-between gap-4",
|
|
51
|
+
children: [/* @__PURE__ */ D("div", {
|
|
52
|
+
className: "min-w-0",
|
|
53
|
+
children: [/* @__PURE__ */ E(r, {
|
|
54
|
+
to: "/$workspace/dashboards",
|
|
55
|
+
params: { workspace: s },
|
|
56
|
+
className: "text-xs text-muted-foreground hover:underline",
|
|
57
|
+
children: o("title")
|
|
58
|
+
}), /* @__PURE__ */ E("h1", {
|
|
59
|
+
className: "truncate text-xl font-semibold tracking-tight",
|
|
60
|
+
children: m.name
|
|
61
|
+
})]
|
|
62
|
+
}), /* @__PURE__ */ D("div", {
|
|
63
|
+
className: "flex flex-wrap items-center gap-2",
|
|
64
|
+
children: [m.canEdit ? /* @__PURE__ */ E(x, {
|
|
65
|
+
"aria-label": o("sharing"),
|
|
66
|
+
value: z,
|
|
67
|
+
onValueChange: (e) => e && I.mutate(g(e)),
|
|
68
|
+
items: h(o, v),
|
|
69
|
+
size: "sm",
|
|
70
|
+
width: "content"
|
|
71
|
+
}) : /* @__PURE__ */ E("span", {
|
|
72
|
+
className: "text-xs text-muted-foreground",
|
|
73
|
+
children: o("ownedBy", { owner: m.owner })
|
|
74
|
+
}), m.canEdit && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(_, {
|
|
75
|
+
size: "sm",
|
|
76
|
+
variant: "primary",
|
|
77
|
+
onClick: () => F({
|
|
78
|
+
at: m.panels.length,
|
|
79
|
+
panel: {
|
|
80
|
+
title: "",
|
|
81
|
+
chart: "bar",
|
|
82
|
+
spec: {
|
|
83
|
+
measure: "count",
|
|
84
|
+
groupBy: "team",
|
|
85
|
+
filters: { view: "active" }
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
children: o("addPanel")
|
|
90
|
+
}), /* @__PURE__ */ E(_, {
|
|
91
|
+
size: "sm",
|
|
92
|
+
variant: "outline",
|
|
93
|
+
onClick: () => k({
|
|
94
|
+
title: o("deleteTitle"),
|
|
95
|
+
description: o("deleteDescription", { name: m.name }),
|
|
96
|
+
confirmLabel: o("delete"),
|
|
97
|
+
onConfirm: () => L.mutateAsync()
|
|
98
|
+
}),
|
|
99
|
+
children: o("delete")
|
|
100
|
+
})] })]
|
|
101
|
+
})]
|
|
102
|
+
}),
|
|
103
|
+
N.error && /* @__PURE__ */ E("p", {
|
|
104
|
+
className: "text-sm text-danger",
|
|
105
|
+
children: N.error
|
|
106
|
+
}),
|
|
107
|
+
m.panels.length === 0 ? /* @__PURE__ */ E("p", {
|
|
108
|
+
className: "text-sm text-muted-foreground",
|
|
109
|
+
children: o("noPanels")
|
|
110
|
+
}) : /* @__PURE__ */ E("div", {
|
|
111
|
+
className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
112
|
+
children: m.panels.map((e, t) => /* @__PURE__ */ E(p, {
|
|
113
|
+
workspace: s,
|
|
114
|
+
panel: e,
|
|
115
|
+
onEdit: m.canEdit ? () => F({
|
|
116
|
+
at: t,
|
|
117
|
+
panel: e
|
|
118
|
+
}) : void 0,
|
|
119
|
+
onDelete: m.canEdit ? () => B(m.panels.filter((e, n) => n !== t)) : void 0
|
|
120
|
+
}, e.id ?? t))
|
|
121
|
+
}),
|
|
122
|
+
P && /* @__PURE__ */ E(R, {
|
|
123
|
+
workspace: s,
|
|
124
|
+
initial: P.panel,
|
|
125
|
+
onClose: () => F(null),
|
|
126
|
+
onSave: (e) => {
|
|
127
|
+
let t = [...m.panels];
|
|
128
|
+
t.splice(P.at, +(P.at < m.panels.length), e), B(t), F(null);
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
var N = [
|
|
135
|
+
"count",
|
|
136
|
+
"created_completed",
|
|
137
|
+
"open",
|
|
138
|
+
"throughput",
|
|
139
|
+
"cycle_time",
|
|
140
|
+
"lead_time",
|
|
141
|
+
"estimate",
|
|
142
|
+
"sla_breached"
|
|
143
|
+
], P = [
|
|
144
|
+
"bar",
|
|
145
|
+
"stacked",
|
|
146
|
+
"line",
|
|
147
|
+
"pie",
|
|
148
|
+
"number",
|
|
149
|
+
"table",
|
|
150
|
+
"list"
|
|
151
|
+
], F = [
|
|
152
|
+
"",
|
|
153
|
+
"team",
|
|
154
|
+
"assignee",
|
|
155
|
+
"label",
|
|
156
|
+
"project",
|
|
157
|
+
"priority",
|
|
158
|
+
"status",
|
|
159
|
+
"type"
|
|
160
|
+
], I = /* @__PURE__ */ new Set([
|
|
161
|
+
"created_completed",
|
|
162
|
+
"open",
|
|
163
|
+
"throughput",
|
|
164
|
+
"cycle_time",
|
|
165
|
+
"lead_time"
|
|
166
|
+
]), L = [
|
|
167
|
+
"active",
|
|
168
|
+
"backlog",
|
|
169
|
+
"done",
|
|
170
|
+
"all"
|
|
171
|
+
];
|
|
172
|
+
function R({ workspace: e, initial: t, onClose: n, onSave: r }) {
|
|
173
|
+
let i = w("dashboards"), [a, u] = C(t), { data: d = [] } = k(c(e)), { data: f = [] } = k(l(e)), { data: p = [] } = k(o(e)), { data: h } = k(s(e, a.chart, a.spec)), g = a.spec, S = g.filters, O = (e) => u((t) => ({
|
|
174
|
+
...t,
|
|
175
|
+
spec: Object.fromEntries(Object.entries({
|
|
176
|
+
...t.spec,
|
|
177
|
+
...e
|
|
178
|
+
}).filter(([, e]) => e !== void 0))
|
|
179
|
+
})), A = (e) => O({ filters: Object.fromEntries(Object.entries({
|
|
180
|
+
...S,
|
|
181
|
+
...e
|
|
182
|
+
}).filter(([, e]) => e)) }), { viewId: j, ...M } = g;
|
|
183
|
+
return /* @__PURE__ */ E(b, {
|
|
184
|
+
open: !0,
|
|
185
|
+
onClose: n,
|
|
186
|
+
title: t.id ? i("editPanel") : i("addPanel"),
|
|
187
|
+
size: "xl",
|
|
188
|
+
onSubmit: (e) => {
|
|
189
|
+
e.preventDefault(), r(a);
|
|
190
|
+
},
|
|
191
|
+
footer: /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(_, {
|
|
192
|
+
variant: "ghost",
|
|
193
|
+
onClick: n,
|
|
194
|
+
children: i("cancel")
|
|
195
|
+
}), /* @__PURE__ */ E(_, {
|
|
196
|
+
type: "submit",
|
|
197
|
+
variant: "primary",
|
|
198
|
+
children: i("save")
|
|
199
|
+
})] }),
|
|
200
|
+
children: /* @__PURE__ */ D("div", {
|
|
201
|
+
className: "grid gap-4 md:grid-cols-2",
|
|
202
|
+
children: [/* @__PURE__ */ D("div", {
|
|
203
|
+
className: "space-y-3",
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ E(v, {
|
|
206
|
+
label: i("panelTitle"),
|
|
207
|
+
children: /* @__PURE__ */ E(y, {
|
|
208
|
+
value: a.title,
|
|
209
|
+
placeholder: i(`measures.${g.measure}`),
|
|
210
|
+
onChange: (e) => u({
|
|
211
|
+
...a,
|
|
212
|
+
title: e.target.value
|
|
213
|
+
}),
|
|
214
|
+
maxLength: 200
|
|
215
|
+
})
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ E(v, {
|
|
218
|
+
label: i("measure"),
|
|
219
|
+
children: /* @__PURE__ */ E(x, {
|
|
220
|
+
value: g.measure,
|
|
221
|
+
onValueChange: (e) => e && O({ measure: e }),
|
|
222
|
+
items: N.map((e) => ({
|
|
223
|
+
value: e,
|
|
224
|
+
label: i(`measures.${e}`)
|
|
225
|
+
}))
|
|
226
|
+
})
|
|
227
|
+
}),
|
|
228
|
+
g.measure !== "created_completed" && /* @__PURE__ */ E(v, {
|
|
229
|
+
label: i("groupBy"),
|
|
230
|
+
children: /* @__PURE__ */ E(x, {
|
|
231
|
+
value: g.groupBy ?? "",
|
|
232
|
+
onValueChange: (e) => O(e ? { groupBy: e } : { groupBy: void 0 }),
|
|
233
|
+
items: F.map((e) => ({
|
|
234
|
+
value: e,
|
|
235
|
+
label: i(`groupings.${e || "none"}`)
|
|
236
|
+
}))
|
|
237
|
+
})
|
|
238
|
+
}),
|
|
239
|
+
/* @__PURE__ */ E(v, {
|
|
240
|
+
label: i("chart"),
|
|
241
|
+
children: /* @__PURE__ */ E(x, {
|
|
242
|
+
value: a.chart,
|
|
243
|
+
onValueChange: (e) => e && u({
|
|
244
|
+
...a,
|
|
245
|
+
chart: e
|
|
246
|
+
}),
|
|
247
|
+
items: P.map((e) => ({
|
|
248
|
+
value: e,
|
|
249
|
+
label: i(`charts.${e}`)
|
|
250
|
+
}))
|
|
251
|
+
})
|
|
252
|
+
}),
|
|
253
|
+
I.has(g.measure) && /* @__PURE__ */ E(v, {
|
|
254
|
+
label: i("weeks"),
|
|
255
|
+
children: /* @__PURE__ */ E(x, {
|
|
256
|
+
value: String(g.weeks ?? 12),
|
|
257
|
+
onValueChange: (e) => e && O({ weeks: Number(e) }),
|
|
258
|
+
items: [
|
|
259
|
+
4,
|
|
260
|
+
8,
|
|
261
|
+
12,
|
|
262
|
+
26,
|
|
263
|
+
52
|
|
264
|
+
].map((e) => ({
|
|
265
|
+
value: String(e),
|
|
266
|
+
label: i("weeksValue", { count: e })
|
|
267
|
+
}))
|
|
268
|
+
})
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ E(v, {
|
|
271
|
+
label: i("issuesFrom"),
|
|
272
|
+
children: /* @__PURE__ */ E(x, {
|
|
273
|
+
value: g.viewId ?? "",
|
|
274
|
+
onValueChange: (e) => u({
|
|
275
|
+
...a,
|
|
276
|
+
spec: e ? {
|
|
277
|
+
...g,
|
|
278
|
+
viewId: e
|
|
279
|
+
} : M
|
|
280
|
+
}),
|
|
281
|
+
items: [{
|
|
282
|
+
value: "",
|
|
283
|
+
label: i("filtersBelow")
|
|
284
|
+
}, ...f.map((e) => ({
|
|
285
|
+
value: e.id,
|
|
286
|
+
label: e.name
|
|
287
|
+
}))]
|
|
288
|
+
})
|
|
289
|
+
}),
|
|
290
|
+
!g.viewId && /* @__PURE__ */ D("div", {
|
|
291
|
+
className: "grid grid-cols-2 gap-2",
|
|
292
|
+
children: [
|
|
293
|
+
/* @__PURE__ */ E(x, {
|
|
294
|
+
"aria-label": i("team"),
|
|
295
|
+
value: S.team ?? "",
|
|
296
|
+
onValueChange: (e) => A({ team: e ?? "" }),
|
|
297
|
+
items: [{
|
|
298
|
+
value: "",
|
|
299
|
+
label: i("allTeams")
|
|
300
|
+
}, ...d.filter((e) => !e.archivedAt).map((e) => ({
|
|
301
|
+
value: e.key,
|
|
302
|
+
label: e.name
|
|
303
|
+
}))],
|
|
304
|
+
size: "sm"
|
|
305
|
+
}),
|
|
306
|
+
/* @__PURE__ */ E(x, {
|
|
307
|
+
"aria-label": i("tab"),
|
|
308
|
+
value: S.view ?? "active",
|
|
309
|
+
onValueChange: (e) => A({ view: e ?? "active" }),
|
|
310
|
+
items: L.map((e) => ({
|
|
311
|
+
value: e,
|
|
312
|
+
label: i(`tabs.${e}`)
|
|
313
|
+
})),
|
|
314
|
+
size: "sm"
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ E(x, {
|
|
317
|
+
"aria-label": i("priority"),
|
|
318
|
+
value: S.priority ?? "",
|
|
319
|
+
onValueChange: (e) => A({ priority: e ?? "" }),
|
|
320
|
+
items: [{
|
|
321
|
+
value: "",
|
|
322
|
+
label: i("anyPriority")
|
|
323
|
+
}, ...[
|
|
324
|
+
"1",
|
|
325
|
+
"2",
|
|
326
|
+
"3",
|
|
327
|
+
"4",
|
|
328
|
+
"0"
|
|
329
|
+
].map((e) => ({
|
|
330
|
+
value: e,
|
|
331
|
+
label: i(`priorities.${e}`)
|
|
332
|
+
}))],
|
|
333
|
+
size: "sm"
|
|
334
|
+
}),
|
|
335
|
+
/* @__PURE__ */ E(x, {
|
|
336
|
+
"aria-label": i("label"),
|
|
337
|
+
value: S.label ?? "",
|
|
338
|
+
onValueChange: (e) => A({ label: e ?? "" }),
|
|
339
|
+
items: [{
|
|
340
|
+
value: "",
|
|
341
|
+
label: i("anyLabel")
|
|
342
|
+
}, ...p.map((e) => ({
|
|
343
|
+
value: e.id,
|
|
344
|
+
label: e.name
|
|
345
|
+
}))],
|
|
346
|
+
size: "sm"
|
|
347
|
+
})
|
|
348
|
+
]
|
|
349
|
+
})
|
|
350
|
+
]
|
|
351
|
+
}), /* @__PURE__ */ D("div", {
|
|
352
|
+
className: "min-w-0 rounded-md border border-border p-3",
|
|
353
|
+
children: [/* @__PURE__ */ E("p", {
|
|
354
|
+
className: "mb-2 text-xs font-medium text-muted-foreground",
|
|
355
|
+
children: i("preview")
|
|
356
|
+
}), h ? /* @__PURE__ */ E(m, {
|
|
357
|
+
workspace: e,
|
|
358
|
+
panel: a,
|
|
359
|
+
data: h
|
|
360
|
+
}) : /* @__PURE__ */ E("p", {
|
|
361
|
+
className: "text-sm text-muted-foreground",
|
|
362
|
+
children: i("loading")
|
|
363
|
+
})]
|
|
364
|
+
})]
|
|
365
|
+
})
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
export { M as component };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { dashboardQuery as e, teamsQuery as t } from "../../../api/queries.js";
|
|
2
|
+
// src/routes/$workspace/dashboards/$dashboardId.tsx?tsr-split=loader
|
|
3
|
+
var n = ({ context: { queryClient: n }, params: { workspace: r, dashboardId: i } }) => Promise.all([n.ensureQueryData(e(r, i)), 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/dashboards/")({
|
|
3
|
+
loader: t(() => import("./index3.js"), "loader"),
|
|
4
|
+
component: n(() => import("./index2.js"), "component")
|
|
5
|
+
});
|
|
6
|
+
export { r as Route };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
|
+
import { usePageTitle as n } from "../../../lib/pageTitle.js";
|
|
3
|
+
import { Link as r } from "../../../lib/router.js";
|
|
4
|
+
import { dashboardsQuery as i, teamsQuery as a } from "../../../api/queries.js";
|
|
5
|
+
import { ChartIcon as o } from "../../../components/icons.js";
|
|
6
|
+
import { useFormError as s } from "../../../components/settings.js";
|
|
7
|
+
import { Route as c } from "./index.js";
|
|
8
|
+
import { sharingItems as l, sharingOf as u, starterPanels as d } from "../../../components/DashboardPanel.js";
|
|
9
|
+
import { Button as f, Card as p, EmptyState as m, Field as h, Input as g, Modal as _, Select as v } from "@parallelworks/ui";
|
|
10
|
+
import { useNavigate as y } from "@tanstack/react-router";
|
|
11
|
+
import { useState as b } from "react";
|
|
12
|
+
import { useTranslations as x } from "use-intl";
|
|
13
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
14
|
+
import { useMutation as T, useQueryClient as E, useSuspenseQuery as D } from "@tanstack/react-query";
|
|
15
|
+
// src/routes/$workspace/dashboards/index.tsx?tsr-split=component
|
|
16
|
+
function O() {
|
|
17
|
+
let e = x("dashboards");
|
|
18
|
+
n(e("title"));
|
|
19
|
+
let { workspace: t } = c.useParams(), { data: s } = D(i(t)), { data: l } = D(a(t)), [u, d] = b(!1), h = (e) => l.find((t) => t.key === e)?.name;
|
|
20
|
+
return /* @__PURE__ */ w("div", {
|
|
21
|
+
className: "w-full space-y-6 px-4 py-6 md:px-8 md:py-8",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ w("div", {
|
|
24
|
+
className: "flex flex-wrap items-end justify-between gap-4",
|
|
25
|
+
children: [/* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("h1", {
|
|
26
|
+
className: "text-xl font-semibold tracking-tight",
|
|
27
|
+
children: e("title")
|
|
28
|
+
}), /* @__PURE__ */ C("p", {
|
|
29
|
+
className: "mt-1 text-sm text-muted-foreground",
|
|
30
|
+
children: e("description")
|
|
31
|
+
})] }), /* @__PURE__ */ C(f, {
|
|
32
|
+
variant: "primary",
|
|
33
|
+
onClick: () => d(!0),
|
|
34
|
+
children: e("new")
|
|
35
|
+
})]
|
|
36
|
+
}),
|
|
37
|
+
s.length === 0 ? /* @__PURE__ */ C(m, {
|
|
38
|
+
icon: /* @__PURE__ */ C(o, {}),
|
|
39
|
+
title: e("noneTitle"),
|
|
40
|
+
description: e("noneDescription"),
|
|
41
|
+
action: /* @__PURE__ */ C(f, {
|
|
42
|
+
variant: "primary",
|
|
43
|
+
onClick: () => d(!0),
|
|
44
|
+
children: e("new")
|
|
45
|
+
})
|
|
46
|
+
}) : /* @__PURE__ */ C("ul", {
|
|
47
|
+
className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
|
|
48
|
+
children: s.map((n) => /* @__PURE__ */ C("li", { children: /* @__PURE__ */ C(p, {
|
|
49
|
+
padding: "none",
|
|
50
|
+
children: /* @__PURE__ */ w(r, {
|
|
51
|
+
to: "/$workspace/dashboards/$dashboardId",
|
|
52
|
+
params: {
|
|
53
|
+
workspace: t,
|
|
54
|
+
dashboardId: n.id
|
|
55
|
+
},
|
|
56
|
+
className: "block space-y-1 p-4",
|
|
57
|
+
children: [/* @__PURE__ */ w("span", {
|
|
58
|
+
className: "flex items-center gap-2 font-medium",
|
|
59
|
+
children: [/* @__PURE__ */ C(o, { className: "size-4 text-muted-foreground" }), /* @__PURE__ */ C("span", {
|
|
60
|
+
className: "truncate",
|
|
61
|
+
children: n.name
|
|
62
|
+
})]
|
|
63
|
+
}), /* @__PURE__ */ C("span", {
|
|
64
|
+
className: "block text-xs text-muted-foreground",
|
|
65
|
+
children: [
|
|
66
|
+
e("panels", { count: n.panels.length }),
|
|
67
|
+
n.shared ? n.team ? e("sharedTeam", { team: h(n.team) ?? n.team }) : e("sharedWorkspace") : e("private"),
|
|
68
|
+
n.owner
|
|
69
|
+
].join(" · ")
|
|
70
|
+
})]
|
|
71
|
+
})
|
|
72
|
+
}) }, n.id))
|
|
73
|
+
}),
|
|
74
|
+
u && /* @__PURE__ */ C(k, {
|
|
75
|
+
workspace: t,
|
|
76
|
+
onClose: () => d(!1)
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function k({ workspace: n, onClose: r }) {
|
|
82
|
+
let o = x("dashboards"), c = E(), p = y(), { data: m } = D(a(n)), [O, k] = b(""), [A, j] = b("private"), M = s(), N = T({
|
|
83
|
+
mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/dashboards", {
|
|
84
|
+
params: { path: { workspace: n } },
|
|
85
|
+
body: {
|
|
86
|
+
name: O,
|
|
87
|
+
...u(A),
|
|
88
|
+
panels: d(o)
|
|
89
|
+
}
|
|
90
|
+
})),
|
|
91
|
+
onMutate: M.clear,
|
|
92
|
+
onSuccess: (e) => {
|
|
93
|
+
c.invalidateQueries({ queryKey: i(n).queryKey }), p({
|
|
94
|
+
to: "/$workspace/dashboards/$dashboardId",
|
|
95
|
+
params: {
|
|
96
|
+
workspace: n,
|
|
97
|
+
dashboardId: e.id
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
onError: M.set
|
|
102
|
+
});
|
|
103
|
+
return /* @__PURE__ */ C(_, {
|
|
104
|
+
open: !0,
|
|
105
|
+
onClose: r,
|
|
106
|
+
title: o("new"),
|
|
107
|
+
size: "md",
|
|
108
|
+
onSubmit: (e) => {
|
|
109
|
+
e.preventDefault(), N.mutate();
|
|
110
|
+
},
|
|
111
|
+
footer: /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(f, {
|
|
112
|
+
variant: "ghost",
|
|
113
|
+
onClick: r,
|
|
114
|
+
children: o("cancel")
|
|
115
|
+
}), /* @__PURE__ */ C(f, {
|
|
116
|
+
type: "submit",
|
|
117
|
+
variant: "primary",
|
|
118
|
+
loading: N.isPending,
|
|
119
|
+
children: o("create")
|
|
120
|
+
})] }),
|
|
121
|
+
children: /* @__PURE__ */ w("div", {
|
|
122
|
+
className: "space-y-4",
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ C(h, {
|
|
125
|
+
label: o("name"),
|
|
126
|
+
children: /* @__PURE__ */ C(g, {
|
|
127
|
+
value: O,
|
|
128
|
+
onChange: (e) => k(e.target.value),
|
|
129
|
+
required: !0,
|
|
130
|
+
maxLength: 200,
|
|
131
|
+
autoFocus: !0
|
|
132
|
+
})
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ C(h, {
|
|
135
|
+
label: o("sharing"),
|
|
136
|
+
description: o("startsWith"),
|
|
137
|
+
children: /* @__PURE__ */ C(v, {
|
|
138
|
+
value: A,
|
|
139
|
+
onValueChange: (e) => e && j(e),
|
|
140
|
+
items: l(o, m)
|
|
141
|
+
})
|
|
142
|
+
}),
|
|
143
|
+
M.error && /* @__PURE__ */ C("p", {
|
|
144
|
+
className: "text-sm text-danger",
|
|
145
|
+
children: M.error
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
export { O as component };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { dashboardsQuery as e, teamsQuery as t } from "../../../api/queries.js";
|
|
2
|
+
// src/routes/$workspace/dashboards/index.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 };
|
|
@@ -8,7 +8,7 @@ var c = a("/$workspace/issues/")({
|
|
|
8
8
|
validateSearch: r,
|
|
9
9
|
beforeLoad: async ({ context: { queryClient: r }, params: a, search: o, location: s, preload: c }) => {
|
|
10
10
|
let l = o.team;
|
|
11
|
-
if (!l && !o.assignee && !o.creator && !o.saved) {
|
|
11
|
+
if (!l && !o.assignee && !o.creator && !o.saved && !o.scope) {
|
|
12
12
|
let e = (await r.ensureQueryData(n(a.workspace))).filter((e) => !e.archivedAt), t = i(a.workspace);
|
|
13
13
|
l = (e.find((e) => e.key === t) ?? e[0])?.key;
|
|
14
14
|
}
|