react-semaphor 0.1.257 → 0.1.259
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-51P6aUVB.js +1847 -0
- package/dist/chunks/dashboard-controls-BC3hDGwD.js +47 -0
- package/dist/chunks/{dashboard-json-D6k6IUk5.js → dashboard-json-B43n1l6C.js} +1 -1
- package/dist/chunks/{dashboard-json-6MWuTr1Q.js → dashboard-json-D0oSxmLa.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-CeRt95NI.js → dashboard-summary-settings-dialog-CxZAMb8B.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-MP3O8tJW.js → dashboard-summary-settings-dialog-DMWYgbwB.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BjyLKDMg.js → edit-dashboard-visual-CCoz1oGX.js} +5410 -5397
- package/dist/chunks/edit-dashboard-visual-D1mwhPGF.js +193 -0
- package/dist/chunks/{editor-action-buttons-C2bil10O.js → editor-action-buttons-B6ElCCo2.js} +2 -2
- package/dist/chunks/{editor-action-buttons-Bcbfk4x4.js → editor-action-buttons-Dbs6eczj.js} +1 -1
- package/dist/chunks/index-DAhkssOV.js +1109 -0
- package/dist/chunks/{index-O0zHE3FZ.js → index-DpSxZvI0.js} +27561 -27042
- package/dist/chunks/{notification-bell-B-UnTb7w.js → notification-bell-DoIAAZqX.js} +1 -1
- package/dist/chunks/{notification-bell-D0wrUdyr.js → notification-bell-cYCkxEbp.js} +3 -3
- package/dist/chunks/{resource-management-panel-DSrbq5W6.js → resource-management-panel-B_bDGuq_.js} +2 -2
- package/dist/chunks/{resource-management-panel-DiGJpeIw.js → resource-management-panel-L51m1i4h.js} +1 -1
- package/dist/chunks/{use-visual-utils-DTSrqSws.js → use-visual-utils-Cp5KVbr6.js} +1 -1
- package/dist/chunks/{use-visual-utils-CzXtMQW8.js → use-visual-utils-V6paZich.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 +5 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +7 -1
- package/dist/types/main.d.ts +10 -2
- package/dist/types/shared.d.ts +7 -1
- package/dist/types/surfboard.d.ts +7 -1
- package/dist/types/types.d.ts +7 -1
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-8FxQiC6H.js +0 -1837
- package/dist/chunks/dashboard-controls-B-V_E2V9.js +0 -47
- package/dist/chunks/edit-dashboard-visual-gyLMkv_8.js +0 -193
- package/dist/chunks/index-BPRqci8Y.js +0 -1109
|
@@ -0,0 +1,1847 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import { bL as Z, cL as Ma, u as w, c0 as Xe, c1 as Ye, B as E, c3 as Ze, c4 as z, cM as es, N as _s, b as G, e as ss, cN as Oa, b$ as as, f as ts, g as rs, h as ns, i as Ps, L as je, I as oe, v as Ia, a6 as $, cO as ve, c8 as qe, cP as Ta, cQ as Ls, cR as Us, c as X, cS as Rs, cT as _a, cq as os, cU as Pa, cV as Ua, cW as Ra, cX as Ga, cY as Fa, cZ as Va, H as Ne, V as Se, x as k, c_ as Gs, cA as ja, c$ as qa, w as Y, c7 as K, d0 as Ha, d1 as $a, d2 as He, d3 as za, d4 as Ba, d5 as Fs, d6 as Vs, d7 as be, d8 as ye, cw as $e, ce as ze, d9 as Be, c9 as js, da as Ke, db as qs, dc as Ka, ch as Hs, ci as $s, cj as zs, ck as Bs, cl as Ks, cm as Qs, cn as Ws, co as Qe, b_ as Qa, dd as Wa, af as Ja, U as ks, ae as ge, de as Xa, al as Ya, ag as Re, df as Za, dg as et, dh as st, aA as at, di as tt, dj as rt, bS as nt, bT as ot, bU as it, dk as lt, bV as ct, c5 as dt, as as ut, dl as mt, dm as ht, dn as pt, dp as ft, dq as gt, dr as vt, c2 as bt, a8 as yt, cb as Nt, ds as St, ak as wt, a9 as xt, ar as Dt, dt as Ct } from "./index-DpSxZvI0.js";
|
|
3
|
+
import * as A from "react";
|
|
4
|
+
import Js, { useState as S, useMemo as B, useEffect as Et, useCallback as At } from "react";
|
|
5
|
+
import "react-dom";
|
|
6
|
+
import { b as Lt, u as kt, c as Mt, A as Ot, V as It, N as Tt, U as _t } from "./notification-bell-cYCkxEbp.js";
|
|
7
|
+
import { l as Pt } from "./date-formatter-vkCj9Ct-.js";
|
|
8
|
+
import { C as Ut, D as Rt } from "./dashboard-summary-settings-dialog-CxZAMb8B.js";
|
|
9
|
+
import { u as Gt } from "./use-debounced-dirty-check-BwAbnX_5.js";
|
|
10
|
+
import { s as Ge } from "./normalize-dashboard-for-dirty-check-Bn27S0PN.js";
|
|
11
|
+
import { S as Ms } from "./editor-action-buttons-B6ElCCo2.js";
|
|
12
|
+
/**
|
|
13
|
+
* @license lucide-react v0.453.0 - ISC
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the ISC license.
|
|
16
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
const Ft = Z("FilterX", [
|
|
19
|
+
["path", { d: "M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055", key: "1fi1da" }],
|
|
20
|
+
["path", { d: "m22 3-5 5", key: "12jva0" }],
|
|
21
|
+
["path", { d: "m17 3 5 5", key: "k36vhe" }]
|
|
22
|
+
]);
|
|
23
|
+
/**
|
|
24
|
+
* @license lucide-react v0.453.0 - ISC
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the ISC license.
|
|
27
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
28
|
+
*/
|
|
29
|
+
const Vt = Z("Glasses", [
|
|
30
|
+
["circle", { cx: "6", cy: "15", r: "4", key: "vux9w4" }],
|
|
31
|
+
["circle", { cx: "18", cy: "15", r: "4", key: "18o8ve" }],
|
|
32
|
+
["path", { d: "M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2", key: "1ag4bs" }],
|
|
33
|
+
["path", { d: "M2.5 13 5 7c.7-1.3 1.4-2 3-2", key: "1hm1gs" }],
|
|
34
|
+
["path", { d: "M21.5 13 19 7c-.7-1.3-1.5-2-3-2", key: "1r31ai" }]
|
|
35
|
+
]);
|
|
36
|
+
/**
|
|
37
|
+
* @license lucide-react v0.453.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/
|
|
42
|
+
const jt = Z("Menu", [
|
|
43
|
+
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
|
|
44
|
+
["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
|
|
45
|
+
["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
|
|
46
|
+
]);
|
|
47
|
+
/**
|
|
48
|
+
* @license lucide-react v0.453.0 - ISC
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the ISC license.
|
|
51
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/
|
|
53
|
+
const qt = Z("Moon", [
|
|
54
|
+
["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
|
|
55
|
+
]);
|
|
56
|
+
/**
|
|
57
|
+
* @license lucide-react v0.453.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/
|
|
62
|
+
const Ht = Z("ShieldX", [
|
|
63
|
+
[
|
|
64
|
+
"path",
|
|
65
|
+
{
|
|
66
|
+
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",
|
|
67
|
+
key: "oel41y"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
["path", { d: "m14.5 9.5-5 5", key: "17q4r4" }],
|
|
71
|
+
["path", { d: "m9.5 9.5 5 5", key: "18nt4w" }]
|
|
72
|
+
]);
|
|
73
|
+
/**
|
|
74
|
+
* @license lucide-react v0.453.0 - ISC
|
|
75
|
+
*
|
|
76
|
+
* This source code is licensed under the ISC license.
|
|
77
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
78
|
+
*/
|
|
79
|
+
const $t = Z("Sun", [
|
|
80
|
+
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
|
|
81
|
+
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
82
|
+
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
83
|
+
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
|
|
84
|
+
["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
|
|
85
|
+
["path", { d: "M2 12h2", key: "1t8f8n" }],
|
|
86
|
+
["path", { d: "M20 12h2", key: "1q8mjw" }],
|
|
87
|
+
["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
|
|
88
|
+
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
|
|
89
|
+
]);
|
|
90
|
+
var We = { exports: {} }, Fe = {};
|
|
91
|
+
/**
|
|
92
|
+
* @license React
|
|
93
|
+
* use-sync-external-store-shim.production.js
|
|
94
|
+
*
|
|
95
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
96
|
+
*
|
|
97
|
+
* This source code is licensed under the MIT license found in the
|
|
98
|
+
* LICENSE file in the root directory of this source tree.
|
|
99
|
+
*/
|
|
100
|
+
var Os;
|
|
101
|
+
function zt() {
|
|
102
|
+
if (Os) return Fe;
|
|
103
|
+
Os = 1;
|
|
104
|
+
var s = Js;
|
|
105
|
+
function o(a, u) {
|
|
106
|
+
return a === u && (a !== 0 || 1 / a === 1 / u) || a !== a && u !== u;
|
|
107
|
+
}
|
|
108
|
+
var r = typeof Object.is == "function" ? Object.is : o, t = s.useState, l = s.useEffect, c = s.useLayoutEffect, d = s.useDebugValue;
|
|
109
|
+
function m(a, u) {
|
|
110
|
+
var p = u(), v = t({ inst: { value: p, getSnapshot: u } }), b = v[0].inst, N = v[1];
|
|
111
|
+
return c(
|
|
112
|
+
function() {
|
|
113
|
+
b.value = p, b.getSnapshot = u, h(b) && N({ inst: b });
|
|
114
|
+
},
|
|
115
|
+
[a, p, u]
|
|
116
|
+
), l(
|
|
117
|
+
function() {
|
|
118
|
+
return h(b) && N({ inst: b }), a(function() {
|
|
119
|
+
h(b) && N({ inst: b });
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
[a]
|
|
123
|
+
), d(p), p;
|
|
124
|
+
}
|
|
125
|
+
function h(a) {
|
|
126
|
+
var u = a.getSnapshot;
|
|
127
|
+
a = a.value;
|
|
128
|
+
try {
|
|
129
|
+
var p = u();
|
|
130
|
+
return !r(a, p);
|
|
131
|
+
} catch {
|
|
132
|
+
return !0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function y(a, u) {
|
|
136
|
+
return u();
|
|
137
|
+
}
|
|
138
|
+
var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? y : m;
|
|
139
|
+
return Fe.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : f, Fe;
|
|
140
|
+
}
|
|
141
|
+
var Ve = {};
|
|
142
|
+
/**
|
|
143
|
+
* @license React
|
|
144
|
+
* use-sync-external-store-shim.development.js
|
|
145
|
+
*
|
|
146
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
147
|
+
*
|
|
148
|
+
* This source code is licensed under the MIT license found in the
|
|
149
|
+
* LICENSE file in the root directory of this source tree.
|
|
150
|
+
*/
|
|
151
|
+
var Is;
|
|
152
|
+
function Bt() {
|
|
153
|
+
return Is || (Is = 1, process.env.NODE_ENV !== "production" && function() {
|
|
154
|
+
function s(p, v) {
|
|
155
|
+
return p === v && (p !== 0 || 1 / p === 1 / v) || p !== p && v !== v;
|
|
156
|
+
}
|
|
157
|
+
function o(p, v) {
|
|
158
|
+
f || l.startTransition === void 0 || (f = !0, console.error(
|
|
159
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
160
|
+
));
|
|
161
|
+
var b = v();
|
|
162
|
+
if (!a) {
|
|
163
|
+
var N = v();
|
|
164
|
+
c(b, N) || (console.error(
|
|
165
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
166
|
+
), a = !0);
|
|
167
|
+
}
|
|
168
|
+
N = d({
|
|
169
|
+
inst: { value: b, getSnapshot: v }
|
|
170
|
+
});
|
|
171
|
+
var D = N[0].inst, P = N[1];
|
|
172
|
+
return h(
|
|
173
|
+
function() {
|
|
174
|
+
D.value = b, D.getSnapshot = v, r(D) && P({ inst: D });
|
|
175
|
+
},
|
|
176
|
+
[p, b, v]
|
|
177
|
+
), m(
|
|
178
|
+
function() {
|
|
179
|
+
return r(D) && P({ inst: D }), p(function() {
|
|
180
|
+
r(D) && P({ inst: D });
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
[p]
|
|
184
|
+
), y(b), b;
|
|
185
|
+
}
|
|
186
|
+
function r(p) {
|
|
187
|
+
var v = p.getSnapshot;
|
|
188
|
+
p = p.value;
|
|
189
|
+
try {
|
|
190
|
+
var b = v();
|
|
191
|
+
return !c(p, b);
|
|
192
|
+
} catch {
|
|
193
|
+
return !0;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function t(p, v) {
|
|
197
|
+
return v();
|
|
198
|
+
}
|
|
199
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
200
|
+
var l = Js, c = typeof Object.is == "function" ? Object.is : s, d = l.useState, m = l.useEffect, h = l.useLayoutEffect, y = l.useDebugValue, f = !1, a = !1, u = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? t : o;
|
|
201
|
+
Ve.useSyncExternalStore = l.useSyncExternalStore !== void 0 ? l.useSyncExternalStore : u, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
202
|
+
}()), Ve;
|
|
203
|
+
}
|
|
204
|
+
process.env.NODE_ENV === "production" ? We.exports = zt() : We.exports = Bt();
|
|
205
|
+
var Kt = We.exports;
|
|
206
|
+
function Qt() {
|
|
207
|
+
const { setTheme: s } = Ma(), o = w(
|
|
208
|
+
(r) => r.actions.setDashboardTheme
|
|
209
|
+
);
|
|
210
|
+
return /* @__PURE__ */ n(Xe, { children: [
|
|
211
|
+
/* @__PURE__ */ e(Ye, { asChild: !0, children: /* @__PURE__ */ n(E, { className: "h-7 p-2", variant: "ghost", size: "sm", children: [
|
|
212
|
+
/* @__PURE__ */ e(
|
|
213
|
+
$t,
|
|
214
|
+
{
|
|
215
|
+
strokeWidth: 1.5,
|
|
216
|
+
className: "h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
/* @__PURE__ */ e(
|
|
220
|
+
qt,
|
|
221
|
+
{
|
|
222
|
+
strokeWidth: 1.5,
|
|
223
|
+
className: "absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "Toggle theme" })
|
|
227
|
+
] }) }),
|
|
228
|
+
/* @__PURE__ */ n(Ze, { align: "end", children: [
|
|
229
|
+
/* @__PURE__ */ e(
|
|
230
|
+
z,
|
|
231
|
+
{
|
|
232
|
+
onClick: () => {
|
|
233
|
+
s("light"), o("light");
|
|
234
|
+
},
|
|
235
|
+
children: "Light"
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ e(
|
|
239
|
+
z,
|
|
240
|
+
{
|
|
241
|
+
onClick: () => {
|
|
242
|
+
s("dark"), o("dark");
|
|
243
|
+
},
|
|
244
|
+
children: "Dark"
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ e(
|
|
248
|
+
z,
|
|
249
|
+
{
|
|
250
|
+
onClick: () => {
|
|
251
|
+
s("system"), o("system");
|
|
252
|
+
},
|
|
253
|
+
children: "System"
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] })
|
|
257
|
+
] });
|
|
258
|
+
}
|
|
259
|
+
async function Wt(s, o, r, t, l) {
|
|
260
|
+
if (!l)
|
|
261
|
+
return null;
|
|
262
|
+
const c = JSON.stringify(r), d = `${s}/v1/lens`;
|
|
263
|
+
return await es(d, l, {
|
|
264
|
+
name: o,
|
|
265
|
+
template: c,
|
|
266
|
+
filterValues: t,
|
|
267
|
+
operation: "create"
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
async function Je(s, o, r) {
|
|
271
|
+
if (!r)
|
|
272
|
+
return null;
|
|
273
|
+
const { id: t, template: l, filterValues: c, isDefault: d, shared: m } = o, h = `${s}/v1/lens`;
|
|
274
|
+
return await es(h, r, {
|
|
275
|
+
lensId: t,
|
|
276
|
+
template: l,
|
|
277
|
+
filterValues: c,
|
|
278
|
+
isDefault: d,
|
|
279
|
+
shared: m,
|
|
280
|
+
operation: "update"
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
async function Jt(s, o, r) {
|
|
284
|
+
if (!r)
|
|
285
|
+
return null;
|
|
286
|
+
const t = `${s}/v1/lens`;
|
|
287
|
+
return await es(t, r, {
|
|
288
|
+
operation: "delete",
|
|
289
|
+
lensId: o
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function Xt() {
|
|
293
|
+
const [s, o] = S(""), [r, t] = S(!1), l = w((N) => N.lenses), { setLenses: c, setSelectedLensId: d } = _s(), [m, h] = S(!1), [y, f] = S(!1), a = w((N) => N.dashboard), u = w((N) => N.filterValues), { authToken: p, tokenProps: v } = G();
|
|
294
|
+
async function b() {
|
|
295
|
+
h(!0);
|
|
296
|
+
const N = await Wt(
|
|
297
|
+
v.apiServiceUrl,
|
|
298
|
+
s,
|
|
299
|
+
a,
|
|
300
|
+
u,
|
|
301
|
+
p == null ? void 0 : p.accessToken
|
|
302
|
+
);
|
|
303
|
+
N && (c([...l || [], N]), d(N.id), f(!1)), h(!1);
|
|
304
|
+
}
|
|
305
|
+
return /* @__PURE__ */ n(ss, { open: y, onOpenChange: f, children: [
|
|
306
|
+
/* @__PURE__ */ e(Oa, { asChild: !0, children: /* @__PURE__ */ n(
|
|
307
|
+
E,
|
|
308
|
+
{
|
|
309
|
+
variant: "secondary",
|
|
310
|
+
className: "h-7 p-2",
|
|
311
|
+
size: "sm",
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ e(as, { className: "mr-2 h-4 w-4" }),
|
|
314
|
+
"Lens"
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
) }),
|
|
318
|
+
/* @__PURE__ */ n(ts, { className: "sm:max-w-[425px]", children: [
|
|
319
|
+
/* @__PURE__ */ n(rs, { children: [
|
|
320
|
+
/* @__PURE__ */ e(ns, { children: "Create Lens" }),
|
|
321
|
+
/* @__PURE__ */ e(Ps, { children: "Lenses are private by default and are only visible to you." })
|
|
322
|
+
] }),
|
|
323
|
+
/* @__PURE__ */ e("div", { className: "grid gap-4 py-4", children: /* @__PURE__ */ n("div", { className: "grid grid-cols-8 items-center gap-4", children: [
|
|
324
|
+
/* @__PURE__ */ e(je, { className: "text-right", children: "Name" }),
|
|
325
|
+
/* @__PURE__ */ e(
|
|
326
|
+
oe,
|
|
327
|
+
{
|
|
328
|
+
value: s,
|
|
329
|
+
onChange: (N) => {
|
|
330
|
+
o(N.target.value);
|
|
331
|
+
},
|
|
332
|
+
id: "name",
|
|
333
|
+
className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
] }) }),
|
|
337
|
+
r && /* @__PURE__ */ e("p", { className: "text-sm", children: "The lens name already exists. Use a differnet name." }),
|
|
338
|
+
/* @__PURE__ */ e(Ia, { children: /* @__PURE__ */ e(
|
|
339
|
+
E,
|
|
340
|
+
{
|
|
341
|
+
size: "sm",
|
|
342
|
+
variant: "outline",
|
|
343
|
+
type: "submit",
|
|
344
|
+
onClick: b,
|
|
345
|
+
disabled: m,
|
|
346
|
+
children: m ? "Creating..." : "Add"
|
|
347
|
+
}
|
|
348
|
+
) })
|
|
349
|
+
] })
|
|
350
|
+
] });
|
|
351
|
+
}
|
|
352
|
+
function Yt() {
|
|
353
|
+
const [s, o] = S(!1), r = w((a) => a.lenses), t = w((a) => a.selectedLensId), { setLenses: l, setSelectedLensId: c } = _s(), { authToken: d, tokenProps: m } = G();
|
|
354
|
+
async function h(a) {
|
|
355
|
+
c(a);
|
|
356
|
+
}
|
|
357
|
+
async function y(a) {
|
|
358
|
+
if (await Jt(m.apiServiceUrl, a, d == null ? void 0 : d.accessToken)) {
|
|
359
|
+
const p = r == null ? void 0 : r.filter((v) => v.id !== a);
|
|
360
|
+
l(p || []), c("original");
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
async function f(a) {
|
|
364
|
+
const u = r == null ? void 0 : r.map((b) => b.id === a.id ? {
|
|
365
|
+
...b,
|
|
366
|
+
isDefault: !a.isDefault
|
|
367
|
+
} : {
|
|
368
|
+
...b,
|
|
369
|
+
isDefault: !1
|
|
370
|
+
});
|
|
371
|
+
l(u || []);
|
|
372
|
+
const p = {
|
|
373
|
+
...a,
|
|
374
|
+
isDefault: !a.isDefault
|
|
375
|
+
};
|
|
376
|
+
await Je(m.apiServiceUrl, p, d == null ? void 0 : d.accessToken);
|
|
377
|
+
const v = r == null ? void 0 : r.find((b) => b.isDefault);
|
|
378
|
+
if (v && v.id !== a.id) {
|
|
379
|
+
const b = {
|
|
380
|
+
...v,
|
|
381
|
+
isDefault: !1
|
|
382
|
+
};
|
|
383
|
+
await Je(m.apiServiceUrl, b, d == null ? void 0 : d.accessToken);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return /* @__PURE__ */ n(Xe, { open: s, onOpenChange: o, children: [
|
|
387
|
+
/* @__PURE__ */ e(Ye, { asChild: !0, children: /* @__PURE__ */ e($, { tooltip: "Lenses", className: "h-7 p-2", children: /* @__PURE__ */ e(Vt, { className: "h-4 w-4" }) }) }),
|
|
388
|
+
/* @__PURE__ */ n(Ze, { align: "end", className: "w-60", children: [
|
|
389
|
+
/* @__PURE__ */ e(ve, { className: "px-3", children: "Lenses" }),
|
|
390
|
+
/* @__PURE__ */ e(qe, {}),
|
|
391
|
+
/* @__PURE__ */ n(
|
|
392
|
+
Ta,
|
|
393
|
+
{
|
|
394
|
+
value: t,
|
|
395
|
+
onValueChange: h,
|
|
396
|
+
children: [
|
|
397
|
+
/* @__PURE__ */ e(Ls, { value: "original", children: "Original" }),
|
|
398
|
+
r == null ? void 0 : r.map((a) => /* @__PURE__ */ n(
|
|
399
|
+
Ls,
|
|
400
|
+
{
|
|
401
|
+
className: "group flex justify-between gap-2",
|
|
402
|
+
value: a.id,
|
|
403
|
+
children: [
|
|
404
|
+
/* @__PURE__ */ e("p", { children: a.name }),
|
|
405
|
+
/* @__PURE__ */ n("span", { className: "flex items-center gap-3", children: [
|
|
406
|
+
/* @__PURE__ */ e(
|
|
407
|
+
Us,
|
|
408
|
+
{
|
|
409
|
+
onClick: (u) => {
|
|
410
|
+
u.preventDefault(), f(a);
|
|
411
|
+
},
|
|
412
|
+
className: X(
|
|
413
|
+
"size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
414
|
+
{
|
|
415
|
+
invisible: !a.isDefault,
|
|
416
|
+
"text-green-500": a.isDefault
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
strokeWidth: 1.5
|
|
420
|
+
}
|
|
421
|
+
),
|
|
422
|
+
/* @__PURE__ */ e(
|
|
423
|
+
Rs,
|
|
424
|
+
{
|
|
425
|
+
onClick: (u) => {
|
|
426
|
+
u.preventDefault(), y(a.id);
|
|
427
|
+
},
|
|
428
|
+
className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
429
|
+
strokeWidth: 1.5
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
] })
|
|
433
|
+
]
|
|
434
|
+
},
|
|
435
|
+
a.id
|
|
436
|
+
))
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
] })
|
|
441
|
+
] });
|
|
442
|
+
}
|
|
443
|
+
function Zt() {
|
|
444
|
+
const { displayPreferences: s, shouldShowElement: o } = _a(), { currentUser: r, userContext: t } = os(), l = B(
|
|
445
|
+
() => Pa(r),
|
|
446
|
+
[r]
|
|
447
|
+
), c = B(() => (m) => l && l[m] !== void 0 && l[m] === !1 ? !1 : o(m), [l, o, s]), d = B(
|
|
448
|
+
() => {
|
|
449
|
+
var m, h, y, f, a;
|
|
450
|
+
return {
|
|
451
|
+
canEdit: ((m = t == null ? void 0 : t.permissions) == null ? void 0 : m.canEdit) ?? Va(r),
|
|
452
|
+
canUseFilters: ((h = t == null ? void 0 : t.permissions) == null ? void 0 : h.canEdit) ?? Fa(r),
|
|
453
|
+
canManageDashboards: ((y = t == null ? void 0 : t.permissions) == null ? void 0 : y.canCreateDashboard) ?? Ga(r),
|
|
454
|
+
canCreateDashboards: ((f = t == null ? void 0 : t.permissions) == null ? void 0 : f.canCreateDashboard) ?? Ra(r),
|
|
455
|
+
canAccessVisuals: ((a = t == null ? void 0 : t.permissions) == null ? void 0 : a.canEdit) ?? Ua(r)
|
|
456
|
+
};
|
|
457
|
+
},
|
|
458
|
+
[r, t]
|
|
459
|
+
);
|
|
460
|
+
return {
|
|
461
|
+
displayPreferences: s,
|
|
462
|
+
shouldShowElement: c,
|
|
463
|
+
permissions: d,
|
|
464
|
+
currentUser: r
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
const er = async (s, o, r) => {
|
|
468
|
+
const t = `${s}/management/v1/groups`;
|
|
469
|
+
return await Gs(t, o, r);
|
|
470
|
+
}, sr = async (s, o, r) => {
|
|
471
|
+
const t = `${s}/management/v1/groups/${r}`, l = await fetch(t, {
|
|
472
|
+
method: "DELETE",
|
|
473
|
+
headers: {
|
|
474
|
+
Authorization: `Bearer ${o}`
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
if (!l.ok) {
|
|
478
|
+
const c = await l.text();
|
|
479
|
+
throw new Error(c || "Failed to delete group");
|
|
480
|
+
}
|
|
481
|
+
}, ar = async (s, o, r, t) => {
|
|
482
|
+
const l = `${s}/management/v1/groups/${r}/members`;
|
|
483
|
+
return await Gs(l, o, t);
|
|
484
|
+
}, tr = async (s, o, r, t) => {
|
|
485
|
+
const l = `${s}/management/v1/groups/${r}/members`, c = await fetch(l, {
|
|
486
|
+
method: "DELETE",
|
|
487
|
+
headers: {
|
|
488
|
+
"Content-Type": "application/json",
|
|
489
|
+
Authorization: `Bearer ${o}`
|
|
490
|
+
},
|
|
491
|
+
body: JSON.stringify(t)
|
|
492
|
+
});
|
|
493
|
+
if (!c.ok) {
|
|
494
|
+
const d = await c.text();
|
|
495
|
+
throw new Error(d || "Failed to remove group members");
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
function rr() {
|
|
499
|
+
const { authToken: s, tokenProps: o } = G(), r = Ne();
|
|
500
|
+
return Se({
|
|
501
|
+
mutationFn: (t) => er(o.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t),
|
|
502
|
+
onSuccess: () => {
|
|
503
|
+
r.invalidateQueries({ queryKey: ["groups"] }), k.success("Group created successfully");
|
|
504
|
+
},
|
|
505
|
+
onError: (t) => {
|
|
506
|
+
console.error("Failed to create group:", t), k.error("Failed to create group", {
|
|
507
|
+
description: t.message
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
function nr() {
|
|
513
|
+
const { authToken: s, tokenProps: o } = G(), r = Ne();
|
|
514
|
+
return Se({
|
|
515
|
+
mutationFn: (t) => sr(o.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t),
|
|
516
|
+
onSuccess: (t, l) => {
|
|
517
|
+
r.invalidateQueries({ queryKey: ["groups"] }), r.removeQueries({ queryKey: ["group", l] }), k.success("Group deleted successfully");
|
|
518
|
+
},
|
|
519
|
+
onError: (t) => {
|
|
520
|
+
console.error("Failed to delete group:", t), k.error("Failed to delete group", {
|
|
521
|
+
description: t.message
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
function or() {
|
|
527
|
+
const { authToken: s, tokenProps: o } = G(), r = Ne();
|
|
528
|
+
return Se({
|
|
529
|
+
mutationFn: ({
|
|
530
|
+
groupId: t,
|
|
531
|
+
data: l
|
|
532
|
+
}) => ar(o.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t, l),
|
|
533
|
+
onSuccess: (t, l) => {
|
|
534
|
+
r.invalidateQueries({ queryKey: ["group", l.groupId] }), r.invalidateQueries({
|
|
535
|
+
queryKey: ["group-members", l.groupId]
|
|
536
|
+
}), r.invalidateQueries({ queryKey: ["groups"] }), k.success("Members added successfully");
|
|
537
|
+
},
|
|
538
|
+
onError: (t) => {
|
|
539
|
+
console.error("Failed to add group members:", t), k.error("Failed to add members", {
|
|
540
|
+
description: t.message
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
function ir() {
|
|
546
|
+
const { authToken: s, tokenProps: o } = G(), r = Ne();
|
|
547
|
+
return Se({
|
|
548
|
+
mutationFn: ({
|
|
549
|
+
groupId: t,
|
|
550
|
+
data: l
|
|
551
|
+
}) => tr(o.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t, l),
|
|
552
|
+
onSuccess: (t, l) => {
|
|
553
|
+
r.invalidateQueries({ queryKey: ["group", l.groupId] }), r.invalidateQueries({
|
|
554
|
+
queryKey: ["group-members", l.groupId]
|
|
555
|
+
}), r.invalidateQueries({ queryKey: ["groups"] }), k.success("Members removed successfully");
|
|
556
|
+
},
|
|
557
|
+
onError: (t) => {
|
|
558
|
+
console.error("Failed to remove group members:", t), k.error("Failed to remove members", {
|
|
559
|
+
description: t.message
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
function lr({
|
|
565
|
+
onSuccess: s,
|
|
566
|
+
tenantId: o,
|
|
567
|
+
isTenantUser: r
|
|
568
|
+
}) {
|
|
569
|
+
const [t, l] = S(""), [c, d] = S(""), [m, h] = S({}), y = rr(), f = () => {
|
|
570
|
+
const u = {};
|
|
571
|
+
return t.trim() ? t.length < 3 ? u.name = "Group name must be at least 3 characters" : t.length > 50 && (u.name = "Group name must be less than 50 characters") : u.name = "Group name is required", c && c.length > 200 && (u.description = "Description must be less than 200 characters"), h(u), Object.keys(u).length === 0;
|
|
572
|
+
};
|
|
573
|
+
return /* @__PURE__ */ n("form", { onSubmit: async (u) => {
|
|
574
|
+
if (u.preventDefault(), !f()) return;
|
|
575
|
+
const p = {
|
|
576
|
+
name: t.trim(),
|
|
577
|
+
description: c.trim() || void 0,
|
|
578
|
+
type: r ? "TENANT_GROUP" : "ORG_GROUP",
|
|
579
|
+
...r && o ? { tenantId: o } : {}
|
|
580
|
+
};
|
|
581
|
+
try {
|
|
582
|
+
await y.mutateAsync(p), l(""), d(""), h({}), s();
|
|
583
|
+
} catch (v) {
|
|
584
|
+
console.error("Failed to create group:", v);
|
|
585
|
+
}
|
|
586
|
+
}, className: "space-y-6", children: [
|
|
587
|
+
/* @__PURE__ */ n("div", { className: "space-y-4", children: [
|
|
588
|
+
/* @__PURE__ */ n("div", { className: "space-y-2", children: [
|
|
589
|
+
/* @__PURE__ */ n(je, { htmlFor: "group-name", children: [
|
|
590
|
+
"Group Name ",
|
|
591
|
+
/* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
592
|
+
] }),
|
|
593
|
+
/* @__PURE__ */ e(
|
|
594
|
+
oe,
|
|
595
|
+
{
|
|
596
|
+
id: "group-name",
|
|
597
|
+
placeholder: "e.g., Marketing Team, Engineering Squad",
|
|
598
|
+
value: t,
|
|
599
|
+
onChange: (u) => {
|
|
600
|
+
l(u.target.value), m.name && h((p) => ({ ...p, name: "" }));
|
|
601
|
+
},
|
|
602
|
+
className: m.name ? "border-destructive" : "",
|
|
603
|
+
disabled: y.isPending
|
|
604
|
+
}
|
|
605
|
+
),
|
|
606
|
+
m.name && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: m.name })
|
|
607
|
+
] }),
|
|
608
|
+
/* @__PURE__ */ n("div", { className: "space-y-2", children: [
|
|
609
|
+
/* @__PURE__ */ n(je, { htmlFor: "group-description", children: [
|
|
610
|
+
"Description",
|
|
611
|
+
/* @__PURE__ */ e("span", { className: "ml-2 text-xs text-muted-foreground", children: "(optional)" })
|
|
612
|
+
] }),
|
|
613
|
+
/* @__PURE__ */ e(
|
|
614
|
+
ja,
|
|
615
|
+
{
|
|
616
|
+
id: "group-description",
|
|
617
|
+
placeholder: "Describe the purpose of this group...",
|
|
618
|
+
value: c,
|
|
619
|
+
onChange: (u) => {
|
|
620
|
+
d(u.target.value), m.description && h((p) => ({ ...p, description: "" }));
|
|
621
|
+
},
|
|
622
|
+
className: m.description ? "border-destructive" : "",
|
|
623
|
+
disabled: y.isPending,
|
|
624
|
+
rows: 3
|
|
625
|
+
}
|
|
626
|
+
),
|
|
627
|
+
m.description && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: m.description }),
|
|
628
|
+
/* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground", children: [
|
|
629
|
+
c.length,
|
|
630
|
+
"/200 characters"
|
|
631
|
+
] })
|
|
632
|
+
] }),
|
|
633
|
+
/* @__PURE__ */ e("div", { className: "rounded-lg border bg-muted/50 p-4", children: /* @__PURE__ */ n("div", { className: "flex gap-3", children: [
|
|
634
|
+
/* @__PURE__ */ e(qa, { className: "h-4 w-4 mt-0.5 text-muted-foreground" }),
|
|
635
|
+
/* @__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." })
|
|
636
|
+
] }) })
|
|
637
|
+
] }),
|
|
638
|
+
/* @__PURE__ */ n("div", { className: "flex justify-end gap-3", children: [
|
|
639
|
+
/* @__PURE__ */ e(
|
|
640
|
+
E,
|
|
641
|
+
{
|
|
642
|
+
type: "button",
|
|
643
|
+
variant: "outline",
|
|
644
|
+
onClick: () => {
|
|
645
|
+
l(""), d(""), h({});
|
|
646
|
+
},
|
|
647
|
+
disabled: y.isPending,
|
|
648
|
+
children: "Clear"
|
|
649
|
+
}
|
|
650
|
+
),
|
|
651
|
+
/* @__PURE__ */ e(
|
|
652
|
+
E,
|
|
653
|
+
{
|
|
654
|
+
type: "submit",
|
|
655
|
+
disabled: y.isPending || !t.trim(),
|
|
656
|
+
children: y.isPending ? /* @__PURE__ */ n(M, { children: [
|
|
657
|
+
/* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
658
|
+
"Creating..."
|
|
659
|
+
] }) : /* @__PURE__ */ n(M, { children: [
|
|
660
|
+
/* @__PURE__ */ e(K, { className: "mr-2 h-4 w-4" }),
|
|
661
|
+
"Create Group"
|
|
662
|
+
] })
|
|
663
|
+
}
|
|
664
|
+
)
|
|
665
|
+
] })
|
|
666
|
+
] });
|
|
667
|
+
}
|
|
668
|
+
function cr(s, o = []) {
|
|
669
|
+
let r = [];
|
|
670
|
+
function t(c, d) {
|
|
671
|
+
const m = A.createContext(d);
|
|
672
|
+
m.displayName = c + "Context";
|
|
673
|
+
const h = r.length;
|
|
674
|
+
r = [...r, d];
|
|
675
|
+
const y = (a) => {
|
|
676
|
+
var D;
|
|
677
|
+
const { scope: u, children: p, ...v } = a, b = ((D = u == null ? void 0 : u[s]) == null ? void 0 : D[h]) || m, N = A.useMemo(() => v, Object.values(v));
|
|
678
|
+
return /* @__PURE__ */ e(b.Provider, { value: N, children: p });
|
|
679
|
+
};
|
|
680
|
+
y.displayName = c + "Provider";
|
|
681
|
+
function f(a, u) {
|
|
682
|
+
var b;
|
|
683
|
+
const p = ((b = u == null ? void 0 : u[s]) == null ? void 0 : b[h]) || m, v = A.useContext(p);
|
|
684
|
+
if (v) return v;
|
|
685
|
+
if (d !== void 0) return d;
|
|
686
|
+
throw new Error(`\`${a}\` must be used within \`${c}\``);
|
|
687
|
+
}
|
|
688
|
+
return [y, f];
|
|
689
|
+
}
|
|
690
|
+
const l = () => {
|
|
691
|
+
const c = r.map((d) => A.createContext(d));
|
|
692
|
+
return function(m) {
|
|
693
|
+
const h = (m == null ? void 0 : m[s]) || c;
|
|
694
|
+
return A.useMemo(
|
|
695
|
+
() => ({ [`__scope${s}`]: { ...m, [s]: h } }),
|
|
696
|
+
[m, h]
|
|
697
|
+
);
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
return l.scopeName = s, [t, dr(l, ...o)];
|
|
701
|
+
}
|
|
702
|
+
function dr(...s) {
|
|
703
|
+
const o = s[0];
|
|
704
|
+
if (s.length === 1) return o;
|
|
705
|
+
const r = () => {
|
|
706
|
+
const t = s.map((l) => ({
|
|
707
|
+
useScope: l(),
|
|
708
|
+
scopeName: l.scopeName
|
|
709
|
+
}));
|
|
710
|
+
return function(c) {
|
|
711
|
+
const d = t.reduce((m, { useScope: h, scopeName: y }) => {
|
|
712
|
+
const a = h(c)[`__scope${y}`];
|
|
713
|
+
return { ...m, ...a };
|
|
714
|
+
}, {});
|
|
715
|
+
return A.useMemo(() => ({ [`__scope${o.scopeName}`]: d }), [d]);
|
|
716
|
+
};
|
|
717
|
+
};
|
|
718
|
+
return r.scopeName = o.scopeName, r;
|
|
719
|
+
}
|
|
720
|
+
var ur = [
|
|
721
|
+
"a",
|
|
722
|
+
"button",
|
|
723
|
+
"div",
|
|
724
|
+
"form",
|
|
725
|
+
"h2",
|
|
726
|
+
"h3",
|
|
727
|
+
"img",
|
|
728
|
+
"input",
|
|
729
|
+
"label",
|
|
730
|
+
"li",
|
|
731
|
+
"nav",
|
|
732
|
+
"ol",
|
|
733
|
+
"p",
|
|
734
|
+
"select",
|
|
735
|
+
"span",
|
|
736
|
+
"svg",
|
|
737
|
+
"ul"
|
|
738
|
+
], is = ur.reduce((s, o) => {
|
|
739
|
+
const r = Ha(`Primitive.${o}`), t = A.forwardRef((l, c) => {
|
|
740
|
+
const { asChild: d, ...m } = l, h = d ? r : o;
|
|
741
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ e(h, { ...m, ref: c });
|
|
742
|
+
});
|
|
743
|
+
return t.displayName = `Primitive.${o}`, { ...s, [o]: t };
|
|
744
|
+
}, {});
|
|
745
|
+
function mr() {
|
|
746
|
+
return Kt.useSyncExternalStore(
|
|
747
|
+
hr,
|
|
748
|
+
() => !0,
|
|
749
|
+
() => !1
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
function hr() {
|
|
753
|
+
return () => {
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
var ls = "Avatar", [pr] = cr(ls), [fr, Xs] = pr(ls), Ys = A.forwardRef(
|
|
757
|
+
(s, o) => {
|
|
758
|
+
const { __scopeAvatar: r, ...t } = s, [l, c] = A.useState("idle");
|
|
759
|
+
return /* @__PURE__ */ e(
|
|
760
|
+
fr,
|
|
761
|
+
{
|
|
762
|
+
scope: r,
|
|
763
|
+
imageLoadingStatus: l,
|
|
764
|
+
onImageLoadingStatusChange: c,
|
|
765
|
+
children: /* @__PURE__ */ e(is.span, { ...t, ref: o })
|
|
766
|
+
}
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
);
|
|
770
|
+
Ys.displayName = ls;
|
|
771
|
+
var Zs = "AvatarImage", ea = A.forwardRef(
|
|
772
|
+
(s, o) => {
|
|
773
|
+
const { __scopeAvatar: r, src: t, onLoadingStatusChange: l = () => {
|
|
774
|
+
}, ...c } = s, d = Xs(Zs, r), m = gr(t, c), h = $a((y) => {
|
|
775
|
+
l(y), d.onImageLoadingStatusChange(y);
|
|
776
|
+
});
|
|
777
|
+
return He(() => {
|
|
778
|
+
m !== "idle" && h(m);
|
|
779
|
+
}, [m, h]), m === "loaded" ? /* @__PURE__ */ e(is.img, { ...c, ref: o, src: t }) : null;
|
|
780
|
+
}
|
|
781
|
+
);
|
|
782
|
+
ea.displayName = Zs;
|
|
783
|
+
var sa = "AvatarFallback", aa = A.forwardRef(
|
|
784
|
+
(s, o) => {
|
|
785
|
+
const { __scopeAvatar: r, delayMs: t, ...l } = s, c = Xs(sa, r), [d, m] = A.useState(t === void 0);
|
|
786
|
+
return A.useEffect(() => {
|
|
787
|
+
if (t !== void 0) {
|
|
788
|
+
const h = window.setTimeout(() => m(!0), t);
|
|
789
|
+
return () => window.clearTimeout(h);
|
|
790
|
+
}
|
|
791
|
+
}, [t]), d && c.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ e(is.span, { ...l, ref: o }) : null;
|
|
792
|
+
}
|
|
793
|
+
);
|
|
794
|
+
aa.displayName = sa;
|
|
795
|
+
function Ts(s, o) {
|
|
796
|
+
return s ? o ? (s.src !== o && (s.src = o), s.complete && s.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
|
|
797
|
+
}
|
|
798
|
+
function gr(s, { referrerPolicy: o, crossOrigin: r }) {
|
|
799
|
+
const t = mr(), l = A.useRef(null), c = t ? (l.current || (l.current = new window.Image()), l.current) : null, [d, m] = A.useState(
|
|
800
|
+
() => Ts(c, s)
|
|
801
|
+
);
|
|
802
|
+
return He(() => {
|
|
803
|
+
m(Ts(c, s));
|
|
804
|
+
}, [c, s]), He(() => {
|
|
805
|
+
const h = (a) => () => {
|
|
806
|
+
m(a);
|
|
807
|
+
};
|
|
808
|
+
if (!c) return;
|
|
809
|
+
const y = h("loaded"), f = h("error");
|
|
810
|
+
return c.addEventListener("load", y), c.addEventListener("error", f), o && (c.referrerPolicy = o), typeof r == "string" && (c.crossOrigin = r), () => {
|
|
811
|
+
c.removeEventListener("load", y), c.removeEventListener("error", f);
|
|
812
|
+
};
|
|
813
|
+
}, [c, r, o]), d;
|
|
814
|
+
}
|
|
815
|
+
var ta = Ys, ra = ea, na = aa;
|
|
816
|
+
const cs = A.forwardRef(({ className: s, ...o }, r) => /* @__PURE__ */ e(
|
|
817
|
+
ta,
|
|
818
|
+
{
|
|
819
|
+
ref: r,
|
|
820
|
+
className: X(
|
|
821
|
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
822
|
+
s
|
|
823
|
+
),
|
|
824
|
+
...o
|
|
825
|
+
}
|
|
826
|
+
));
|
|
827
|
+
cs.displayName = ta.displayName;
|
|
828
|
+
const vr = A.forwardRef(({ className: s, ...o }, r) => /* @__PURE__ */ e(
|
|
829
|
+
ra,
|
|
830
|
+
{
|
|
831
|
+
ref: r,
|
|
832
|
+
className: X("aspect-square h-full w-full", s),
|
|
833
|
+
...o
|
|
834
|
+
}
|
|
835
|
+
));
|
|
836
|
+
vr.displayName = ra.displayName;
|
|
837
|
+
const ds = A.forwardRef(({ className: s, ...o }, r) => /* @__PURE__ */ e(
|
|
838
|
+
na,
|
|
839
|
+
{
|
|
840
|
+
ref: r,
|
|
841
|
+
className: X(
|
|
842
|
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
843
|
+
s
|
|
844
|
+
),
|
|
845
|
+
...o
|
|
846
|
+
}
|
|
847
|
+
));
|
|
848
|
+
ds.displayName = na.displayName;
|
|
849
|
+
function br({
|
|
850
|
+
open: s,
|
|
851
|
+
onOpenChange: o,
|
|
852
|
+
group: r,
|
|
853
|
+
onUpdate: t
|
|
854
|
+
}) {
|
|
855
|
+
const [l, c] = S("members"), [d, m] = S(""), [h, y] = S([]), [f, a] = S([]), { data: u, isLoading: p, refetch: v } = za(r.id), b = r.type === "TENANT_GROUP" ? "tenant" : "organization", { users: N, isLoading: D } = Ba({
|
|
856
|
+
type: b,
|
|
857
|
+
tenantId: r.tenantId || void 0,
|
|
858
|
+
active: !0,
|
|
859
|
+
limit: 100
|
|
860
|
+
}), P = or(), U = ir(), T = (u == null ? void 0 : u.members) || [], F = B(() => new Set(T.map((g) => g.userId)), [T]), V = B(() => N.filter((g) => !F.has(g.id)), [N, F]), j = B(() => {
|
|
861
|
+
if (!d) return V;
|
|
862
|
+
const g = d.toLowerCase();
|
|
863
|
+
return V.filter(
|
|
864
|
+
(L) => {
|
|
865
|
+
var O, H;
|
|
866
|
+
return ((O = L.name) == null ? void 0 : O.toLowerCase().includes(g)) || ((H = L.email) == null ? void 0 : H.toLowerCase().includes(g));
|
|
867
|
+
}
|
|
868
|
+
);
|
|
869
|
+
}, [V, d]), x = B(() => {
|
|
870
|
+
if (!d) return T;
|
|
871
|
+
const g = d.toLowerCase();
|
|
872
|
+
return T.filter(
|
|
873
|
+
(L) => {
|
|
874
|
+
var O, H, ie, le;
|
|
875
|
+
return ((H = (O = L.user) == null ? void 0 : O.name) == null ? void 0 : H.toLowerCase().includes(g)) || ((le = (ie = L.user) == null ? void 0 : ie.email) == null ? void 0 : le.toLowerCase().includes(g));
|
|
876
|
+
}
|
|
877
|
+
);
|
|
878
|
+
}, [T, d]), q = async () => {
|
|
879
|
+
if (h.length !== 0)
|
|
880
|
+
try {
|
|
881
|
+
await P.mutateAsync({
|
|
882
|
+
groupId: r.id,
|
|
883
|
+
data: {
|
|
884
|
+
userIds: h,
|
|
885
|
+
userType: b === "tenant" ? "tenant" : "org"
|
|
886
|
+
}
|
|
887
|
+
}), y([]), c("members"), v(), t == null || t();
|
|
888
|
+
} catch (g) {
|
|
889
|
+
console.error("Failed to add members:", g);
|
|
890
|
+
}
|
|
891
|
+
}, we = async () => {
|
|
892
|
+
if (f.length !== 0)
|
|
893
|
+
try {
|
|
894
|
+
await U.mutateAsync({
|
|
895
|
+
groupId: r.id,
|
|
896
|
+
data: {
|
|
897
|
+
userIds: f
|
|
898
|
+
}
|
|
899
|
+
}), a([]), v(), t == null || t();
|
|
900
|
+
} catch (g) {
|
|
901
|
+
console.error("Failed to remove members:", g);
|
|
902
|
+
}
|
|
903
|
+
}, Q = (g) => {
|
|
904
|
+
y(
|
|
905
|
+
(L) => L.includes(g) ? L.filter((O) => O !== g) : [...L, g]
|
|
906
|
+
);
|
|
907
|
+
}, W = (g) => {
|
|
908
|
+
a(
|
|
909
|
+
(L) => L.includes(g) ? L.filter((O) => O !== g) : [...L, g]
|
|
910
|
+
);
|
|
911
|
+
};
|
|
912
|
+
return /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(ss, { open: s, onOpenChange: o, children: /* @__PURE__ */ n(ts, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
|
|
913
|
+
/* @__PURE__ */ n(rs, { children: [
|
|
914
|
+
/* @__PURE__ */ e(ns, { children: r.name }),
|
|
915
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mt-1", children: /* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground", children: [
|
|
916
|
+
T.length,
|
|
917
|
+
" ",
|
|
918
|
+
T.length === 1 ? "member" : "members"
|
|
919
|
+
] }) }),
|
|
920
|
+
/* @__PURE__ */ n("p", { id: "group-members-description", className: "sr-only", children: [
|
|
921
|
+
"Add or remove members from the ",
|
|
922
|
+
r.name,
|
|
923
|
+
" group"
|
|
924
|
+
] })
|
|
925
|
+
] }),
|
|
926
|
+
/* @__PURE__ */ n(Fs, { value: l, onValueChange: (g) => {
|
|
927
|
+
c(g), m(""), a([]);
|
|
928
|
+
}, className: "mt-4", children: [
|
|
929
|
+
/* @__PURE__ */ n(Vs, { className: "grid w-full grid-cols-2", children: [
|
|
930
|
+
/* @__PURE__ */ e(be, { value: "members", children: "Current Members" }),
|
|
931
|
+
/* @__PURE__ */ e(be, { value: "add", children: "Add Members" })
|
|
932
|
+
] }),
|
|
933
|
+
/* @__PURE__ */ n(ye, { value: "members", className: "mt-4 space-y-4", children: [
|
|
934
|
+
/* @__PURE__ */ n("div", { className: "relative", children: [
|
|
935
|
+
/* @__PURE__ */ e($e, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
936
|
+
/* @__PURE__ */ e(
|
|
937
|
+
oe,
|
|
938
|
+
{
|
|
939
|
+
placeholder: "Search members...",
|
|
940
|
+
value: d,
|
|
941
|
+
onChange: (g) => m(g.target.value),
|
|
942
|
+
className: "pl-10"
|
|
943
|
+
}
|
|
944
|
+
)
|
|
945
|
+
] }),
|
|
946
|
+
/* @__PURE__ */ e(ze, { className: f.length > 0 ? "h-[300px]" : "h-[350px]", children: p ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((g) => /* @__PURE__ */ e(Be, { className: "h-16 w-full" }, g)) }) : x.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
947
|
+
/* @__PURE__ */ e(K, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
948
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: d ? "No members found" : "No members yet" }),
|
|
949
|
+
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: d ? "Try a different search" : 'Switch to the "Add Members" tab to add people to this group' })
|
|
950
|
+
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: x.map((g) => /* @__PURE__ */ e(
|
|
951
|
+
yr,
|
|
952
|
+
{
|
|
953
|
+
member: g,
|
|
954
|
+
selected: f.includes(g.userId),
|
|
955
|
+
onToggle: () => W(g.userId)
|
|
956
|
+
},
|
|
957
|
+
g.id
|
|
958
|
+
)) }) }),
|
|
959
|
+
f.length > 0 && /* @__PURE__ */ n("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
960
|
+
/* @__PURE__ */ n("span", { className: "text-sm text-muted-foreground", children: [
|
|
961
|
+
f.length,
|
|
962
|
+
" member",
|
|
963
|
+
f.length !== 1 ? "s" : "",
|
|
964
|
+
" selected"
|
|
965
|
+
] }),
|
|
966
|
+
/* @__PURE__ */ e(
|
|
967
|
+
E,
|
|
968
|
+
{
|
|
969
|
+
variant: "destructive",
|
|
970
|
+
size: "sm",
|
|
971
|
+
onClick: we,
|
|
972
|
+
disabled: U.isPending,
|
|
973
|
+
children: U.isPending ? /* @__PURE__ */ n(M, { children: [
|
|
974
|
+
/* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
975
|
+
"Removing..."
|
|
976
|
+
] }) : /* @__PURE__ */ n(M, { children: [
|
|
977
|
+
/* @__PURE__ */ e(js, { className: "mr-2 h-4 w-4" }),
|
|
978
|
+
"Remove Selected"
|
|
979
|
+
] })
|
|
980
|
+
}
|
|
981
|
+
)
|
|
982
|
+
] })
|
|
983
|
+
] }),
|
|
984
|
+
/* @__PURE__ */ n(ye, { value: "add", className: "mt-4 space-y-4", children: [
|
|
985
|
+
/* @__PURE__ */ n("div", { className: "relative", children: [
|
|
986
|
+
/* @__PURE__ */ e($e, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
987
|
+
/* @__PURE__ */ e(
|
|
988
|
+
oe,
|
|
989
|
+
{
|
|
990
|
+
placeholder: "Search users to add...",
|
|
991
|
+
value: d,
|
|
992
|
+
onChange: (g) => m(g.target.value),
|
|
993
|
+
className: "pl-10"
|
|
994
|
+
}
|
|
995
|
+
)
|
|
996
|
+
] }),
|
|
997
|
+
/* @__PURE__ */ e(ze, { className: "h-[300px]", children: D ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((g) => /* @__PURE__ */ e(Be, { className: "h-16 w-full" }, g)) }) : j.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
998
|
+
/* @__PURE__ */ e(Ke, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
999
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No available users" }),
|
|
1000
|
+
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: d ? "Try a different search" : "All eligible users are already members" })
|
|
1001
|
+
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: j.map((g) => /* @__PURE__ */ e(
|
|
1002
|
+
Nr,
|
|
1003
|
+
{
|
|
1004
|
+
user: g,
|
|
1005
|
+
selected: h.includes(g.id),
|
|
1006
|
+
onToggle: () => Q(g.id)
|
|
1007
|
+
},
|
|
1008
|
+
g.id
|
|
1009
|
+
)) }) }),
|
|
1010
|
+
h.length > 0 && /* @__PURE__ */ n("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
1011
|
+
/* @__PURE__ */ n("span", { className: "text-sm text-muted-foreground", children: [
|
|
1012
|
+
h.length,
|
|
1013
|
+
" user",
|
|
1014
|
+
h.length !== 1 ? "s" : "",
|
|
1015
|
+
" selected"
|
|
1016
|
+
] }),
|
|
1017
|
+
/* @__PURE__ */ e(
|
|
1018
|
+
E,
|
|
1019
|
+
{
|
|
1020
|
+
onClick: q,
|
|
1021
|
+
disabled: P.isPending,
|
|
1022
|
+
children: P.isPending ? /* @__PURE__ */ n(M, { children: [
|
|
1023
|
+
/* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1024
|
+
"Adding..."
|
|
1025
|
+
] }) : /* @__PURE__ */ n(M, { children: [
|
|
1026
|
+
/* @__PURE__ */ e(Ke, { className: "mr-2 h-4 w-4" }),
|
|
1027
|
+
"Add Members"
|
|
1028
|
+
] })
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
] })
|
|
1032
|
+
] })
|
|
1033
|
+
] })
|
|
1034
|
+
] }) }) });
|
|
1035
|
+
}
|
|
1036
|
+
function yr({
|
|
1037
|
+
member: s,
|
|
1038
|
+
selected: o,
|
|
1039
|
+
onToggle: r
|
|
1040
|
+
}) {
|
|
1041
|
+
var l, c, d, m;
|
|
1042
|
+
const t = ((c = (l = s.user) == null ? void 0 : l.name) == null ? void 0 : c.split(" ").map((h) => h[0]).join("").toUpperCase()) || "?";
|
|
1043
|
+
return /* @__PURE__ */ n(
|
|
1044
|
+
"div",
|
|
1045
|
+
{
|
|
1046
|
+
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
1047
|
+
onClick: r,
|
|
1048
|
+
children: [
|
|
1049
|
+
/* @__PURE__ */ e(qs, { checked: o }),
|
|
1050
|
+
/* @__PURE__ */ e(cs, { className: "h-8 w-8", children: /* @__PURE__ */ e(ds, { className: "text-xs", children: t }) }),
|
|
1051
|
+
/* @__PURE__ */ n("div", { className: "flex-1", children: [
|
|
1052
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: ((d = s.user) == null ? void 0 : d.name) || "Unknown User" }),
|
|
1053
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: (m = s.user) == null ? void 0 : m.email })
|
|
1054
|
+
] })
|
|
1055
|
+
]
|
|
1056
|
+
}
|
|
1057
|
+
);
|
|
1058
|
+
}
|
|
1059
|
+
function Nr({
|
|
1060
|
+
user: s,
|
|
1061
|
+
selected: o,
|
|
1062
|
+
onToggle: r
|
|
1063
|
+
}) {
|
|
1064
|
+
var l;
|
|
1065
|
+
const t = ((l = s.name) == null ? void 0 : l.split(" ").map((c) => c[0]).join("").toUpperCase()) || "?";
|
|
1066
|
+
return /* @__PURE__ */ n(
|
|
1067
|
+
"div",
|
|
1068
|
+
{
|
|
1069
|
+
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
1070
|
+
onClick: r,
|
|
1071
|
+
children: [
|
|
1072
|
+
/* @__PURE__ */ e(qs, { checked: o }),
|
|
1073
|
+
/* @__PURE__ */ e(cs, { className: "h-8 w-8", children: /* @__PURE__ */ e(ds, { className: "text-xs", children: t }) }),
|
|
1074
|
+
/* @__PURE__ */ n("div", { className: "flex-1", children: [
|
|
1075
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: s.name }),
|
|
1076
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: s.email })
|
|
1077
|
+
] })
|
|
1078
|
+
]
|
|
1079
|
+
}
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
function Sr({
|
|
1083
|
+
open: s,
|
|
1084
|
+
onOpenChange: o
|
|
1085
|
+
}) {
|
|
1086
|
+
const [r, t] = S("groups"), [l, c] = S(""), [d, m] = S(null), [h, y] = S(!1), [f, a] = S(null), { tokenProps: u } = G(), { currentUser: p } = os(), v = nr(), b = (p == null ? void 0 : p.type) === "tenant", N = u == null ? void 0 : u.tenantId, { groups: D, isLoading: P, refetch: U } = Ka({
|
|
1087
|
+
type: b ? "TENANT_GROUP" : "all",
|
|
1088
|
+
tenantId: b ? N : void 0,
|
|
1089
|
+
includeMembers: !1
|
|
1090
|
+
}), T = D.filter(
|
|
1091
|
+
(x) => {
|
|
1092
|
+
var q;
|
|
1093
|
+
return x.name.toLowerCase().includes(l.toLowerCase()) || ((q = x.description) == null ? void 0 : q.toLowerCase().includes(l.toLowerCase()));
|
|
1094
|
+
}
|
|
1095
|
+
), F = async () => {
|
|
1096
|
+
if (f)
|
|
1097
|
+
try {
|
|
1098
|
+
await v.mutateAsync(f.id), a(null), U();
|
|
1099
|
+
} catch (x) {
|
|
1100
|
+
console.error("Failed to delete group:", x);
|
|
1101
|
+
}
|
|
1102
|
+
}, V = (x) => {
|
|
1103
|
+
m(x), y(!0);
|
|
1104
|
+
}, j = () => {
|
|
1105
|
+
t("groups"), U();
|
|
1106
|
+
};
|
|
1107
|
+
return /* @__PURE__ */ n(M, { children: [
|
|
1108
|
+
/* @__PURE__ */ e(ss, { open: s, onOpenChange: o, children: /* @__PURE__ */ n(ts, { className: "max-w-4xl max-h-[80vh]", children: [
|
|
1109
|
+
/* @__PURE__ */ n(rs, { children: [
|
|
1110
|
+
/* @__PURE__ */ n(ns, { className: "flex items-center gap-2", children: [
|
|
1111
|
+
/* @__PURE__ */ e(K, { className: "h-5 w-5" }),
|
|
1112
|
+
"Group Management"
|
|
1113
|
+
] }),
|
|
1114
|
+
/* @__PURE__ */ e(Ps, { children: "Manage your groups, create new groups, and control group membership" })
|
|
1115
|
+
] }),
|
|
1116
|
+
/* @__PURE__ */ n(Fs, { value: r, onValueChange: t, className: "mt-4", children: [
|
|
1117
|
+
/* @__PURE__ */ n(Vs, { className: "grid w-full grid-cols-2", children: [
|
|
1118
|
+
/* @__PURE__ */ n(be, { value: "groups", className: "flex items-center gap-2", children: [
|
|
1119
|
+
/* @__PURE__ */ e(K, { className: "h-4 w-4" }),
|
|
1120
|
+
"Groups"
|
|
1121
|
+
] }),
|
|
1122
|
+
/* @__PURE__ */ n(be, { value: "create", className: "flex items-center gap-2", children: [
|
|
1123
|
+
/* @__PURE__ */ e(as, { className: "h-4 w-4" }),
|
|
1124
|
+
"Create Group"
|
|
1125
|
+
] })
|
|
1126
|
+
] }),
|
|
1127
|
+
/* @__PURE__ */ e(ye, { value: "groups", className: "mt-4", children: /* @__PURE__ */ n("div", { className: "space-y-4", children: [
|
|
1128
|
+
/* @__PURE__ */ n("div", { className: "relative", children: [
|
|
1129
|
+
/* @__PURE__ */ e($e, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
1130
|
+
/* @__PURE__ */ e(
|
|
1131
|
+
oe,
|
|
1132
|
+
{
|
|
1133
|
+
placeholder: "Search groups...",
|
|
1134
|
+
value: l,
|
|
1135
|
+
onChange: (x) => c(x.target.value),
|
|
1136
|
+
className: "pl-10"
|
|
1137
|
+
}
|
|
1138
|
+
)
|
|
1139
|
+
] }),
|
|
1140
|
+
/* @__PURE__ */ e(ze, { className: "h-[400px]", children: P ? /* @__PURE__ */ e("div", { className: "space-y-3", children: [1, 2, 3].map((x) => /* @__PURE__ */ e(Be, { className: "h-24 w-full" }, x)) }) : T.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
1141
|
+
/* @__PURE__ */ e(K, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
1142
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No groups found" }),
|
|
1143
|
+
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: l ? "Try a different search" : "Create your first group to get started" })
|
|
1144
|
+
] }) : /* @__PURE__ */ e("div", { className: "space-y-3", children: T.map((x) => /* @__PURE__ */ e(
|
|
1145
|
+
wr,
|
|
1146
|
+
{
|
|
1147
|
+
group: x,
|
|
1148
|
+
onManageMembers: () => V(x),
|
|
1149
|
+
onDelete: () => a(x),
|
|
1150
|
+
currentUserId: p == null ? void 0 : p.id
|
|
1151
|
+
},
|
|
1152
|
+
x.id
|
|
1153
|
+
)) }) })
|
|
1154
|
+
] }) }),
|
|
1155
|
+
/* @__PURE__ */ e(ye, { value: "create", className: "mt-4", children: /* @__PURE__ */ e(
|
|
1156
|
+
lr,
|
|
1157
|
+
{
|
|
1158
|
+
onSuccess: j,
|
|
1159
|
+
tenantId: N,
|
|
1160
|
+
isTenantUser: b
|
|
1161
|
+
}
|
|
1162
|
+
) })
|
|
1163
|
+
] })
|
|
1164
|
+
] }) }),
|
|
1165
|
+
d && /* @__PURE__ */ e(
|
|
1166
|
+
br,
|
|
1167
|
+
{
|
|
1168
|
+
open: h,
|
|
1169
|
+
onOpenChange: y,
|
|
1170
|
+
group: d,
|
|
1171
|
+
onUpdate: () => U()
|
|
1172
|
+
}
|
|
1173
|
+
),
|
|
1174
|
+
/* @__PURE__ */ e(
|
|
1175
|
+
Hs,
|
|
1176
|
+
{
|
|
1177
|
+
open: !!f,
|
|
1178
|
+
onOpenChange: () => a(null),
|
|
1179
|
+
children: /* @__PURE__ */ n($s, { children: [
|
|
1180
|
+
/* @__PURE__ */ n(zs, { children: [
|
|
1181
|
+
/* @__PURE__ */ e(Bs, { children: "Delete Group" }),
|
|
1182
|
+
/* @__PURE__ */ n(Ks, { children: [
|
|
1183
|
+
'Are you sure you want to delete "',
|
|
1184
|
+
f == null ? void 0 : f.name,
|
|
1185
|
+
'"? This action cannot be undone and will remove all members from the group.'
|
|
1186
|
+
] })
|
|
1187
|
+
] }),
|
|
1188
|
+
/* @__PURE__ */ n(Qs, { children: [
|
|
1189
|
+
/* @__PURE__ */ e(Ws, { children: "Cancel" }),
|
|
1190
|
+
/* @__PURE__ */ e(
|
|
1191
|
+
Qe,
|
|
1192
|
+
{
|
|
1193
|
+
onClick: F,
|
|
1194
|
+
disabled: v.isPending,
|
|
1195
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1196
|
+
children: v.isPending ? /* @__PURE__ */ n(M, { children: [
|
|
1197
|
+
/* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1198
|
+
"Deleting..."
|
|
1199
|
+
] }) : "Delete Group"
|
|
1200
|
+
}
|
|
1201
|
+
)
|
|
1202
|
+
] })
|
|
1203
|
+
] })
|
|
1204
|
+
}
|
|
1205
|
+
)
|
|
1206
|
+
] });
|
|
1207
|
+
}
|
|
1208
|
+
function wr({
|
|
1209
|
+
group: s,
|
|
1210
|
+
onManageMembers: o,
|
|
1211
|
+
onDelete: r,
|
|
1212
|
+
currentUserId: t
|
|
1213
|
+
}) {
|
|
1214
|
+
const l = s.createdBy === t;
|
|
1215
|
+
return /* @__PURE__ */ e("div", { className: "rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50", children: /* @__PURE__ */ n("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1216
|
+
/* @__PURE__ */ n("div", { className: "flex-1 space-y-2", children: [
|
|
1217
|
+
/* @__PURE__ */ n("div", { children: [
|
|
1218
|
+
/* @__PURE__ */ e("h4", { className: "font-medium", children: s.name }),
|
|
1219
|
+
s.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-1", children: s.description })
|
|
1220
|
+
] }),
|
|
1221
|
+
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-3 text-xs text-muted-foreground", children: [
|
|
1222
|
+
/* @__PURE__ */ n("span", { className: "flex items-center gap-1", children: [
|
|
1223
|
+
/* @__PURE__ */ e(K, { className: "h-3 w-3" }),
|
|
1224
|
+
s.memberCount,
|
|
1225
|
+
" ",
|
|
1226
|
+
s.memberCount === 1 ? "member" : "members"
|
|
1227
|
+
] }),
|
|
1228
|
+
/* @__PURE__ */ n("span", { children: [
|
|
1229
|
+
"Created ",
|
|
1230
|
+
Pt(new Date(s.createdAt), "MMM d, yyyy")
|
|
1231
|
+
] })
|
|
1232
|
+
] })
|
|
1233
|
+
] }),
|
|
1234
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: [
|
|
1235
|
+
/* @__PURE__ */ e(
|
|
1236
|
+
E,
|
|
1237
|
+
{
|
|
1238
|
+
variant: "ghost",
|
|
1239
|
+
size: "sm",
|
|
1240
|
+
onClick: o,
|
|
1241
|
+
title: "Manage members",
|
|
1242
|
+
children: /* @__PURE__ */ e(Ke, { className: "h-4 w-4" })
|
|
1243
|
+
}
|
|
1244
|
+
),
|
|
1245
|
+
l && /* @__PURE__ */ e(
|
|
1246
|
+
E,
|
|
1247
|
+
{
|
|
1248
|
+
variant: "ghost",
|
|
1249
|
+
size: "sm",
|
|
1250
|
+
onClick: r,
|
|
1251
|
+
title: "Delete group",
|
|
1252
|
+
className: "text-destructive hover:text-destructive",
|
|
1253
|
+
children: /* @__PURE__ */ e(js, { className: "h-4 w-4" })
|
|
1254
|
+
}
|
|
1255
|
+
)
|
|
1256
|
+
] })
|
|
1257
|
+
] }) });
|
|
1258
|
+
}
|
|
1259
|
+
function Tr() {
|
|
1260
|
+
var Ns, Ss, ws, xs;
|
|
1261
|
+
Lt(), kt();
|
|
1262
|
+
const {
|
|
1263
|
+
authToken: s,
|
|
1264
|
+
tokenProps: o,
|
|
1265
|
+
id: r
|
|
1266
|
+
} = G(), { isLocalDev: t } = Qa(), { permissions: l } = Zt(), c = Wa(), { isLoading: d } = Ja();
|
|
1267
|
+
w((i) => i.theme);
|
|
1268
|
+
const m = w(
|
|
1269
|
+
(i) => i.dashboardAssistantDraftScopeKey
|
|
1270
|
+
), h = w((i) => i.lenses), y = w((i) => i.selectedLensId), f = h == null ? void 0 : h.find((i) => i.id === y), a = w((i) => i.dashboard);
|
|
1271
|
+
w((i) => i.selectedSheetId);
|
|
1272
|
+
const u = w(
|
|
1273
|
+
(i) => i.isDashboardEditing
|
|
1274
|
+
), { setDashboardTitle: p } = w((i) => i.actions), [v, b] = S(!1), [N, D] = S(!1), [P, U] = S(!1), [T, F] = S(!1), [V, j] = S(!1), [x, q] = S(!1), [we, Q] = S(!1), [W, g] = S(null), [L, O] = S(!1), H = w((i) => i.isDashboardPanelOpen), ie = w(
|
|
1275
|
+
(i) => i.actions.setIsDashboardPanelOpen
|
|
1276
|
+
), le = w((i) => i.filterValues), C = w((i) => i.isVisualEditing);
|
|
1277
|
+
ks((i) => i.card);
|
|
1278
|
+
const ee = ge(
|
|
1279
|
+
(i) => i.selectedDashboard
|
|
1280
|
+
), ce = ge(
|
|
1281
|
+
(i) => i.initialDashboard
|
|
1282
|
+
);
|
|
1283
|
+
ge((i) => i.selectedVisual), w((i) => i.selectedFrameId), ks((i) => i.frame);
|
|
1284
|
+
const de = ee ? (Ss = ee == null ? void 0 : ee.permissions) == null ? void 0 : Ss.canEdit : (Ns = ce == null ? void 0 : ce.permissions) == null ? void 0 : Ns.canEdit, xe = w((i) => i.showFilters), oa = Xa((i) => i.setPanelOpen), ia = w(
|
|
1285
|
+
(i) => i.showDashboardJSON
|
|
1286
|
+
), De = w((i) => i.onSaveFunction), la = w(
|
|
1287
|
+
(i) => i.actions.setShowFilters
|
|
1288
|
+
), { setIsDashboardEditing: us, setShowDashboardJSON: ms } = w(
|
|
1289
|
+
(i) => i.actions
|
|
1290
|
+
), { setInitialDashboard: hs, clearSelectedDashboard: Ce } = ge(
|
|
1291
|
+
(i) => i.actions
|
|
1292
|
+
), { resources: ue } = Ya(Re.DASHBOARD), { data: Ee } = Za(), ca = ((ws = Ee == null ? void 0 : Ee.preference) == null ? void 0 : ws.defaultDashboardId) || null, { mutate: da, isPending: ua } = et(), { currentUser: ma } = os(), ha = st(ma), J = ee || ce, ps = J ? {
|
|
1293
|
+
id: J.id,
|
|
1294
|
+
title: (a == null ? void 0 : a.title) || J.title || "Dashboard"
|
|
1295
|
+
} : null, { handleAddNewFrame: pa } = at(), [Ae, Le] = S(!1), [fa, se] = S(!1), [ke, me] = S("close"), ae = tt(Re.DASHBOARD), [R, Me] = S(
|
|
1296
|
+
null
|
|
1297
|
+
), ga = async (i, I) => {
|
|
1298
|
+
if (!(a != null && a.id)) {
|
|
1299
|
+
console.log("No dashboard ID found");
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
console.log("Updating dashboard title:", {
|
|
1303
|
+
dashboardId: a.id,
|
|
1304
|
+
newTitle: i,
|
|
1305
|
+
previousTitle: I
|
|
1306
|
+
}), ae.mutate(
|
|
1307
|
+
{
|
|
1308
|
+
resourceId: a.id,
|
|
1309
|
+
data: { title: i }
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
onSuccess: () => {
|
|
1313
|
+
console.log("Dashboard title updated successfully"), k.success("Dashboard title updated");
|
|
1314
|
+
},
|
|
1315
|
+
onError: (ne) => {
|
|
1316
|
+
console.error("Failed to update dashboard title:", ne), k.error("Failed to update dashboard title"), p(I);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
);
|
|
1320
|
+
};
|
|
1321
|
+
Et(() => {
|
|
1322
|
+
if (ue && ue.length > 0) {
|
|
1323
|
+
const i = a == null ? void 0 : a.id;
|
|
1324
|
+
if (i) {
|
|
1325
|
+
const I = ue.find(
|
|
1326
|
+
(ne) => ne.id === i
|
|
1327
|
+
);
|
|
1328
|
+
I && hs(I);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}, [ue, a == null ? void 0 : a.id, hs]);
|
|
1332
|
+
const he = o.orgUserId || o.tenantId, fs = u && !C && he && de, { setDashboard: Oe } = w((i) => i.actions), va = () => {
|
|
1333
|
+
us(!0);
|
|
1334
|
+
}, Ie = () => {
|
|
1335
|
+
us(!1), ms(!1), Me(null);
|
|
1336
|
+
};
|
|
1337
|
+
Mt(
|
|
1338
|
+
u,
|
|
1339
|
+
a,
|
|
1340
|
+
R,
|
|
1341
|
+
(i) => Me(i)
|
|
1342
|
+
);
|
|
1343
|
+
const { isDirty: gs, isDirtyPending: ba, resetDirty: pe } = Gt(
|
|
1344
|
+
a,
|
|
1345
|
+
R,
|
|
1346
|
+
300,
|
|
1347
|
+
1e3,
|
|
1348
|
+
Ge
|
|
1349
|
+
), vs = At(() => R ? Ge(a) !== Ge(R) : !1, [a, R]), Te = gs || ba, te = Ae || ae.isPending, ya = () => {
|
|
1350
|
+
vs() ? (me("close"), se(!0)) : (Ie(), pe());
|
|
1351
|
+
}, Na = async () => {
|
|
1352
|
+
await _e({
|
|
1353
|
+
closeAfterSave: !0,
|
|
1354
|
+
navigateHomeAfterSave: ke === "home"
|
|
1355
|
+
});
|
|
1356
|
+
}, Sa = () => {
|
|
1357
|
+
R && Oe(R), Ie(), ke === "home" && Ce(), me("close"), se(!1), pe();
|
|
1358
|
+
}, wa = () => {
|
|
1359
|
+
R && (Oe(R), pe());
|
|
1360
|
+
}, xa = () => {
|
|
1361
|
+
if (u && vs()) {
|
|
1362
|
+
me("home"), se(!0);
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
Ce();
|
|
1366
|
+
};
|
|
1367
|
+
async function _e(i) {
|
|
1368
|
+
const I = (i == null ? void 0 : i.closeAfterSave) ?? L, ne = (i == null ? void 0 : i.navigateHomeAfterSave) ?? !1;
|
|
1369
|
+
O(I), I && se(!1);
|
|
1370
|
+
const La = Dt(a);
|
|
1371
|
+
Q(!0), g(null), Le(!0);
|
|
1372
|
+
const ka = {
|
|
1373
|
+
template: a
|
|
1374
|
+
};
|
|
1375
|
+
ae.mutate(
|
|
1376
|
+
{
|
|
1377
|
+
resourceId: a.id,
|
|
1378
|
+
data: ka
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
onSuccess: (_) => {
|
|
1382
|
+
var Cs, Es, As;
|
|
1383
|
+
const Ds = (_ == null ? void 0 : _.id) || ((Cs = _ == null ? void 0 : _.dashboard) == null ? void 0 : Cs.id) || ((Es = _ == null ? void 0 : _.resource) == null ? void 0 : Es.id) || ((As = _ == null ? void 0 : _.template) == null ? void 0 : As.id) || null;
|
|
1384
|
+
if (!a.id && Ds) {
|
|
1385
|
+
const Ue = Ct.getState(), fe = Ue.pendingDashboardDraftMigration;
|
|
1386
|
+
(fe == null ? void 0 : fe.scopeKey) === m ? Ue.actions.setPendingDashboardDraftMigrationExpectedDashboardId(
|
|
1387
|
+
Ds
|
|
1388
|
+
) : fe && Ue.actions.clearPendingDashboardDraftMigration();
|
|
1389
|
+
}
|
|
1390
|
+
Le(!1), k.success("Dashboard saved!"), Me(La), Q(!1), O(!1), I && (Ie(), pe(), ne && Ce()), me("close");
|
|
1391
|
+
},
|
|
1392
|
+
onError: () => {
|
|
1393
|
+
Le(!1), g("Failed to save dashboard. Please try again."), k.error("Failed to save dashboard");
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
);
|
|
1397
|
+
}
|
|
1398
|
+
async function Da() {
|
|
1399
|
+
if (b(!0), !y || !f) return;
|
|
1400
|
+
const i = JSON.stringify(a), I = {
|
|
1401
|
+
...f,
|
|
1402
|
+
template: i,
|
|
1403
|
+
filterValues: le
|
|
1404
|
+
};
|
|
1405
|
+
await Je(
|
|
1406
|
+
o.apiServiceUrl,
|
|
1407
|
+
I,
|
|
1408
|
+
s == null ? void 0 : s.accessToken
|
|
1409
|
+
), k.success("Lens saved"), De == null || De(a), b(!1);
|
|
1410
|
+
}
|
|
1411
|
+
const bs = (f == null ? void 0 : f.name) || a.title;
|
|
1412
|
+
ae.isPending && console.log("Title during update:", {
|
|
1413
|
+
title: bs,
|
|
1414
|
+
dashboardStateTitle: a.title,
|
|
1415
|
+
dashboardId: a == null ? void 0 : a.id,
|
|
1416
|
+
currentLensName: f == null ? void 0 : f.name
|
|
1417
|
+
});
|
|
1418
|
+
const ys = o.orgUserId || o.tenantId && o.endUserId && o.endUserEmail, Ca = !!ys && !!(s != null && s.accessToken) && !!(o != null && o.apiServiceUrl), Ea = c, re = (a == null ? void 0 : a.id) || null, Pe = !!re && ca === re, Aa = () => {
|
|
1419
|
+
re && da({
|
|
1420
|
+
dashboardId: Pe ? null : re
|
|
1421
|
+
});
|
|
1422
|
+
};
|
|
1423
|
+
return /* @__PURE__ */ n(
|
|
1424
|
+
"div",
|
|
1425
|
+
{
|
|
1426
|
+
className: "flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",
|
|
1427
|
+
role: "dashboard-controls",
|
|
1428
|
+
children: [
|
|
1429
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
1430
|
+
ys && /* @__PURE__ */ n(M, { children: [
|
|
1431
|
+
/* @__PURE__ */ e(
|
|
1432
|
+
$,
|
|
1433
|
+
{
|
|
1434
|
+
"aria-label": "Manage Dashboards",
|
|
1435
|
+
tooltip: "Manage Dashboards",
|
|
1436
|
+
onClick: () => {
|
|
1437
|
+
ie(!H);
|
|
1438
|
+
},
|
|
1439
|
+
className: "h-7 p-2",
|
|
1440
|
+
children: /* @__PURE__ */ e(jt, { className: "h-4 w-4" })
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
Ea && !C && /* @__PURE__ */ e(
|
|
1444
|
+
$,
|
|
1445
|
+
{
|
|
1446
|
+
"aria-label": "Dashboard Hub",
|
|
1447
|
+
tooltip: "Dashboard Hub",
|
|
1448
|
+
onClick: xa,
|
|
1449
|
+
className: "h-7 p-2",
|
|
1450
|
+
children: /* @__PURE__ */ e(Us, { className: "h-4 w-4" })
|
|
1451
|
+
}
|
|
1452
|
+
)
|
|
1453
|
+
] }),
|
|
1454
|
+
!C && c && (d ? /* @__PURE__ */ e(
|
|
1455
|
+
"div",
|
|
1456
|
+
{
|
|
1457
|
+
className: "h-4 w-28 rounded-md bg-muted/70 animate-pulse",
|
|
1458
|
+
"aria-label": "Loading dashboard title",
|
|
1459
|
+
role: "status",
|
|
1460
|
+
children: /* @__PURE__ */ e("span", { className: "sr-only", children: "Loading dashboard title" })
|
|
1461
|
+
}
|
|
1462
|
+
) : /* @__PURE__ */ n(M, { children: [
|
|
1463
|
+
/* @__PURE__ */ e(
|
|
1464
|
+
rt,
|
|
1465
|
+
{
|
|
1466
|
+
value: bs || "Untitled Dashboard",
|
|
1467
|
+
onSave: (i) => {
|
|
1468
|
+
console.log("EditableText onSave called:", {
|
|
1469
|
+
newTitle: i,
|
|
1470
|
+
canEditDashboard: de,
|
|
1471
|
+
dashboardId: a == null ? void 0 : a.id
|
|
1472
|
+
});
|
|
1473
|
+
const I = (a == null ? void 0 : a.title) || "";
|
|
1474
|
+
p(i), ga(i, I);
|
|
1475
|
+
},
|
|
1476
|
+
isEditable: de && !f,
|
|
1477
|
+
displayClassName: "text-sm font-medium",
|
|
1478
|
+
inputClassName: "text-sm font-medium",
|
|
1479
|
+
placeholder: "Dashboard Title",
|
|
1480
|
+
isPending: ae.isPending
|
|
1481
|
+
}
|
|
1482
|
+
),
|
|
1483
|
+
Ca && re && /* @__PURE__ */ e(nt, { children: /* @__PURE__ */ n(ot, { children: [
|
|
1484
|
+
/* @__PURE__ */ e(it, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1485
|
+
E,
|
|
1486
|
+
{
|
|
1487
|
+
variant: "ghost",
|
|
1488
|
+
size: "icon",
|
|
1489
|
+
onClick: Aa,
|
|
1490
|
+
disabled: ua || !(s != null && s.accessToken) || !(o != null && o.apiServiceUrl),
|
|
1491
|
+
className: "h-7 w-7",
|
|
1492
|
+
children: /* @__PURE__ */ e(
|
|
1493
|
+
lt,
|
|
1494
|
+
{
|
|
1495
|
+
className: X(
|
|
1496
|
+
"h-4 w-4 transition-colors",
|
|
1497
|
+
Pe ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground hover:text-yellow-400"
|
|
1498
|
+
)
|
|
1499
|
+
}
|
|
1500
|
+
)
|
|
1501
|
+
}
|
|
1502
|
+
) }),
|
|
1503
|
+
/* @__PURE__ */ e(ct, { children: /* @__PURE__ */ e("p", { children: Pe ? "Remove as default dashboard" : "Make this a default dashboard" }) })
|
|
1504
|
+
] }) })
|
|
1505
|
+
] }))
|
|
1506
|
+
] }),
|
|
1507
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
1508
|
+
C && /* @__PURE__ */ n(M, { children: [
|
|
1509
|
+
/* @__PURE__ */ e(Ot, { className: "mr-2" }),
|
|
1510
|
+
/* @__PURE__ */ e(It, { className: "h-7" })
|
|
1511
|
+
] }),
|
|
1512
|
+
t && !C && /* @__PURE__ */ n(M, { children: [
|
|
1513
|
+
/* @__PURE__ */ e(
|
|
1514
|
+
$,
|
|
1515
|
+
{
|
|
1516
|
+
tooltip: "Copy Token",
|
|
1517
|
+
onClick: () => {
|
|
1518
|
+
var i;
|
|
1519
|
+
s != null && s.accessToken && ((i = navigator == null ? void 0 : navigator.clipboard) != null && i.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"));
|
|
1520
|
+
},
|
|
1521
|
+
className: "h-7 p-2",
|
|
1522
|
+
children: /* @__PURE__ */ e(dt, { className: "h-4 w-4" })
|
|
1523
|
+
}
|
|
1524
|
+
),
|
|
1525
|
+
/* @__PURE__ */ e(
|
|
1526
|
+
$,
|
|
1527
|
+
{
|
|
1528
|
+
tooltip: "Invalidate Token",
|
|
1529
|
+
onClick: () => ut(o.apiServiceUrl),
|
|
1530
|
+
className: "h-7 p-2",
|
|
1531
|
+
children: /* @__PURE__ */ e(Ht, { className: "h-4 w-4" })
|
|
1532
|
+
}
|
|
1533
|
+
)
|
|
1534
|
+
] }),
|
|
1535
|
+
!C && c && /* @__PURE__ */ e(mt, {}),
|
|
1536
|
+
!C && c && /* @__PURE__ */ e(Tt, {}),
|
|
1537
|
+
!C && c && ((xs = J == null ? void 0 : J.permissions) == null ? void 0 : xs.canShare) && /* @__PURE__ */ e(
|
|
1538
|
+
$,
|
|
1539
|
+
{
|
|
1540
|
+
tooltip: "Share Dashboard",
|
|
1541
|
+
onClick: () => D(!0),
|
|
1542
|
+
className: "h-7 p-2",
|
|
1543
|
+
children: /* @__PURE__ */ e(ht, { className: "h-4 w-4" })
|
|
1544
|
+
}
|
|
1545
|
+
),
|
|
1546
|
+
!C && u && l.canUseFilters && c && /* @__PURE__ */ n(
|
|
1547
|
+
E,
|
|
1548
|
+
{
|
|
1549
|
+
className: "h-7 px-2",
|
|
1550
|
+
variant: "outline",
|
|
1551
|
+
onClick: () => {
|
|
1552
|
+
xe || oa("dashboard", !1), la(!xe);
|
|
1553
|
+
},
|
|
1554
|
+
size: "sm",
|
|
1555
|
+
children: [
|
|
1556
|
+
xe ? /* @__PURE__ */ e(Ft, { className: "mr-2 h-4 w-4" }) : /* @__PURE__ */ e(pt, { className: "mr-2 h-4 w-4" }),
|
|
1557
|
+
"Filter"
|
|
1558
|
+
]
|
|
1559
|
+
}
|
|
1560
|
+
),
|
|
1561
|
+
u && !C && he && t && c && /* @__PURE__ */ e(Xt, {}),
|
|
1562
|
+
!C && he && t && c && /* @__PURE__ */ e(Yt, {}),
|
|
1563
|
+
u && !C && he && f && t && c && /* @__PURE__ */ n(
|
|
1564
|
+
E,
|
|
1565
|
+
{
|
|
1566
|
+
className: "h-7 p-2",
|
|
1567
|
+
variant: "secondary",
|
|
1568
|
+
disabled: v,
|
|
1569
|
+
onClick: Da,
|
|
1570
|
+
size: "sm",
|
|
1571
|
+
children: [
|
|
1572
|
+
/* @__PURE__ */ e(Ms, { className: "mr-2 h-4 w-4" }),
|
|
1573
|
+
"Save Lens"
|
|
1574
|
+
]
|
|
1575
|
+
}
|
|
1576
|
+
),
|
|
1577
|
+
u && !C && c && /* @__PURE__ */ n(
|
|
1578
|
+
E,
|
|
1579
|
+
{
|
|
1580
|
+
variant: "outline",
|
|
1581
|
+
className: "h-7 p-2",
|
|
1582
|
+
size: "sm",
|
|
1583
|
+
disabled: !u,
|
|
1584
|
+
onClick: () => pa(),
|
|
1585
|
+
children: [
|
|
1586
|
+
/* @__PURE__ */ e(as, { className: "mr-2 h-4 w-4" }),
|
|
1587
|
+
"Visual"
|
|
1588
|
+
]
|
|
1589
|
+
}
|
|
1590
|
+
),
|
|
1591
|
+
!C && !u && de && c && /* @__PURE__ */ n(
|
|
1592
|
+
E,
|
|
1593
|
+
{
|
|
1594
|
+
variant: "outline",
|
|
1595
|
+
className: "h-7 p-2",
|
|
1596
|
+
onClick: va,
|
|
1597
|
+
size: "sm",
|
|
1598
|
+
children: [
|
|
1599
|
+
/* @__PURE__ */ e(ft, { className: "mr-2 h-4 w-4" }),
|
|
1600
|
+
"Edit"
|
|
1601
|
+
]
|
|
1602
|
+
}
|
|
1603
|
+
),
|
|
1604
|
+
fs && c && gs && /* @__PURE__ */ n(
|
|
1605
|
+
E,
|
|
1606
|
+
{
|
|
1607
|
+
variant: "outline",
|
|
1608
|
+
className: "h-7 p-2",
|
|
1609
|
+
onClick: wa,
|
|
1610
|
+
size: "sm",
|
|
1611
|
+
disabled: te,
|
|
1612
|
+
children: [
|
|
1613
|
+
/* @__PURE__ */ e(gt, { className: "mr-2 h-4 w-4" }),
|
|
1614
|
+
"Undo"
|
|
1615
|
+
]
|
|
1616
|
+
}
|
|
1617
|
+
),
|
|
1618
|
+
fs && c && /* @__PURE__ */ n("div", { className: "relative inline-flex", children: [
|
|
1619
|
+
/* @__PURE__ */ n(
|
|
1620
|
+
E,
|
|
1621
|
+
{
|
|
1622
|
+
className: X("h-7 p-2", !Te && "opacity-60"),
|
|
1623
|
+
disabled: te || !Te,
|
|
1624
|
+
onClick: () => _e(),
|
|
1625
|
+
size: "sm",
|
|
1626
|
+
children: [
|
|
1627
|
+
te ? /* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(Ms, { className: "mr-2 h-4 w-4" }),
|
|
1628
|
+
te ? "Saving..." : "Save"
|
|
1629
|
+
]
|
|
1630
|
+
}
|
|
1631
|
+
),
|
|
1632
|
+
Te && !te && /* @__PURE__ */ e(
|
|
1633
|
+
"span",
|
|
1634
|
+
{
|
|
1635
|
+
"aria-hidden": "true",
|
|
1636
|
+
className: "pointer-events-none absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full bg-orange-500 ring-2 ring-background"
|
|
1637
|
+
}
|
|
1638
|
+
)
|
|
1639
|
+
] }),
|
|
1640
|
+
!C && u && t && c && /* @__PURE__ */ e("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e(
|
|
1641
|
+
E,
|
|
1642
|
+
{
|
|
1643
|
+
className: "h-7 p-2",
|
|
1644
|
+
onClick: () => ms(!ia),
|
|
1645
|
+
size: "sm",
|
|
1646
|
+
variant: "ghost",
|
|
1647
|
+
children: /* @__PURE__ */ e(vt, { className: "h-4 w-4" })
|
|
1648
|
+
}
|
|
1649
|
+
) }),
|
|
1650
|
+
!C && t && /* @__PURE__ */ e(Qt, {}),
|
|
1651
|
+
u && !C && c && /* @__PURE__ */ n(
|
|
1652
|
+
E,
|
|
1653
|
+
{
|
|
1654
|
+
variant: "outline",
|
|
1655
|
+
className: "h-7 p-2",
|
|
1656
|
+
onClick: ya,
|
|
1657
|
+
children: [
|
|
1658
|
+
/* @__PURE__ */ e(Rs, { className: "mr-2 h-4 w-4" }),
|
|
1659
|
+
"Close"
|
|
1660
|
+
]
|
|
1661
|
+
}
|
|
1662
|
+
),
|
|
1663
|
+
!C && c && /* @__PURE__ */ n(Xe, { children: [
|
|
1664
|
+
/* @__PURE__ */ e(Ye, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1665
|
+
$,
|
|
1666
|
+
{
|
|
1667
|
+
tooltip: "More Options",
|
|
1668
|
+
className: "h-8 w-8 rounded-md border border-transparent p-0 text-muted-foreground hover:bg-muted/50 hover:text-foreground",
|
|
1669
|
+
buttonProps: { "aria-label": "More dashboard options" },
|
|
1670
|
+
children: /* @__PURE__ */ e(bt, { className: "h-4 w-4" })
|
|
1671
|
+
}
|
|
1672
|
+
) }),
|
|
1673
|
+
/* @__PURE__ */ n(
|
|
1674
|
+
Ze,
|
|
1675
|
+
{
|
|
1676
|
+
align: "end",
|
|
1677
|
+
className: "w-56 rounded-xl border border-border/60 p-1 shadow-sm",
|
|
1678
|
+
children: [
|
|
1679
|
+
/* @__PURE__ */ e(ve, { className: "px-2.5 text-xs font-medium text-muted-foreground", children: "Automation" }),
|
|
1680
|
+
/* @__PURE__ */ n(
|
|
1681
|
+
z,
|
|
1682
|
+
{
|
|
1683
|
+
onClick: () => F(!0),
|
|
1684
|
+
className: "flex items-center gap-2",
|
|
1685
|
+
children: [
|
|
1686
|
+
/* @__PURE__ */ e(yt, { className: "mr-2 h-4 w-4" }),
|
|
1687
|
+
"Schedule Dashboard"
|
|
1688
|
+
]
|
|
1689
|
+
}
|
|
1690
|
+
),
|
|
1691
|
+
/* @__PURE__ */ e(qe, {}),
|
|
1692
|
+
ha && /* @__PURE__ */ n(M, { children: [
|
|
1693
|
+
/* @__PURE__ */ e(ve, { className: "px-2.5 text-xs font-medium text-muted-foreground", children: "Access" }),
|
|
1694
|
+
/* @__PURE__ */ n(
|
|
1695
|
+
z,
|
|
1696
|
+
{
|
|
1697
|
+
onClick: () => U(!0),
|
|
1698
|
+
className: "flex items-center gap-2",
|
|
1699
|
+
children: [
|
|
1700
|
+
/* @__PURE__ */ e(K, { className: "mr-2 h-4 w-4" }),
|
|
1701
|
+
"Manage Groups"
|
|
1702
|
+
]
|
|
1703
|
+
}
|
|
1704
|
+
),
|
|
1705
|
+
/* @__PURE__ */ e(qe, {})
|
|
1706
|
+
] }),
|
|
1707
|
+
/* @__PURE__ */ e(ve, { className: "px-2.5 text-xs font-medium text-muted-foreground", children: "Preferences" }),
|
|
1708
|
+
/* @__PURE__ */ n(
|
|
1709
|
+
z,
|
|
1710
|
+
{
|
|
1711
|
+
onClick: () => j(!0),
|
|
1712
|
+
className: "flex items-center gap-2",
|
|
1713
|
+
children: [
|
|
1714
|
+
/* @__PURE__ */ e(Nt, { className: "mr-2 h-4 w-4" }),
|
|
1715
|
+
"Calendar Preferences"
|
|
1716
|
+
]
|
|
1717
|
+
}
|
|
1718
|
+
),
|
|
1719
|
+
/* @__PURE__ */ n(
|
|
1720
|
+
z,
|
|
1721
|
+
{
|
|
1722
|
+
onClick: () => q(!0),
|
|
1723
|
+
className: "flex items-center gap-2",
|
|
1724
|
+
children: [
|
|
1725
|
+
/* @__PURE__ */ e(St, { className: "mr-2 h-4 w-4" }),
|
|
1726
|
+
"Summary Settings"
|
|
1727
|
+
]
|
|
1728
|
+
}
|
|
1729
|
+
)
|
|
1730
|
+
]
|
|
1731
|
+
}
|
|
1732
|
+
)
|
|
1733
|
+
] }),
|
|
1734
|
+
N && ps && /* @__PURE__ */ e(
|
|
1735
|
+
wt,
|
|
1736
|
+
{
|
|
1737
|
+
resource: ps,
|
|
1738
|
+
resourceType: Re.DASHBOARD,
|
|
1739
|
+
onClose: () => D(!1)
|
|
1740
|
+
}
|
|
1741
|
+
),
|
|
1742
|
+
/* @__PURE__ */ e(
|
|
1743
|
+
Sr,
|
|
1744
|
+
{
|
|
1745
|
+
open: P,
|
|
1746
|
+
onOpenChange: U
|
|
1747
|
+
}
|
|
1748
|
+
),
|
|
1749
|
+
(a == null ? void 0 : a.id) && /* @__PURE__ */ e(
|
|
1750
|
+
xt,
|
|
1751
|
+
{
|
|
1752
|
+
open: T,
|
|
1753
|
+
onOpenChange: F,
|
|
1754
|
+
dashboardId: a.id,
|
|
1755
|
+
dashboardName: a == null ? void 0 : a.title
|
|
1756
|
+
}
|
|
1757
|
+
),
|
|
1758
|
+
/* @__PURE__ */ e(
|
|
1759
|
+
Ut,
|
|
1760
|
+
{
|
|
1761
|
+
open: V,
|
|
1762
|
+
onOpenChange: j
|
|
1763
|
+
}
|
|
1764
|
+
),
|
|
1765
|
+
/* @__PURE__ */ e(
|
|
1766
|
+
Rt,
|
|
1767
|
+
{
|
|
1768
|
+
open: x,
|
|
1769
|
+
onOpenChange: q,
|
|
1770
|
+
dashboard: a,
|
|
1771
|
+
disabled: !u,
|
|
1772
|
+
onApply: (i) => Oe({
|
|
1773
|
+
...a,
|
|
1774
|
+
summary: i
|
|
1775
|
+
})
|
|
1776
|
+
}
|
|
1777
|
+
),
|
|
1778
|
+
/* @__PURE__ */ e(
|
|
1779
|
+
Hs,
|
|
1780
|
+
{
|
|
1781
|
+
open: we,
|
|
1782
|
+
onOpenChange: (i) => {
|
|
1783
|
+
!i && Ae && !W || (Q(i), i || (g(null), O(!1)));
|
|
1784
|
+
},
|
|
1785
|
+
children: /* @__PURE__ */ n($s, { className: "max-w-sm", children: [
|
|
1786
|
+
/* @__PURE__ */ n(zs, { children: [
|
|
1787
|
+
/* @__PURE__ */ e(Bs, { children: W ? "Save failed" : "Saving dashboard" }),
|
|
1788
|
+
/* @__PURE__ */ e(Ks, { className: "pt-2", children: W ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." })
|
|
1789
|
+
] }),
|
|
1790
|
+
/* @__PURE__ */ e(Qs, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: W ? /* @__PURE__ */ n(M, { children: [
|
|
1791
|
+
/* @__PURE__ */ e(
|
|
1792
|
+
Ws,
|
|
1793
|
+
{
|
|
1794
|
+
onClick: () => {
|
|
1795
|
+
Q(!1), g(null), O(!1);
|
|
1796
|
+
},
|
|
1797
|
+
className: "m-0",
|
|
1798
|
+
children: "Close"
|
|
1799
|
+
}
|
|
1800
|
+
),
|
|
1801
|
+
/* @__PURE__ */ e(
|
|
1802
|
+
Qe,
|
|
1803
|
+
{
|
|
1804
|
+
onClick: () => _e({
|
|
1805
|
+
closeAfterSave: L,
|
|
1806
|
+
navigateHomeAfterSave: ke === "home"
|
|
1807
|
+
}),
|
|
1808
|
+
className: "m-0",
|
|
1809
|
+
children: "Retry"
|
|
1810
|
+
}
|
|
1811
|
+
)
|
|
1812
|
+
] }) : /* @__PURE__ */ n(
|
|
1813
|
+
Qe,
|
|
1814
|
+
{
|
|
1815
|
+
disabled: !0,
|
|
1816
|
+
className: "m-0 cursor-default",
|
|
1817
|
+
children: [
|
|
1818
|
+
/* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1819
|
+
"Saving..."
|
|
1820
|
+
]
|
|
1821
|
+
}
|
|
1822
|
+
) })
|
|
1823
|
+
] })
|
|
1824
|
+
}
|
|
1825
|
+
),
|
|
1826
|
+
/* @__PURE__ */ e(
|
|
1827
|
+
_t,
|
|
1828
|
+
{
|
|
1829
|
+
open: fa,
|
|
1830
|
+
onOpenChange: (i) => {
|
|
1831
|
+
se(i);
|
|
1832
|
+
},
|
|
1833
|
+
onSave: Na,
|
|
1834
|
+
onDiscard: Sa,
|
|
1835
|
+
isSaving: Ae,
|
|
1836
|
+
saveLabel: "Save",
|
|
1837
|
+
discardLabel: "Discard"
|
|
1838
|
+
}
|
|
1839
|
+
)
|
|
1840
|
+
] })
|
|
1841
|
+
]
|
|
1842
|
+
}
|
|
1843
|
+
);
|
|
1844
|
+
}
|
|
1845
|
+
export {
|
|
1846
|
+
Tr as default
|
|
1847
|
+
};
|