@parallelworks/tandem-web 0.193.0 → 0.194.1
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 +56 -6
- package/_virtual/_virtual_i18n/es/common.js +56 -6
- package/_virtual/_virtual_i18n/ja/common.js +56 -6
- package/_virtual/_virtual_i18n/ko/common.js +56 -6
- package/_virtual/_virtual_i18n/zh/common.js +56 -6
- package/api/queries.js +2 -1
- package/components/AgentActions.js +97 -0
- package/components/AgentBugReports.js +228 -0
- package/components/AgentDeploy.js +88 -0
- package/components/DashboardPanel.js +70 -57
- package/components/IssueBreakdown.js +1 -1
- package/components/NewIssueDialog.js +146 -146
- package/lib/agents.js +11 -1
- package/lib/knowledge.js +8 -1
- package/package.json +1 -1
- package/routes/_workspace/agents/_slug.js +1 -0
- package/routes/_workspace/agents/_slug2.js +399 -347
- package/routes/_workspace/dashboards/_dashboardId2.js +26 -2
- package/routes/_workspace/knowledge/_term2.js +121 -109
- package/routes/_workspace/knowledge/index2.js +88 -81
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { api as e, unwrap as t } from "../api/client.js";
|
|
2
|
+
import { inboxQuery as n } from "../api/queries.js";
|
|
3
|
+
import { Link as r } from "../lib/router.js";
|
|
4
|
+
import { Button as i, Card as a, Input as o, Modal as s, Select as c, Textarea as l, toast as u } from "@parallelworks/ui";
|
|
5
|
+
import { useState as d } from "react";
|
|
6
|
+
import { useErrorMessage as f } from "@parallelworks/problem/react";
|
|
7
|
+
import { useTranslations as p } from "use-intl";
|
|
8
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
import { useMutation as _, useQuery as v, useQueryClient as y } from "@tanstack/react-query";
|
|
10
|
+
// src/components/AgentBugReports.tsx
|
|
11
|
+
var b = [
|
|
12
|
+
"critical",
|
|
13
|
+
"high",
|
|
14
|
+
"medium",
|
|
15
|
+
"low"
|
|
16
|
+
];
|
|
17
|
+
function x({ workspace: o, agent: s }) {
|
|
18
|
+
let c = p("agent"), l = f(), m = y(), { data: x = [] } = v(n(o)), [C, w] = d(null), T = x.filter((e) => e.bug && !e.answer && !e.canceled && e.agent.kind === "agent" && e.agent.handle === s.slug).sort((e, t) => b.indexOf(e.bug?.severity ?? "low") - b.indexOf(t.bug?.severity ?? "low")), E = () => m.invalidateQueries({ queryKey: [
|
|
19
|
+
"workspace",
|
|
20
|
+
o,
|
|
21
|
+
"decisions"
|
|
22
|
+
] }), D = async (n, r) => t(await e.POST("/api/v1/workspaces/{workspace}/decisions/{decisionId}/answer", {
|
|
23
|
+
params: { path: {
|
|
24
|
+
workspace: o,
|
|
25
|
+
decisionId: n.id
|
|
26
|
+
} },
|
|
27
|
+
body: { optionId: r }
|
|
28
|
+
})), O = _({
|
|
29
|
+
mutationFn: ({ d: e, optionId: t }) => D(e, t),
|
|
30
|
+
onSuccess: (e) => {
|
|
31
|
+
let t = e.subIssues[0];
|
|
32
|
+
t && u.success(c("bugFiled", { identifier: t.identifier }));
|
|
33
|
+
},
|
|
34
|
+
onError: (e) => u.error(l(e)),
|
|
35
|
+
onSettled: E
|
|
36
|
+
}), k = _({
|
|
37
|
+
mutationFn: async () => {
|
|
38
|
+
for (let e of T) await D(e, "create");
|
|
39
|
+
},
|
|
40
|
+
onSuccess: () => u.success(c("bugsFiled", { count: T.length })),
|
|
41
|
+
onError: (e) => u.error(l(e)),
|
|
42
|
+
onSettled: E
|
|
43
|
+
});
|
|
44
|
+
return T.length === 0 ? null : /* @__PURE__ */ g(a, {
|
|
45
|
+
"aria-labelledby": "agent-bugs",
|
|
46
|
+
className: "w-full max-w-3xl space-y-3",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ g("div", {
|
|
49
|
+
className: "flex flex-wrap items-center justify-between gap-3",
|
|
50
|
+
children: [/* @__PURE__ */ h("h2", {
|
|
51
|
+
id: "agent-bugs",
|
|
52
|
+
className: "text-base font-semibold",
|
|
53
|
+
children: c("bugsToReview", { count: T.length })
|
|
54
|
+
}), /* @__PURE__ */ h(i, {
|
|
55
|
+
loading: k.isPending,
|
|
56
|
+
onClick: () => k.mutate(),
|
|
57
|
+
children: c("approveAll")
|
|
58
|
+
})]
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ h("ul", {
|
|
61
|
+
className: "divide-y divide-border",
|
|
62
|
+
children: T.map((e) => {
|
|
63
|
+
let t = e.bug;
|
|
64
|
+
return /* @__PURE__ */ g("li", {
|
|
65
|
+
className: "space-y-1.5 py-3 first:pt-0 last:pb-0",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ g("div", {
|
|
68
|
+
className: "flex flex-wrap items-baseline gap-x-2 gap-y-1",
|
|
69
|
+
children: [/* @__PURE__ */ h("span", {
|
|
70
|
+
className: "rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",
|
|
71
|
+
children: c(`severity.${t.severity}`)
|
|
72
|
+
}), /* @__PURE__ */ h("span", {
|
|
73
|
+
className: "min-w-0 flex-1 text-sm font-medium",
|
|
74
|
+
children: t.title
|
|
75
|
+
})]
|
|
76
|
+
}),
|
|
77
|
+
t.file && /* @__PURE__ */ h("code", {
|
|
78
|
+
className: "block truncate font-mono text-xs text-muted-foreground",
|
|
79
|
+
children: t.line ? `${t.file}:${t.line}` : t.file
|
|
80
|
+
}),
|
|
81
|
+
t.body && /* @__PURE__ */ h("p", {
|
|
82
|
+
className: "line-clamp-3 text-sm whitespace-pre-line text-muted-foreground",
|
|
83
|
+
children: t.body
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ g("div", {
|
|
86
|
+
className: "flex flex-wrap items-center gap-2 pt-1",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ h(i, {
|
|
89
|
+
size: "sm",
|
|
90
|
+
variant: "primary",
|
|
91
|
+
disabled: O.isPending || k.isPending,
|
|
92
|
+
onClick: () => O.mutate({
|
|
93
|
+
d: e,
|
|
94
|
+
optionId: "create"
|
|
95
|
+
}),
|
|
96
|
+
children: c("approve")
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ h(i, {
|
|
99
|
+
size: "sm",
|
|
100
|
+
variant: "ghost",
|
|
101
|
+
onClick: () => w(e),
|
|
102
|
+
children: c("editReport")
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ h(i, {
|
|
105
|
+
size: "sm",
|
|
106
|
+
variant: "ghost",
|
|
107
|
+
disabled: O.isPending || k.isPending,
|
|
108
|
+
onClick: () => O.mutate({
|
|
109
|
+
d: e,
|
|
110
|
+
optionId: "dismiss"
|
|
111
|
+
}),
|
|
112
|
+
children: c("dismissReport")
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ h(r, {
|
|
115
|
+
to: "/$workspace/issues/$identifier",
|
|
116
|
+
params: {
|
|
117
|
+
workspace: o,
|
|
118
|
+
identifier: e.identifier
|
|
119
|
+
},
|
|
120
|
+
className: "ml-auto text-xs text-muted-foreground hover:underline",
|
|
121
|
+
children: c("fromScan", { identifier: e.identifier })
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
}, e.id);
|
|
127
|
+
})
|
|
128
|
+
}),
|
|
129
|
+
C && /* @__PURE__ */ h(S, {
|
|
130
|
+
workspace: o,
|
|
131
|
+
decision: C,
|
|
132
|
+
onClose: () => w(null),
|
|
133
|
+
onDone: () => {
|
|
134
|
+
w(null), E();
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function S({ workspace: n, decision: r, onClose: a, onDone: v }) {
|
|
141
|
+
let y = p("agent"), x = p("common"), S = f(), [C, w] = d(r.bug), T = _({
|
|
142
|
+
mutationFn: async () => {
|
|
143
|
+
let i = { path: {
|
|
144
|
+
workspace: n,
|
|
145
|
+
decisionId: r.id
|
|
146
|
+
} };
|
|
147
|
+
return t(await e.PUT("/api/v1/workspaces/{workspace}/decisions/{decisionId}/bug", {
|
|
148
|
+
params: i,
|
|
149
|
+
body: C
|
|
150
|
+
})), t(await e.POST("/api/v1/workspaces/{workspace}/decisions/{decisionId}/answer", {
|
|
151
|
+
params: i,
|
|
152
|
+
body: { optionId: "create" }
|
|
153
|
+
}));
|
|
154
|
+
},
|
|
155
|
+
onSuccess: (e) => {
|
|
156
|
+
let t = e.subIssues[0];
|
|
157
|
+
t && u.success(y("bugFiled", { identifier: t.identifier })), v();
|
|
158
|
+
},
|
|
159
|
+
onError: (e) => u.error(S(e))
|
|
160
|
+
});
|
|
161
|
+
return /* @__PURE__ */ h(s, {
|
|
162
|
+
open: !0,
|
|
163
|
+
onClose: a,
|
|
164
|
+
title: y("editReportTitle"),
|
|
165
|
+
onSubmit: (e) => {
|
|
166
|
+
e.preventDefault(), T.mutate();
|
|
167
|
+
},
|
|
168
|
+
footer: /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(i, {
|
|
169
|
+
variant: "ghost",
|
|
170
|
+
onClick: a,
|
|
171
|
+
children: x("cancel")
|
|
172
|
+
}), /* @__PURE__ */ h(i, {
|
|
173
|
+
type: "submit",
|
|
174
|
+
variant: "primary",
|
|
175
|
+
loading: T.isPending,
|
|
176
|
+
disabled: !C.title.trim(),
|
|
177
|
+
children: y("approve")
|
|
178
|
+
})] }),
|
|
179
|
+
children: /* @__PURE__ */ g("div", {
|
|
180
|
+
className: "space-y-3",
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ g("label", {
|
|
183
|
+
className: "block text-sm font-medium",
|
|
184
|
+
children: [y("reportTitle"), /* @__PURE__ */ h(o, {
|
|
185
|
+
value: C.title,
|
|
186
|
+
onChange: (e) => w({
|
|
187
|
+
...C,
|
|
188
|
+
title: e.target.value
|
|
189
|
+
}),
|
|
190
|
+
className: "mt-1"
|
|
191
|
+
})]
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ g("label", {
|
|
194
|
+
className: "block text-sm font-medium",
|
|
195
|
+
children: [x("description"), /* @__PURE__ */ h(l, {
|
|
196
|
+
value: C.body ?? "",
|
|
197
|
+
onChange: (e) => w({
|
|
198
|
+
...C,
|
|
199
|
+
body: e.target.value
|
|
200
|
+
}),
|
|
201
|
+
rows: 6,
|
|
202
|
+
className: "mt-1"
|
|
203
|
+
})]
|
|
204
|
+
}),
|
|
205
|
+
/* @__PURE__ */ g("div", {
|
|
206
|
+
className: "block text-sm font-medium",
|
|
207
|
+
children: [y("severityLabel"), /* @__PURE__ */ h("div", {
|
|
208
|
+
className: "mt-1",
|
|
209
|
+
children: /* @__PURE__ */ h(c, {
|
|
210
|
+
value: C.severity,
|
|
211
|
+
items: b.map((e) => ({
|
|
212
|
+
value: e,
|
|
213
|
+
label: y(`severity.${e}`)
|
|
214
|
+
})),
|
|
215
|
+
onValueChange: (e) => w({
|
|
216
|
+
...C,
|
|
217
|
+
severity: e
|
|
218
|
+
}),
|
|
219
|
+
"aria-label": y("severityLabel"),
|
|
220
|
+
width: "content"
|
|
221
|
+
})
|
|
222
|
+
})]
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
})
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
export { x as AgentBugReports };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { meQuery as e, runnersQuery as t } from "../api/queries.js";
|
|
2
|
+
import { runnerCommand as n, runnersFor as r } from "../lib/agents.js";
|
|
3
|
+
import { appURL as i } from "../lib/base.js";
|
|
4
|
+
import { RunnerBadge as a } from "./RunnerBadge.js";
|
|
5
|
+
import { Card as o, CopyButton as s } from "@parallelworks/ui";
|
|
6
|
+
import { useTranslations as c } from "use-intl";
|
|
7
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
import { useQuery as f } from "@tanstack/react-query";
|
|
9
|
+
// src/components/AgentDeploy.tsx
|
|
10
|
+
var p = "go install github.com/parallelworks/tandem/cmd/tandem@latest";
|
|
11
|
+
function m({ workspace: m, agent: h }) {
|
|
12
|
+
let g = c("agent"), { data: _ = [] } = f(t(m)), { data: v } = f(e), y = r(h, _).filter((e) => e.online), b = i(""), x = v?.mode === "platform" ? `tandem login --server ${b} --token -` : `tandem login --server ${b}`, S = [
|
|
13
|
+
{
|
|
14
|
+
title: g("deployInstall"),
|
|
15
|
+
command: p
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: v?.mode === "platform" ? g("deployLoginToken") : g("deployLogin"),
|
|
19
|
+
command: x
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
title: g("deployRun"),
|
|
23
|
+
command: n(h)
|
|
24
|
+
}
|
|
25
|
+
], C = /* @__PURE__ */ u("ol", {
|
|
26
|
+
className: "space-y-3",
|
|
27
|
+
children: S.map((e, t) => /* @__PURE__ */ d("li", {
|
|
28
|
+
className: "space-y-1",
|
|
29
|
+
children: [/* @__PURE__ */ d("p", {
|
|
30
|
+
className: "text-sm",
|
|
31
|
+
children: [/* @__PURE__ */ d("span", {
|
|
32
|
+
className: "mr-1.5 text-muted-foreground tabular-nums",
|
|
33
|
+
children: [t + 1, "."]
|
|
34
|
+
}), e.title]
|
|
35
|
+
}), /* @__PURE__ */ d("div", {
|
|
36
|
+
className: "flex items-center gap-1 rounded-md border border-border bg-muted px-2 py-1",
|
|
37
|
+
children: [/* @__PURE__ */ u("code", {
|
|
38
|
+
className: "min-w-0 flex-1 overflow-x-auto font-mono text-xs whitespace-nowrap",
|
|
39
|
+
children: e.command
|
|
40
|
+
}), /* @__PURE__ */ u(s, {
|
|
41
|
+
text: e.command,
|
|
42
|
+
label: g("copyCommand"),
|
|
43
|
+
size: "sm",
|
|
44
|
+
variant: "ghost"
|
|
45
|
+
})]
|
|
46
|
+
})]
|
|
47
|
+
}, e.title))
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ d(o, {
|
|
50
|
+
"aria-labelledby": "agent-deploy",
|
|
51
|
+
className: "w-full max-w-3xl space-y-3",
|
|
52
|
+
children: [/* @__PURE__ */ u("h2", {
|
|
53
|
+
id: "agent-deploy",
|
|
54
|
+
className: "text-base font-semibold",
|
|
55
|
+
children: y.length > 0 ? g("deployReady") : g("deployTitle")
|
|
56
|
+
}), y.length > 0 ? /* @__PURE__ */ d(l, { children: [
|
|
57
|
+
/* @__PURE__ */ u("p", {
|
|
58
|
+
className: "text-sm text-muted-foreground",
|
|
59
|
+
children: g("deployOnline", { count: y.length })
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ u("ul", {
|
|
62
|
+
className: "flex flex-wrap gap-2",
|
|
63
|
+
children: y.map(({ runner: e }) => /* @__PURE__ */ u("li", {
|
|
64
|
+
className: "text-sm",
|
|
65
|
+
children: /* @__PURE__ */ u(a, {
|
|
66
|
+
workspace: m,
|
|
67
|
+
name: e.name,
|
|
68
|
+
kind: e.kind
|
|
69
|
+
})
|
|
70
|
+
}, e.id))
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ d("details", {
|
|
73
|
+
className: "text-sm",
|
|
74
|
+
children: [/* @__PURE__ */ u("summary", {
|
|
75
|
+
className: "cursor-pointer text-muted-foreground",
|
|
76
|
+
children: g("deployAnother")
|
|
77
|
+
}), /* @__PURE__ */ u("div", {
|
|
78
|
+
className: "mt-3",
|
|
79
|
+
children: C
|
|
80
|
+
})]
|
|
81
|
+
})
|
|
82
|
+
] }) : /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("p", {
|
|
83
|
+
className: "text-sm text-muted-foreground text-pretty",
|
|
84
|
+
children: g("deployLead")
|
|
85
|
+
}), C] })]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export { m as AgentDeploy };
|
|
@@ -17,9 +17,10 @@ function b(e) {
|
|
|
17
17
|
var x = /* @__PURE__ */ new Set([
|
|
18
18
|
"created_completed",
|
|
19
19
|
"open",
|
|
20
|
-
"throughput"
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
"throughput",
|
|
21
|
+
"active_users"
|
|
22
|
+
]), S = "total", C = (e) => e.days.length > 0 ? e.days : e.weeks;
|
|
23
|
+
function w(e) {
|
|
23
24
|
return [
|
|
24
25
|
{
|
|
25
26
|
title: e("starter.createdCompleted"),
|
|
@@ -59,7 +60,7 @@ function S(e) {
|
|
|
59
60
|
}
|
|
60
61
|
];
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function T(e, t) {
|
|
63
64
|
return [
|
|
64
65
|
{
|
|
65
66
|
value: "private",
|
|
@@ -75,7 +76,7 @@ function C(e, t) {
|
|
|
75
76
|
}))
|
|
76
77
|
];
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
+
function E(e) {
|
|
79
80
|
return e === "private" ? {
|
|
80
81
|
shared: !1,
|
|
81
82
|
team: ""
|
|
@@ -87,7 +88,7 @@ function w(e) {
|
|
|
87
88
|
team: e.slice(5)
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function D({ workspace: t, panel: o, onEdit: s, onDelete: c }) {
|
|
91
92
|
let u = g("dashboards"), { data: d, isPending: f, isError: p } = y({
|
|
92
93
|
...e(t, o.chart, o.spec),
|
|
93
94
|
refetchInterval: 6e4
|
|
@@ -108,7 +109,7 @@ function T({ workspace: t, panel: o, onEdit: s, onDelete: c }) {
|
|
|
108
109
|
size: "sm",
|
|
109
110
|
icon: /* @__PURE__ */ _(n, {}),
|
|
110
111
|
label: u("csv"),
|
|
111
|
-
onClick: () =>
|
|
112
|
+
onClick: () => F(o.title || o.spec.measure, d, u)
|
|
112
113
|
}),
|
|
113
114
|
s && /* @__PURE__ */ _(l, {
|
|
114
115
|
variant: "ghost",
|
|
@@ -133,7 +134,7 @@ function T({ workspace: t, panel: o, onEdit: s, onDelete: c }) {
|
|
|
133
134
|
}) : p || !d ? /* @__PURE__ */ _("p", {
|
|
134
135
|
className: "text-sm text-danger",
|
|
135
136
|
children: u("failed")
|
|
136
|
-
}) : /* @__PURE__ */ _(
|
|
137
|
+
}) : /* @__PURE__ */ _(k, {
|
|
137
138
|
workspace: t,
|
|
138
139
|
panel: o,
|
|
139
140
|
data: d
|
|
@@ -141,12 +142,12 @@ function T({ workspace: t, panel: o, onEdit: s, onDelete: c }) {
|
|
|
141
142
|
})]
|
|
142
143
|
});
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function O(e) {
|
|
145
146
|
let t = h(), n = g("dashboards");
|
|
146
147
|
return (r) => e === "days" ? n("daysValue", { days: t.number(r, { maximumFractionDigits: 1 }) }) : t.number(r, { maximumFractionDigits: +(e === "points") });
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
-
let i = g("dashboards"), a =
|
|
149
|
+
function k({ workspace: e, panel: n, data: r }) {
|
|
150
|
+
let i = g("dashboards"), a = O(r.unit), o = r.series.length > 0 && C(r).length > 0, s = n.chart;
|
|
150
151
|
return s === "number" ? /* @__PURE__ */ v(t, {
|
|
151
152
|
to: "/$workspace/issues",
|
|
152
153
|
params: { workspace: e },
|
|
@@ -159,7 +160,7 @@ function D({ workspace: e, panel: n, data: r }) {
|
|
|
159
160
|
className: "text-xs text-muted-foreground",
|
|
160
161
|
children: i(`units.${r.unit}`)
|
|
161
162
|
})]
|
|
162
|
-
}) : s === "list" ? r.issues.length === 0 ? /* @__PURE__ */ _(
|
|
163
|
+
}) : s === "list" ? r.issues.length === 0 ? /* @__PURE__ */ _(A, {}) : /* @__PURE__ */ _("ul", {
|
|
163
164
|
className: "divide-y divide-border text-sm",
|
|
164
165
|
children: r.issues.map((n) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v(t, {
|
|
165
166
|
to: "/$workspace/issues/$identifier",
|
|
@@ -183,7 +184,7 @@ function D({ workspace: e, panel: n, data: r }) {
|
|
|
183
184
|
})
|
|
184
185
|
]
|
|
185
186
|
}) }, n.identifier))
|
|
186
|
-
}) : s === "table" ? r.rows.length === 0 ? /* @__PURE__ */ _(
|
|
187
|
+
}) : s === "table" ? r.rows.length === 0 ? /* @__PURE__ */ _(A, {}) : /* @__PURE__ */ v("table", {
|
|
187
188
|
className: "w-full text-sm",
|
|
188
189
|
children: [/* @__PURE__ */ _("thead", { children: /* @__PURE__ */ v("tr", {
|
|
189
190
|
className: "text-left text-xs text-muted-foreground",
|
|
@@ -203,37 +204,37 @@ function D({ workspace: e, panel: n, data: r }) {
|
|
|
203
204
|
params: { workspace: e },
|
|
204
205
|
search: b(r.filter),
|
|
205
206
|
className: "hover:underline",
|
|
206
|
-
children:
|
|
207
|
+
children: j(r.name, n.spec.groupBy, i)
|
|
207
208
|
})
|
|
208
209
|
}), /* @__PURE__ */ _("td", {
|
|
209
210
|
className: "py-1.5 text-right tabular-nums",
|
|
210
211
|
children: a(r.value)
|
|
211
212
|
})] }, r.key || "-"))
|
|
212
213
|
})]
|
|
213
|
-
}) : o && (s === "line" || s === "stacked" || x.has(n.spec.measure)) ? /* @__PURE__ */ _(
|
|
214
|
+
}) : o && (s === "line" || s === "stacked" || x.has(n.spec.measure)) ? /* @__PURE__ */ _(P, {
|
|
214
215
|
workspace: e,
|
|
215
216
|
data: r,
|
|
216
217
|
stacked: s !== "line",
|
|
217
|
-
names: (e) => e.key === "created" || e.key === "completed" ? i(`series.${e.key}`) :
|
|
218
|
+
names: (e) => e.key === "created" || e.key === "completed" || e.key === S ? i(`series.${e.key}`) : j(e.name, n.spec.groupBy, i),
|
|
218
219
|
value: a
|
|
219
|
-
}) : r.rows.length === 0 || r.rows.every((e) => e.value === 0) ? /* @__PURE__ */ _(
|
|
220
|
+
}) : r.rows.length === 0 || r.rows.every((e) => e.value === 0) ? /* @__PURE__ */ _(A, {}) : _(s === "pie" ? N : M, {
|
|
220
221
|
workspace: e,
|
|
221
222
|
data: r,
|
|
222
223
|
groupBy: n.spec.groupBy,
|
|
223
224
|
value: a
|
|
224
225
|
});
|
|
225
226
|
}
|
|
226
|
-
function
|
|
227
|
+
function A() {
|
|
227
228
|
let e = g("dashboards");
|
|
228
229
|
return /* @__PURE__ */ _("p", {
|
|
229
230
|
className: "text-sm text-muted-foreground",
|
|
230
231
|
children: e("empty")
|
|
231
232
|
});
|
|
232
233
|
}
|
|
233
|
-
function
|
|
234
|
+
function j(e, t, n) {
|
|
234
235
|
return t === "priority" ? n(`priorities.${e}`) : t === "status" && e ? n(`categories.${e}`) : t ? e || n("none") : n("all");
|
|
235
236
|
}
|
|
236
|
-
function
|
|
237
|
+
function M({ workspace: e, data: n, groupBy: r, value: i }) {
|
|
237
238
|
let a = g("dashboards"), o = Math.max(...n.rows.map((e) => e.value), 1);
|
|
238
239
|
return /* @__PURE__ */ _("ul", {
|
|
239
240
|
className: "space-y-1.5",
|
|
@@ -245,7 +246,7 @@ function A({ workspace: e, data: n, groupBy: r, value: i }) {
|
|
|
245
246
|
children: [
|
|
246
247
|
/* @__PURE__ */ _("span", {
|
|
247
248
|
className: "truncate text-muted-foreground group-hover:text-foreground",
|
|
248
|
-
children:
|
|
249
|
+
children: j(n.name, r, a)
|
|
249
250
|
}),
|
|
250
251
|
/* @__PURE__ */ _("span", {
|
|
251
252
|
className: "h-4 rounded-sm bg-muted",
|
|
@@ -262,7 +263,7 @@ function A({ workspace: e, data: n, groupBy: r, value: i }) {
|
|
|
262
263
|
}) }, n.key))
|
|
263
264
|
});
|
|
264
265
|
}
|
|
265
|
-
function
|
|
266
|
+
function N({ workspace: e, data: n, groupBy: r, value: i }) {
|
|
266
267
|
let a = g("dashboards"), o = n.rows.filter((e) => e.value > 0), { keys: s, folded: c } = f(o.map((e) => e.key)), l = p(s), m = s.map((e) => {
|
|
267
268
|
if (e === u) return {
|
|
268
269
|
key: e,
|
|
@@ -273,7 +274,7 @@ function j({ workspace: e, data: n, groupBy: r, value: i }) {
|
|
|
273
274
|
let t = o.find((t) => t.key === e);
|
|
274
275
|
return {
|
|
275
276
|
key: e,
|
|
276
|
-
name:
|
|
277
|
+
name: j(t.name, r, a),
|
|
277
278
|
value: t.value,
|
|
278
279
|
filter: t.filter
|
|
279
280
|
};
|
|
@@ -325,23 +326,30 @@ function j({ workspace: e, data: n, groupBy: r, value: i }) {
|
|
|
325
326
|
})]
|
|
326
327
|
});
|
|
327
328
|
}
|
|
328
|
-
function
|
|
329
|
-
let l = g("dashboards"), d = h(), [y, x] = m(null),
|
|
329
|
+
function P({ workspace: e, data: n, stacked: r, names: i, value: a }) {
|
|
330
|
+
let l = g("dashboards"), d = h(), [y, x] = m(null), w = C(n), T = n.days.length > 0, E = n.series.find((e) => e.key === S), D = E ? n.series.filter((e) => e !== E) : n.series, { keys: O, folded: k } = f(D.map((e) => e.key)), A = {
|
|
331
|
+
...p(O),
|
|
332
|
+
[S]: "var(--color-muted-foreground)"
|
|
333
|
+
}, j = O.map((e) => {
|
|
330
334
|
if (e === u) {
|
|
331
|
-
let t =
|
|
335
|
+
let t = D.filter((e) => k.includes(e.key));
|
|
332
336
|
return {
|
|
333
337
|
key: e,
|
|
334
338
|
name: l("other"),
|
|
335
|
-
values:
|
|
339
|
+
values: w.map((e, n) => t.reduce((e, t) => e + (t.values[n] ?? 0), 0))
|
|
336
340
|
};
|
|
337
341
|
}
|
|
338
|
-
let t =
|
|
342
|
+
let t = D.find((t) => t.key === e);
|
|
339
343
|
return {
|
|
340
344
|
key: e,
|
|
341
345
|
name: i(t),
|
|
342
346
|
values: t.values
|
|
343
347
|
};
|
|
344
|
-
}),
|
|
348
|
+
}), M = E ? [{
|
|
349
|
+
key: S,
|
|
350
|
+
name: i(E),
|
|
351
|
+
values: E.values
|
|
352
|
+
}] : [], N = [...j, ...M], P = w.length, F = w.map((e, t) => j.reduce((e, n) => e + (n.values[t] ?? 0), 0)), I = Math.max(1, ...r ? F : j.flatMap((e) => e.values), ...M.flatMap((e) => e.values)), L = 300 / P, R = (e) => 120 - e / I * 120, z = (e) => d.dateTime(/* @__PURE__ */ new Date(`${w[e]}T00:00:00Z`), {
|
|
345
353
|
month: "short",
|
|
346
354
|
day: "numeric",
|
|
347
355
|
timeZone: "UTC"
|
|
@@ -357,23 +365,23 @@ function M({ workspace: e, data: n, stacked: r, names: i, value: a }) {
|
|
|
357
365
|
viewBox: "0 0 300 134",
|
|
358
366
|
className: "h-40 w-full overflow-visible",
|
|
359
367
|
role: "img",
|
|
360
|
-
"aria-label": l("overTime"),
|
|
368
|
+
"aria-label": l(T ? "overTimeDaily" : "overTime"),
|
|
361
369
|
onPointerMove: (e) => {
|
|
362
370
|
let t = e.currentTarget, n = t.getScreenCTM();
|
|
363
371
|
if (!n) return;
|
|
364
|
-
let r = Math.floor((e.clientX - n.e) / n.a /
|
|
365
|
-
if (r < 0 || r >=
|
|
372
|
+
let r = Math.floor((e.clientX - n.e) / n.a / L);
|
|
373
|
+
if (r < 0 || r >= P) return x(null);
|
|
366
374
|
let i = t.getBoundingClientRect().left;
|
|
367
375
|
x({
|
|
368
376
|
i: r,
|
|
369
|
-
x: n.a * (r + .5) *
|
|
377
|
+
x: n.a * (r + .5) * L + n.e - i
|
|
370
378
|
});
|
|
371
379
|
},
|
|
372
380
|
onPointerLeave: () => x(null),
|
|
373
381
|
children: [
|
|
374
382
|
y && /* @__PURE__ */ _("rect", {
|
|
375
|
-
x: y.i *
|
|
376
|
-
width:
|
|
383
|
+
x: y.i * L,
|
|
384
|
+
width: L,
|
|
377
385
|
y: 0,
|
|
378
386
|
height: 120,
|
|
379
387
|
rx: 3,
|
|
@@ -390,65 +398,70 @@ function M({ workspace: e, data: n, stacked: r, names: i, value: a }) {
|
|
|
390
398
|
x: 0,
|
|
391
399
|
y: 8,
|
|
392
400
|
className: "fill-muted-foreground text-[8px]",
|
|
393
|
-
children: a(
|
|
401
|
+
children: a(I)
|
|
394
402
|
}),
|
|
395
|
-
r ?
|
|
403
|
+
r ? w.map((e, t) => {
|
|
396
404
|
let n = 120;
|
|
397
|
-
return /* @__PURE__ */ _("g", { children:
|
|
398
|
-
let r = (e.values[t] ?? 0) /
|
|
405
|
+
return /* @__PURE__ */ _("g", { children: j.map((e) => {
|
|
406
|
+
let r = (e.values[t] ?? 0) / I * 120;
|
|
399
407
|
return n -= r, /* @__PURE__ */ _("rect", {
|
|
400
|
-
x: t *
|
|
401
|
-
width:
|
|
408
|
+
x: t * L + L * .15,
|
|
409
|
+
width: L * .7,
|
|
402
410
|
y: n,
|
|
403
411
|
height: r,
|
|
404
|
-
fill:
|
|
412
|
+
fill: A[e.key]
|
|
405
413
|
}, e.key);
|
|
406
414
|
}) }, t);
|
|
407
|
-
}) :
|
|
415
|
+
}) : null,
|
|
416
|
+
(r ? M : N).map((e) => /* @__PURE__ */ _("polyline", {
|
|
408
417
|
fill: "none",
|
|
409
|
-
stroke:
|
|
418
|
+
stroke: A[e.key],
|
|
410
419
|
strokeWidth: 2,
|
|
420
|
+
...e.key === S && {
|
|
421
|
+
strokeDasharray: "0 5",
|
|
422
|
+
strokeLinecap: "round"
|
|
423
|
+
},
|
|
411
424
|
vectorEffect: "non-scaling-stroke",
|
|
412
|
-
points: e.values.map((e, t) => `${t *
|
|
425
|
+
points: e.values.map((e, t) => `${t * L + L / 2},${R(e)}`).join(" ")
|
|
413
426
|
}, e.key)),
|
|
414
427
|
[
|
|
415
428
|
0,
|
|
416
|
-
Math.floor((
|
|
417
|
-
|
|
429
|
+
Math.floor((P - 1) / 2),
|
|
430
|
+
P - 1
|
|
418
431
|
].filter((e, t, n) => n.indexOf(e) === t).map((e) => /* @__PURE__ */ _("text", {
|
|
419
|
-
x: e *
|
|
432
|
+
x: e * L + L / 2,
|
|
420
433
|
y: 132,
|
|
421
434
|
textAnchor: "middle",
|
|
422
435
|
className: "fill-muted-foreground text-[8px]",
|
|
423
|
-
children:
|
|
436
|
+
children: z(e)
|
|
424
437
|
}, e))
|
|
425
438
|
]
|
|
426
439
|
}), y && /* @__PURE__ */ _(s, {
|
|
427
440
|
x: y.x,
|
|
428
441
|
children: /* @__PURE__ */ _(c, { ...((e) => ({
|
|
429
|
-
label:
|
|
442
|
+
label: z(e),
|
|
430
443
|
total: !1,
|
|
431
444
|
formatValue: a,
|
|
432
|
-
items:
|
|
445
|
+
items: N.map((t) => ({
|
|
433
446
|
key: t.key,
|
|
434
447
|
name: t.name,
|
|
435
448
|
value: t.values[e] ?? 0,
|
|
436
|
-
color:
|
|
449
|
+
color: A[t.key] ?? ""
|
|
437
450
|
}))
|
|
438
451
|
}))(y.i) })
|
|
439
452
|
})]
|
|
440
|
-
}),
|
|
453
|
+
}), N.length > 1 && /* @__PURE__ */ _(o, { items: N.map((e) => ({
|
|
441
454
|
key: e.key,
|
|
442
455
|
label: e.name,
|
|
443
|
-
color:
|
|
456
|
+
color: A[e.key] ?? ""
|
|
444
457
|
})) })]
|
|
445
458
|
});
|
|
446
459
|
}
|
|
447
|
-
function
|
|
460
|
+
function F(e, t, n) {
|
|
448
461
|
let r = (e) => {
|
|
449
462
|
let t = String(e);
|
|
450
463
|
return /[",\n]/.test(t) ? `"${t.replaceAll("\"", "\"\"")}"` : t;
|
|
451
|
-
}, i = t.series.length > 0 && t.
|
|
464
|
+
}, i = t.series.length > 0 && C(t).length > 0 ? [[n(t.days.length > 0 ? "day" : "week"), ...t.series.map((e) => e.key === S ? n("series.total") : e.name || e.key)], ...C(t).map((e, n) => [e, ...t.series.map((e) => e.values[n] ?? 0)])] : t.issues.length > 0 ? [[
|
|
452
465
|
"identifier",
|
|
453
466
|
"title",
|
|
454
467
|
"status"
|
|
@@ -467,4 +480,4 @@ function N(e, t, n) {
|
|
|
467
480
|
])], a = new Blob([i.map((e) => e.map(r).join(",")).join("\n")], { type: "text/csv" }), o = document.createElement("a");
|
|
468
481
|
o.href = URL.createObjectURL(a), o.download = `${e.replace(/[^\w.-]+/g, "-")}.csv`, o.click(), URL.revokeObjectURL(o.href);
|
|
469
482
|
}
|
|
470
|
-
export {
|
|
483
|
+
export { D as DashboardPanel, k as PanelChart, b as issuesSearch, T as sharingItems, E as sharingOf, w as starterPanels };
|
|
@@ -66,7 +66,7 @@ function w(e) {
|
|
|
66
66
|
let t = S.flatMap((t) => (e[t] ?? []).map((e) => `${t}:${e}`));
|
|
67
67
|
return t.length > 0 ? t.join(",") : void 0;
|
|
68
68
|
}
|
|
69
|
-
var T = (e) => Object.values(e).reduce((e, t) => e + t.length, 0), E = (e) => e
|
|
69
|
+
var T = (e) => Object.values(e).reduce((e, t) => e + t.length, 0), E = (e) => e !== "cycles";
|
|
70
70
|
function D(e, t, n) {
|
|
71
71
|
let r = e[t] ?? [], i = r.includes(n) ? r.filter((e) => e !== n) : E(t) ? [...r, n] : [n], { [t]: a, ...o } = e;
|
|
72
72
|
return i.length > 0 ? {
|