@burdenoff/microfe-bigconsole 2026.1124.2 → 2026.1124.4
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/FleetBindingsDialog.d.ts +19 -0
- package/dist/bigconsole/components/fleet/FleetBindingsDialog.js +287 -0
- package/dist/bigconsole/components/fleet/FleetChildrenPanel.d.ts +8 -0
- package/dist/bigconsole/components/fleet/FleetChildrenPanel.js +185 -156
- package/dist/bigconsole/components/fleet/FleetCopySection.d.ts +5 -0
- package/dist/bigconsole/components/fleet/FleetCopySection.js +115 -118
- package/dist/bigconsole/components/fleet/FleetWidgetActions.d.ts +36 -0
- package/dist/bigconsole/components/fleet/FleetWidgetActions.js +82 -0
- package/dist/bigconsole/components/widgets/WidgetMenu.js +146 -96
- package/dist/bigconsole/hooks/useFleetBindingActions.d.ts +23 -0
- package/dist/bigconsole/hooks/useFleetBindingActions.js +50 -0
- package/dist/bigconsole/hooks/useFleetBindings.d.ts +19 -0
- package/dist/bigconsole/hooks/useFleetBindings.js +140 -0
- package/dist/bigconsole/hooks/useFleetConfirm.d.ts +7 -0
- package/dist/bigconsole/hooks/useFleetConfirm.js +17 -0
- package/dist/bigconsole/hooks/useFleetWidgetActions.d.ts +10 -0
- package/dist/bigconsole/hooks/useFleetWidgetActions.js +41 -0
- package/dist/bigconsole/hooks/useOwnerBoundRun.d.ts +13 -18
- package/dist/bigconsole/hooks/useOwnerBoundRun.js +45 -30
- package/dist/bigconsole/hooks/useWidgetOperations.js +2 -0
- package/dist/bigconsole/pages/DashboardViewPage.js +303 -291
- package/dist/bigconsole/types/index.d.ts +4 -0
- package/dist/bigconsole/utils/fleetBindings.d.ts +49 -0
- package/dist/bigconsole/utils/fleetBindings.js +52 -0
- package/dist/bigconsole/utils/fleetNotices.d.ts +12 -0
- package/dist/bigconsole/utils/fleetNotices.js +5 -0
- package/dist/bigconsole/utils/fleetWidgetMenu.d.ts +20 -0
- package/dist/bigconsole/utils/fleetWidgetMenu.js +13 -0
- package/dist/generated/wspace-operations.d.ts +163 -0
- package/dist/generated/wspace-operations.js +935 -122
- package/dist/generated/wspace-types.d.ts +395 -9
- package/dist/generated/wspace-types.js +12 -10
- package/package.json +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import "../context/index.js";
|
|
2
|
+
import { useBigConsole as e } from "../context/BigConsoleContext.js";
|
|
3
|
+
import { FleetDataSinkChoicesDocument as t, FleetMasterSourcesDocument as n } from "../../generated/wspace-operations.js";
|
|
4
|
+
import { masterSources as r } from "../utils/fleetBindings.js";
|
|
5
|
+
import { useCallback as i, useEffect as a, useLayoutEffect as o, useRef as s, useState as c } from "react";
|
|
6
|
+
import { useApolloClient as l } from "@apollo/client/react";
|
|
7
|
+
import { gql as u } from "@apollo/client";
|
|
8
|
+
// src/bigconsole/hooks/useFleetBindings.ts
|
|
9
|
+
var d = 10, f = 100, p = 20, m = (e) => u`query FleetCopyBindings(${Array.from({ length: e }, (e, t) => `$c${t}: ID!`).join(", ")}) {
|
|
10
|
+
${Array.from({ length: e }, (e, t) => `c${t}: dashboardBindings(dashboardId: $c${t}) { kind masterRefId copyRefId }`).join("\n ")}
|
|
11
|
+
}`, h = (e) => typeof e == "object" && !!e && "kind" in e && typeof e.kind == "string" && "masterRefId" in e && typeof e.masterRefId == "string" && "copyRefId" in e && typeof e.copyRefId == "string", g = {
|
|
12
|
+
key: "",
|
|
13
|
+
master: {
|
|
14
|
+
sinks: [],
|
|
15
|
+
otherSourceWidgets: 0
|
|
16
|
+
},
|
|
17
|
+
sinks: /* @__PURE__ */ new Map(),
|
|
18
|
+
sinksTruncated: !1,
|
|
19
|
+
bindings: /* @__PURE__ */ new Map(),
|
|
20
|
+
error: null
|
|
21
|
+
};
|
|
22
|
+
function _(u, _, v) {
|
|
23
|
+
let { workspaceId: y, currentUser: b } = e(), x = l(), S = [..._].sort().join(","), C = `${y ?? ""}:${b?.id ?? ""}:${u}:${S}`, [w, T] = c(g), [E, D] = c(v), O = s(C), k = s(0);
|
|
24
|
+
o(() => (O.current = C, () => {
|
|
25
|
+
O.current = "", k.current += 1;
|
|
26
|
+
}), [C]);
|
|
27
|
+
let A = i(async () => {
|
|
28
|
+
if (O.current !== C) return;
|
|
29
|
+
let e = ++k.current, i = () => O.current === C && k.current === e, a = {
|
|
30
|
+
requiredWorkspaceAuth: !0,
|
|
31
|
+
requiredWorkspaceId: y,
|
|
32
|
+
queryDeduplication: !1
|
|
33
|
+
}, o = S ? S.split(",") : [];
|
|
34
|
+
try {
|
|
35
|
+
D(!0);
|
|
36
|
+
let e = async () => {
|
|
37
|
+
let e = await x.query({
|
|
38
|
+
query: n,
|
|
39
|
+
variables: { dashboardId: u },
|
|
40
|
+
fetchPolicy: "no-cache",
|
|
41
|
+
errorPolicy: "none",
|
|
42
|
+
context: a
|
|
43
|
+
});
|
|
44
|
+
return r(e.data?.listWidgetsByDashboard ?? []);
|
|
45
|
+
}, s = async (e) => {
|
|
46
|
+
let n = (await x.query({
|
|
47
|
+
query: t,
|
|
48
|
+
variables: {
|
|
49
|
+
first: f,
|
|
50
|
+
after: e
|
|
51
|
+
},
|
|
52
|
+
fetchPolicy: "no-cache",
|
|
53
|
+
errorPolicy: "none",
|
|
54
|
+
context: a
|
|
55
|
+
})).data?.listDataSinks;
|
|
56
|
+
return {
|
|
57
|
+
nodes: (n?.edges ?? []).map((e) => ({
|
|
58
|
+
id: e.node.id,
|
|
59
|
+
name: e.node.name ?? e.node.id,
|
|
60
|
+
isActive: e.node.isActive
|
|
61
|
+
})),
|
|
62
|
+
next: n?.pageInfo.hasNextPage ? n.pageInfo.endCursor ?? null : null
|
|
63
|
+
};
|
|
64
|
+
}, [c, l, g] = await Promise.all([
|
|
65
|
+
e(),
|
|
66
|
+
(async () => {
|
|
67
|
+
let e = /* @__PURE__ */ new Map(), t = null;
|
|
68
|
+
for (let n = 0; n < p; n += 1) {
|
|
69
|
+
let n = await s(t);
|
|
70
|
+
for (let t of n.nodes) e.set(t.id, t);
|
|
71
|
+
if (n.next === null) return {
|
|
72
|
+
sinks: e,
|
|
73
|
+
truncated: !1
|
|
74
|
+
};
|
|
75
|
+
t = n.next;
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
sinks: e,
|
|
79
|
+
truncated: !0
|
|
80
|
+
};
|
|
81
|
+
})(),
|
|
82
|
+
(async () => {
|
|
83
|
+
let e = [];
|
|
84
|
+
for (let t = 0; t < o.length; t += d) e.push(o.slice(t, t + d));
|
|
85
|
+
let t = /* @__PURE__ */ new Map();
|
|
86
|
+
return await Promise.all(e.map(async (e) => {
|
|
87
|
+
let n = await x.query({
|
|
88
|
+
query: m(e.length),
|
|
89
|
+
variables: Object.fromEntries(e.map((e, t) => [`c${t}`, e])),
|
|
90
|
+
fetchPolicy: "no-cache",
|
|
91
|
+
errorPolicy: "none",
|
|
92
|
+
context: a
|
|
93
|
+
});
|
|
94
|
+
e.forEach((e, r) => {
|
|
95
|
+
let i = n.data?.[`c${r}`];
|
|
96
|
+
if (!Array.isArray(i)) throw Error("The data sources of a copy could not be read");
|
|
97
|
+
t.set(e, i.filter(h));
|
|
98
|
+
});
|
|
99
|
+
})), t;
|
|
100
|
+
})()
|
|
101
|
+
]);
|
|
102
|
+
i() && T({
|
|
103
|
+
key: C,
|
|
104
|
+
master: c,
|
|
105
|
+
sinks: l.sinks,
|
|
106
|
+
sinksTruncated: l.truncated,
|
|
107
|
+
bindings: g,
|
|
108
|
+
error: null
|
|
109
|
+
});
|
|
110
|
+
} catch (e) {
|
|
111
|
+
i() && T({
|
|
112
|
+
...g,
|
|
113
|
+
key: C,
|
|
114
|
+
error: e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load the data sources")
|
|
115
|
+
});
|
|
116
|
+
} finally {
|
|
117
|
+
i() && D(!1);
|
|
118
|
+
}
|
|
119
|
+
}, [
|
|
120
|
+
x,
|
|
121
|
+
S,
|
|
122
|
+
C,
|
|
123
|
+
u,
|
|
124
|
+
y
|
|
125
|
+
]);
|
|
126
|
+
a(() => {
|
|
127
|
+
v && A();
|
|
128
|
+
}, [v, A]);
|
|
129
|
+
let j = w.key === C;
|
|
130
|
+
return {
|
|
131
|
+
loading: v && (E || !j),
|
|
132
|
+
error: j ? w.error : null,
|
|
133
|
+
master: j ? w.master : g.master,
|
|
134
|
+
sinks: j ? w.sinks : g.sinks,
|
|
135
|
+
sinksTruncated: j ? w.sinksTruncated : !1,
|
|
136
|
+
bindings: j ? w.bindings : g.bindings,
|
|
137
|
+
refetch: A
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export { m as bindingsBatchDocument, _ as useFleetBindings };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFleetConfirm (BOFF-15410)
|
|
3
|
+
*
|
|
4
|
+
* The confirmation prompt of a fleet action that replaces the owner's work: the native one where the app runs
|
|
5
|
+
* inside a shell that has it, the browser's otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useFleetConfirm(): (title: string, text: string, ok: string) => Promise<boolean>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { nativeConfirm as e } from "../../utils/nativeBridge.js";
|
|
2
|
+
import { useTr as t } from "../../shared/hooks/useTr.js";
|
|
3
|
+
import { useCallback as n } from "react";
|
|
4
|
+
// src/bigconsole/hooks/useFleetConfirm.ts
|
|
5
|
+
function r() {
|
|
6
|
+
let r = t();
|
|
7
|
+
return n(async (t, n, i) => {
|
|
8
|
+
let a = await e({
|
|
9
|
+
title: t,
|
|
10
|
+
message: n,
|
|
11
|
+
okButtonTitle: i,
|
|
12
|
+
cancelButtonTitle: r("bigconsole.fleet.link.cancel", "Cancel")
|
|
13
|
+
});
|
|
14
|
+
return a === null ? window.confirm(n) : a;
|
|
15
|
+
}, [r]);
|
|
16
|
+
}
|
|
17
|
+
export { r as useFleetConfirm };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RestoreNotice } from './useFleetCopyActions';
|
|
2
|
+
interface UseFleetWidgetActionsResult {
|
|
3
|
+
busy: boolean;
|
|
4
|
+
/** Puts the widget back to the master's version. Returns what could not be carried over exactly. */
|
|
5
|
+
restoreWidget: (widgetId: string) => Promise<RestoreNotice[]>;
|
|
6
|
+
/** Adds the widget to the master, which the board's widget then follows. Returns what could not be carried over. */
|
|
7
|
+
promoteWidget: (widgetId: string) => Promise<RestoreNotice[]>;
|
|
8
|
+
}
|
|
9
|
+
export declare function useFleetWidgetActions(): UseFleetWidgetActionsResult;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PromoteWidgetToMasterDocument as e, RestoreWidgetToOriginalDocument as t } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { useCallback as n, useState as r } from "react";
|
|
3
|
+
import { useApolloClient as i } from "@apollo/client/react";
|
|
4
|
+
// src/bigconsole/hooks/useFleetWidgetActions.ts
|
|
5
|
+
var a = (e) => e.map((e) => ({
|
|
6
|
+
code: e.code,
|
|
7
|
+
pageName: e.pageName,
|
|
8
|
+
widgetId: e.widgetId
|
|
9
|
+
}));
|
|
10
|
+
function o() {
|
|
11
|
+
let o = i(), [s, c] = r(!1), l = n(async (e) => {
|
|
12
|
+
c(!0);
|
|
13
|
+
try {
|
|
14
|
+
return await e();
|
|
15
|
+
} finally {
|
|
16
|
+
c(!1);
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
return {
|
|
20
|
+
busy: s,
|
|
21
|
+
restoreWidget: n((e) => l(async () => {
|
|
22
|
+
let n = (await o.mutate({
|
|
23
|
+
mutation: t,
|
|
24
|
+
variables: { widgetId: e },
|
|
25
|
+
errorPolicy: "none"
|
|
26
|
+
})).data?.restoreWidgetToOriginal;
|
|
27
|
+
if (!n) throw Error("The widget could not be restored.");
|
|
28
|
+
return a(n.notices);
|
|
29
|
+
}), [o, l]),
|
|
30
|
+
promoteWidget: n((t) => l(async () => {
|
|
31
|
+
let n = (await o.mutate({
|
|
32
|
+
mutation: e,
|
|
33
|
+
variables: { widgetId: t },
|
|
34
|
+
errorPolicy: "none"
|
|
35
|
+
})).data?.promoteWidgetToMaster;
|
|
36
|
+
if (!n) throw Error("The widget could not be promoted.");
|
|
37
|
+
return a(n.notices);
|
|
38
|
+
}), [o, l])
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export { o as useFleetWidgetActions };
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - the outcome is shown only if the panel is still on the owner (board, workspace and account) the action
|
|
8
|
-
* started for, so an answer that arrives after the person moved on is dropped before it touches any state;
|
|
9
|
-
* - a failed re-read is not a failed action: the action already happened, and the read reports its own failure;
|
|
10
|
-
* - `acting` stays true until the re-read is done, not only until the action returns, so a second click cannot
|
|
11
|
-
* start a second action in the gap.
|
|
12
|
-
*
|
|
13
|
-
* When the owner changes, `onOwnerChange` lets the panel drop the state that belonged to the previous one.
|
|
14
|
-
*
|
|
15
|
-
* Two sections of one panel can share a lock (`useActionLock`), so an action in one holds the buttons of the
|
|
16
|
-
* other: a board that is both a copy and a master must not start a push while a restore is still running.
|
|
17
|
-
* A run that finishes after the panel went away is dropped too: it must not touch a board the person left.
|
|
3
|
+
* An action lock: which owner has an action running (`owner`, for the buttons to show), and the same fact kept
|
|
4
|
+
* synchronously, which is what decides whether an action may start. The state is only seen after a render; the
|
|
5
|
+
* synchronous side changes the instant an action starts, so two prompts answered together in different sections
|
|
6
|
+
* of one panel cannot both start.
|
|
18
7
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
export interface ActionLock {
|
|
9
|
+
owner: string | null;
|
|
10
|
+
setOwner: Dispatch<SetStateAction<string | null>>;
|
|
11
|
+
/** Takes the lock for the owner; false when an action of that owner already holds it. */
|
|
12
|
+
tryAcquire: (owner: string) => boolean;
|
|
13
|
+
/** Lets go of the lock if the owner still holds it. */
|
|
14
|
+
release: (owner: string) => void;
|
|
15
|
+
}
|
|
21
16
|
/** One lock for the sections of a panel to share. */
|
|
22
17
|
export declare function useActionLock(): ActionLock;
|
|
23
18
|
interface UseOwnerBoundRunResult {
|
|
@@ -1,41 +1,56 @@
|
|
|
1
|
-
import { useCallback as e, useEffect as t, useLayoutEffect as n,
|
|
1
|
+
import { useCallback as e, useEffect as t, useLayoutEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
2
2
|
// src/bigconsole/hooks/useOwnerBoundRun.ts
|
|
3
|
-
function
|
|
4
|
-
|
|
3
|
+
function o() {
|
|
4
|
+
let [e, t] = a(null), n = i(null);
|
|
5
|
+
return r(() => ({
|
|
6
|
+
owner: e,
|
|
7
|
+
setOwner: t,
|
|
8
|
+
tryAcquire: (e) => n.current !== e && (n.current = e, !0),
|
|
9
|
+
release: (e) => {
|
|
10
|
+
n.current === e && (n.current = null);
|
|
11
|
+
}
|
|
12
|
+
}), [e]);
|
|
5
13
|
}
|
|
6
|
-
function
|
|
7
|
-
let l =
|
|
14
|
+
function s(r, a, s, c) {
|
|
15
|
+
let l = o(), { owner: u, setOwner: d, tryAcquire: f, release: p } = c ?? l, m = i(!0), h = i(r), g = i(s);
|
|
8
16
|
n(() => {
|
|
9
|
-
|
|
10
|
-
}, [s]), t(() => (
|
|
11
|
-
|
|
17
|
+
g.current = s;
|
|
18
|
+
}, [s]), t(() => (m.current = !0, () => {
|
|
19
|
+
m.current = !1;
|
|
12
20
|
}), []), t(() => {
|
|
13
|
-
|
|
14
|
-
}, [
|
|
15
|
-
let
|
|
16
|
-
let r =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let r;
|
|
21
|
+
h.current !== r && (h.current = r, g.current());
|
|
22
|
+
}, [r]);
|
|
23
|
+
let _ = e(async (e, t, n) => {
|
|
24
|
+
let r = h.current, i = () => !m.current || h.current !== r;
|
|
25
|
+
if (f(r)) {
|
|
26
|
+
d(r);
|
|
20
27
|
try {
|
|
21
|
-
r
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
let r;
|
|
29
|
+
try {
|
|
30
|
+
r = await e();
|
|
31
|
+
} catch (e) {
|
|
32
|
+
i() || n(e);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (i()) return;
|
|
36
|
+
t(r), await a();
|
|
37
|
+
} finally {
|
|
38
|
+
p(r), d((e) => e === r ? null : e);
|
|
25
39
|
}
|
|
26
|
-
if (i()) return;
|
|
27
|
-
t(r), await o();
|
|
28
|
-
} finally {
|
|
29
|
-
i() || d(null);
|
|
30
40
|
}
|
|
31
|
-
}, [
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
}, [
|
|
42
|
+
a,
|
|
43
|
+
p,
|
|
44
|
+
d,
|
|
45
|
+
f
|
|
46
|
+
]), v = e(() => {
|
|
47
|
+
let e = h.current;
|
|
48
|
+
return () => m.current && h.current === e;
|
|
34
49
|
}, []);
|
|
35
50
|
return {
|
|
36
|
-
acting: u ===
|
|
37
|
-
begin:
|
|
38
|
-
run:
|
|
51
|
+
acting: u === r,
|
|
52
|
+
begin: v,
|
|
53
|
+
run: _
|
|
39
54
|
};
|
|
40
55
|
}
|
|
41
|
-
export {
|
|
56
|
+
export { o as useActionLock, s as useOwnerBoundRun };
|
|
@@ -54,6 +54,8 @@ function S(e) {
|
|
|
54
54
|
translations: e.translations || [],
|
|
55
55
|
actions: t || [],
|
|
56
56
|
data: e.data || null,
|
|
57
|
+
isInherited: e.isInherited === !0,
|
|
58
|
+
isOverridden: e.isOverridden === !0,
|
|
57
59
|
createdAt: e.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
58
60
|
updatedAt: e.updatedAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
59
61
|
};
|