@burdenoff/microfe-bigconsole 2026.1123.1 → 2026.1123.2
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/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/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/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
|
@@ -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 };
|
|
@@ -10,6 +10,14 @@ export interface DashboardListItem {
|
|
|
10
10
|
description?: string;
|
|
11
11
|
category?: string;
|
|
12
12
|
isPublic?: boolean;
|
|
13
|
+
/** Other boards may follow this one as linked copies (fleet boards). */
|
|
14
|
+
isMaster?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Where the board's own link to a master stands: ACTIVE when it follows one, PENDING while its owner has not
|
|
17
|
+
* accepted a request, null when it follows none. Says nothing about which master, so it is known even when
|
|
18
|
+
* the caller cannot read that master.
|
|
19
|
+
*/
|
|
20
|
+
linkStatus?: 'ACTIVE' | 'PENDING' | null;
|
|
13
21
|
/** Undefined only if the field is missing from the response. */
|
|
14
22
|
status?: DashboardListStatus;
|
|
15
23
|
viewCount?: number;
|
|
@@ -58,6 +58,8 @@ function y(e) {
|
|
|
58
58
|
description: e.description,
|
|
59
59
|
category: e.category,
|
|
60
60
|
isPublic: e.isPublic,
|
|
61
|
+
isMaster: e.isMaster === !0,
|
|
62
|
+
linkStatus: e.linkStatus === "ACTIVE" || e.linkStatus === "PENDING" ? e.linkStatus : null,
|
|
61
63
|
status: v(e.status),
|
|
62
64
|
viewCount: e.viewCount,
|
|
63
65
|
widgetCount: e.widgetCount,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFleetBoardActions (BOFF-15410)
|
|
3
|
+
*
|
|
4
|
+
* The actions that link a board under a master and take it out again. The server decides whether an action is
|
|
5
|
+
* allowed (loops, the depth cap, who may write to which board, whether the owner has to accept), so a refusal
|
|
6
|
+
* comes back as an error whose message is already worded for the person, and is shown as it is.
|
|
7
|
+
*/
|
|
8
|
+
/** Where a board stands after an action: linked now, waiting for its owner to accept, or following nothing. */
|
|
9
|
+
export type FleetLinkOutcome = 'ACTIVE' | 'PENDING' | 'NONE';
|
|
10
|
+
interface UseFleetBoardActionsResult {
|
|
11
|
+
busy: boolean;
|
|
12
|
+
linkToMaster: (childDashboardId: string, masterDashboardId: string) => Promise<FleetLinkOutcome>;
|
|
13
|
+
detach: (dashboardId: string) => Promise<void>;
|
|
14
|
+
/** Accept or decline a request to link a board the caller owns. */
|
|
15
|
+
respond: (childDashboardId: string, accept: boolean) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare function useFleetBoardActions(): UseFleetBoardActionsResult;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DetachDashboardDocument as e, LinkDashboardToMasterDocument as t, RespondToDashboardLinkDocument as n } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { useCallback as r, useState as i } from "react";
|
|
3
|
+
import { useApolloClient as a } from "@apollo/client/react";
|
|
4
|
+
// src/bigconsole/hooks/useFleetBoardActions.ts
|
|
5
|
+
var o = (e) => e === "ACTIVE" ? "ACTIVE" : e === "PENDING" ? "PENDING" : "NONE";
|
|
6
|
+
function s() {
|
|
7
|
+
let s = a(), [c, l] = i(!1);
|
|
8
|
+
return {
|
|
9
|
+
busy: c,
|
|
10
|
+
linkToMaster: r(async (e, n) => {
|
|
11
|
+
l(!0);
|
|
12
|
+
try {
|
|
13
|
+
return o((await s.mutate({
|
|
14
|
+
mutation: t,
|
|
15
|
+
variables: { input: {
|
|
16
|
+
childDashboardId: e,
|
|
17
|
+
masterDashboardId: n
|
|
18
|
+
} },
|
|
19
|
+
errorPolicy: "none"
|
|
20
|
+
})).data?.linkDashboardToMaster?.linkStatus);
|
|
21
|
+
} finally {
|
|
22
|
+
l(!1);
|
|
23
|
+
}
|
|
24
|
+
}, [s]),
|
|
25
|
+
detach: r(async (t) => {
|
|
26
|
+
l(!0);
|
|
27
|
+
try {
|
|
28
|
+
await s.mutate({
|
|
29
|
+
mutation: e,
|
|
30
|
+
variables: { id: t },
|
|
31
|
+
errorPolicy: "none"
|
|
32
|
+
});
|
|
33
|
+
} finally {
|
|
34
|
+
l(!1);
|
|
35
|
+
}
|
|
36
|
+
}, [s]),
|
|
37
|
+
respond: r(async (e, t) => {
|
|
38
|
+
l(!0);
|
|
39
|
+
try {
|
|
40
|
+
await s.mutate({
|
|
41
|
+
mutation: n,
|
|
42
|
+
variables: {
|
|
43
|
+
childDashboardId: e,
|
|
44
|
+
accept: t
|
|
45
|
+
},
|
|
46
|
+
errorPolicy: "none"
|
|
47
|
+
});
|
|
48
|
+
} finally {
|
|
49
|
+
l(!1);
|
|
50
|
+
}
|
|
51
|
+
}, [s])
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export { s as useFleetBoardActions };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFleetBreadcrumb (BOFF-15410)
|
|
3
|
+
*
|
|
4
|
+
* The masters above a board, from the top down, with their names, for the breadcrumb on the board's page. The
|
|
5
|
+
* ids come from `dashboardLinks`; each name is a small read of its own, so a long chain costs one cheap query
|
|
6
|
+
* per level and the depth cap keeps that to a few. A master the caller cannot read is left out rather than
|
|
7
|
+
* shown by id. Nothing here can break the board's page: any failure just means no breadcrumb.
|
|
8
|
+
*/
|
|
9
|
+
export interface FleetBreadcrumbAncestor {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function useFleetBreadcrumb(dashboardId: string | undefined): FleetBreadcrumbAncestor[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import "../context/index.js";
|
|
2
|
+
import { useBigConsole as e } from "../context/BigConsoleContext.js";
|
|
3
|
+
import { FleetBoardNameDocument as t } from "../../generated/wspace-operations.js";
|
|
4
|
+
import { ancestorIds as n } from "../utils/fleetTree.js";
|
|
5
|
+
import { useFleetLinks as r } from "./useFleetLinks.js";
|
|
6
|
+
import { useEffect as i, useMemo as a, useState as o } from "react";
|
|
7
|
+
import { useApolloClient as s } from "@apollo/client/react";
|
|
8
|
+
// src/bigconsole/hooks/useFleetBreadcrumb.ts
|
|
9
|
+
function c(c) {
|
|
10
|
+
let { links: l } = r({ skip: !c }), { workspaceId: u } = e(), d = s(), f = a(() => c ? n(c, l) : [], [c, l]), p = f.join("|"), [m, h] = o({
|
|
11
|
+
key: "",
|
|
12
|
+
items: []
|
|
13
|
+
});
|
|
14
|
+
return i(() => {
|
|
15
|
+
let e = p ? p.split("|") : [];
|
|
16
|
+
if (e.length === 0) return;
|
|
17
|
+
let n = !0;
|
|
18
|
+
return Promise.all(e.map(async (e) => {
|
|
19
|
+
try {
|
|
20
|
+
let n = (await d.query({
|
|
21
|
+
query: t,
|
|
22
|
+
variables: { id: e },
|
|
23
|
+
fetchPolicy: "no-cache",
|
|
24
|
+
errorPolicy: "none",
|
|
25
|
+
context: {
|
|
26
|
+
requiredWorkspaceAuth: !0,
|
|
27
|
+
requiredWorkspaceId: u,
|
|
28
|
+
queryDeduplication: !1
|
|
29
|
+
}
|
|
30
|
+
})).data?.getDashboard;
|
|
31
|
+
return n ? {
|
|
32
|
+
id: n.id,
|
|
33
|
+
name: n.name
|
|
34
|
+
} : null;
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
})).then((e) => {
|
|
39
|
+
n && h({
|
|
40
|
+
key: p,
|
|
41
|
+
items: e.filter((e) => !!e)
|
|
42
|
+
});
|
|
43
|
+
}), () => {
|
|
44
|
+
n = !1;
|
|
45
|
+
};
|
|
46
|
+
}, [
|
|
47
|
+
d,
|
|
48
|
+
p,
|
|
49
|
+
u
|
|
50
|
+
]), f.length > 0 && m.key === p ? m.items : [];
|
|
51
|
+
}
|
|
52
|
+
export { c as useFleetBreadcrumb };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFleetCopyTotals (BOFF-15410)
|
|
3
|
+
*
|
|
4
|
+
* How many active copies follow each master on the page, from the server's rollup (a pending request is not
|
|
5
|
+
* following yet). The rollup counts copies the caller cannot read, which the list of links leaves out, so the
|
|
6
|
+
* badge on a master reads this and not the links. A master whose count has not arrived (or failed to load) is
|
|
7
|
+
* missing from the map and the page falls back to the readable links.
|
|
8
|
+
*/
|
|
9
|
+
/** One request for up to MASTERS_PER_REQUEST masters: each is an alias of the same rollup field. */
|
|
10
|
+
export declare const batchDocument: (count: number) => import('graphql').DocumentNode;
|
|
11
|
+
export declare function useFleetCopyTotals(masterIds: readonly string[], refreshOn: unknown): Map<string, number>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useBigConsole as e } from "../context/BigConsoleContext.js";
|
|
2
|
+
import "../context/index.js";
|
|
3
|
+
import { useEffect as t, useState as n } from "react";
|
|
4
|
+
import { useApolloClient as r } from "@apollo/client/react";
|
|
5
|
+
import { gql as i } from "@apollo/client";
|
|
6
|
+
// src/bigconsole/hooks/useFleetCopyTotals.ts
|
|
7
|
+
var a = 10, o = (e) => i`query FleetCopyTotals(${Array.from({ length: e }, (e, t) => `$m${t}: ID!`).join(", ")}) {
|
|
8
|
+
${Array.from({ length: e }, (e, t) => `m${t}: dashboardChildren(masterDashboardId: $m${t}) { masterDashboardId active }`).join("\n ")}
|
|
9
|
+
}`, s = (e) => typeof e == "object" && !!e && "masterDashboardId" in e && typeof e.masterDashboardId == "string" && "active" in e && typeof e.active == "number";
|
|
10
|
+
function c(i, c) {
|
|
11
|
+
let [l, u] = n(/* @__PURE__ */ new Map()), { workspaceId: d } = e(), f = r(), p = [...i].sort().join(",");
|
|
12
|
+
return t(() => {
|
|
13
|
+
let e = !1, t = p ? p.split(",") : [];
|
|
14
|
+
if (t.length === 0) {
|
|
15
|
+
u(/* @__PURE__ */ new Map());
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let n = [];
|
|
19
|
+
for (let e = 0; e < t.length; e += a) n.push(t.slice(e, e + a));
|
|
20
|
+
return Promise.all(n.map(async (e) => {
|
|
21
|
+
try {
|
|
22
|
+
let t = await f.query({
|
|
23
|
+
query: o(e.length),
|
|
24
|
+
variables: Object.fromEntries(e.map((e, t) => [`m${t}`, e])),
|
|
25
|
+
fetchPolicy: "no-cache",
|
|
26
|
+
errorPolicy: "none",
|
|
27
|
+
context: {
|
|
28
|
+
requiredWorkspaceAuth: !0,
|
|
29
|
+
requiredWorkspaceId: d,
|
|
30
|
+
queryDeduplication: !1
|
|
31
|
+
}
|
|
32
|
+
}), n = [];
|
|
33
|
+
return e.forEach((e, r) => {
|
|
34
|
+
let i = t.data?.[`m${r}`];
|
|
35
|
+
s(i) && i.masterDashboardId === e && n.push([e, i.active]);
|
|
36
|
+
}), n;
|
|
37
|
+
} catch {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
})).then((t) => {
|
|
41
|
+
e || u(new Map(t.flat()));
|
|
42
|
+
}), () => {
|
|
43
|
+
e = !0;
|
|
44
|
+
};
|
|
45
|
+
}, [
|
|
46
|
+
f,
|
|
47
|
+
p,
|
|
48
|
+
c,
|
|
49
|
+
d
|
|
50
|
+
]), l;
|
|
51
|
+
}
|
|
52
|
+
export { o as batchDocument, c as useFleetCopyTotals };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FleetLink } from '../utils/fleetTree';
|
|
2
|
+
/** A request to link a board the caller owns under a master, waiting for the caller's answer. */
|
|
3
|
+
export interface FleetLinkRequest {
|
|
4
|
+
childDashboardId: string;
|
|
5
|
+
childName: string;
|
|
6
|
+
masterName: string;
|
|
7
|
+
}
|
|
8
|
+
interface UseFleetLinksResult {
|
|
9
|
+
links: FleetLink[];
|
|
10
|
+
/** Requests the caller has to accept or decline. */
|
|
11
|
+
requests: FleetLinkRequest[];
|
|
12
|
+
loading: boolean;
|
|
13
|
+
error: Error | null;
|
|
14
|
+
refetch: () => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare function useFleetLinks({ skip }?: {
|
|
17
|
+
skip?: boolean;
|
|
18
|
+
}): UseFleetLinksResult;
|
|
19
|
+
export {};
|