@nivaro/react 0.3.44 → 0.3.45
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +38 -5
- package/dist/shared/components/CollectionBrowserView.js +1390 -1358
- package/dist/shared/components/DataTable.js +356 -334
- package/dist/shared/components/ProfileView.js +16 -21
- package/dist/shared/components/command-center/CommandCenterView.js +90 -355
- package/dist/shared/components/command-center/Header.js +70 -0
- package/dist/shared/components/command-center/PeekPanel.js +6 -0
- package/dist/shared/components/command-center/api.js +26 -0
- package/dist/shared/components/command-center/panels/AttentionPanel.js +6 -0
- package/dist/shared/components/command-center/panels/FeedPanel.js +33 -0
- package/dist/shared/components/command-center/panels/FlowPanel.js +61 -0
- package/dist/shared/components/command-center/panels/ForecastPanel.js +6 -0
- package/dist/shared/components/command-center/panels/MapPanel.js +74 -0
- package/dist/shared/components/command-center/panels/PartnersPanel.js +6 -0
- package/dist/shared/components/command-center/panels/PeoplePanel.js +47 -0
- package/dist/shared/components/command-center/panels/RegionPicker.js +6 -0
- package/dist/shared/components/command-center/panels/SystemPanel.js +53 -0
- package/dist/shared/components/command-center/panels/ThroughputPanel.js +6 -0
- package/dist/shared/components/command-center/panels/TimeBar.js +10 -0
- package/dist/shared/components/command-center/panels/TrafficPanel.js +11 -0
- package/dist/shared/components/command-center/panels/WorkloadPanel.js +6 -0
- package/dist/shared/components/command-center/panels/registry.js +28 -0
- package/dist/shared/components/command-center/state.js +12 -0
- package/dist/shared/components/command-center/theme.js +66 -0
- package/dist/shared/components/imports/ImportConsole.js +48 -47
- package/dist/shared/components/notifications/TestMyRules.js +39 -38
- package/dist/shared/components/profile/TeamsConnect.js +2 -2
- package/dist/shared/components/queue/QueueQuickFilters.js +81 -63
- package/dist/shared/components/queue/QueueWorklist.js +598 -586
- package/dist/shared/lib/quick-filter-cascade.js +29 -0
- package/package.json +1 -1
|
@@ -303,7 +303,8 @@ function st() {
|
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
),
|
|
306
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "plays when a notification or a direct message arrives" })
|
|
306
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "plays when a notification or a direct message arrives" }),
|
|
307
|
+
/* @__PURE__ */ e("span", { className: "ml-auto", children: /* @__PURE__ */ e(Ie, {}) })
|
|
307
308
|
] }),
|
|
308
309
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2 text-[12.5px] text-slate-600 dark:text-muted-foreground", children: [
|
|
309
310
|
/* @__PURE__ */ e(
|
|
@@ -340,26 +341,20 @@ function st() {
|
|
|
340
341
|
"Sound",
|
|
341
342
|
/* @__PURE__ */ e(Z, { text: "A different sound for this category, or none. Default follows the Sound setting above." })
|
|
342
343
|
] }),
|
|
343
|
-
cell: (n, b) => /* @__PURE__ */
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
{
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
),
|
|
358
|
-
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
359
|
-
/* @__PURE__ */ e(Ie, {}),
|
|
360
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "see what would happen to a notification for you right now, and which rule decides it" })
|
|
361
|
-
] })
|
|
362
|
-
] })
|
|
344
|
+
cell: (n, b) => /* @__PURE__ */ e("div", { className: "inline-block", children: /* @__PURE__ */ e(
|
|
345
|
+
U,
|
|
346
|
+
{
|
|
347
|
+
ariaLabel: `Sound for ${b}`,
|
|
348
|
+
value: L[n] ?? "default",
|
|
349
|
+
options: [
|
|
350
|
+
{ value: "default", label: "Default" },
|
|
351
|
+
{ value: "off", label: "None" },
|
|
352
|
+
{ value: "subtle", label: "Subtle blip" },
|
|
353
|
+
{ value: "chime", label: "Chime" }
|
|
354
|
+
],
|
|
355
|
+
onChange: (N) => x(n, N)
|
|
356
|
+
}
|
|
357
|
+
) })
|
|
363
358
|
}
|
|
364
359
|
}
|
|
365
360
|
),
|
|
@@ -1,361 +1,96 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsx as t, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { useState as n, useMemo as y, useContext as F } from "react";
|
|
3
|
+
import { useNavigation as Q } from "../../context.js";
|
|
4
|
+
import { useCcQuery as P } from "./api.js";
|
|
5
|
+
import { Header as T } from "./Header.js";
|
|
6
|
+
import { PeekPanel as D } from "./PeekPanel.js";
|
|
7
|
+
import { CC_PANELS as I } from "./panels/registry.js";
|
|
8
|
+
import { EMPTY_FILTERS as S, CcContext as g } from "./state.js";
|
|
9
|
+
import { useAppIsDark as j, ccVars as H } from "./theme.js";
|
|
10
|
+
function G({
|
|
11
|
+
/** Fallback map collections when the instance has no Command Center config yet. */
|
|
12
|
+
geoCollections: p = ["locations"],
|
|
13
|
+
recordUrl: i,
|
|
14
|
+
isAdmin: s = !1,
|
|
15
|
+
kiosk: a = null
|
|
16
|
+
}) {
|
|
17
|
+
const { navigate: m } = Q(), u = j(), [r, f] = n(null), [d, c] = n(null), [o, e] = n(null), [v, E] = n(S), [x, A] = n(null), [C, N] = n(!1), [k, _] = n(null), h = y(
|
|
18
|
+
() => i ?? ((l, M) => `/collections/${l}/${M}`),
|
|
19
|
+
[i]
|
|
20
|
+
), w = y(
|
|
21
|
+
() => ({
|
|
22
|
+
isAdmin: s,
|
|
23
|
+
kiosk: a,
|
|
24
|
+
config: null,
|
|
25
|
+
snapshot: null,
|
|
26
|
+
snapshotError: !1,
|
|
27
|
+
updatedAt: null,
|
|
28
|
+
region: r,
|
|
29
|
+
setRegion: f,
|
|
30
|
+
at: d,
|
|
31
|
+
setAt: c,
|
|
32
|
+
mapCollection: o,
|
|
33
|
+
setMapCollection: e,
|
|
34
|
+
filters: v,
|
|
35
|
+
setFilters: E,
|
|
36
|
+
peek: x,
|
|
37
|
+
setPeek: (l) => {
|
|
38
|
+
l && m(h(l.collection, l.id)), A(null);
|
|
39
|
+
},
|
|
40
|
+
focusMap: (l) => _({ ...l, nonce: Date.now() }),
|
|
41
|
+
mapFocus: k,
|
|
42
|
+
tv: C,
|
|
43
|
+
setTv: N,
|
|
44
|
+
navigate: m,
|
|
45
|
+
recordUrl: h
|
|
46
|
+
}),
|
|
47
|
+
[s, a, r, d, o, v, x, k, C, m, h]
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ t(g.Provider, { value: w, children: /* @__PURE__ */ t(L, { fallbackCollections: p, appDark: u }) });
|
|
13
50
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
recordUrl: r
|
|
51
|
+
function L({
|
|
52
|
+
fallbackCollections: p,
|
|
53
|
+
appDark: i
|
|
18
54
|
}) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const e = ((t == null ? void 0 : t.people.offices) ?? []).map((n, _) => ({
|
|
52
|
-
id: `office-${_}`,
|
|
53
|
-
lat: n.lat,
|
|
54
|
-
lng: n.lng,
|
|
55
|
-
count: n.count,
|
|
56
|
-
label: `${n.label}${n.names.length ? ` — ${n.names.slice(0, 5).join(", ")}${n.names.length > 5 ? ` +${n.names.length - 5}` : ""}` : ""}`,
|
|
57
|
-
color: "#34d399"
|
|
58
|
-
})), i = new Map(((t == null ? void 0 : t.people.by_region) ?? []).map((n) => [n.region_id, n.count])), s = y.filter((n) => (i.get(n.id) ?? 0) > 0).map((n) => ({
|
|
59
|
-
id: String(n.id),
|
|
60
|
-
lat: n.lat,
|
|
61
|
-
lng: n.lng,
|
|
62
|
-
count: i.get(n.id) ?? 0,
|
|
63
|
-
label: n.label,
|
|
64
|
-
color: "#34d399"
|
|
65
|
-
}));
|
|
66
|
-
return [...e, ...s];
|
|
67
|
-
}, [y, t, N]), m = t == null ? void 0 : t.throughput, w = m ? m.transitions_today - m.transitions_yesterday_same_time : 0;
|
|
68
|
-
return /* @__PURE__ */ l("div", { className: "flex h-full min-h-0 flex-1 flex-col gap-3 bg-[#0b1220] p-4 text-slate-200", children: [
|
|
69
|
-
/* @__PURE__ */ l("div", { className: "flex shrink-0 flex-wrap items-center gap-x-6 gap-y-2", children: [
|
|
70
|
-
/* @__PURE__ */ a("h1", { className: "text-[16px] font-semibold tracking-[-0.01em] text-white", children: "Command Center" }),
|
|
71
|
-
/* @__PURE__ */ a("span", { className: "font-mono text-[13px] tabular-nums text-slate-400", children: D.toLocaleTimeString() }),
|
|
72
|
-
/* @__PURE__ */ l("span", { className: "flex items-center gap-1.5 text-[12.5px] text-slate-300", children: [
|
|
73
|
-
/* @__PURE__ */ a("span", { className: "h-2 w-2 rounded-full bg-emerald-400" }),
|
|
74
|
-
(t == null ? void 0 : t.people.online_count) ?? "–",
|
|
75
|
-
" online",
|
|
76
|
-
t && t.people.idle_count > 0 && /* @__PURE__ */ l("span", { className: "text-slate-500", children: [
|
|
77
|
-
"· ",
|
|
78
|
-
t.people.idle_count,
|
|
79
|
-
" idle"
|
|
80
|
-
] })
|
|
81
|
-
] }),
|
|
82
|
-
m && /* @__PURE__ */ l("span", { className: "text-[12.5px] text-slate-300", children: [
|
|
83
|
-
/* @__PURE__ */ a("b", { className: "tabular-nums", children: m.transitions_today }),
|
|
84
|
-
" transitions today",
|
|
85
|
-
" ",
|
|
86
|
-
/* @__PURE__ */ l("span", { className: w >= 0 ? "text-emerald-400" : "text-amber-400", children: [
|
|
87
|
-
"(",
|
|
88
|
-
w >= 0 ? "+" : "",
|
|
89
|
-
w,
|
|
90
|
-
" vs yesterday)"
|
|
91
|
-
] })
|
|
92
|
-
] }),
|
|
93
|
-
t && t.risk.open_issues > 0 && /* @__PURE__ */ l(
|
|
94
|
-
"button",
|
|
95
|
-
{
|
|
96
|
-
type: "button",
|
|
97
|
-
onClick: () => b("/issues"),
|
|
98
|
-
className: "rounded-full bg-red-500/15 px-2.5 py-0.5 text-[12px] font-medium text-red-400 hover:bg-red-500/25",
|
|
99
|
-
children: [
|
|
100
|
-
t.risk.open_issues,
|
|
101
|
-
" open issues"
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
/* @__PURE__ */ a(
|
|
106
|
-
"button",
|
|
107
|
-
{
|
|
108
|
-
type: "button",
|
|
109
|
-
onClick: () => void q.invalidateQueries({ queryKey: ["command-center"] }),
|
|
110
|
-
className: "ml-auto rounded-md border border-white/15 px-2.5 py-1 text-[11.5px] text-slate-300 hover:bg-white/5",
|
|
111
|
-
children: "Refresh"
|
|
112
|
-
}
|
|
113
|
-
)
|
|
114
|
-
] }),
|
|
115
|
-
/* @__PURE__ */ l("div", { className: "grid min-h-0 flex-1 gap-3 xl:grid-cols-[1fr_340px]", children: [
|
|
116
|
-
/* @__PURE__ */ l("div", { className: `${p} flex min-h-[420px] flex-col overflow-hidden`, children: [
|
|
117
|
-
/* @__PURE__ */ l("div", { className: f, children: [
|
|
118
|
-
/* @__PURE__ */ a("span", { className: u, children: "Live map" }),
|
|
119
|
-
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
120
|
-
x.map((e) => {
|
|
121
|
-
const i = d && o === e;
|
|
122
|
-
return /* @__PURE__ */ a(
|
|
123
|
-
"button",
|
|
124
|
-
{
|
|
125
|
-
type: "button",
|
|
126
|
-
onClick: () => {
|
|
127
|
-
o === e ? C((s) => !s) : (L(e), C(!0));
|
|
128
|
-
},
|
|
129
|
-
className: `rounded px-2 py-0.5 text-[11px] ${i ? "bg-nvr-cyan font-medium text-[#172940]" : "text-slate-400 hover:bg-white/5"}`,
|
|
130
|
-
title: i ? "Hide this layer" : "Show this layer",
|
|
131
|
-
children: B(e.replace(/_/g, " "))
|
|
132
|
-
},
|
|
133
|
-
e
|
|
134
|
-
);
|
|
135
|
-
}),
|
|
136
|
-
/* @__PURE__ */ a(
|
|
137
|
-
"button",
|
|
138
|
-
{
|
|
139
|
-
type: "button",
|
|
140
|
-
onClick: () => j((e) => !e),
|
|
141
|
-
className: `rounded px-2 py-0.5 text-[11px] ${N ? "bg-emerald-400/20 font-medium text-emerald-300" : "text-slate-400 hover:bg-white/5"}`,
|
|
142
|
-
title: "Online users by region (from scope placements)",
|
|
143
|
-
children: "People"
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
] })
|
|
147
|
-
] }),
|
|
148
|
-
/* @__PURE__ */ a("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ a(
|
|
149
|
-
H,
|
|
150
|
-
{
|
|
151
|
-
pins: S,
|
|
152
|
-
bubbles: v,
|
|
153
|
-
focus: P,
|
|
154
|
-
onPinClick: (e) => b(
|
|
155
|
-
r ? r(o, e) : `/collections/${o}/${e}`
|
|
156
|
-
),
|
|
157
|
-
statusLine: `${d ? `${S.length} ${o.replace(/_/g, " ")}${c != null && c.truncated ? " (first 500)" : ""}` : `${o.replace(/_/g, " ")} hidden`}${v.length > 0 ? ` · ${v.length} groups with people on` : ""} · © OpenStreetMap`,
|
|
158
|
-
minHeight: 380
|
|
159
|
-
}
|
|
160
|
-
) })
|
|
161
|
-
] }),
|
|
162
|
-
/* @__PURE__ */ l("div", { className: "flex min-h-0 flex-col gap-3 overflow-y-auto", children: [
|
|
163
|
-
/* @__PURE__ */ l("div", { className: p, children: [
|
|
164
|
-
/* @__PURE__ */ a("div", { className: f, children: /* @__PURE__ */ a("span", { className: u, children: "Pipeline flow" }) }),
|
|
165
|
-
/* @__PURE__ */ l("div", { className: "space-y-3 p-3", children: [
|
|
166
|
-
((t == null ? void 0 : t.flow) ?? []).map((e) => {
|
|
167
|
-
const i = e.states.reduce((s, n) => s + n.count, 0);
|
|
168
|
-
return /* @__PURE__ */ l("div", { children: [
|
|
169
|
-
/* @__PURE__ */ l("div", { className: "mb-1 flex items-baseline justify-between", children: [
|
|
170
|
-
/* @__PURE__ */ a("span", { className: "text-[12px] font-medium text-slate-200", children: e.template_name }),
|
|
171
|
-
/* @__PURE__ */ l("span", { className: "text-[11px] tabular-nums text-slate-500", children: [
|
|
172
|
-
i,
|
|
173
|
-
" open"
|
|
174
|
-
] })
|
|
175
|
-
] }),
|
|
176
|
-
/* @__PURE__ */ a("div", { className: "flex h-2.5 overflow-hidden rounded-full bg-white/5", children: e.states.map((s) => /* @__PURE__ */ a(
|
|
177
|
-
"button",
|
|
178
|
-
{
|
|
179
|
-
type: "button",
|
|
180
|
-
onClick: () => b(`/collections/${e.collection}`),
|
|
181
|
-
className: "h-full transition-opacity hover:opacity-75",
|
|
182
|
-
style: {
|
|
183
|
-
width: `${Math.max(2, s.count / Math.max(1, i) * 100)}%`,
|
|
184
|
-
background: s.color ?? "#00a5cc"
|
|
185
|
-
},
|
|
186
|
-
"data-tip": `${s.label}: ${s.count}`
|
|
187
|
-
},
|
|
188
|
-
s.key
|
|
189
|
-
)) }),
|
|
190
|
-
/* @__PURE__ */ a("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-0.5", children: e.states.map((s) => /* @__PURE__ */ l(
|
|
191
|
-
"span",
|
|
192
|
-
{
|
|
193
|
-
className: "flex items-center gap-1 text-[10.5px] text-slate-400",
|
|
194
|
-
children: [
|
|
195
|
-
/* @__PURE__ */ a(
|
|
196
|
-
"span",
|
|
197
|
-
{
|
|
198
|
-
className: "h-1.5 w-1.5 rounded-full",
|
|
199
|
-
style: { background: s.color ?? "#00a5cc" }
|
|
200
|
-
}
|
|
201
|
-
),
|
|
202
|
-
s.label,
|
|
203
|
-
" ",
|
|
204
|
-
/* @__PURE__ */ a("b", { className: "tabular-nums text-slate-300", children: s.count })
|
|
205
|
-
]
|
|
206
|
-
},
|
|
207
|
-
s.key
|
|
208
|
-
)) })
|
|
209
|
-
] }, e.collection);
|
|
210
|
-
}),
|
|
211
|
-
((t == null ? void 0 : t.flow) ?? []).length === 0 && /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-500", children: "No workflow-bound collections visible to you." })
|
|
212
|
-
] })
|
|
213
|
-
] }),
|
|
214
|
-
/* @__PURE__ */ l("div", { className: p, children: [
|
|
215
|
-
/* @__PURE__ */ l("div", { className: f, children: [
|
|
216
|
-
/* @__PURE__ */ a("span", { className: u, children: "People on now" }),
|
|
217
|
-
/* @__PURE__ */ a("span", { className: "text-[11px] tabular-nums text-slate-500", children: (t == null ? void 0 : t.people.online_count) ?? 0 })
|
|
218
|
-
] }),
|
|
219
|
-
/* @__PURE__ */ l("div", { className: "space-y-2.5 p-3", children: [
|
|
220
|
-
((t == null ? void 0 : t.people.regions) ?? []).map((e) => {
|
|
221
|
-
const i = e.region_id != null ? y.find((n) => n.id === e.region_id) : null, s = e.lat != null && e.lng != null ? { lat: e.lat, lng: e.lng, zoom: 12 } : i ? { lat: i.lat, lng: i.lng, zoom: 8 } : null;
|
|
222
|
-
return /* @__PURE__ */ l("div", { children: [
|
|
223
|
-
/* @__PURE__ */ l(
|
|
224
|
-
"button",
|
|
225
|
-
{
|
|
226
|
-
type: "button",
|
|
227
|
-
disabled: !s,
|
|
228
|
-
onClick: () => s && A({ ...s, nonce: Date.now() }),
|
|
229
|
-
className: `flex w-full items-center gap-1.5 text-left ${s ? "group cursor-pointer" : "cursor-default"}`,
|
|
230
|
-
title: s ? "Show this group on the map" : "No map placement for this group",
|
|
231
|
-
children: [
|
|
232
|
-
/* @__PURE__ */ a("span", { className: "flex h-3.5 w-3.5 items-center justify-center rounded-full border-2 border-dashed border-emerald-400/80 bg-emerald-400/25" }),
|
|
233
|
-
/* @__PURE__ */ a("span", { className: "text-[11.5px] font-semibold uppercase tracking-wide text-emerald-300 group-hover:underline", children: e.label }),
|
|
234
|
-
/* @__PURE__ */ a("span", { className: "text-[11px] tabular-nums text-slate-500", children: e.count }),
|
|
235
|
-
s && /* @__PURE__ */ a("span", { className: "ml-auto text-[10.5px] text-slate-500 opacity-0 transition-opacity group-hover:opacity-100", children: "show on map →" })
|
|
236
|
-
]
|
|
237
|
-
}
|
|
238
|
-
),
|
|
239
|
-
/* @__PURE__ */ a("div", { className: "mt-1 flex flex-wrap gap-1.5 pl-5", children: e.names.map((n, _) => /* @__PURE__ */ a(
|
|
240
|
-
"span",
|
|
241
|
-
{
|
|
242
|
-
className: "rounded-full bg-white/5 px-2 py-0.5 text-[11.5px] text-slate-300",
|
|
243
|
-
children: n
|
|
244
|
-
},
|
|
245
|
-
_
|
|
246
|
-
)) })
|
|
247
|
-
] }, `${e.region_id ?? "x"}:${e.label}`);
|
|
248
|
-
}),
|
|
249
|
-
((t == null ? void 0 : t.people.regions) ?? []).length === 0 && /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-500", children: "Nobody online right now." })
|
|
250
|
-
] })
|
|
55
|
+
const s = F(g);
|
|
56
|
+
if (!s) throw new Error("Command Center board outside its provider");
|
|
57
|
+
const a = P("/snapshot", void 0, { refetchInterval: 2e4 }), u = P("/config", void 0, {
|
|
58
|
+
staleTime: 5 * 6e4,
|
|
59
|
+
lenses: !1,
|
|
60
|
+
retry: !1
|
|
61
|
+
}).data ?? {
|
|
62
|
+
geo_collections: p.map((o) => ({ key: o, label: "" })),
|
|
63
|
+
regions: [],
|
|
64
|
+
region_label: null,
|
|
65
|
+
stuck_days: 7
|
|
66
|
+
}, r = {
|
|
67
|
+
...s,
|
|
68
|
+
config: u,
|
|
69
|
+
snapshot: a.data ?? null,
|
|
70
|
+
snapshotError: a.isError,
|
|
71
|
+
updatedAt: a.dataUpdatedAt || null
|
|
72
|
+
}, f = i || s.tv ? "dark" : "light", d = I.filter((o) => {
|
|
73
|
+
var e;
|
|
74
|
+
return !o.adminOnly || r.isAdmin || !!((e = r.snapshot) != null && e.health);
|
|
75
|
+
}), c = (o) => d.filter((e) => e.area === o).map((e) => /* @__PURE__ */ t(e.component, {}, e.key));
|
|
76
|
+
return /* @__PURE__ */ t(g.Provider, { value: r, children: /* @__PURE__ */ b(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: "flex h-full min-h-0 flex-1 flex-col gap-3 bg-[var(--cc-bg)] p-4 text-[var(--cc-text)]",
|
|
80
|
+
style: H(f),
|
|
81
|
+
"data-cc-mode": f,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ t(T, {}),
|
|
84
|
+
/* @__PURE__ */ b("div", { className: "grid min-h-0 flex-1 gap-3 xl:grid-cols-[1fr_360px]", children: [
|
|
85
|
+
/* @__PURE__ */ t("div", { className: "flex min-h-0 flex-col gap-3", children: c("main") }),
|
|
86
|
+
/* @__PURE__ */ t("div", { className: "flex min-h-0 flex-col gap-3 overflow-y-auto", children: c("rail") })
|
|
251
87
|
] }),
|
|
252
|
-
(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
t.health.instances,
|
|
258
|
-
" instance(s)"
|
|
259
|
-
] })
|
|
260
|
-
] }),
|
|
261
|
-
/* @__PURE__ */ l("div", { className: "grid grid-cols-2 gap-x-4 gap-y-1.5 p-3 text-[12px]", children: [
|
|
262
|
-
/* @__PURE__ */ l("span", { className: "flex items-center gap-1.5", children: [
|
|
263
|
-
/* @__PURE__ */ a(
|
|
264
|
-
"span",
|
|
265
|
-
{
|
|
266
|
-
className: `h-2 w-2 rounded-full ${t.health.db_ok ? "bg-emerald-400" : "bg-red-500"}`
|
|
267
|
-
}
|
|
268
|
-
),
|
|
269
|
-
"Database"
|
|
270
|
-
] }),
|
|
271
|
-
/* @__PURE__ */ l("span", { className: "flex items-center gap-1.5", children: [
|
|
272
|
-
/* @__PURE__ */ a(
|
|
273
|
-
"span",
|
|
274
|
-
{
|
|
275
|
-
className: `h-2 w-2 rounded-full ${t.health.redis_ok ? "bg-emerald-400" : "bg-red-500"}`
|
|
276
|
-
}
|
|
277
|
-
),
|
|
278
|
-
"Redis"
|
|
279
|
-
] }),
|
|
280
|
-
/* @__PURE__ */ l("span", { children: [
|
|
281
|
-
"Errors 1h:",
|
|
282
|
-
" ",
|
|
283
|
-
/* @__PURE__ */ a(
|
|
284
|
-
"b",
|
|
285
|
-
{
|
|
286
|
-
className: `tabular-nums ${t.health.errors_1h > 20 ? "text-red-400" : "text-slate-200"}`,
|
|
287
|
-
children: t.health.errors_1h
|
|
288
|
-
}
|
|
289
|
-
),
|
|
290
|
-
/* @__PURE__ */ l("span", { className: "text-slate-500", children: [
|
|
291
|
-
" ",
|
|
292
|
-
"/ ",
|
|
293
|
-
t.health.requests_1h.toLocaleString(),
|
|
294
|
-
" req"
|
|
295
|
-
] })
|
|
296
|
-
] }),
|
|
297
|
-
/* @__PURE__ */ l("span", { children: [
|
|
298
|
-
"Jobs: ",
|
|
299
|
-
/* @__PURE__ */ a("b", { className: "tabular-nums", children: t.health.jobs_running }),
|
|
300
|
-
" running",
|
|
301
|
-
t.health.jobs_failed_1h > 0 && /* @__PURE__ */ l("b", { className: "tabular-nums text-amber-400", children: [
|
|
302
|
-
" ",
|
|
303
|
-
"· ",
|
|
304
|
-
t.health.jobs_failed_1h,
|
|
305
|
-
" failed"
|
|
306
|
-
] })
|
|
307
|
-
] }),
|
|
308
|
-
/* @__PURE__ */ l("span", { children: [
|
|
309
|
-
"RSS: ",
|
|
310
|
-
/* @__PURE__ */ l("b", { className: "tabular-nums", children: [
|
|
311
|
-
t.health.runtime.rss_mb,
|
|
312
|
-
" MB"
|
|
313
|
-
] })
|
|
314
|
-
] }),
|
|
315
|
-
/* @__PURE__ */ l("span", { children: [
|
|
316
|
-
"Loop lag:",
|
|
317
|
-
" ",
|
|
318
|
-
/* @__PURE__ */ l(
|
|
319
|
-
"b",
|
|
320
|
-
{
|
|
321
|
-
className: `tabular-nums ${t.health.runtime.event_loop_lag_ms.max_1m > 300 ? "text-red-400" : ""}`,
|
|
322
|
-
children: [
|
|
323
|
-
t.health.runtime.event_loop_lag_ms.max_1m,
|
|
324
|
-
" ms"
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
)
|
|
328
|
-
] })
|
|
329
|
-
] })
|
|
330
|
-
] })
|
|
331
|
-
] })
|
|
332
|
-
] }),
|
|
333
|
-
/* @__PURE__ */ a("div", { className: `${p} shrink-0`, children: /* @__PURE__ */ l("div", { className: "flex items-center gap-3 overflow-x-auto px-3 py-2", children: [
|
|
334
|
-
/* @__PURE__ */ a("span", { className: `${u} shrink-0`, children: "Live" }),
|
|
335
|
-
((t == null ? void 0 : t.activity) ?? []).map((e) => /* @__PURE__ */ l(
|
|
336
|
-
"button",
|
|
337
|
-
{
|
|
338
|
-
type: "button",
|
|
339
|
-
onClick: () => e.collection && e.item ? b(
|
|
340
|
-
r ? r(e.collection, e.item) : `/collections/${e.collection}/${e.item}`
|
|
341
|
-
) : void 0,
|
|
342
|
-
className: "flex shrink-0 items-center gap-1.5 rounded-full bg-white/5 px-2.5 py-1 text-[11.5px] text-slate-300 hover:bg-white/10",
|
|
343
|
-
children: [
|
|
344
|
-
/* @__PURE__ */ a("span", { className: "tabular-nums text-slate-500", children: Q(e.timestamp) }),
|
|
345
|
-
/* @__PURE__ */ a("span", { className: "font-medium text-slate-200", children: e.user_name || "System" }),
|
|
346
|
-
/* @__PURE__ */ a("span", { className: "text-slate-400", children: e.action.replace(/-/g, " ") }),
|
|
347
|
-
e.collection && /* @__PURE__ */ l("span", { className: "text-slate-400", children: [
|
|
348
|
-
e.collection.replace(/_/g, " "),
|
|
349
|
-
e.item ? ` #${e.item}` : ""
|
|
350
|
-
] })
|
|
351
|
-
]
|
|
352
|
-
},
|
|
353
|
-
e.id
|
|
354
|
-
)),
|
|
355
|
-
((t == null ? void 0 : t.activity) ?? []).length === 0 && /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-500", children: "Quiet — no recent activity you can see." })
|
|
356
|
-
] }) })
|
|
357
|
-
] });
|
|
88
|
+
c("bottom"),
|
|
89
|
+
/* @__PURE__ */ t(D, {})
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
) });
|
|
358
93
|
}
|
|
359
94
|
export {
|
|
360
|
-
|
|
95
|
+
G as CommandCenterView
|
|
361
96
|
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as i } from "@tanstack/react-query";
|
|
3
|
+
import { RegionPicker as c } from "./panels/RegionPicker.js";
|
|
4
|
+
import { SystemPill as l } from "./panels/SystemPanel.js";
|
|
5
|
+
import { TimeBar as m, BriefButton as d } from "./panels/TimeBar.js";
|
|
6
|
+
import { useCc as p } from "./state.js";
|
|
7
|
+
import { FAINT as u, BUTTON as x } from "./theme.js";
|
|
8
|
+
function _() {
|
|
9
|
+
const a = p(), o = i(), e = a.snapshot, r = e == null ? void 0 : e.throughput, n = r ? r.transitions_today - r.transitions_yesterday_same_time : 0;
|
|
10
|
+
return /* @__PURE__ */ s("header", { className: "flex shrink-0 flex-wrap items-center gap-x-5 gap-y-2", children: [
|
|
11
|
+
/* @__PURE__ */ t("h1", { className: "text-[16px] font-semibold tracking-[-0.01em] text-[var(--cc-strong)]", children: "Command Center" }),
|
|
12
|
+
/* @__PURE__ */ t(c, {}),
|
|
13
|
+
/* @__PURE__ */ s("span", { className: "flex items-center gap-1.5 text-[12.5px] text-[var(--cc-text)]", children: [
|
|
14
|
+
/* @__PURE__ */ t("span", { className: "h-2 w-2 rounded-full bg-[var(--cc-people)]" }),
|
|
15
|
+
(e == null ? void 0 : e.people.online_count) ?? "–",
|
|
16
|
+
" online",
|
|
17
|
+
e && e.people.idle_count > 0 && /* @__PURE__ */ s("span", { className: u, children: [
|
|
18
|
+
"· ",
|
|
19
|
+
e.people.idle_count,
|
|
20
|
+
" idle"
|
|
21
|
+
] })
|
|
22
|
+
] }),
|
|
23
|
+
r && /* @__PURE__ */ s("span", { className: "text-[12.5px] text-[var(--cc-text)]", children: [
|
|
24
|
+
/* @__PURE__ */ t("b", { className: "tabular-nums", children: r.transitions_today }),
|
|
25
|
+
" transitions today",
|
|
26
|
+
" ",
|
|
27
|
+
/* @__PURE__ */ s(
|
|
28
|
+
"span",
|
|
29
|
+
{
|
|
30
|
+
className: n >= 0 ? "text-[var(--cc-good-text)]" : "text-[var(--cc-warn-text)]",
|
|
31
|
+
children: [
|
|
32
|
+
"(",
|
|
33
|
+
n >= 0 ? "+" : "",
|
|
34
|
+
n,
|
|
35
|
+
" vs yesterday)"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] }),
|
|
40
|
+
e && e.risk.open_issues > 0 && /* @__PURE__ */ s(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
type: "button",
|
|
44
|
+
onClick: () => a.navigate("/issues"),
|
|
45
|
+
className: "rounded-full bg-red-500/15 px-2.5 py-0.5 text-[12px] font-medium text-[var(--cc-bad-text)] hover:bg-red-500/25",
|
|
46
|
+
children: [
|
|
47
|
+
e.risk.open_issues,
|
|
48
|
+
" open issues"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ t(l, {}),
|
|
53
|
+
/* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
54
|
+
/* @__PURE__ */ t(m, {}),
|
|
55
|
+
/* @__PURE__ */ t(d, {}),
|
|
56
|
+
/* @__PURE__ */ t(
|
|
57
|
+
"button",
|
|
58
|
+
{
|
|
59
|
+
type: "button",
|
|
60
|
+
onClick: () => void o.invalidateQueries({ queryKey: ["command-center"] }),
|
|
61
|
+
className: x,
|
|
62
|
+
children: "Refresh"
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] })
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
_ as Header
|
|
70
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useQuery as f } from "@tanstack/react-query";
|
|
2
|
+
import { useNivaroClient as g } from "../../context.js";
|
|
3
|
+
import { get as p } from "../../lib/commands.js";
|
|
4
|
+
import { useCc as y } from "./state.js";
|
|
5
|
+
function q(e, r) {
|
|
6
|
+
return {
|
|
7
|
+
...r ?? {},
|
|
8
|
+
...e.region ? { region: e.region } : {},
|
|
9
|
+
...e.at ? { at: new Date(e.at).toISOString() } : {}
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function Q(e, r, o) {
|
|
13
|
+
const s = g(), { region: c, at: u, kiosk: t } = y(), { lenses: i, ...m } = o ?? {}, n = {
|
|
14
|
+
...i !== !1 ? q({ region: c, at: u }, r) : r ?? {},
|
|
15
|
+
...t ? { kiosk: t } : {}
|
|
16
|
+
};
|
|
17
|
+
return f({
|
|
18
|
+
queryKey: ["command-center", e, n],
|
|
19
|
+
queryFn: () => s.request(p(`/command-center${e}`, n)).then((a) => a.data),
|
|
20
|
+
...m
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
q as ccParams,
|
|
25
|
+
Q as useCcQuery
|
|
26
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as t, jsxs as c, Fragment as r } from "react/jsx-runtime";
|
|
2
|
+
import { useCc as o } from "../state.js";
|
|
3
|
+
import { PANEL as a, FAINT as i, rel as m } from "../theme.js";
|
|
4
|
+
function x() {
|
|
5
|
+
const { snapshot: n, setPeek: l } = o(), s = (n == null ? void 0 : n.activity) ?? [];
|
|
6
|
+
return /* @__PURE__ */ t("section", { className: `${a} shrink-0`, "data-cc-panel": "feed", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-3 overflow-x-auto px-3 py-2", children: [
|
|
7
|
+
/* @__PURE__ */ t("h2", { className: "shrink-0 text-[12.5px] font-semibold text-[var(--cc-strong)]", children: "Live" }),
|
|
8
|
+
s.map((e) => /* @__PURE__ */ c(
|
|
9
|
+
"button",
|
|
10
|
+
{
|
|
11
|
+
type: "button",
|
|
12
|
+
onClick: () => e.collection && e.item ? l({ collection: e.collection, id: e.item }) : void 0,
|
|
13
|
+
className: "flex shrink-0 items-center gap-1.5 rounded-full bg-[var(--cc-chip)] px-2.5 py-1 text-[11.5px] text-[var(--cc-text)] hover:bg-[var(--cc-chip-hover)]",
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ t("span", { className: `tabular-nums ${i}`, children: m(e.timestamp) }),
|
|
16
|
+
e.sentence ? /* @__PURE__ */ t("span", { children: e.sentence }) : /* @__PURE__ */ c(r, { children: [
|
|
17
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: e.user_name || "System" }),
|
|
18
|
+
/* @__PURE__ */ t("span", { className: "text-[var(--cc-muted)]", children: e.action.replace(/-/g, " ") }),
|
|
19
|
+
e.collection && /* @__PURE__ */ c("span", { className: "text-[var(--cc-muted)]", children: [
|
|
20
|
+
e.collection.replace(/_/g, " "),
|
|
21
|
+
e.item ? ` #${e.item}` : ""
|
|
22
|
+
] })
|
|
23
|
+
] })
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
e.id
|
|
27
|
+
)),
|
|
28
|
+
s.length === 0 && /* @__PURE__ */ t("span", { className: `text-[12px] ${i}`, children: "Quiet — no recent activity you can see." })
|
|
29
|
+
] }) });
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
x as FeedPanel
|
|
33
|
+
};
|