react-semaphor 0.1.176 → 0.1.178
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/chunks/dashboard-controls-00cjSeD7.js +42 -0
- package/dist/chunks/dashboard-controls-C9IWIFfW.js +1624 -0
- package/dist/chunks/{dashboard-json-BnCOeWny.js → dashboard-json--ke9XK9p.js} +1 -1
- package/dist/chunks/{dashboard-json-CY8Vbmi5.js → dashboard-json-BDjl-3ej.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BXBPQpCA.js → edit-dashboard-visual-BBsC9feJ.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-BX-hJR3k.js → edit-dashboard-visual-BroCdmtP.js} +1 -1
- package/dist/chunks/{editor-action-buttons-DUp8ZHiE.js → editor-action-buttons-CHoiNw7F.js} +2 -2
- package/dist/chunks/{editor-action-buttons-B-m2BOfh.js → editor-action-buttons-JE9t84-4.js} +1 -1
- package/dist/chunks/{index-D9Vg4Ioz.js → index-CdfFCbJb.js} +194 -225
- package/dist/chunks/{index-Cskof6E0.js → index-DZjcALSv.js} +16075 -16385
- package/dist/chunks/{resource-management-panel-DxRvAR5Q.js → resource-management-panel-C96ElLa5.js} +1 -1
- package/dist/chunks/{resource-management-panel-N2ZpMRwr.js → resource-management-panel-DE8DnPSl.js} +3 -3
- package/dist/chunks/{schedule-dashboard-Cd9H79qL.js → schedule-dashboard-BFa0Uljc.js} +3 -3
- package/dist/chunks/{schedule-dashboard-CmpnXuyb.js → schedule-dashboard-CzU0ziLB.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-0BX-GN_0.js → use-role-aware-display-preferences-Dovp_VmV.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-Cl52AceY.js → use-role-aware-display-preferences-Rd1BhDG4.js} +1 -1
- package/dist/chunks/{use-visual-utils-DsrKjvLV.js → use-visual-utils-BkRr5LoD.js} +1 -1
- package/dist/chunks/{use-visual-utils-Czmg35Mw.js → use-visual-utils-Cnju2tnE.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/main.d.ts +6 -3
- package/package.json +2 -2
- package/dist/chunks/dashboard-controls-BtrmT5hV.js +0 -1509
- package/dist/chunks/dashboard-controls-DR6ruxzW.js +0 -26
|
@@ -1,1509 +0,0 @@
|
|
|
1
|
-
import { jsxs as r, jsx as e, Fragment as E } from "react/jsx-runtime";
|
|
2
|
-
import { l as W, bE as qs, bF as zs, u as y, aS as Je, aT as We, B as L, aV as Xe, aW as ve, bG as ke, o as Ye, aA as U, aF as Le, bH as js, bc as Ae, aG as Ie, aH as Te, aI as Ee, aJ as Ze, aK as Ne, bI as J, aO as Vs, K as $, bJ as Hs, bg as Qs, bK as Ks, bL as He, bM as es, c as ie, bN as ss, p as le, bO as ce, t as k, bP as as, aM as Bs, bQ as Js, L as q, bf as z, bR as Ws, bS as Xs, bT as ye, bU as Ys, bV as Zs, bW as ts, bX as rs, bY as ne, bZ as oe, bB as xe, bm as we, b_ as Ce, bh as ns, b$ as Se, aN as os, e as is, c0 as ea, a_ as ls, a$ as cs, b0 as ds, b2 as us, b3 as ms, b4 as hs, b5 as ps, b6 as De, c1 as sa, ba as aa, c2 as ta, T as ra, n as Qe, R as te, c3 as na, $ as oa, V as be, c4 as ia, c5 as la, c6 as ca, c7 as da, bd as ua, a6 as ma, c8 as ha, c9 as pa, ca as ga, cb as fa, cc as va, _ as ba, a5 as Na } from "./index-Cskof6E0.js";
|
|
3
|
-
import * as M from "react";
|
|
4
|
-
import { useState as b, useMemo as re, useEffect as ya } from "react";
|
|
5
|
-
import "react-dom";
|
|
6
|
-
import { u as xa, A as wa, V as Ca, S as Sa, U as Da } from "./schedule-dashboard-Cd9H79qL.js";
|
|
7
|
-
import { u as Ma } from "./use-role-aware-display-preferences-0BX-GN_0.js";
|
|
8
|
-
import { S as Ke } from "./editor-action-buttons-DUp8ZHiE.js";
|
|
9
|
-
/**
|
|
10
|
-
* @license lucide-react v0.453.0 - ISC
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the ISC license.
|
|
13
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/
|
|
15
|
-
const ka = W("Glasses", [
|
|
16
|
-
["circle", { cx: "6", cy: "15", r: "4", key: "vux9w4" }],
|
|
17
|
-
["circle", { cx: "18", cy: "15", r: "4", key: "18o8ve" }],
|
|
18
|
-
["path", { d: "M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2", key: "1ag4bs" }],
|
|
19
|
-
["path", { d: "M2.5 13 5 7c.7-1.3 1.4-2 3-2", key: "1hm1gs" }],
|
|
20
|
-
["path", { d: "M21.5 13 19 7c-.7-1.3-1.5-2-3-2", key: "1r31ai" }]
|
|
21
|
-
]);
|
|
22
|
-
/**
|
|
23
|
-
* @license lucide-react v0.453.0 - ISC
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the ISC license.
|
|
26
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/
|
|
28
|
-
const La = W("Menu", [
|
|
29
|
-
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
|
|
30
|
-
["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
|
|
31
|
-
["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
|
|
32
|
-
]);
|
|
33
|
-
/**
|
|
34
|
-
* @license lucide-react v0.453.0 - ISC
|
|
35
|
-
*
|
|
36
|
-
* This source code is licensed under the ISC license.
|
|
37
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
38
|
-
*/
|
|
39
|
-
const Aa = W("Moon", [
|
|
40
|
-
["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
|
|
41
|
-
]);
|
|
42
|
-
/**
|
|
43
|
-
* @license lucide-react v0.453.0 - ISC
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the ISC license.
|
|
46
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/
|
|
48
|
-
const Ia = W("ShieldX", [
|
|
49
|
-
[
|
|
50
|
-
"path",
|
|
51
|
-
{
|
|
52
|
-
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
53
|
-
key: "oel41y"
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
["path", { d: "m14.5 9.5-5 5", key: "17q4r4" }],
|
|
57
|
-
["path", { d: "m9.5 9.5 5 5", key: "18nt4w" }]
|
|
58
|
-
]);
|
|
59
|
-
/**
|
|
60
|
-
* @license lucide-react v0.453.0 - ISC
|
|
61
|
-
*
|
|
62
|
-
* This source code is licensed under the ISC license.
|
|
63
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
64
|
-
*/
|
|
65
|
-
const Ta = W("Sun", [
|
|
66
|
-
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
|
|
67
|
-
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
68
|
-
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
69
|
-
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
|
|
70
|
-
["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
|
|
71
|
-
["path", { d: "M2 12h2", key: "1t8f8n" }],
|
|
72
|
-
["path", { d: "M20 12h2", key: "1q8mjw" }],
|
|
73
|
-
["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
|
|
74
|
-
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
|
|
75
|
-
]);
|
|
76
|
-
var Ea = qs();
|
|
77
|
-
function Pa() {
|
|
78
|
-
const { setTheme: s } = zs(), n = y(
|
|
79
|
-
(a) => a.actions.setDashboardTheme
|
|
80
|
-
);
|
|
81
|
-
return /* @__PURE__ */ r(Je, { children: [
|
|
82
|
-
/* @__PURE__ */ e(We, { asChild: !0, children: /* @__PURE__ */ r(L, { className: "h-7 p-2", variant: "ghost", size: "sm", children: [
|
|
83
|
-
/* @__PURE__ */ e(
|
|
84
|
-
Ta,
|
|
85
|
-
{
|
|
86
|
-
strokeWidth: 1.5,
|
|
87
|
-
className: "h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"
|
|
88
|
-
}
|
|
89
|
-
),
|
|
90
|
-
/* @__PURE__ */ e(
|
|
91
|
-
Aa,
|
|
92
|
-
{
|
|
93
|
-
strokeWidth: 1.5,
|
|
94
|
-
className: "absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
/* @__PURE__ */ e("span", { className: "sr-only", children: "Toggle theme" })
|
|
98
|
-
] }) }),
|
|
99
|
-
/* @__PURE__ */ r(Xe, { align: "end", children: [
|
|
100
|
-
/* @__PURE__ */ e(
|
|
101
|
-
ve,
|
|
102
|
-
{
|
|
103
|
-
onClick: () => {
|
|
104
|
-
s("light"), n("light");
|
|
105
|
-
},
|
|
106
|
-
children: "Light"
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
/* @__PURE__ */ e(
|
|
110
|
-
ve,
|
|
111
|
-
{
|
|
112
|
-
onClick: () => {
|
|
113
|
-
s("dark"), n("dark");
|
|
114
|
-
},
|
|
115
|
-
children: "Dark"
|
|
116
|
-
}
|
|
117
|
-
),
|
|
118
|
-
/* @__PURE__ */ e(
|
|
119
|
-
ve,
|
|
120
|
-
{
|
|
121
|
-
onClick: () => {
|
|
122
|
-
s("system"), n("system");
|
|
123
|
-
},
|
|
124
|
-
children: "System"
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
] })
|
|
128
|
-
] });
|
|
129
|
-
}
|
|
130
|
-
async function Ga(s, n, a, t, l) {
|
|
131
|
-
if (!l)
|
|
132
|
-
return null;
|
|
133
|
-
const i = JSON.stringify(a), c = `${s}/v1/lens`;
|
|
134
|
-
return await ke(c, l, {
|
|
135
|
-
name: n,
|
|
136
|
-
template: i,
|
|
137
|
-
filterValues: t,
|
|
138
|
-
operation: "create"
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
async function Me(s, n, a) {
|
|
142
|
-
if (!a)
|
|
143
|
-
return null;
|
|
144
|
-
const { id: t, template: l, filterValues: i, isDefault: c, shared: u } = n, p = `${s}/v1/lens`;
|
|
145
|
-
return await ke(p, a, {
|
|
146
|
-
lensId: t,
|
|
147
|
-
template: l,
|
|
148
|
-
filterValues: i,
|
|
149
|
-
isDefault: c,
|
|
150
|
-
shared: u,
|
|
151
|
-
operation: "update"
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
async function Fa(s, n, a) {
|
|
155
|
-
if (!a)
|
|
156
|
-
return null;
|
|
157
|
-
const t = `${s}/v1/lens`;
|
|
158
|
-
return await ke(t, a, {
|
|
159
|
-
operation: "delete",
|
|
160
|
-
lensId: n
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
function Oa() {
|
|
164
|
-
const [s, n] = b(""), [a, t] = b(!1), l = y((C) => C.lenses), { setLenses: i, setSelectedLensId: c } = Ye(), [u, p] = b(!1), [f, d] = b(!1), m = y((C) => C.dashboard), g = y((C) => C.filterValues), { authToken: v, tokenProps: N } = U();
|
|
165
|
-
async function x() {
|
|
166
|
-
p(!0);
|
|
167
|
-
const C = await Ga(
|
|
168
|
-
N.apiServiceUrl,
|
|
169
|
-
s,
|
|
170
|
-
m,
|
|
171
|
-
g,
|
|
172
|
-
v == null ? void 0 : v.accessToken
|
|
173
|
-
);
|
|
174
|
-
C && (i([...l || [], C]), c(C.id), d(!1)), p(!1);
|
|
175
|
-
}
|
|
176
|
-
return /* @__PURE__ */ r(Le, { open: f, onOpenChange: d, children: [
|
|
177
|
-
/* @__PURE__ */ e(js, { asChild: !0, children: /* @__PURE__ */ r(
|
|
178
|
-
L,
|
|
179
|
-
{
|
|
180
|
-
variant: "secondary",
|
|
181
|
-
className: "h-7 p-2",
|
|
182
|
-
size: "sm",
|
|
183
|
-
children: [
|
|
184
|
-
/* @__PURE__ */ e(Ae, { className: "mr-2 h-4 w-4" }),
|
|
185
|
-
"Lens"
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
) }),
|
|
189
|
-
/* @__PURE__ */ r(Ie, { className: "sm:max-w-[425px]", children: [
|
|
190
|
-
/* @__PURE__ */ r(Te, { children: [
|
|
191
|
-
/* @__PURE__ */ e(Ee, { children: "Create Lens" }),
|
|
192
|
-
/* @__PURE__ */ e(Ze, { children: "Lenses are private by default and are only visible to you." })
|
|
193
|
-
] }),
|
|
194
|
-
/* @__PURE__ */ e("div", { className: "grid gap-4 py-4", children: /* @__PURE__ */ r("div", { className: "grid grid-cols-8 items-center gap-4", children: [
|
|
195
|
-
/* @__PURE__ */ e(Ne, { className: "text-right", children: "Name" }),
|
|
196
|
-
/* @__PURE__ */ e(
|
|
197
|
-
J,
|
|
198
|
-
{
|
|
199
|
-
value: s,
|
|
200
|
-
onChange: (C) => {
|
|
201
|
-
n(C.target.value);
|
|
202
|
-
},
|
|
203
|
-
id: "name",
|
|
204
|
-
className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
|
|
205
|
-
}
|
|
206
|
-
)
|
|
207
|
-
] }) }),
|
|
208
|
-
a && /* @__PURE__ */ e("p", { className: "text-sm", children: "The lens name already exists. Use a differnet name." }),
|
|
209
|
-
/* @__PURE__ */ e(Vs, { children: /* @__PURE__ */ e(
|
|
210
|
-
L,
|
|
211
|
-
{
|
|
212
|
-
size: "sm",
|
|
213
|
-
variant: "outline",
|
|
214
|
-
type: "submit",
|
|
215
|
-
onClick: x,
|
|
216
|
-
disabled: u,
|
|
217
|
-
children: u ? "Creating..." : "Add"
|
|
218
|
-
}
|
|
219
|
-
) })
|
|
220
|
-
] })
|
|
221
|
-
] });
|
|
222
|
-
}
|
|
223
|
-
function Ra() {
|
|
224
|
-
const [s, n] = b(!1), a = y((m) => m.lenses), t = y((m) => m.selectedLensId), { setLenses: l, setSelectedLensId: i } = Ye(), { authToken: c, tokenProps: u } = U();
|
|
225
|
-
async function p(m) {
|
|
226
|
-
i(m);
|
|
227
|
-
}
|
|
228
|
-
async function f(m) {
|
|
229
|
-
if (await Fa(u.apiServiceUrl, m, c == null ? void 0 : c.accessToken)) {
|
|
230
|
-
const v = a == null ? void 0 : a.filter((N) => N.id !== m);
|
|
231
|
-
l(v || []), i("original");
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
async function d(m) {
|
|
235
|
-
const g = a == null ? void 0 : a.map((x) => x.id === m.id ? {
|
|
236
|
-
...x,
|
|
237
|
-
isDefault: !m.isDefault
|
|
238
|
-
} : {
|
|
239
|
-
...x,
|
|
240
|
-
isDefault: !1
|
|
241
|
-
});
|
|
242
|
-
l(g || []);
|
|
243
|
-
const v = {
|
|
244
|
-
...m,
|
|
245
|
-
isDefault: !m.isDefault
|
|
246
|
-
};
|
|
247
|
-
await Me(u.apiServiceUrl, v, c == null ? void 0 : c.accessToken);
|
|
248
|
-
const N = a == null ? void 0 : a.find((x) => x.isDefault);
|
|
249
|
-
if (N && N.id !== m.id) {
|
|
250
|
-
const x = {
|
|
251
|
-
...N,
|
|
252
|
-
isDefault: !1
|
|
253
|
-
};
|
|
254
|
-
await Me(u.apiServiceUrl, x, c == null ? void 0 : c.accessToken);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return /* @__PURE__ */ r(Je, { open: s, onOpenChange: n, children: [
|
|
258
|
-
/* @__PURE__ */ e(We, { asChild: !0, children: /* @__PURE__ */ e($, { tooltip: "Lenses", className: "h-7 p-2", children: /* @__PURE__ */ e(ka, { className: "h-4 w-4" }) }) }),
|
|
259
|
-
/* @__PURE__ */ r(Xe, { align: "end", className: "w-60", children: [
|
|
260
|
-
/* @__PURE__ */ e(Hs, { className: "px-3", children: "Lenses" }),
|
|
261
|
-
/* @__PURE__ */ e(Qs, {}),
|
|
262
|
-
/* @__PURE__ */ r(
|
|
263
|
-
Ks,
|
|
264
|
-
{
|
|
265
|
-
value: t,
|
|
266
|
-
onValueChange: p,
|
|
267
|
-
children: [
|
|
268
|
-
/* @__PURE__ */ e(He, { value: "original", children: "Original" }),
|
|
269
|
-
a == null ? void 0 : a.map((m) => /* @__PURE__ */ r(
|
|
270
|
-
He,
|
|
271
|
-
{
|
|
272
|
-
className: "group flex justify-between gap-2",
|
|
273
|
-
value: m.id,
|
|
274
|
-
children: [
|
|
275
|
-
/* @__PURE__ */ e("p", { children: m.name }),
|
|
276
|
-
/* @__PURE__ */ r("span", { className: "flex items-center gap-3", children: [
|
|
277
|
-
/* @__PURE__ */ e(
|
|
278
|
-
es,
|
|
279
|
-
{
|
|
280
|
-
onClick: (g) => {
|
|
281
|
-
g.preventDefault(), d(m);
|
|
282
|
-
},
|
|
283
|
-
className: ie(
|
|
284
|
-
"size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
285
|
-
{
|
|
286
|
-
invisible: !m.isDefault,
|
|
287
|
-
"text-green-500": m.isDefault
|
|
288
|
-
}
|
|
289
|
-
),
|
|
290
|
-
strokeWidth: 1.5
|
|
291
|
-
}
|
|
292
|
-
),
|
|
293
|
-
/* @__PURE__ */ e(
|
|
294
|
-
ss,
|
|
295
|
-
{
|
|
296
|
-
onClick: (g) => {
|
|
297
|
-
g.preventDefault(), f(m.id);
|
|
298
|
-
},
|
|
299
|
-
className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
300
|
-
strokeWidth: 1.5
|
|
301
|
-
}
|
|
302
|
-
)
|
|
303
|
-
] })
|
|
304
|
-
]
|
|
305
|
-
},
|
|
306
|
-
m.id
|
|
307
|
-
))
|
|
308
|
-
]
|
|
309
|
-
}
|
|
310
|
-
)
|
|
311
|
-
] })
|
|
312
|
-
] });
|
|
313
|
-
}
|
|
314
|
-
const Ua = async (s, n, a) => {
|
|
315
|
-
const t = `${s}/management/v1/groups`;
|
|
316
|
-
return await as(t, n, a);
|
|
317
|
-
}, _a = async (s, n, a) => {
|
|
318
|
-
const t = `${s}/management/v1/groups/${a}`, l = await fetch(t, {
|
|
319
|
-
method: "DELETE",
|
|
320
|
-
headers: {
|
|
321
|
-
Authorization: `Bearer ${n}`
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
if (!l.ok) {
|
|
325
|
-
const i = await l.text();
|
|
326
|
-
throw new Error(i || "Failed to delete group");
|
|
327
|
-
}
|
|
328
|
-
}, $a = async (s, n, a, t) => {
|
|
329
|
-
const l = `${s}/management/v1/groups/${a}/members`;
|
|
330
|
-
return await as(l, n, t);
|
|
331
|
-
}, qa = async (s, n, a, t) => {
|
|
332
|
-
const l = `${s}/management/v1/groups/${a}/members`, i = await fetch(l, {
|
|
333
|
-
method: "DELETE",
|
|
334
|
-
headers: {
|
|
335
|
-
"Content-Type": "application/json",
|
|
336
|
-
Authorization: `Bearer ${n}`
|
|
337
|
-
},
|
|
338
|
-
body: JSON.stringify(t)
|
|
339
|
-
});
|
|
340
|
-
if (!i.ok) {
|
|
341
|
-
const c = await i.text();
|
|
342
|
-
throw new Error(c || "Failed to remove group members");
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
function za() {
|
|
346
|
-
const { authToken: s, tokenProps: n } = U(), a = le();
|
|
347
|
-
return ce({
|
|
348
|
-
mutationFn: (t) => Ua(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t),
|
|
349
|
-
onSuccess: () => {
|
|
350
|
-
a.invalidateQueries({ queryKey: ["groups"] }), k.success("Group created successfully");
|
|
351
|
-
},
|
|
352
|
-
onError: (t) => {
|
|
353
|
-
console.error("Failed to create group:", t), k.error("Failed to create group", {
|
|
354
|
-
description: t.message
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
function ja() {
|
|
360
|
-
const { authToken: s, tokenProps: n } = U(), a = le();
|
|
361
|
-
return ce({
|
|
362
|
-
mutationFn: (t) => _a(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t),
|
|
363
|
-
onSuccess: (t, l) => {
|
|
364
|
-
a.invalidateQueries({ queryKey: ["groups"] }), a.removeQueries({ queryKey: ["group", l] }), k.success("Group deleted successfully");
|
|
365
|
-
},
|
|
366
|
-
onError: (t) => {
|
|
367
|
-
console.error("Failed to delete group:", t), k.error("Failed to delete group", {
|
|
368
|
-
description: t.message
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
function Va() {
|
|
374
|
-
const { authToken: s, tokenProps: n } = U(), a = le();
|
|
375
|
-
return ce({
|
|
376
|
-
mutationFn: ({
|
|
377
|
-
groupId: t,
|
|
378
|
-
data: l
|
|
379
|
-
}) => $a(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t, l),
|
|
380
|
-
onSuccess: (t, l) => {
|
|
381
|
-
a.invalidateQueries({ queryKey: ["group", l.groupId] }), a.invalidateQueries({
|
|
382
|
-
queryKey: ["group-members", l.groupId]
|
|
383
|
-
}), a.invalidateQueries({ queryKey: ["groups"] }), k.success("Members added successfully");
|
|
384
|
-
},
|
|
385
|
-
onError: (t) => {
|
|
386
|
-
console.error("Failed to add group members:", t), k.error("Failed to add members", {
|
|
387
|
-
description: t.message
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
function Ha() {
|
|
393
|
-
const { authToken: s, tokenProps: n } = U(), a = le();
|
|
394
|
-
return ce({
|
|
395
|
-
mutationFn: ({
|
|
396
|
-
groupId: t,
|
|
397
|
-
data: l
|
|
398
|
-
}) => qa(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t, l),
|
|
399
|
-
onSuccess: (t, l) => {
|
|
400
|
-
a.invalidateQueries({ queryKey: ["group", l.groupId] }), a.invalidateQueries({
|
|
401
|
-
queryKey: ["group-members", l.groupId]
|
|
402
|
-
}), a.invalidateQueries({ queryKey: ["groups"] }), k.success("Members removed successfully");
|
|
403
|
-
},
|
|
404
|
-
onError: (t) => {
|
|
405
|
-
console.error("Failed to remove group members:", t), k.error("Failed to remove members", {
|
|
406
|
-
description: t.message
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
function Qa({
|
|
412
|
-
onSuccess: s,
|
|
413
|
-
tenantId: n,
|
|
414
|
-
isTenantUser: a
|
|
415
|
-
}) {
|
|
416
|
-
const [t, l] = b(""), [i, c] = b(""), [u, p] = b({}), f = za(), d = () => {
|
|
417
|
-
const g = {};
|
|
418
|
-
return t.trim() ? t.length < 3 ? g.name = "Group name must be at least 3 characters" : t.length > 50 && (g.name = "Group name must be less than 50 characters") : g.name = "Group name is required", i && i.length > 200 && (g.description = "Description must be less than 200 characters"), p(g), Object.keys(g).length === 0;
|
|
419
|
-
};
|
|
420
|
-
return /* @__PURE__ */ r("form", { onSubmit: async (g) => {
|
|
421
|
-
if (g.preventDefault(), !d()) return;
|
|
422
|
-
const v = {
|
|
423
|
-
name: t.trim(),
|
|
424
|
-
description: i.trim() || void 0,
|
|
425
|
-
type: a ? "TENANT_GROUP" : "ORG_GROUP",
|
|
426
|
-
...a && n ? { tenantId: n } : {}
|
|
427
|
-
};
|
|
428
|
-
try {
|
|
429
|
-
await f.mutateAsync(v), l(""), c(""), p({}), s();
|
|
430
|
-
} catch (N) {
|
|
431
|
-
console.error("Failed to create group:", N);
|
|
432
|
-
}
|
|
433
|
-
}, className: "space-y-6", children: [
|
|
434
|
-
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
435
|
-
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
436
|
-
/* @__PURE__ */ r(Ne, { htmlFor: "group-name", children: [
|
|
437
|
-
"Group Name ",
|
|
438
|
-
/* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
439
|
-
] }),
|
|
440
|
-
/* @__PURE__ */ e(
|
|
441
|
-
J,
|
|
442
|
-
{
|
|
443
|
-
id: "group-name",
|
|
444
|
-
placeholder: "e.g., Marketing Team, Engineering Squad",
|
|
445
|
-
value: t,
|
|
446
|
-
onChange: (g) => {
|
|
447
|
-
l(g.target.value), u.name && p((v) => ({ ...v, name: "" }));
|
|
448
|
-
},
|
|
449
|
-
className: u.name ? "border-destructive" : "",
|
|
450
|
-
disabled: f.isPending
|
|
451
|
-
}
|
|
452
|
-
),
|
|
453
|
-
u.name && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: u.name })
|
|
454
|
-
] }),
|
|
455
|
-
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
456
|
-
/* @__PURE__ */ r(Ne, { htmlFor: "group-description", children: [
|
|
457
|
-
"Description",
|
|
458
|
-
/* @__PURE__ */ e("span", { className: "ml-2 text-xs text-muted-foreground", children: "(optional)" })
|
|
459
|
-
] }),
|
|
460
|
-
/* @__PURE__ */ e(
|
|
461
|
-
Bs,
|
|
462
|
-
{
|
|
463
|
-
id: "group-description",
|
|
464
|
-
placeholder: "Describe the purpose of this group...",
|
|
465
|
-
value: i,
|
|
466
|
-
onChange: (g) => {
|
|
467
|
-
c(g.target.value), u.description && p((v) => ({ ...v, description: "" }));
|
|
468
|
-
},
|
|
469
|
-
className: u.description ? "border-destructive" : "",
|
|
470
|
-
disabled: f.isPending,
|
|
471
|
-
rows: 3
|
|
472
|
-
}
|
|
473
|
-
),
|
|
474
|
-
u.description && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: u.description }),
|
|
475
|
-
/* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground", children: [
|
|
476
|
-
i.length,
|
|
477
|
-
"/200 characters"
|
|
478
|
-
] })
|
|
479
|
-
] }),
|
|
480
|
-
/* @__PURE__ */ e("div", { className: "rounded-lg border bg-muted/50 p-4", children: /* @__PURE__ */ r("div", { className: "flex gap-3", children: [
|
|
481
|
-
/* @__PURE__ */ e(Js, { className: "h-4 w-4 mt-0.5 text-muted-foreground" }),
|
|
482
|
-
/* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground", children: "This group will be accessible to users in your workspace. You can add members after creating the group." })
|
|
483
|
-
] }) })
|
|
484
|
-
] }),
|
|
485
|
-
/* @__PURE__ */ r("div", { className: "flex justify-end gap-3", children: [
|
|
486
|
-
/* @__PURE__ */ e(
|
|
487
|
-
L,
|
|
488
|
-
{
|
|
489
|
-
type: "button",
|
|
490
|
-
variant: "outline",
|
|
491
|
-
onClick: () => {
|
|
492
|
-
l(""), c(""), p({});
|
|
493
|
-
},
|
|
494
|
-
disabled: f.isPending,
|
|
495
|
-
children: "Clear"
|
|
496
|
-
}
|
|
497
|
-
),
|
|
498
|
-
/* @__PURE__ */ e(
|
|
499
|
-
L,
|
|
500
|
-
{
|
|
501
|
-
type: "submit",
|
|
502
|
-
disabled: f.isPending || !t.trim(),
|
|
503
|
-
children: f.isPending ? /* @__PURE__ */ r(E, { children: [
|
|
504
|
-
/* @__PURE__ */ e(q, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
505
|
-
"Creating..."
|
|
506
|
-
] }) : /* @__PURE__ */ r(E, { children: [
|
|
507
|
-
/* @__PURE__ */ e(z, { className: "mr-2 h-4 w-4" }),
|
|
508
|
-
"Create Group"
|
|
509
|
-
] })
|
|
510
|
-
}
|
|
511
|
-
)
|
|
512
|
-
] })
|
|
513
|
-
] });
|
|
514
|
-
}
|
|
515
|
-
function Ka(s, n = []) {
|
|
516
|
-
let a = [];
|
|
517
|
-
function t(i, c) {
|
|
518
|
-
const u = M.createContext(c);
|
|
519
|
-
u.displayName = i + "Context";
|
|
520
|
-
const p = a.length;
|
|
521
|
-
a = [...a, c];
|
|
522
|
-
const f = (m) => {
|
|
523
|
-
var O;
|
|
524
|
-
const { scope: g, children: v, ...N } = m, x = ((O = g == null ? void 0 : g[s]) == null ? void 0 : O[p]) || u, C = M.useMemo(() => N, Object.values(N));
|
|
525
|
-
return /* @__PURE__ */ e(x.Provider, { value: C, children: v });
|
|
526
|
-
};
|
|
527
|
-
f.displayName = i + "Provider";
|
|
528
|
-
function d(m, g) {
|
|
529
|
-
var x;
|
|
530
|
-
const v = ((x = g == null ? void 0 : g[s]) == null ? void 0 : x[p]) || u, N = M.useContext(v);
|
|
531
|
-
if (N) return N;
|
|
532
|
-
if (c !== void 0) return c;
|
|
533
|
-
throw new Error(`\`${m}\` must be used within \`${i}\``);
|
|
534
|
-
}
|
|
535
|
-
return [f, d];
|
|
536
|
-
}
|
|
537
|
-
const l = () => {
|
|
538
|
-
const i = a.map((c) => M.createContext(c));
|
|
539
|
-
return function(u) {
|
|
540
|
-
const p = (u == null ? void 0 : u[s]) || i;
|
|
541
|
-
return M.useMemo(
|
|
542
|
-
() => ({ [`__scope${s}`]: { ...u, [s]: p } }),
|
|
543
|
-
[u, p]
|
|
544
|
-
);
|
|
545
|
-
};
|
|
546
|
-
};
|
|
547
|
-
return l.scopeName = s, [t, Ba(l, ...n)];
|
|
548
|
-
}
|
|
549
|
-
function Ba(...s) {
|
|
550
|
-
const n = s[0];
|
|
551
|
-
if (s.length === 1) return n;
|
|
552
|
-
const a = () => {
|
|
553
|
-
const t = s.map((l) => ({
|
|
554
|
-
useScope: l(),
|
|
555
|
-
scopeName: l.scopeName
|
|
556
|
-
}));
|
|
557
|
-
return function(i) {
|
|
558
|
-
const c = t.reduce((u, { useScope: p, scopeName: f }) => {
|
|
559
|
-
const m = p(i)[`__scope${f}`];
|
|
560
|
-
return { ...u, ...m };
|
|
561
|
-
}, {});
|
|
562
|
-
return M.useMemo(() => ({ [`__scope${n.scopeName}`]: c }), [c]);
|
|
563
|
-
};
|
|
564
|
-
};
|
|
565
|
-
return a.scopeName = n.scopeName, a;
|
|
566
|
-
}
|
|
567
|
-
var Ja = [
|
|
568
|
-
"a",
|
|
569
|
-
"button",
|
|
570
|
-
"div",
|
|
571
|
-
"form",
|
|
572
|
-
"h2",
|
|
573
|
-
"h3",
|
|
574
|
-
"img",
|
|
575
|
-
"input",
|
|
576
|
-
"label",
|
|
577
|
-
"li",
|
|
578
|
-
"nav",
|
|
579
|
-
"ol",
|
|
580
|
-
"p",
|
|
581
|
-
"select",
|
|
582
|
-
"span",
|
|
583
|
-
"svg",
|
|
584
|
-
"ul"
|
|
585
|
-
], Pe = Ja.reduce((s, n) => {
|
|
586
|
-
const a = Ws(`Primitive.${n}`), t = M.forwardRef((l, i) => {
|
|
587
|
-
const { asChild: c, ...u } = l, p = c ? a : n;
|
|
588
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ e(p, { ...u, ref: i });
|
|
589
|
-
});
|
|
590
|
-
return t.displayName = `Primitive.${n}`, { ...s, [n]: t };
|
|
591
|
-
}, {});
|
|
592
|
-
function Wa() {
|
|
593
|
-
return Ea.useSyncExternalStore(
|
|
594
|
-
Xa,
|
|
595
|
-
() => !0,
|
|
596
|
-
() => !1
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
function Xa() {
|
|
600
|
-
return () => {
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
var Ge = "Avatar", [Ya] = Ka(Ge), [Za, gs] = Ya(Ge), fs = M.forwardRef(
|
|
604
|
-
(s, n) => {
|
|
605
|
-
const { __scopeAvatar: a, ...t } = s, [l, i] = M.useState("idle");
|
|
606
|
-
return /* @__PURE__ */ e(
|
|
607
|
-
Za,
|
|
608
|
-
{
|
|
609
|
-
scope: a,
|
|
610
|
-
imageLoadingStatus: l,
|
|
611
|
-
onImageLoadingStatusChange: i,
|
|
612
|
-
children: /* @__PURE__ */ e(Pe.span, { ...t, ref: n })
|
|
613
|
-
}
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
|
-
);
|
|
617
|
-
fs.displayName = Ge;
|
|
618
|
-
var vs = "AvatarImage", bs = M.forwardRef(
|
|
619
|
-
(s, n) => {
|
|
620
|
-
const { __scopeAvatar: a, src: t, onLoadingStatusChange: l = () => {
|
|
621
|
-
}, ...i } = s, c = gs(vs, a), u = et(t, i), p = Xs((f) => {
|
|
622
|
-
l(f), c.onImageLoadingStatusChange(f);
|
|
623
|
-
});
|
|
624
|
-
return ye(() => {
|
|
625
|
-
u !== "idle" && p(u);
|
|
626
|
-
}, [u, p]), u === "loaded" ? /* @__PURE__ */ e(Pe.img, { ...i, ref: n, src: t }) : null;
|
|
627
|
-
}
|
|
628
|
-
);
|
|
629
|
-
bs.displayName = vs;
|
|
630
|
-
var Ns = "AvatarFallback", ys = M.forwardRef(
|
|
631
|
-
(s, n) => {
|
|
632
|
-
const { __scopeAvatar: a, delayMs: t, ...l } = s, i = gs(Ns, a), [c, u] = M.useState(t === void 0);
|
|
633
|
-
return M.useEffect(() => {
|
|
634
|
-
if (t !== void 0) {
|
|
635
|
-
const p = window.setTimeout(() => u(!0), t);
|
|
636
|
-
return () => window.clearTimeout(p);
|
|
637
|
-
}
|
|
638
|
-
}, [t]), c && i.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ e(Pe.span, { ...l, ref: n }) : null;
|
|
639
|
-
}
|
|
640
|
-
);
|
|
641
|
-
ys.displayName = Ns;
|
|
642
|
-
function Be(s, n) {
|
|
643
|
-
return s ? n ? (s.src !== n && (s.src = n), s.complete && s.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
|
|
644
|
-
}
|
|
645
|
-
function et(s, { referrerPolicy: n, crossOrigin: a }) {
|
|
646
|
-
const t = Wa(), l = M.useRef(null), i = t ? (l.current || (l.current = new window.Image()), l.current) : null, [c, u] = M.useState(
|
|
647
|
-
() => Be(i, s)
|
|
648
|
-
);
|
|
649
|
-
return ye(() => {
|
|
650
|
-
u(Be(i, s));
|
|
651
|
-
}, [i, s]), ye(() => {
|
|
652
|
-
const p = (m) => () => {
|
|
653
|
-
u(m);
|
|
654
|
-
};
|
|
655
|
-
if (!i) return;
|
|
656
|
-
const f = p("loaded"), d = p("error");
|
|
657
|
-
return i.addEventListener("load", f), i.addEventListener("error", d), n && (i.referrerPolicy = n), typeof a == "string" && (i.crossOrigin = a), () => {
|
|
658
|
-
i.removeEventListener("load", f), i.removeEventListener("error", d);
|
|
659
|
-
};
|
|
660
|
-
}, [i, a, n]), c;
|
|
661
|
-
}
|
|
662
|
-
var xs = fs, ws = bs, Cs = ys;
|
|
663
|
-
const Fe = M.forwardRef(({ className: s, ...n }, a) => /* @__PURE__ */ e(
|
|
664
|
-
xs,
|
|
665
|
-
{
|
|
666
|
-
ref: a,
|
|
667
|
-
className: ie(
|
|
668
|
-
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
669
|
-
s
|
|
670
|
-
),
|
|
671
|
-
...n
|
|
672
|
-
}
|
|
673
|
-
));
|
|
674
|
-
Fe.displayName = xs.displayName;
|
|
675
|
-
const st = M.forwardRef(({ className: s, ...n }, a) => /* @__PURE__ */ e(
|
|
676
|
-
ws,
|
|
677
|
-
{
|
|
678
|
-
ref: a,
|
|
679
|
-
className: ie("aspect-square h-full w-full", s),
|
|
680
|
-
...n
|
|
681
|
-
}
|
|
682
|
-
));
|
|
683
|
-
st.displayName = ws.displayName;
|
|
684
|
-
const Oe = M.forwardRef(({ className: s, ...n }, a) => /* @__PURE__ */ e(
|
|
685
|
-
Cs,
|
|
686
|
-
{
|
|
687
|
-
ref: a,
|
|
688
|
-
className: ie(
|
|
689
|
-
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
690
|
-
s
|
|
691
|
-
),
|
|
692
|
-
...n
|
|
693
|
-
}
|
|
694
|
-
));
|
|
695
|
-
Oe.displayName = Cs.displayName;
|
|
696
|
-
function at({
|
|
697
|
-
open: s,
|
|
698
|
-
onOpenChange: n,
|
|
699
|
-
group: a,
|
|
700
|
-
onUpdate: t
|
|
701
|
-
}) {
|
|
702
|
-
const [l, i] = b("members"), [c, u] = b(""), [p, f] = b([]), [d, m] = b([]), { data: g, isLoading: v, refetch: N } = Ys(a.id), x = a.type === "TENANT_GROUP" ? "tenant" : "organization", { users: C, isLoading: O } = Zs({
|
|
703
|
-
type: x,
|
|
704
|
-
tenantId: a.tenantId || void 0,
|
|
705
|
-
active: !0,
|
|
706
|
-
limit: 100
|
|
707
|
-
}), R = Va(), G = Ha(), A = (g == null ? void 0 : g.members) || [], F = re(() => new Set(A.map((h) => h.userId)), [A]), P = re(() => C.filter((h) => !F.has(h.id)), [C, F]), j = re(() => {
|
|
708
|
-
if (!c) return P;
|
|
709
|
-
const h = c.toLowerCase();
|
|
710
|
-
return P.filter(
|
|
711
|
-
(D) => {
|
|
712
|
-
var I, _;
|
|
713
|
-
return ((I = D.name) == null ? void 0 : I.toLowerCase().includes(h)) || ((_ = D.email) == null ? void 0 : _.toLowerCase().includes(h));
|
|
714
|
-
}
|
|
715
|
-
);
|
|
716
|
-
}, [P, c]), w = re(() => {
|
|
717
|
-
if (!c) return A;
|
|
718
|
-
const h = c.toLowerCase();
|
|
719
|
-
return A.filter(
|
|
720
|
-
(D) => {
|
|
721
|
-
var I, _, X, Y;
|
|
722
|
-
return ((_ = (I = D.user) == null ? void 0 : I.name) == null ? void 0 : _.toLowerCase().includes(h)) || ((Y = (X = D.user) == null ? void 0 : X.email) == null ? void 0 : Y.toLowerCase().includes(h));
|
|
723
|
-
}
|
|
724
|
-
);
|
|
725
|
-
}, [A, c]), V = async () => {
|
|
726
|
-
if (p.length !== 0)
|
|
727
|
-
try {
|
|
728
|
-
await R.mutateAsync({
|
|
729
|
-
groupId: a.id,
|
|
730
|
-
data: {
|
|
731
|
-
userIds: p,
|
|
732
|
-
userType: x === "tenant" ? "tenant" : "org"
|
|
733
|
-
}
|
|
734
|
-
}), f([]), i("members"), N(), t == null || t();
|
|
735
|
-
} catch (h) {
|
|
736
|
-
console.error("Failed to add members:", h);
|
|
737
|
-
}
|
|
738
|
-
}, de = async () => {
|
|
739
|
-
if (d.length !== 0)
|
|
740
|
-
try {
|
|
741
|
-
await G.mutateAsync({
|
|
742
|
-
groupId: a.id,
|
|
743
|
-
data: {
|
|
744
|
-
userIds: d
|
|
745
|
-
}
|
|
746
|
-
}), m([]), N(), t == null || t();
|
|
747
|
-
} catch (h) {
|
|
748
|
-
console.error("Failed to remove members:", h);
|
|
749
|
-
}
|
|
750
|
-
}, ue = (h) => {
|
|
751
|
-
f(
|
|
752
|
-
(D) => D.includes(h) ? D.filter((I) => I !== h) : [...D, h]
|
|
753
|
-
);
|
|
754
|
-
}, S = (h) => {
|
|
755
|
-
m(
|
|
756
|
-
(D) => D.includes(h) ? D.filter((I) => I !== h) : [...D, h]
|
|
757
|
-
);
|
|
758
|
-
};
|
|
759
|
-
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(Le, { open: s, onOpenChange: n, children: /* @__PURE__ */ r(Ie, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
|
|
760
|
-
/* @__PURE__ */ r(Te, { children: [
|
|
761
|
-
/* @__PURE__ */ e(Ee, { children: a.name }),
|
|
762
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mt-1", children: /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground", children: [
|
|
763
|
-
A.length,
|
|
764
|
-
" ",
|
|
765
|
-
A.length === 1 ? "member" : "members"
|
|
766
|
-
] }) }),
|
|
767
|
-
/* @__PURE__ */ r("p", { id: "group-members-description", className: "sr-only", children: [
|
|
768
|
-
"Add or remove members from the ",
|
|
769
|
-
a.name,
|
|
770
|
-
" group"
|
|
771
|
-
] })
|
|
772
|
-
] }),
|
|
773
|
-
/* @__PURE__ */ r(ts, { value: l, onValueChange: (h) => {
|
|
774
|
-
i(h), u(""), m([]);
|
|
775
|
-
}, className: "mt-4", children: [
|
|
776
|
-
/* @__PURE__ */ r(rs, { className: "grid w-full grid-cols-2", children: [
|
|
777
|
-
/* @__PURE__ */ e(ne, { value: "members", children: "Current Members" }),
|
|
778
|
-
/* @__PURE__ */ e(ne, { value: "add", children: "Add Members" })
|
|
779
|
-
] }),
|
|
780
|
-
/* @__PURE__ */ r(oe, { value: "members", className: "mt-4 space-y-4", children: [
|
|
781
|
-
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
782
|
-
/* @__PURE__ */ e(xe, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
783
|
-
/* @__PURE__ */ e(
|
|
784
|
-
J,
|
|
785
|
-
{
|
|
786
|
-
placeholder: "Search members...",
|
|
787
|
-
value: c,
|
|
788
|
-
onChange: (h) => u(h.target.value),
|
|
789
|
-
className: "pl-10"
|
|
790
|
-
}
|
|
791
|
-
)
|
|
792
|
-
] }),
|
|
793
|
-
/* @__PURE__ */ e(we, { className: d.length > 0 ? "h-[300px]" : "h-[350px]", children: v ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((h) => /* @__PURE__ */ e(Ce, { className: "h-16 w-full" }, h)) }) : w.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
794
|
-
/* @__PURE__ */ e(z, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
795
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: c ? "No members found" : "No members yet" }),
|
|
796
|
-
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: c ? "Try a different search" : 'Switch to the "Add Members" tab to add people to this group' })
|
|
797
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: w.map((h) => /* @__PURE__ */ e(
|
|
798
|
-
tt,
|
|
799
|
-
{
|
|
800
|
-
member: h,
|
|
801
|
-
selected: d.includes(h.userId),
|
|
802
|
-
onToggle: () => S(h.userId)
|
|
803
|
-
},
|
|
804
|
-
h.id
|
|
805
|
-
)) }) }),
|
|
806
|
-
d.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
807
|
-
/* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground", children: [
|
|
808
|
-
d.length,
|
|
809
|
-
" member",
|
|
810
|
-
d.length !== 1 ? "s" : "",
|
|
811
|
-
" selected"
|
|
812
|
-
] }),
|
|
813
|
-
/* @__PURE__ */ e(
|
|
814
|
-
L,
|
|
815
|
-
{
|
|
816
|
-
variant: "destructive",
|
|
817
|
-
size: "sm",
|
|
818
|
-
onClick: de,
|
|
819
|
-
disabled: G.isPending,
|
|
820
|
-
children: G.isPending ? /* @__PURE__ */ r(E, { children: [
|
|
821
|
-
/* @__PURE__ */ e(q, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
822
|
-
"Removing..."
|
|
823
|
-
] }) : /* @__PURE__ */ r(E, { children: [
|
|
824
|
-
/* @__PURE__ */ e(ns, { className: "mr-2 h-4 w-4" }),
|
|
825
|
-
"Remove Selected"
|
|
826
|
-
] })
|
|
827
|
-
}
|
|
828
|
-
)
|
|
829
|
-
] })
|
|
830
|
-
] }),
|
|
831
|
-
/* @__PURE__ */ r(oe, { value: "add", className: "mt-4 space-y-4", children: [
|
|
832
|
-
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
833
|
-
/* @__PURE__ */ e(xe, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
834
|
-
/* @__PURE__ */ e(
|
|
835
|
-
J,
|
|
836
|
-
{
|
|
837
|
-
placeholder: "Search users to add...",
|
|
838
|
-
value: c,
|
|
839
|
-
onChange: (h) => u(h.target.value),
|
|
840
|
-
className: "pl-10"
|
|
841
|
-
}
|
|
842
|
-
)
|
|
843
|
-
] }),
|
|
844
|
-
/* @__PURE__ */ e(we, { className: "h-[300px]", children: O ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((h) => /* @__PURE__ */ e(Ce, { className: "h-16 w-full" }, h)) }) : j.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
845
|
-
/* @__PURE__ */ e(Se, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
846
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No available users" }),
|
|
847
|
-
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: c ? "Try a different search" : "All eligible users are already members" })
|
|
848
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: j.map((h) => /* @__PURE__ */ e(
|
|
849
|
-
rt,
|
|
850
|
-
{
|
|
851
|
-
user: h,
|
|
852
|
-
selected: p.includes(h.id),
|
|
853
|
-
onToggle: () => ue(h.id)
|
|
854
|
-
},
|
|
855
|
-
h.id
|
|
856
|
-
)) }) }),
|
|
857
|
-
p.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
858
|
-
/* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground", children: [
|
|
859
|
-
p.length,
|
|
860
|
-
" user",
|
|
861
|
-
p.length !== 1 ? "s" : "",
|
|
862
|
-
" selected"
|
|
863
|
-
] }),
|
|
864
|
-
/* @__PURE__ */ e(
|
|
865
|
-
L,
|
|
866
|
-
{
|
|
867
|
-
onClick: V,
|
|
868
|
-
disabled: R.isPending,
|
|
869
|
-
children: R.isPending ? /* @__PURE__ */ r(E, { children: [
|
|
870
|
-
/* @__PURE__ */ e(q, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
871
|
-
"Adding..."
|
|
872
|
-
] }) : /* @__PURE__ */ r(E, { children: [
|
|
873
|
-
/* @__PURE__ */ e(Se, { className: "mr-2 h-4 w-4" }),
|
|
874
|
-
"Add Members"
|
|
875
|
-
] })
|
|
876
|
-
}
|
|
877
|
-
)
|
|
878
|
-
] })
|
|
879
|
-
] })
|
|
880
|
-
] })
|
|
881
|
-
] }) }) });
|
|
882
|
-
}
|
|
883
|
-
function tt({
|
|
884
|
-
member: s,
|
|
885
|
-
selected: n,
|
|
886
|
-
onToggle: a
|
|
887
|
-
}) {
|
|
888
|
-
var l, i, c, u;
|
|
889
|
-
const t = ((i = (l = s.user) == null ? void 0 : l.name) == null ? void 0 : i.split(" ").map((p) => p[0]).join("").toUpperCase()) || "?";
|
|
890
|
-
return /* @__PURE__ */ r(
|
|
891
|
-
"div",
|
|
892
|
-
{
|
|
893
|
-
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
894
|
-
onClick: a,
|
|
895
|
-
children: [
|
|
896
|
-
/* @__PURE__ */ e(os, { checked: n }),
|
|
897
|
-
/* @__PURE__ */ e(Fe, { className: "h-8 w-8", children: /* @__PURE__ */ e(Oe, { className: "text-xs", children: t }) }),
|
|
898
|
-
/* @__PURE__ */ r("div", { className: "flex-1", children: [
|
|
899
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: ((c = s.user) == null ? void 0 : c.name) || "Unknown User" }),
|
|
900
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: (u = s.user) == null ? void 0 : u.email })
|
|
901
|
-
] })
|
|
902
|
-
]
|
|
903
|
-
}
|
|
904
|
-
);
|
|
905
|
-
}
|
|
906
|
-
function rt({
|
|
907
|
-
user: s,
|
|
908
|
-
selected: n,
|
|
909
|
-
onToggle: a
|
|
910
|
-
}) {
|
|
911
|
-
var l;
|
|
912
|
-
const t = ((l = s.name) == null ? void 0 : l.split(" ").map((i) => i[0]).join("").toUpperCase()) || "?";
|
|
913
|
-
return /* @__PURE__ */ r(
|
|
914
|
-
"div",
|
|
915
|
-
{
|
|
916
|
-
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
917
|
-
onClick: a,
|
|
918
|
-
children: [
|
|
919
|
-
/* @__PURE__ */ e(os, { checked: n }),
|
|
920
|
-
/* @__PURE__ */ e(Fe, { className: "h-8 w-8", children: /* @__PURE__ */ e(Oe, { className: "text-xs", children: t }) }),
|
|
921
|
-
/* @__PURE__ */ r("div", { className: "flex-1", children: [
|
|
922
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: s.name }),
|
|
923
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: s.email })
|
|
924
|
-
] })
|
|
925
|
-
]
|
|
926
|
-
}
|
|
927
|
-
);
|
|
928
|
-
}
|
|
929
|
-
function nt({
|
|
930
|
-
open: s,
|
|
931
|
-
onOpenChange: n
|
|
932
|
-
}) {
|
|
933
|
-
const [a, t] = b("groups"), [l, i] = b(""), [c, u] = b(null), [p, f] = b(!1), [d, m] = b(null), { tokenProps: g } = U(), { currentUser: v } = is(), N = ja(), x = (v == null ? void 0 : v.type) === "tenant", C = g == null ? void 0 : g.tenantId, { groups: O, isLoading: R, refetch: G } = ea({
|
|
934
|
-
type: x ? "TENANT_GROUP" : "all",
|
|
935
|
-
tenantId: x ? C : void 0,
|
|
936
|
-
includeMembers: !1
|
|
937
|
-
}), A = O.filter(
|
|
938
|
-
(w) => {
|
|
939
|
-
var V;
|
|
940
|
-
return w.name.toLowerCase().includes(l.toLowerCase()) || ((V = w.description) == null ? void 0 : V.toLowerCase().includes(l.toLowerCase()));
|
|
941
|
-
}
|
|
942
|
-
), F = async () => {
|
|
943
|
-
if (d)
|
|
944
|
-
try {
|
|
945
|
-
await N.mutateAsync(d.id), m(null), G();
|
|
946
|
-
} catch (w) {
|
|
947
|
-
console.error("Failed to delete group:", w);
|
|
948
|
-
}
|
|
949
|
-
}, P = (w) => {
|
|
950
|
-
u(w), f(!0);
|
|
951
|
-
}, j = () => {
|
|
952
|
-
t("groups"), G();
|
|
953
|
-
};
|
|
954
|
-
return /* @__PURE__ */ r(E, { children: [
|
|
955
|
-
/* @__PURE__ */ e(Le, { open: s, onOpenChange: n, children: /* @__PURE__ */ r(Ie, { className: "max-w-4xl max-h-[80vh]", children: [
|
|
956
|
-
/* @__PURE__ */ r(Te, { children: [
|
|
957
|
-
/* @__PURE__ */ r(Ee, { className: "flex items-center gap-2", children: [
|
|
958
|
-
/* @__PURE__ */ e(z, { className: "h-5 w-5" }),
|
|
959
|
-
"Group Management"
|
|
960
|
-
] }),
|
|
961
|
-
/* @__PURE__ */ e(Ze, { children: "Manage your groups, create new groups, and control group membership" })
|
|
962
|
-
] }),
|
|
963
|
-
/* @__PURE__ */ r(ts, { value: a, onValueChange: t, className: "mt-4", children: [
|
|
964
|
-
/* @__PURE__ */ r(rs, { className: "grid w-full grid-cols-2", children: [
|
|
965
|
-
/* @__PURE__ */ r(ne, { value: "groups", className: "flex items-center gap-2", children: [
|
|
966
|
-
/* @__PURE__ */ e(z, { className: "h-4 w-4" }),
|
|
967
|
-
"Groups"
|
|
968
|
-
] }),
|
|
969
|
-
/* @__PURE__ */ r(ne, { value: "create", className: "flex items-center gap-2", children: [
|
|
970
|
-
/* @__PURE__ */ e(Ae, { className: "h-4 w-4" }),
|
|
971
|
-
"Create Group"
|
|
972
|
-
] })
|
|
973
|
-
] }),
|
|
974
|
-
/* @__PURE__ */ e(oe, { value: "groups", className: "mt-4", children: /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
975
|
-
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
976
|
-
/* @__PURE__ */ e(xe, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
977
|
-
/* @__PURE__ */ e(
|
|
978
|
-
J,
|
|
979
|
-
{
|
|
980
|
-
placeholder: "Search groups...",
|
|
981
|
-
value: l,
|
|
982
|
-
onChange: (w) => i(w.target.value),
|
|
983
|
-
className: "pl-10"
|
|
984
|
-
}
|
|
985
|
-
)
|
|
986
|
-
] }),
|
|
987
|
-
/* @__PURE__ */ e(we, { className: "h-[400px]", children: R ? /* @__PURE__ */ e("div", { className: "space-y-3", children: [1, 2, 3].map((w) => /* @__PURE__ */ e(Ce, { className: "h-24 w-full" }, w)) }) : A.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
988
|
-
/* @__PURE__ */ e(z, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
989
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No groups found" }),
|
|
990
|
-
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: l ? "Try a different search" : "Create your first group to get started" })
|
|
991
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-3", children: A.map((w) => /* @__PURE__ */ e(
|
|
992
|
-
ot,
|
|
993
|
-
{
|
|
994
|
-
group: w,
|
|
995
|
-
onManageMembers: () => P(w),
|
|
996
|
-
onDelete: () => m(w),
|
|
997
|
-
currentUserId: v == null ? void 0 : v.id
|
|
998
|
-
},
|
|
999
|
-
w.id
|
|
1000
|
-
)) }) })
|
|
1001
|
-
] }) }),
|
|
1002
|
-
/* @__PURE__ */ e(oe, { value: "create", className: "mt-4", children: /* @__PURE__ */ e(
|
|
1003
|
-
Qa,
|
|
1004
|
-
{
|
|
1005
|
-
onSuccess: j,
|
|
1006
|
-
tenantId: C,
|
|
1007
|
-
isTenantUser: x
|
|
1008
|
-
}
|
|
1009
|
-
) })
|
|
1010
|
-
] })
|
|
1011
|
-
] }) }),
|
|
1012
|
-
c && /* @__PURE__ */ e(
|
|
1013
|
-
at,
|
|
1014
|
-
{
|
|
1015
|
-
open: p,
|
|
1016
|
-
onOpenChange: f,
|
|
1017
|
-
group: c,
|
|
1018
|
-
onUpdate: () => G()
|
|
1019
|
-
}
|
|
1020
|
-
),
|
|
1021
|
-
/* @__PURE__ */ e(
|
|
1022
|
-
ls,
|
|
1023
|
-
{
|
|
1024
|
-
open: !!d,
|
|
1025
|
-
onOpenChange: () => m(null),
|
|
1026
|
-
children: /* @__PURE__ */ r(cs, { children: [
|
|
1027
|
-
/* @__PURE__ */ r(ds, { children: [
|
|
1028
|
-
/* @__PURE__ */ e(us, { children: "Delete Group" }),
|
|
1029
|
-
/* @__PURE__ */ r(ms, { children: [
|
|
1030
|
-
'Are you sure you want to delete "',
|
|
1031
|
-
d == null ? void 0 : d.name,
|
|
1032
|
-
'"? This action cannot be undone and will remove all members from the group.'
|
|
1033
|
-
] })
|
|
1034
|
-
] }),
|
|
1035
|
-
/* @__PURE__ */ r(hs, { children: [
|
|
1036
|
-
/* @__PURE__ */ e(ps, { children: "Cancel" }),
|
|
1037
|
-
/* @__PURE__ */ e(
|
|
1038
|
-
De,
|
|
1039
|
-
{
|
|
1040
|
-
onClick: F,
|
|
1041
|
-
disabled: N.isPending,
|
|
1042
|
-
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1043
|
-
children: N.isPending ? /* @__PURE__ */ r(E, { children: [
|
|
1044
|
-
/* @__PURE__ */ e(q, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1045
|
-
"Deleting..."
|
|
1046
|
-
] }) : "Delete Group"
|
|
1047
|
-
}
|
|
1048
|
-
)
|
|
1049
|
-
] })
|
|
1050
|
-
] })
|
|
1051
|
-
}
|
|
1052
|
-
)
|
|
1053
|
-
] });
|
|
1054
|
-
}
|
|
1055
|
-
function ot({
|
|
1056
|
-
group: s,
|
|
1057
|
-
onManageMembers: n,
|
|
1058
|
-
onDelete: a,
|
|
1059
|
-
currentUserId: t
|
|
1060
|
-
}) {
|
|
1061
|
-
const l = s.createdBy === t;
|
|
1062
|
-
return /* @__PURE__ */ e("div", { className: "rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50", children: /* @__PURE__ */ r("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1063
|
-
/* @__PURE__ */ r("div", { className: "flex-1 space-y-2", children: [
|
|
1064
|
-
/* @__PURE__ */ r("div", { children: [
|
|
1065
|
-
/* @__PURE__ */ e("h4", { className: "font-medium", children: s.name }),
|
|
1066
|
-
s.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-1", children: s.description })
|
|
1067
|
-
] }),
|
|
1068
|
-
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-3 text-xs text-muted-foreground", children: [
|
|
1069
|
-
/* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
1070
|
-
/* @__PURE__ */ e(z, { className: "h-3 w-3" }),
|
|
1071
|
-
s.memberCount,
|
|
1072
|
-
" ",
|
|
1073
|
-
s.memberCount === 1 ? "member" : "members"
|
|
1074
|
-
] }),
|
|
1075
|
-
/* @__PURE__ */ r("span", { children: [
|
|
1076
|
-
"Created ",
|
|
1077
|
-
sa(new Date(s.createdAt), "MMM d, yyyy")
|
|
1078
|
-
] })
|
|
1079
|
-
] })
|
|
1080
|
-
] }),
|
|
1081
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
|
|
1082
|
-
/* @__PURE__ */ e(
|
|
1083
|
-
L,
|
|
1084
|
-
{
|
|
1085
|
-
variant: "ghost",
|
|
1086
|
-
size: "sm",
|
|
1087
|
-
onClick: n,
|
|
1088
|
-
title: "Manage members",
|
|
1089
|
-
children: /* @__PURE__ */ e(Se, { className: "h-4 w-4" })
|
|
1090
|
-
}
|
|
1091
|
-
),
|
|
1092
|
-
l && /* @__PURE__ */ e(
|
|
1093
|
-
L,
|
|
1094
|
-
{
|
|
1095
|
-
variant: "ghost",
|
|
1096
|
-
size: "sm",
|
|
1097
|
-
onClick: a,
|
|
1098
|
-
title: "Delete group",
|
|
1099
|
-
className: "text-destructive hover:text-destructive",
|
|
1100
|
-
children: /* @__PURE__ */ e(ns, { className: "h-4 w-4" })
|
|
1101
|
-
}
|
|
1102
|
-
)
|
|
1103
|
-
] })
|
|
1104
|
-
] }) });
|
|
1105
|
-
}
|
|
1106
|
-
function gt() {
|
|
1107
|
-
var ze, je, Ve;
|
|
1108
|
-
const {
|
|
1109
|
-
authToken: s,
|
|
1110
|
-
tokenProps: n,
|
|
1111
|
-
id: a
|
|
1112
|
-
} = U(), { isLocalDev: t } = aa(), { permissions: l } = Ma(), i = ta(), { isLoading: c } = ra();
|
|
1113
|
-
y((o) => o.theme);
|
|
1114
|
-
const u = y((o) => o.lenses), p = y((o) => o.selectedLensId), f = u == null ? void 0 : u.find((o) => o.id === p), d = y((o) => o.dashboard);
|
|
1115
|
-
y((o) => o.selectedSheetId);
|
|
1116
|
-
const m = y(
|
|
1117
|
-
(o) => o.isDashboardEditing
|
|
1118
|
-
), { setDashboardTitle: g } = y((o) => o.actions), [v, N] = b(!1), [x, C] = b(!1), [O, R] = b(!1), [G, A] = b(!1), [F, P] = b(null), [j, w] = b(!1), V = y((o) => o.isDashboardPanelOpen), de = y(
|
|
1119
|
-
(o) => o.actions.setIsDashboardPanelOpen
|
|
1120
|
-
), ue = y((o) => o.filterValues), S = y((o) => o.isVisualEditing);
|
|
1121
|
-
Qe((o) => o.card);
|
|
1122
|
-
const h = te(
|
|
1123
|
-
(o) => o.selectedDashboard
|
|
1124
|
-
), D = te(
|
|
1125
|
-
(o) => o.initialDashboard
|
|
1126
|
-
);
|
|
1127
|
-
te((o) => o.selectedVisual), y((o) => o.selectedFrameId), Qe((o) => o.frame);
|
|
1128
|
-
const I = h ? (je = h == null ? void 0 : h.permissions) == null ? void 0 : je.canEdit : (ze = D == null ? void 0 : D.permissions) == null ? void 0 : ze.canEdit, _ = y((o) => o.showFilters), X = na((o) => o.setPanelOpen), Y = y(
|
|
1129
|
-
(o) => o.showDashboardJSON
|
|
1130
|
-
), me = y((o) => o.onSaveFunction), Ss = y(
|
|
1131
|
-
(o) => o.actions.setShowFilters
|
|
1132
|
-
), { setIsDashboardEditing: Re, setShowDashboardJSON: Ue } = y(
|
|
1133
|
-
(o) => o.actions
|
|
1134
|
-
), { setInitialDashboard: _e, clearSelectedDashboard: Ds } = te(
|
|
1135
|
-
(o) => o.actions
|
|
1136
|
-
), { resources: Z } = oa(be.DASHBOARD), { currentUser: Ms } = is(), ks = ia(Ms), H = h || D, $e = H ? {
|
|
1137
|
-
id: H.id,
|
|
1138
|
-
title: (d == null ? void 0 : d.title) || H.title || "Dashboard"
|
|
1139
|
-
} : null, { handleAddNewFrame: Ls } = la(), [Q, he] = b(!1), [As, ee] = b(!1), se = ca(be.DASHBOARD), [K, pe] = b(
|
|
1140
|
-
null
|
|
1141
|
-
), Is = async (o, T) => {
|
|
1142
|
-
if (!(d != null && d.id)) {
|
|
1143
|
-
console.log("No dashboard ID found");
|
|
1144
|
-
return;
|
|
1145
|
-
}
|
|
1146
|
-
console.log("Updating dashboard title:", {
|
|
1147
|
-
dashboardId: d.id,
|
|
1148
|
-
newTitle: o,
|
|
1149
|
-
previousTitle: T
|
|
1150
|
-
}), se.mutate(
|
|
1151
|
-
{
|
|
1152
|
-
resourceId: d.id,
|
|
1153
|
-
data: { title: o }
|
|
1154
|
-
},
|
|
1155
|
-
{
|
|
1156
|
-
onSuccess: () => {
|
|
1157
|
-
console.log("Dashboard title updated successfully"), k.success("Dashboard title updated");
|
|
1158
|
-
},
|
|
1159
|
-
onError: (B) => {
|
|
1160
|
-
console.error("Failed to update dashboard title:", B), k.error("Failed to update dashboard title"), g(T);
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
);
|
|
1164
|
-
};
|
|
1165
|
-
ya(() => {
|
|
1166
|
-
if (Z && Z.length > 0) {
|
|
1167
|
-
const o = d == null ? void 0 : d.id;
|
|
1168
|
-
if (o) {
|
|
1169
|
-
const T = Z.find(
|
|
1170
|
-
(B) => B.id === o
|
|
1171
|
-
);
|
|
1172
|
-
T && _e(T);
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
}, [Z, d == null ? void 0 : d.id, _e]);
|
|
1176
|
-
const ae = n.orgUserId || n.tenantId, Ts = m && !S && ae && I, { setDashboard: Es } = y((o) => o.actions), Ps = () => {
|
|
1177
|
-
Re(!0);
|
|
1178
|
-
}, ge = () => {
|
|
1179
|
-
Re(!1), Ue(!1), pe(null);
|
|
1180
|
-
};
|
|
1181
|
-
xa(
|
|
1182
|
-
m,
|
|
1183
|
-
d,
|
|
1184
|
-
K,
|
|
1185
|
-
(o) => pe(o)
|
|
1186
|
-
);
|
|
1187
|
-
const Gs = () => K ? JSON.stringify(d) !== JSON.stringify(K) : !1, Fs = () => {
|
|
1188
|
-
Gs() ? ee(!0) : ge();
|
|
1189
|
-
}, Os = async () => {
|
|
1190
|
-
await fe({ closeAfterSave: !0 });
|
|
1191
|
-
}, Rs = () => {
|
|
1192
|
-
K && Es(K), ge(), ee(!1);
|
|
1193
|
-
};
|
|
1194
|
-
async function fe(o) {
|
|
1195
|
-
const T = (o == null ? void 0 : o.closeAfterSave) ?? j;
|
|
1196
|
-
w(T), T && ee(!1);
|
|
1197
|
-
const B = Na(d);
|
|
1198
|
-
A(!0), P(null), he(!0);
|
|
1199
|
-
const $s = {
|
|
1200
|
-
template: d
|
|
1201
|
-
};
|
|
1202
|
-
se.mutate(
|
|
1203
|
-
{
|
|
1204
|
-
resourceId: d.id,
|
|
1205
|
-
data: $s
|
|
1206
|
-
},
|
|
1207
|
-
{
|
|
1208
|
-
onSuccess: () => {
|
|
1209
|
-
he(!1), k.success("Dashboard saved!"), pe(B), A(!1), w(!1), T && ge();
|
|
1210
|
-
},
|
|
1211
|
-
onError: () => {
|
|
1212
|
-
he(!1), P("Failed to save dashboard. Please try again."), k.error("Failed to save dashboard");
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
);
|
|
1216
|
-
}
|
|
1217
|
-
async function Us() {
|
|
1218
|
-
if (N(!0), !p || !f) return;
|
|
1219
|
-
const o = JSON.stringify(d), T = {
|
|
1220
|
-
...f,
|
|
1221
|
-
template: o,
|
|
1222
|
-
filterValues: ue
|
|
1223
|
-
};
|
|
1224
|
-
await Me(
|
|
1225
|
-
n.apiServiceUrl,
|
|
1226
|
-
T,
|
|
1227
|
-
s == null ? void 0 : s.accessToken
|
|
1228
|
-
), k.success("Lens saved"), me == null || me(d), N(!1);
|
|
1229
|
-
}
|
|
1230
|
-
const qe = (f == null ? void 0 : f.name) || d.title;
|
|
1231
|
-
se.isPending && console.log("Title during update:", {
|
|
1232
|
-
title: qe,
|
|
1233
|
-
dashboardStateTitle: d.title,
|
|
1234
|
-
dashboardId: d == null ? void 0 : d.id,
|
|
1235
|
-
currentLensName: f == null ? void 0 : f.name
|
|
1236
|
-
});
|
|
1237
|
-
const _s = n.orgUserId || n.tenantId && n.endUserId && n.endUserEmail;
|
|
1238
|
-
return /* @__PURE__ */ r(
|
|
1239
|
-
"div",
|
|
1240
|
-
{
|
|
1241
|
-
className: "flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",
|
|
1242
|
-
role: "dashboard-controls",
|
|
1243
|
-
children: [
|
|
1244
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
1245
|
-
_s && /* @__PURE__ */ r(E, { children: [
|
|
1246
|
-
/* @__PURE__ */ e(
|
|
1247
|
-
$,
|
|
1248
|
-
{
|
|
1249
|
-
"aria-label": "Manage Dashboards",
|
|
1250
|
-
tooltip: "Manage Dashboards",
|
|
1251
|
-
onClick: () => {
|
|
1252
|
-
de(!V);
|
|
1253
|
-
},
|
|
1254
|
-
className: "h-7 p-2",
|
|
1255
|
-
children: /* @__PURE__ */ e(La, { className: "h-4 w-4" })
|
|
1256
|
-
}
|
|
1257
|
-
),
|
|
1258
|
-
i && !S && /* @__PURE__ */ e(
|
|
1259
|
-
$,
|
|
1260
|
-
{
|
|
1261
|
-
"aria-label": "Dashboard Hub",
|
|
1262
|
-
tooltip: "Dashboard Hub",
|
|
1263
|
-
onClick: () => Ds(),
|
|
1264
|
-
className: "h-7 p-2",
|
|
1265
|
-
children: /* @__PURE__ */ e(es, { className: "h-4 w-4" })
|
|
1266
|
-
}
|
|
1267
|
-
)
|
|
1268
|
-
] }),
|
|
1269
|
-
!S && i && (c ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
1270
|
-
/* @__PURE__ */ e(q, { className: "h-3 w-3 animate-spin text-muted-foreground" }),
|
|
1271
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Loading..." })
|
|
1272
|
-
] }) : /* @__PURE__ */ e(
|
|
1273
|
-
da,
|
|
1274
|
-
{
|
|
1275
|
-
value: qe || "Untitled Dashboard",
|
|
1276
|
-
onSave: (o) => {
|
|
1277
|
-
console.log("EditableText onSave called:", {
|
|
1278
|
-
newTitle: o,
|
|
1279
|
-
canEditDashboard: I,
|
|
1280
|
-
dashboardId: d == null ? void 0 : d.id
|
|
1281
|
-
});
|
|
1282
|
-
const T = (d == null ? void 0 : d.title) || "";
|
|
1283
|
-
g(o), Is(o, T);
|
|
1284
|
-
},
|
|
1285
|
-
isEditable: I && !f,
|
|
1286
|
-
displayClassName: "text-sm font-medium",
|
|
1287
|
-
inputClassName: "text-sm font-medium",
|
|
1288
|
-
placeholder: "Dashboard Title",
|
|
1289
|
-
isPending: se.isPending
|
|
1290
|
-
}
|
|
1291
|
-
))
|
|
1292
|
-
] }),
|
|
1293
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
1294
|
-
S && /* @__PURE__ */ r(E, { children: [
|
|
1295
|
-
/* @__PURE__ */ e(wa, { className: "mr-2" }),
|
|
1296
|
-
/* @__PURE__ */ e(Ca, { className: "h-7" })
|
|
1297
|
-
] }),
|
|
1298
|
-
t && !S && /* @__PURE__ */ r(E, { children: [
|
|
1299
|
-
/* @__PURE__ */ e(
|
|
1300
|
-
$,
|
|
1301
|
-
{
|
|
1302
|
-
tooltip: "Copy Token",
|
|
1303
|
-
onClick: () => {
|
|
1304
|
-
var o;
|
|
1305
|
-
s != null && s.accessToken && ((o = navigator == null ? void 0 : navigator.clipboard) != null && o.writeText ? navigator.clipboard.writeText(s.accessToken).then(() => k.success("Token copied to clipboard")).catch(() => k.error("Unable to copy token")) : k.error("Clipboard not available"));
|
|
1306
|
-
},
|
|
1307
|
-
className: "h-7 p-2",
|
|
1308
|
-
children: /* @__PURE__ */ e(ua, { className: "h-4 w-4" })
|
|
1309
|
-
}
|
|
1310
|
-
),
|
|
1311
|
-
/* @__PURE__ */ e(
|
|
1312
|
-
$,
|
|
1313
|
-
{
|
|
1314
|
-
tooltip: "Invalidate Token",
|
|
1315
|
-
onClick: () => ma(n.apiServiceUrl),
|
|
1316
|
-
className: "h-7 p-2",
|
|
1317
|
-
children: /* @__PURE__ */ e(Ia, { className: "h-4 w-4" })
|
|
1318
|
-
}
|
|
1319
|
-
)
|
|
1320
|
-
] }),
|
|
1321
|
-
!S && i && /* @__PURE__ */ e(ha, {}),
|
|
1322
|
-
!S && i && /* @__PURE__ */ e(Sa, {}),
|
|
1323
|
-
!S && i && ks && /* @__PURE__ */ e(
|
|
1324
|
-
$,
|
|
1325
|
-
{
|
|
1326
|
-
tooltip: "Manage Groups",
|
|
1327
|
-
onClick: () => R(!0),
|
|
1328
|
-
className: "h-7 p-2",
|
|
1329
|
-
children: /* @__PURE__ */ e(z, { className: "h-4 w-4" })
|
|
1330
|
-
}
|
|
1331
|
-
),
|
|
1332
|
-
!S && i && ((Ve = H == null ? void 0 : H.permissions) == null ? void 0 : Ve.canShare) && /* @__PURE__ */ e(
|
|
1333
|
-
$,
|
|
1334
|
-
{
|
|
1335
|
-
tooltip: "Share Dashboard",
|
|
1336
|
-
onClick: () => C(!0),
|
|
1337
|
-
className: "h-7 p-2",
|
|
1338
|
-
children: /* @__PURE__ */ e(pa, { className: "h-4 w-4" })
|
|
1339
|
-
}
|
|
1340
|
-
),
|
|
1341
|
-
!_ && !S && m && l.canUseFilters && i && /* @__PURE__ */ e(
|
|
1342
|
-
L,
|
|
1343
|
-
{
|
|
1344
|
-
className: "h-7 p-2",
|
|
1345
|
-
variant: "outline",
|
|
1346
|
-
onClick: () => {
|
|
1347
|
-
X("dashboard", !1), Ss(!0);
|
|
1348
|
-
},
|
|
1349
|
-
size: "sm",
|
|
1350
|
-
children: /* @__PURE__ */ e(ga, { className: "h-4 w-4" })
|
|
1351
|
-
}
|
|
1352
|
-
),
|
|
1353
|
-
m && !S && ae && t && i && /* @__PURE__ */ e(Oa, {}),
|
|
1354
|
-
!S && ae && t && i && /* @__PURE__ */ e(Ra, {}),
|
|
1355
|
-
m && !S && ae && f && t && i && /* @__PURE__ */ r(
|
|
1356
|
-
L,
|
|
1357
|
-
{
|
|
1358
|
-
className: "h-7 p-2",
|
|
1359
|
-
variant: "secondary",
|
|
1360
|
-
disabled: v,
|
|
1361
|
-
onClick: Us,
|
|
1362
|
-
size: "sm",
|
|
1363
|
-
children: [
|
|
1364
|
-
/* @__PURE__ */ e(Ke, { className: "mr-2 h-4 w-4" }),
|
|
1365
|
-
"Save Lens"
|
|
1366
|
-
]
|
|
1367
|
-
}
|
|
1368
|
-
),
|
|
1369
|
-
m && !S && i && /* @__PURE__ */ r(
|
|
1370
|
-
L,
|
|
1371
|
-
{
|
|
1372
|
-
variant: "outline",
|
|
1373
|
-
className: "h-7 p-2",
|
|
1374
|
-
size: "sm",
|
|
1375
|
-
disabled: !m,
|
|
1376
|
-
onClick: () => Ls(),
|
|
1377
|
-
children: [
|
|
1378
|
-
/* @__PURE__ */ e(Ae, { className: "mr-2 h-4 w-4" }),
|
|
1379
|
-
"Visual"
|
|
1380
|
-
]
|
|
1381
|
-
}
|
|
1382
|
-
),
|
|
1383
|
-
!S && !m && I && i && /* @__PURE__ */ r(
|
|
1384
|
-
L,
|
|
1385
|
-
{
|
|
1386
|
-
variant: "outline",
|
|
1387
|
-
className: "h-7 p-2",
|
|
1388
|
-
onClick: Ps,
|
|
1389
|
-
size: "sm",
|
|
1390
|
-
children: [
|
|
1391
|
-
/* @__PURE__ */ e(fa, { className: "mr-2 h-4 w-4" }),
|
|
1392
|
-
"Edit"
|
|
1393
|
-
]
|
|
1394
|
-
}
|
|
1395
|
-
),
|
|
1396
|
-
Ts && i && /* @__PURE__ */ r(
|
|
1397
|
-
L,
|
|
1398
|
-
{
|
|
1399
|
-
className: "h-7 p-2",
|
|
1400
|
-
disabled: Q,
|
|
1401
|
-
onClick: () => fe(),
|
|
1402
|
-
size: "sm",
|
|
1403
|
-
children: [
|
|
1404
|
-
Q ? /* @__PURE__ */ e(q, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(Ke, { className: "mr-2 h-4 w-4" }),
|
|
1405
|
-
Q ? "Saving..." : "Save"
|
|
1406
|
-
]
|
|
1407
|
-
}
|
|
1408
|
-
),
|
|
1409
|
-
!S && m && t && i && /* @__PURE__ */ e("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e(
|
|
1410
|
-
L,
|
|
1411
|
-
{
|
|
1412
|
-
className: "h-7 p-2",
|
|
1413
|
-
onClick: () => Ue(!Y),
|
|
1414
|
-
size: "sm",
|
|
1415
|
-
variant: "ghost",
|
|
1416
|
-
children: /* @__PURE__ */ e(va, { className: "h-4 w-4" })
|
|
1417
|
-
}
|
|
1418
|
-
) }),
|
|
1419
|
-
!S && t && /* @__PURE__ */ e(Pa, {}),
|
|
1420
|
-
m && !S && i && /* @__PURE__ */ r(
|
|
1421
|
-
L,
|
|
1422
|
-
{
|
|
1423
|
-
variant: "outline",
|
|
1424
|
-
className: "h-7 p-2",
|
|
1425
|
-
onClick: Fs,
|
|
1426
|
-
children: [
|
|
1427
|
-
/* @__PURE__ */ e(ss, { className: "mr-2 h-4 w-4" }),
|
|
1428
|
-
"Close"
|
|
1429
|
-
]
|
|
1430
|
-
}
|
|
1431
|
-
),
|
|
1432
|
-
x && $e && /* @__PURE__ */ e(
|
|
1433
|
-
ba,
|
|
1434
|
-
{
|
|
1435
|
-
resource: $e,
|
|
1436
|
-
resourceType: be.DASHBOARD,
|
|
1437
|
-
onClose: () => C(!1)
|
|
1438
|
-
}
|
|
1439
|
-
),
|
|
1440
|
-
/* @__PURE__ */ e(
|
|
1441
|
-
nt,
|
|
1442
|
-
{
|
|
1443
|
-
open: O,
|
|
1444
|
-
onOpenChange: R
|
|
1445
|
-
}
|
|
1446
|
-
),
|
|
1447
|
-
/* @__PURE__ */ e(
|
|
1448
|
-
ls,
|
|
1449
|
-
{
|
|
1450
|
-
open: G,
|
|
1451
|
-
onOpenChange: (o) => {
|
|
1452
|
-
!o && Q && !F || (A(o), o || (P(null), w(!1)));
|
|
1453
|
-
},
|
|
1454
|
-
children: /* @__PURE__ */ r(cs, { className: "max-w-sm", children: [
|
|
1455
|
-
/* @__PURE__ */ r(ds, { children: [
|
|
1456
|
-
/* @__PURE__ */ e(us, { children: F ? "Save failed" : "Saving dashboard" }),
|
|
1457
|
-
/* @__PURE__ */ e(ms, { className: "pt-2", children: F ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." })
|
|
1458
|
-
] }),
|
|
1459
|
-
/* @__PURE__ */ e(hs, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: F ? /* @__PURE__ */ r(E, { children: [
|
|
1460
|
-
/* @__PURE__ */ e(
|
|
1461
|
-
ps,
|
|
1462
|
-
{
|
|
1463
|
-
onClick: () => {
|
|
1464
|
-
A(!1), P(null), w(!1);
|
|
1465
|
-
},
|
|
1466
|
-
className: "m-0",
|
|
1467
|
-
children: "Close"
|
|
1468
|
-
}
|
|
1469
|
-
),
|
|
1470
|
-
/* @__PURE__ */ e(
|
|
1471
|
-
De,
|
|
1472
|
-
{
|
|
1473
|
-
onClick: () => fe(),
|
|
1474
|
-
className: "m-0",
|
|
1475
|
-
children: "Retry"
|
|
1476
|
-
}
|
|
1477
|
-
)
|
|
1478
|
-
] }) : /* @__PURE__ */ r(
|
|
1479
|
-
De,
|
|
1480
|
-
{
|
|
1481
|
-
disabled: !0,
|
|
1482
|
-
className: "m-0 cursor-default",
|
|
1483
|
-
children: [
|
|
1484
|
-
/* @__PURE__ */ e(q, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1485
|
-
"Saving..."
|
|
1486
|
-
]
|
|
1487
|
-
}
|
|
1488
|
-
) })
|
|
1489
|
-
] })
|
|
1490
|
-
}
|
|
1491
|
-
),
|
|
1492
|
-
/* @__PURE__ */ e(
|
|
1493
|
-
Da,
|
|
1494
|
-
{
|
|
1495
|
-
open: As,
|
|
1496
|
-
onOpenChange: ee,
|
|
1497
|
-
onSave: Os,
|
|
1498
|
-
onDiscard: Rs,
|
|
1499
|
-
isSaving: Q
|
|
1500
|
-
}
|
|
1501
|
-
)
|
|
1502
|
-
] })
|
|
1503
|
-
]
|
|
1504
|
-
}
|
|
1505
|
-
);
|
|
1506
|
-
}
|
|
1507
|
-
export {
|
|
1508
|
-
gt as default
|
|
1509
|
-
};
|