@burdenoff/microfe-bigconsole 2026.1123.1 → 2026.1123.3
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/bigconsole/compare/compareEngine.js +79 -66
- package/dist/bigconsole/components/fleet/FleetBadge.d.ts +12 -0
- package/dist/bigconsole/components/fleet/FleetBadge.js +61 -0
- package/dist/bigconsole/components/fleet/FleetBreadcrumb.d.ts +14 -0
- package/dist/bigconsole/components/fleet/FleetBreadcrumb.js +46 -0
- package/dist/bigconsole/components/fleet/FleetCardActions.d.ts +17 -0
- package/dist/bigconsole/components/fleet/FleetCardActions.js +78 -0
- package/dist/bigconsole/components/fleet/LinkToMasterDialog.d.ts +24 -0
- package/dist/bigconsole/components/fleet/LinkToMasterDialog.js +108 -0
- package/dist/bigconsole/components/widgets/WidgetWrapper.js +144 -148
- package/dist/bigconsole/hooks/useDashboardOperations.d.ts +8 -0
- package/dist/bigconsole/hooks/useDashboardOperations.js +2 -0
- package/dist/bigconsole/hooks/useFleetBoardActions.d.ts +18 -0
- package/dist/bigconsole/hooks/useFleetBoardActions.js +54 -0
- package/dist/bigconsole/hooks/useFleetBreadcrumb.d.ts +13 -0
- package/dist/bigconsole/hooks/useFleetBreadcrumb.js +52 -0
- package/dist/bigconsole/hooks/useFleetCopyTotals.d.ts +11 -0
- package/dist/bigconsole/hooks/useFleetCopyTotals.js +52 -0
- package/dist/bigconsole/hooks/useFleetLinks.d.ts +19 -0
- package/dist/bigconsole/hooks/useFleetLinks.js +74 -0
- package/dist/bigconsole/hooks/useFleetMasterSearch.d.ts +13 -0
- package/dist/bigconsole/hooks/useFleetMasterSearch.js +62 -0
- package/dist/bigconsole/pages/DashboardViewPage.js +313 -303
- package/dist/bigconsole/pages/DashboardsPage.js +733 -435
- package/dist/bigconsole/utils/fleetTree.d.ts +50 -0
- package/dist/bigconsole/utils/fleetTree.js +64 -0
- package/dist/bigconsole/utils/legacyChartRows.d.ts +2 -0
- package/dist/bigconsole/utils/legacyChartRows.js +19 -0
- package/dist/generated/global-types.d.ts +39 -7
- package/dist/generated/wspace-operations.d.ts +86 -0
- package/dist/generated/wspace-operations.js +602 -147
- package/dist/generated/wspace-types.d.ts +3847 -23
- package/package.json +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { numericSeriesKeys as e } from "../components/widgets/chart/charts/numericSeries.js";
|
|
2
2
|
import { classifyChartData as t } from "../components/widgets/chart/chartRows.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { legacyChartToRows as n } from "../utils/legacyChartRows.js";
|
|
4
|
+
import { normalizeMetricData as r } from "../components/widgets/metric-card/metricData.js";
|
|
5
|
+
import { normalizeTableRows as i } from "../components/widgets/table/tableRows.js";
|
|
5
6
|
// src/bigconsole/compare/compareEngine.ts
|
|
6
|
-
var
|
|
7
|
+
var a = {
|
|
7
8
|
absolute: null,
|
|
8
9
|
percent: null,
|
|
9
10
|
direction: "unknown"
|
|
10
11
|
};
|
|
11
|
-
function
|
|
12
|
+
function o(e) {
|
|
12
13
|
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
13
14
|
if (typeof e == "string" && e.trim() !== "") {
|
|
14
15
|
let t = Number(e);
|
|
@@ -16,65 +17,65 @@ function a(e) {
|
|
|
16
17
|
}
|
|
17
18
|
return null;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
let n =
|
|
21
|
-
if (n === null || r === null) return
|
|
22
|
-
let
|
|
20
|
+
function s(e, t) {
|
|
21
|
+
let n = o(e), r = o(t);
|
|
22
|
+
if (n === null || r === null) return a;
|
|
23
|
+
let i = r - n;
|
|
23
24
|
return {
|
|
24
|
-
absolute:
|
|
25
|
-
percent: n === 0 ? null :
|
|
26
|
-
direction:
|
|
25
|
+
absolute: i,
|
|
26
|
+
percent: n === 0 ? null : i / Math.abs(n) * 100,
|
|
27
|
+
direction: i === 0 ? "same" : i > 0 ? "up" : "down"
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
|
-
var
|
|
30
|
+
var c = (e) => ({
|
|
30
31
|
kind: "unavailable",
|
|
31
32
|
reason: e
|
|
32
|
-
}),
|
|
33
|
-
from:
|
|
34
|
-
to:
|
|
35
|
-
change:
|
|
33
|
+
}), l = (e) => typeof e == "number" ? Number.isFinite(e) ? e : null : typeof e == "string" ? e : null, u = (e, t) => ({
|
|
34
|
+
from: l(e),
|
|
35
|
+
to: l(t),
|
|
36
|
+
change: s(e, t)
|
|
36
37
|
});
|
|
37
|
-
function
|
|
38
|
-
let i = e ?? void 0, a = (e) =>
|
|
39
|
-
return o === void 0 &&
|
|
38
|
+
function d(e, t, n) {
|
|
39
|
+
let i = e ?? void 0, a = (e) => r(e, i), o = a(t), s = a(n);
|
|
40
|
+
return o === void 0 && s === void 0 ? c("unreadable_data") : {
|
|
40
41
|
kind: "metric",
|
|
41
|
-
value:
|
|
42
|
+
value: u(o?.value, s?.value),
|
|
42
43
|
from: o ?? null,
|
|
43
|
-
to:
|
|
44
|
+
to: s ?? null
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
-
let
|
|
49
|
-
return
|
|
47
|
+
var f = /* @__PURE__ */ new Set(["bar", "line"]);
|
|
48
|
+
function p(e) {
|
|
49
|
+
let r = t(n(e) ?? e);
|
|
50
|
+
return r.kind === "rows" ? r.rows : r.kind === "empty" ? [] : null;
|
|
50
51
|
}
|
|
51
|
-
var
|
|
52
|
+
var m = (e, t) => {
|
|
52
53
|
let n = e[t];
|
|
53
54
|
return n == null ? "" : String(n);
|
|
54
55
|
};
|
|
55
|
-
function
|
|
56
|
+
function h(e, t) {
|
|
56
57
|
let n = /* @__PURE__ */ new Map();
|
|
57
58
|
for (let r of e) {
|
|
58
|
-
let e =
|
|
59
|
+
let e = m(r, t);
|
|
59
60
|
if (n.has(e)) return null;
|
|
60
61
|
n.set(e, r);
|
|
61
62
|
}
|
|
62
63
|
return n;
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
-
let i =
|
|
66
|
-
if (i === null || a === null) return
|
|
67
|
-
let o = String(t?.xAxisField || t?.labelField || "name"),
|
|
68
|
-
return d === null ||
|
|
65
|
+
function g(t, n, r) {
|
|
66
|
+
let i = p(n), a = p(r);
|
|
67
|
+
if (i === null || a === null) return c("unreadable_data");
|
|
68
|
+
let o = String(t?.xAxisField || t?.labelField || "name"), s = Array.isArray(t?.selectedFields) ? t.selectedFields : void 0, l = [.../* @__PURE__ */ new Set([...e(a, o, s), ...e(i, o, s)])], d = h(i, o), f = h(a, o);
|
|
69
|
+
return d === null || f === null ? c("duplicate_keys") : {
|
|
69
70
|
kind: "chart",
|
|
70
|
-
series:
|
|
71
|
-
points: [.../* @__PURE__ */ new Set([...
|
|
71
|
+
series: l,
|
|
72
|
+
points: [.../* @__PURE__ */ new Set([...f.keys(), ...d.keys()])].map((e) => ({
|
|
72
73
|
label: e,
|
|
73
|
-
values:
|
|
74
|
+
values: l.map((t) => u(d.get(e)?.[t], f.get(e)?.[t]))
|
|
74
75
|
}))
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function _(e, t) {
|
|
78
79
|
let n = (Array.isArray(e?.columns) ? e.columns : []).flatMap((e) => {
|
|
79
80
|
if (typeof e == "string") return [e];
|
|
80
81
|
if (e && typeof e == "object") {
|
|
@@ -87,18 +88,18 @@ function g(e, t) {
|
|
|
87
88
|
let r = t[0];
|
|
88
89
|
return r ? Object.keys(r) : [];
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function v(e, t) {
|
|
91
92
|
if (e === t) return !0;
|
|
92
93
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
|
|
93
|
-
if (Array.isArray(e) || Array.isArray(t)) return Array.isArray(e) && Array.isArray(t) && e.length === t.length && e.every((e, n) =>
|
|
94
|
+
if (Array.isArray(e) || Array.isArray(t)) return Array.isArray(e) && Array.isArray(t) && e.length === t.length && e.every((e, n) => v(e, t[n]));
|
|
94
95
|
let n = e, r = t, i = Object.keys(n);
|
|
95
|
-
return i.length === Object.keys(r).length && i.every((e) => e in r &&
|
|
96
|
+
return i.length === Object.keys(r).length && i.every((e) => e in r && v(n[e], r[e]));
|
|
96
97
|
}
|
|
97
|
-
var
|
|
98
|
-
function
|
|
98
|
+
var y = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
99
|
+
function b(e, t) {
|
|
99
100
|
return t.length > 0 && t.every((e) => e.id !== void 0 && e.id !== null) ? "id" : e[0] ?? null;
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
+
function x(e, t) {
|
|
102
103
|
let n = /* @__PURE__ */ new Map();
|
|
103
104
|
for (let r of e) {
|
|
104
105
|
let e = r[t], i = e == null ? "" : String(e);
|
|
@@ -107,22 +108,34 @@ function b(e, t) {
|
|
|
107
108
|
}
|
|
108
109
|
return n;
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
-
let
|
|
112
|
-
if (!
|
|
113
|
-
let l =
|
|
114
|
-
if (u === null) return
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
function S(e, t, n) {
|
|
112
|
+
let r = i(t), o = i(n);
|
|
113
|
+
if (!r.every(y) || !o.every(y)) return c("unreadable_data");
|
|
114
|
+
let l = _(e, [...o, ...r]), u = b(l, [...o, ...r]);
|
|
115
|
+
if (u === null && o.length === 0 && r.length === 0) return {
|
|
116
|
+
kind: "table",
|
|
117
|
+
columns: l,
|
|
118
|
+
keyColumn: "",
|
|
119
|
+
rows: [],
|
|
120
|
+
summary: {
|
|
121
|
+
added: 0,
|
|
122
|
+
removed: 0,
|
|
123
|
+
changed: 0,
|
|
124
|
+
unchanged: 0
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
if (u === null) return c("no_key_column");
|
|
128
|
+
let d = x(r, u), f = x(o, u);
|
|
129
|
+
if (d === null || f === null) return c("duplicate_keys");
|
|
117
130
|
let p = [.../* @__PURE__ */ new Set([...f.keys(), ...d.keys()])].map((e) => {
|
|
118
131
|
let t = d.get(e), n = f.get(e), r = l.map((e) => {
|
|
119
|
-
let r = t?.[e],
|
|
132
|
+
let r = t?.[e], i = n?.[e], o = t !== void 0 && n !== void 0 && !v(r, i);
|
|
120
133
|
return {
|
|
121
134
|
column: e,
|
|
122
135
|
from: r,
|
|
123
|
-
to:
|
|
124
|
-
changed:
|
|
125
|
-
change:
|
|
136
|
+
to: i,
|
|
137
|
+
changed: o,
|
|
138
|
+
change: o ? s(r, i) : a
|
|
126
139
|
};
|
|
127
140
|
});
|
|
128
141
|
return {
|
|
@@ -145,28 +158,28 @@ function x(e, t, n) {
|
|
|
145
158
|
summary: m
|
|
146
159
|
};
|
|
147
160
|
}
|
|
148
|
-
function
|
|
161
|
+
function C(e) {
|
|
149
162
|
return e === "metric_card" || e === "chart" || e === "table";
|
|
150
163
|
}
|
|
151
|
-
function
|
|
164
|
+
function w(e) {
|
|
152
165
|
return typeof e?.chartType == "string" ? e.chartType.toLowerCase() : "line";
|
|
153
166
|
}
|
|
154
|
-
function
|
|
155
|
-
if (!
|
|
167
|
+
function T(e) {
|
|
168
|
+
if (!C(e.widgetType)) return {
|
|
156
169
|
kind: "unsupported",
|
|
157
170
|
widgetType: e.widgetType
|
|
158
171
|
};
|
|
159
|
-
if (e.widgetType === "chart" && !
|
|
172
|
+
if (e.widgetType === "chart" && !f.has(w(e.config))) return {
|
|
160
173
|
kind: "unsupported",
|
|
161
|
-
widgetType: `chart:${
|
|
174
|
+
widgetType: `chart:${w(e.config)}`
|
|
162
175
|
};
|
|
163
176
|
let { from: t, to: n } = e;
|
|
164
|
-
if (!t.available) return
|
|
165
|
-
if (!n.available) return
|
|
177
|
+
if (!t.available) return c("no_data_from");
|
|
178
|
+
if (!n.available) return c("no_data_to");
|
|
166
179
|
switch (e.widgetType) {
|
|
167
|
-
case "metric_card": return
|
|
168
|
-
case "chart": return
|
|
169
|
-
default: return
|
|
180
|
+
case "metric_card": return d(e.config, t.data, n.data);
|
|
181
|
+
case "chart": return g(e.config, t.data, n.data);
|
|
182
|
+
default: return S(e.config, t.data, n.data);
|
|
170
183
|
}
|
|
171
184
|
}
|
|
172
|
-
export {
|
|
185
|
+
export { s as changeBetween, T as compareWidget, C as isCompareSupported };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface FleetBadgeProps {
|
|
3
|
+
isMaster: boolean;
|
|
4
|
+
/** How many active copies follow this board. */
|
|
5
|
+
copyCount: number;
|
|
6
|
+
/** The board follows a master through an active link. */
|
|
7
|
+
isCopy: boolean;
|
|
8
|
+
/** The board has asked to follow a master and is waiting for its owner. */
|
|
9
|
+
isPending: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const FleetBadge: FC<FleetBadgeProps>;
|
|
12
|
+
export default FleetBadge;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useTr as e } from "../../../shared/hooks/useTr.js";
|
|
2
|
+
import { memo as t } from "react";
|
|
3
|
+
import { Link2 as n, Network as r } from "lucide-react";
|
|
4
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
// src/bigconsole/components/fleet/FleetBadge.tsx
|
|
6
|
+
var s = {
|
|
7
|
+
display: "inline-flex",
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
gap: "var(--space-iconGap)",
|
|
10
|
+
padding: "2px 8px",
|
|
11
|
+
borderRadius: "var(--radius-pill)",
|
|
12
|
+
border: "1px solid var(--color-border-subtle)",
|
|
13
|
+
fontSize: "10px",
|
|
14
|
+
fontWeight: "var(--font-weight-semibold)",
|
|
15
|
+
textTransform: "uppercase",
|
|
16
|
+
letterSpacing: "0.02em",
|
|
17
|
+
whiteSpace: "nowrap"
|
|
18
|
+
}, c = t(function({ isMaster: t, copyCount: c, isCopy: l, isPending: u }) {
|
|
19
|
+
let d = e();
|
|
20
|
+
return !t && !l && !u ? null : /* @__PURE__ */ o(i, { children: [
|
|
21
|
+
t && /* @__PURE__ */ o("span", {
|
|
22
|
+
"data-testid": "fleet-master-badge",
|
|
23
|
+
style: {
|
|
24
|
+
...s,
|
|
25
|
+
backgroundColor: "var(--color-bg-accentSubtle)",
|
|
26
|
+
color: "var(--color-text-primary)"
|
|
27
|
+
},
|
|
28
|
+
children: [/* @__PURE__ */ a(r, {
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
style: {
|
|
31
|
+
height: "var(--size-icon-sm)",
|
|
32
|
+
width: "var(--size-icon-sm)"
|
|
33
|
+
}
|
|
34
|
+
}), c === 1 ? d("bigconsole.fleet.badge.masterOne", "Master · 1 copy") : d("bigconsole.fleet.badge.masterMany", "Master · {{count}} copies", { count: c })]
|
|
35
|
+
}),
|
|
36
|
+
l && /* @__PURE__ */ o("span", {
|
|
37
|
+
"data-testid": "fleet-copy-badge",
|
|
38
|
+
style: {
|
|
39
|
+
...s,
|
|
40
|
+
color: "var(--color-text-secondary)"
|
|
41
|
+
},
|
|
42
|
+
children: [/* @__PURE__ */ a(n, {
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
style: {
|
|
45
|
+
height: "var(--size-icon-sm)",
|
|
46
|
+
width: "var(--size-icon-sm)"
|
|
47
|
+
}
|
|
48
|
+
}), d("bigconsole.fleet.badge.copy", "Linked copy")]
|
|
49
|
+
}),
|
|
50
|
+
u && /* @__PURE__ */ a("span", {
|
|
51
|
+
"data-testid": "fleet-pending-badge",
|
|
52
|
+
style: {
|
|
53
|
+
...s,
|
|
54
|
+
backgroundColor: "var(--color-status-warning-bgSubtle)",
|
|
55
|
+
color: "var(--color-status-warning-text)"
|
|
56
|
+
},
|
|
57
|
+
children: d("bigconsole.fleet.badge.pending", "Waiting for the owner's OK")
|
|
58
|
+
})
|
|
59
|
+
] });
|
|
60
|
+
});
|
|
61
|
+
export { c as FleetBadge, c as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface FleetBreadcrumbItem {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface FleetBreadcrumbProps {
|
|
7
|
+
/** The masters above the board, from the top down. */
|
|
8
|
+
ancestors: readonly FleetBreadcrumbItem[];
|
|
9
|
+
/** The board's own name. */
|
|
10
|
+
currentName: string;
|
|
11
|
+
onNavigate: (dashboardId: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const FleetBreadcrumb: FC<FleetBreadcrumbProps>;
|
|
14
|
+
export default FleetBreadcrumb;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useTr as e } from "../../../shared/hooks/useTr.js";
|
|
2
|
+
import { memo as t } from "react";
|
|
3
|
+
import { ChevronRight as n } from "lucide-react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
// src/bigconsole/components/fleet/FleetBreadcrumb.tsx
|
|
6
|
+
var a = t(function({ ancestors: t, currentName: a, onNavigate: o }) {
|
|
7
|
+
let s = e();
|
|
8
|
+
return t.length === 0 ? null : /* @__PURE__ */ i("nav", {
|
|
9
|
+
"aria-label": s("bigconsole.fleet.breadcrumb.label", "Linked boards"),
|
|
10
|
+
"data-testid": "fleet-breadcrumb",
|
|
11
|
+
style: {
|
|
12
|
+
display: "flex",
|
|
13
|
+
flexWrap: "wrap",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
gap: "var(--space-iconGap)",
|
|
16
|
+
fontSize: "var(--font-size-body-sm)",
|
|
17
|
+
color: "var(--color-text-secondary)",
|
|
18
|
+
minWidth: 0
|
|
19
|
+
},
|
|
20
|
+
children: [t.map((e) => /* @__PURE__ */ i("span", {
|
|
21
|
+
style: {
|
|
22
|
+
display: "inline-flex",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
gap: "var(--space-iconGap)"
|
|
25
|
+
},
|
|
26
|
+
children: [/* @__PURE__ */ r("button", {
|
|
27
|
+
type: "button",
|
|
28
|
+
className: "max-w-[16rem] truncate hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
29
|
+
onClick: () => o(e.id),
|
|
30
|
+
children: e.name
|
|
31
|
+
}), /* @__PURE__ */ r(n, {
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
style: {
|
|
34
|
+
height: "var(--size-icon-sm)",
|
|
35
|
+
width: "var(--size-icon-sm)"
|
|
36
|
+
}
|
|
37
|
+
})]
|
|
38
|
+
}, e.id)), /* @__PURE__ */ r("span", {
|
|
39
|
+
"aria-current": "page",
|
|
40
|
+
className: "max-w-[16rem] truncate",
|
|
41
|
+
style: { color: "var(--color-text-primary)" },
|
|
42
|
+
children: a
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
export { a as FleetBreadcrumb, a as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC, MouseEvent } from 'react';
|
|
2
|
+
export interface FleetCardActionsProps {
|
|
3
|
+
/** The board follows a master, or has asked to: it can be detached. Otherwise it can be linked. */
|
|
4
|
+
linked: boolean;
|
|
5
|
+
onLink: (event: MouseEvent) => void;
|
|
6
|
+
onDetach: (event: MouseEvent) => void;
|
|
7
|
+
/** The board's owner is asked to accept a link: Accept and Decline replace Detach. */
|
|
8
|
+
awaitingAnswer?: boolean;
|
|
9
|
+
/** False while the links load or when they failed to: the board's link state is unknown, so no action is offered. */
|
|
10
|
+
ready?: boolean;
|
|
11
|
+
/** A fleet action is running: the buttons wait so one click cannot be answered twice or two ways. */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onAccept?: (event: MouseEvent) => void;
|
|
14
|
+
onDecline?: (event: MouseEvent) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const FleetCardActions: FC<FleetCardActionsProps>;
|
|
17
|
+
export default FleetCardActions;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { BIGCONSOLE_PERMISSIONS as e } from "../../../constants/permissions.js";
|
|
2
|
+
import { useTr as t } from "../../../shared/hooks/useTr.js";
|
|
3
|
+
import { memo as n } from "react";
|
|
4
|
+
import { PermissionButton as r } from "@burdenoff/fe-libs/shared/components";
|
|
5
|
+
import { Check as i, Link2 as a, Unlink as o, X as s } from "lucide-react";
|
|
6
|
+
import { Button as c } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
// src/bigconsole/components/fleet/FleetCardActions.tsx
|
|
9
|
+
var d = {
|
|
10
|
+
height: "var(--size-controlHeight-md)",
|
|
11
|
+
width: "var(--size-controlHeight-md)",
|
|
12
|
+
padding: 0,
|
|
13
|
+
borderRadius: "var(--radius-button)"
|
|
14
|
+
}, f = n(function({ linked: n, onLink: f, onDetach: p, awaitingAnswer: m = !1, ready: h = !0, disabled: g = !1, onAccept: _, onDecline: v }) {
|
|
15
|
+
let y = t();
|
|
16
|
+
if (!h) return null;
|
|
17
|
+
if (m) {
|
|
18
|
+
let t = y("bigconsole.fleet.action.accept", "Accept link request"), n = y("bigconsole.fleet.action.decline", "Decline link request");
|
|
19
|
+
return /* @__PURE__ */ l(r, {
|
|
20
|
+
permission: e.DASHBOARD_UPDATE,
|
|
21
|
+
deniedBehavior: "hide",
|
|
22
|
+
children: /* @__PURE__ */ u("span", {
|
|
23
|
+
style: {
|
|
24
|
+
display: "inline-flex",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
gap: "var(--space-controlGap)"
|
|
27
|
+
},
|
|
28
|
+
children: [/* @__PURE__ */ l(c, {
|
|
29
|
+
variant: "ghost",
|
|
30
|
+
size: "sm",
|
|
31
|
+
onClick: _,
|
|
32
|
+
disabled: g,
|
|
33
|
+
"aria-label": t,
|
|
34
|
+
title: t,
|
|
35
|
+
"data-testid": "fleet-accept",
|
|
36
|
+
style: d,
|
|
37
|
+
children: /* @__PURE__ */ l(i, { style: {
|
|
38
|
+
height: "var(--size-icon-sm)",
|
|
39
|
+
width: "var(--size-icon-sm)"
|
|
40
|
+
} })
|
|
41
|
+
}), /* @__PURE__ */ l(c, {
|
|
42
|
+
variant: "ghost",
|
|
43
|
+
size: "sm",
|
|
44
|
+
onClick: v,
|
|
45
|
+
disabled: g,
|
|
46
|
+
"aria-label": n,
|
|
47
|
+
title: n,
|
|
48
|
+
"data-testid": "fleet-decline",
|
|
49
|
+
style: d,
|
|
50
|
+
children: /* @__PURE__ */ l(s, { style: {
|
|
51
|
+
height: "var(--size-icon-sm)",
|
|
52
|
+
width: "var(--size-icon-sm)"
|
|
53
|
+
} })
|
|
54
|
+
})]
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
let b = n ? y("bigconsole.fleet.action.detach", "Detach from master") : y("bigconsole.fleet.action.link", "Link to master…");
|
|
59
|
+
return /* @__PURE__ */ l(r, {
|
|
60
|
+
permission: e.DASHBOARD_UPDATE,
|
|
61
|
+
deniedBehavior: "hide",
|
|
62
|
+
children: /* @__PURE__ */ l(c, {
|
|
63
|
+
variant: "ghost",
|
|
64
|
+
size: "sm",
|
|
65
|
+
onClick: n ? p : f,
|
|
66
|
+
disabled: g,
|
|
67
|
+
"aria-label": b,
|
|
68
|
+
title: b,
|
|
69
|
+
"data-testid": n ? "fleet-detach" : "fleet-link",
|
|
70
|
+
style: d,
|
|
71
|
+
children: l(n ? o : a, { style: {
|
|
72
|
+
height: "var(--size-icon-sm)",
|
|
73
|
+
width: "var(--size-icon-sm)"
|
|
74
|
+
} })
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
export { f as FleetCardActions, f as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface MasterCandidate {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
isMaster: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface LinkToMasterDialogProps {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
/** The board that will follow the one chosen. */
|
|
10
|
+
board: {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
} | null;
|
|
14
|
+
candidates: readonly MasterCandidate[];
|
|
15
|
+
busy: boolean;
|
|
16
|
+
/** The server's refusal, worded for the person, or null. */
|
|
17
|
+
error: string | null;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
onLink: (masterDashboardId: string) => void | Promise<void>;
|
|
20
|
+
/** Told what is typed, so the page can search the server for boards beyond the ones it has loaded. */
|
|
21
|
+
onQueryChange?: (query: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const LinkToMasterDialog: FC<LinkToMasterDialogProps>;
|
|
24
|
+
export default LinkToMasterDialog;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { useTr as e } from "../../../shared/hooks/useTr.js";
|
|
2
|
+
import { memo as t, useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
3
|
+
import { Button as o, Dialog as s, DialogContent as c, DialogDescription as l, DialogFooter as u, DialogHeader as d, DialogTitle as f, Input as p, Spinner as m } from "@burdenoff/fe-libs/ui";
|
|
4
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
5
|
+
// src/bigconsole/components/fleet/LinkToMasterDialog.tsx
|
|
6
|
+
var _ = t(function({ isOpen: t, board: _, candidates: v, busy: y, error: b, onClose: x, onLink: S, onQueryChange: C }) {
|
|
7
|
+
let w = e(), [T, E] = a(""), [D, O] = a(null);
|
|
8
|
+
r(() => {
|
|
9
|
+
t && (E(""), O(null));
|
|
10
|
+
}, [t, _?.id]), r(() => {
|
|
11
|
+
C?.(t ? T : "");
|
|
12
|
+
}, [
|
|
13
|
+
t,
|
|
14
|
+
C,
|
|
15
|
+
T
|
|
16
|
+
]);
|
|
17
|
+
let k = i(() => {
|
|
18
|
+
let e = T.trim().toLowerCase();
|
|
19
|
+
return v.filter((t) => !e || t.name.toLowerCase().includes(e));
|
|
20
|
+
}, [v, T]), A = D !== null && k.some((e) => e.id === D) ? D : null, j = n(() => {
|
|
21
|
+
A && !y && S(A);
|
|
22
|
+
}, [
|
|
23
|
+
y,
|
|
24
|
+
S,
|
|
25
|
+
A
|
|
26
|
+
]);
|
|
27
|
+
return /* @__PURE__ */ h(s, {
|
|
28
|
+
open: t,
|
|
29
|
+
onOpenChange: (e) => !e && !y && x(),
|
|
30
|
+
children: /* @__PURE__ */ g(c, { children: [
|
|
31
|
+
/* @__PURE__ */ g(d, { children: [/* @__PURE__ */ h(f, { children: w("bigconsole.fleet.link.title", "Link to master") }), /* @__PURE__ */ h(l, { children: w("bigconsole.fleet.link.description", "\"{{name}}\" will follow the board you choose and receive the widgets added to it. Its own widgets stay.", { name: _?.name ?? "" }) })] }),
|
|
32
|
+
/* @__PURE__ */ h(p, {
|
|
33
|
+
value: T,
|
|
34
|
+
onChange: (e) => E(e.target.value),
|
|
35
|
+
placeholder: w("bigconsole.fleet.link.search", "Search boards"),
|
|
36
|
+
"aria-label": w("bigconsole.fleet.link.search", "Search boards")
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ g("div", {
|
|
39
|
+
role: "radiogroup",
|
|
40
|
+
"aria-label": w("bigconsole.fleet.link.listLabel", "Boards to follow"),
|
|
41
|
+
"data-testid": "fleet-link-candidates",
|
|
42
|
+
style: {
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexDirection: "column",
|
|
45
|
+
gap: "var(--space-controlGap)",
|
|
46
|
+
maxHeight: "16rem",
|
|
47
|
+
overflowY: "auto"
|
|
48
|
+
},
|
|
49
|
+
children: [k.length === 0 && /* @__PURE__ */ h("p", {
|
|
50
|
+
style: {
|
|
51
|
+
color: "var(--color-text-secondary)",
|
|
52
|
+
fontSize: "var(--font-size-body-sm)",
|
|
53
|
+
margin: 0
|
|
54
|
+
},
|
|
55
|
+
children: w("bigconsole.fleet.link.none", "No board to follow.")
|
|
56
|
+
}), k.map((e) => {
|
|
57
|
+
let t = e.id === D;
|
|
58
|
+
return /* @__PURE__ */ g("button", {
|
|
59
|
+
type: "button",
|
|
60
|
+
role: "radio",
|
|
61
|
+
"aria-checked": t,
|
|
62
|
+
onClick: () => O(e.id),
|
|
63
|
+
className: "flex items-center justify-between gap-form-gap rounded-input border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
64
|
+
style: {
|
|
65
|
+
borderColor: t ? "var(--color-action-primary-bg)" : "var(--color-border-subtle)",
|
|
66
|
+
backgroundColor: t ? "var(--color-bg-accentSubtle)" : void 0,
|
|
67
|
+
color: "var(--color-text-primary)"
|
|
68
|
+
},
|
|
69
|
+
children: [/* @__PURE__ */ h("span", {
|
|
70
|
+
className: "min-w-0 truncate",
|
|
71
|
+
children: e.name
|
|
72
|
+
}), e.isMaster && /* @__PURE__ */ h("span", {
|
|
73
|
+
style: {
|
|
74
|
+
fontSize: "var(--font-size-body-sm)",
|
|
75
|
+
color: "var(--color-text-secondary)"
|
|
76
|
+
},
|
|
77
|
+
children: w("bigconsole.fleet.link.alreadyMaster", "Master")
|
|
78
|
+
})]
|
|
79
|
+
}, e.id);
|
|
80
|
+
})]
|
|
81
|
+
}),
|
|
82
|
+
b && /* @__PURE__ */ h("p", {
|
|
83
|
+
role: "alert",
|
|
84
|
+
"data-testid": "fleet-link-error",
|
|
85
|
+
style: {
|
|
86
|
+
color: "var(--color-status-error-text)",
|
|
87
|
+
margin: 0
|
|
88
|
+
},
|
|
89
|
+
children: b
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ g(u, { children: [/* @__PURE__ */ h(o, {
|
|
92
|
+
variant: "outline",
|
|
93
|
+
onClick: x,
|
|
94
|
+
disabled: y,
|
|
95
|
+
children: w("bigconsole.fleet.link.cancel", "Cancel")
|
|
96
|
+
}), /* @__PURE__ */ g(o, {
|
|
97
|
+
onClick: j,
|
|
98
|
+
disabled: !A || y,
|
|
99
|
+
"data-testid": "fleet-link-confirm",
|
|
100
|
+
children: [y && /* @__PURE__ */ h(m, { style: {
|
|
101
|
+
height: "var(--size-icon-sm)",
|
|
102
|
+
width: "var(--size-icon-sm)"
|
|
103
|
+
} }), w("bigconsole.fleet.link.confirm", "Link")]
|
|
104
|
+
})] })
|
|
105
|
+
] })
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
export { _ as LinkToMasterDialog, _ as default };
|