@burdenoff/microfe-bigconsole 2026.1118.10 → 2026.1119.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/asof/AsOfBanner.d.ts +3 -0
- package/dist/bigconsole/asof/AsOfBanner.js +52 -0
- package/dist/bigconsole/asof/AsOfControl.d.ts +4 -0
- package/dist/bigconsole/asof/AsOfControl.js +164 -0
- package/dist/bigconsole/asof/AsOfProvider.d.ts +31 -0
- package/dist/bigconsole/asof/AsOfProvider.js +98 -0
- package/dist/bigconsole/asof/asOfMessage.d.ts +12 -0
- package/dist/bigconsole/asof/asOfMessage.js +12 -0
- package/dist/bigconsole/asof/asOfParam.d.ts +48 -0
- package/dist/bigconsole/asof/asOfParam.js +34 -0
- package/dist/bigconsole/asof/index.d.ts +7 -0
- package/dist/bigconsole/asof/index.js +6 -0
- package/dist/bigconsole/compare/compareEngine.d.ts +104 -0
- package/dist/bigconsole/compare/compareEngine.js +172 -0
- package/dist/bigconsole/compare/compareParam.d.ts +9 -0
- package/dist/bigconsole/compare/compareParam.js +13 -0
- package/dist/bigconsole/compare/compareSide.d.ts +5 -0
- package/dist/bigconsole/compare/compareSide.js +39 -0
- package/dist/bigconsole/compare/index.d.ts +3 -0
- package/dist/bigconsole/components/dashboard/DashboardCanvas.js +142 -138
- package/dist/bigconsole/components/dashboard/DashboardToolbar.js +97 -92
- package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js +78 -74
- package/dist/bigconsole/components/widgets/WidgetCompareView.d.ts +12 -0
- package/dist/bigconsole/components/widgets/WidgetCompareView.js +215 -0
- package/dist/bigconsole/components/widgets/WidgetMenu.js +98 -96
- package/dist/bigconsole/components/widgets/WidgetWrapper.js +399 -311
- package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js +47 -148
- package/dist/bigconsole/components/widgets/metric-card/metricData.d.ts +23 -0
- package/dist/bigconsole/components/widgets/metric-card/metricData.js +105 -0
- package/dist/bigconsole/components/widgets/table/TableCell.d.ts +2 -1
- package/dist/bigconsole/components/widgets/table/TableCell.js +1 -1
- package/dist/bigconsole/components/widgets/table/TableWidget.js +142 -168
- package/dist/bigconsole/components/widgets/table/tableRows.d.ts +17 -0
- package/dist/bigconsole/components/widgets/table/tableRows.js +35 -0
- package/dist/bigconsole/hooks/index.d.ts +1 -0
- package/dist/bigconsole/hooks/index.js +25 -24
- package/dist/bigconsole/hooks/useFilterFieldValues.js +52 -22
- package/dist/bigconsole/hooks/useWidgetCompareData.d.ts +8 -0
- package/dist/bigconsole/hooks/useWidgetCompareData.js +24 -0
- package/dist/bigconsole/hooks/useWidgetData.d.ts +7 -0
- package/dist/bigconsole/hooks/useWidgetData.js +53 -43
- package/dist/bigconsole/pages/DashboardViewPage.d.ts +7 -1
- package/dist/bigconsole/pages/DashboardViewPage.js +300 -278
- package/dist/bigconsole/pages/index.d.ts +1 -1
- package/dist/bigconsole/types/index.d.ts +13 -0
- package/dist/bigconsole/utils/widgetDisplayData.d.ts +16 -0
- package/dist/bigconsole/utils/widgetDisplayData.js +12 -1
- package/dist/generated/wspace-operations.d.ts +47 -0
- package/dist/generated/wspace-operations.js +261 -16
- package/dist/generated/wspace-types.d.ts +78 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Section as e } from "../components/common/Section.js";
|
|
2
|
+
import "../components/common/index.js";
|
|
3
|
+
import { formatWhen as t } from "./AsOfControl.js";
|
|
4
|
+
import { useAsOf as n } from "./AsOfProvider.js";
|
|
5
|
+
import { memo as r } from "react";
|
|
6
|
+
import { History as i } from "lucide-react";
|
|
7
|
+
import { Button as a } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
import { useI18n as o } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
9
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
|
+
// src/bigconsole/asof/AsOfBanner.tsx
|
|
11
|
+
var l = r(function() {
|
|
12
|
+
let { t: r } = o(), { asOf: l, clearAsOf: u, compareTo: d, clearCompare: f } = n();
|
|
13
|
+
if (!l) return null;
|
|
14
|
+
let p = d !== null, m = d instanceof Date ? t(d) : r("bigconsole.compare.banner.now", "now");
|
|
15
|
+
return /* @__PURE__ */ s("div", {
|
|
16
|
+
role: "status",
|
|
17
|
+
"aria-live": "polite",
|
|
18
|
+
className: "mx-card-padding mt-control-gap flex-shrink-0",
|
|
19
|
+
children: /* @__PURE__ */ s(e, {
|
|
20
|
+
tone: "warning",
|
|
21
|
+
padding: "compact",
|
|
22
|
+
headingLevel: 3,
|
|
23
|
+
"data-testid": "as-of-banner",
|
|
24
|
+
icon: /* @__PURE__ */ s(i, {
|
|
25
|
+
className: "size-4",
|
|
26
|
+
"aria-hidden": "true"
|
|
27
|
+
}),
|
|
28
|
+
title: p ? r("bigconsole.compare.banner.title", "Comparing {{from}} with {{to}}", {
|
|
29
|
+
from: t(l),
|
|
30
|
+
to: m
|
|
31
|
+
}) : r("bigconsole.asOf.banner.title", "Showing data as of {{date}}", { date: t(l) }),
|
|
32
|
+
description: p ? r("bigconsole.compare.banner.description", "Each chart, table and metric card shows both times and the difference. Parser versions are pinned to each date. The layout shown is the current one.") : r("bigconsole.asOf.banner.description", "Parser versions are pinned to that date. The layout shown is the current one. This is not live data."),
|
|
33
|
+
meta: /* @__PURE__ */ c("div", {
|
|
34
|
+
className: "flex items-center gap-2",
|
|
35
|
+
children: [p && /* @__PURE__ */ s(a, {
|
|
36
|
+
variant: "outline",
|
|
37
|
+
size: "sm",
|
|
38
|
+
onClick: f,
|
|
39
|
+
"data-testid": "compare-banner-stop",
|
|
40
|
+
children: r("bigconsole.compare.picker.stop", "Stop comparing")
|
|
41
|
+
}), /* @__PURE__ */ s(a, {
|
|
42
|
+
variant: "outline",
|
|
43
|
+
size: "sm",
|
|
44
|
+
onClick: u,
|
|
45
|
+
"data-testid": "as-of-banner-back",
|
|
46
|
+
children: r("bigconsole.asOf.banner.back", "Back to now")
|
|
47
|
+
})]
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
export { l as AsOfBanner, l as default };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { fromLocalInputValue as e, toLocalInputValue as t } from "./asOfParam.js";
|
|
2
|
+
import { useAsOf as n } from "./AsOfProvider.js";
|
|
3
|
+
import { memo as r, useEffect as i, useState as a } from "react";
|
|
4
|
+
import { History as o } from "lucide-react";
|
|
5
|
+
import { Button as s, Input as c, Popover as l, PopoverContent as u, PopoverTrigger as d } from "@burdenoff/fe-libs/ui";
|
|
6
|
+
import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
7
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
|
+
// src/bigconsole/asof/AsOfControl.tsx
|
|
9
|
+
var h = r(function() {
|
|
10
|
+
let { t: r } = f(), { enabled: h, asOf: _, setAsOf: v, clearAsOf: y, compareTo: b, setCompareTo: x, clearCompare: S } = n(), [C, w] = a(!1), [T, E] = a(t(_)), [D, O] = a(!1), [k, A] = a(""), [j, M] = a(!1);
|
|
11
|
+
if (i(() => {
|
|
12
|
+
C && (E(t(_)), O(!1), A(b instanceof Date ? t(b) : ""), M(!1));
|
|
13
|
+
}, [
|
|
14
|
+
C,
|
|
15
|
+
_,
|
|
16
|
+
b
|
|
17
|
+
]), !h) return null;
|
|
18
|
+
let N = _ ? r("bigconsole.asOf.control.at", "As of: {{date}}", { date: g(_) }) : r("bigconsole.asOf.control.now", "As of: Now"), P = () => {
|
|
19
|
+
let t = e(T);
|
|
20
|
+
t ? (v(t), w(!1)) : O(!0);
|
|
21
|
+
}, F = (e) => {
|
|
22
|
+
x(e), w(!1);
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ m(l, {
|
|
25
|
+
open: C,
|
|
26
|
+
onOpenChange: w,
|
|
27
|
+
children: [/* @__PURE__ */ p(d, {
|
|
28
|
+
asChild: !0,
|
|
29
|
+
children: /* @__PURE__ */ m(s, {
|
|
30
|
+
variant: _ ? "secondary" : "outline",
|
|
31
|
+
size: "sm",
|
|
32
|
+
"data-testid": "as-of-control",
|
|
33
|
+
"aria-label": r("bigconsole.asOf.control.aria", "Show this board as of a past date and time"),
|
|
34
|
+
children: [/* @__PURE__ */ p(o, {
|
|
35
|
+
className: "size-4",
|
|
36
|
+
"aria-hidden": "true"
|
|
37
|
+
}), /* @__PURE__ */ p("span", {
|
|
38
|
+
className: "ml-1",
|
|
39
|
+
children: N
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
42
|
+
}), /* @__PURE__ */ m(u, {
|
|
43
|
+
align: "end",
|
|
44
|
+
className: "w-80 space-y-3",
|
|
45
|
+
"data-testid": "as-of-picker",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("p", {
|
|
48
|
+
className: "text-sm font-medium text-text-primary",
|
|
49
|
+
children: r("bigconsole.asOf.picker.title", "Show this board as of")
|
|
50
|
+
}), /* @__PURE__ */ p("p", {
|
|
51
|
+
className: "mt-1 text-xs text-text-muted",
|
|
52
|
+
children: r("bigconsole.asOf.picker.hint", "Pick a past date and time. Each data source is read as it was then, and parsers are pinned to that date.")
|
|
53
|
+
})] }),
|
|
54
|
+
/* @__PURE__ */ p(c, {
|
|
55
|
+
type: "datetime-local",
|
|
56
|
+
value: T,
|
|
57
|
+
max: t(/* @__PURE__ */ new Date()),
|
|
58
|
+
onChange: (e) => {
|
|
59
|
+
E(e.target.value), O(!1);
|
|
60
|
+
},
|
|
61
|
+
"aria-label": r("bigconsole.asOf.picker.input", "Date and time"),
|
|
62
|
+
"aria-invalid": D,
|
|
63
|
+
"data-testid": "as-of-input"
|
|
64
|
+
}),
|
|
65
|
+
D && /* @__PURE__ */ p("p", {
|
|
66
|
+
role: "alert",
|
|
67
|
+
className: "text-xs text-status-danger-text",
|
|
68
|
+
"data-testid": "as-of-invalid",
|
|
69
|
+
children: r("bigconsole.asOf.picker.invalid", "Pick a date and time that is not in the future.")
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ m("div", {
|
|
72
|
+
className: "flex items-center justify-between gap-2",
|
|
73
|
+
children: [/* @__PURE__ */ p(s, {
|
|
74
|
+
variant: "ghost",
|
|
75
|
+
size: "sm",
|
|
76
|
+
disabled: !_,
|
|
77
|
+
onClick: () => {
|
|
78
|
+
y(), w(!1);
|
|
79
|
+
},
|
|
80
|
+
"data-testid": "as-of-back-to-now",
|
|
81
|
+
children: r("bigconsole.asOf.picker.back", "Back to now")
|
|
82
|
+
}), /* @__PURE__ */ p(s, {
|
|
83
|
+
size: "sm",
|
|
84
|
+
onClick: P,
|
|
85
|
+
"data-testid": "as-of-apply",
|
|
86
|
+
children: r("bigconsole.asOf.picker.apply", "Show")
|
|
87
|
+
})]
|
|
88
|
+
}),
|
|
89
|
+
_ && /* @__PURE__ */ m("div", {
|
|
90
|
+
className: "space-y-2 border-t border-border-subtle pt-3",
|
|
91
|
+
"data-testid": "compare-section",
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ p("p", {
|
|
94
|
+
className: "text-sm font-medium text-text-primary",
|
|
95
|
+
children: r("bigconsole.compare.picker.title", "Compare with")
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ p("p", {
|
|
98
|
+
className: "text-xs text-text-muted",
|
|
99
|
+
children: r("bigconsole.compare.picker.hint", "See each chart, table and metric card at both times, with the difference.")
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ p(c, {
|
|
102
|
+
type: "datetime-local",
|
|
103
|
+
value: k,
|
|
104
|
+
min: t(_),
|
|
105
|
+
max: t(/* @__PURE__ */ new Date()),
|
|
106
|
+
onChange: (e) => {
|
|
107
|
+
A(e.target.value), M(!1);
|
|
108
|
+
},
|
|
109
|
+
"aria-label": r("bigconsole.compare.picker.input", "Second date and time"),
|
|
110
|
+
"aria-invalid": j,
|
|
111
|
+
"data-testid": "compare-input"
|
|
112
|
+
}),
|
|
113
|
+
j && /* @__PURE__ */ p("p", {
|
|
114
|
+
role: "alert",
|
|
115
|
+
className: "text-xs text-status-danger-text",
|
|
116
|
+
"data-testid": "compare-invalid",
|
|
117
|
+
children: r("bigconsole.compare.picker.invalid", "Pick a time that is after the first one and not in the future.")
|
|
118
|
+
}),
|
|
119
|
+
/* @__PURE__ */ m("div", {
|
|
120
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
121
|
+
children: [/* @__PURE__ */ p(s, {
|
|
122
|
+
variant: "ghost",
|
|
123
|
+
size: "sm",
|
|
124
|
+
disabled: !b,
|
|
125
|
+
onClick: () => {
|
|
126
|
+
S(), w(!1);
|
|
127
|
+
},
|
|
128
|
+
"data-testid": "compare-stop",
|
|
129
|
+
children: r("bigconsole.compare.picker.stop", "Stop comparing")
|
|
130
|
+
}), /* @__PURE__ */ m("div", {
|
|
131
|
+
className: "flex items-center gap-2",
|
|
132
|
+
children: [/* @__PURE__ */ p(s, {
|
|
133
|
+
variant: "outline",
|
|
134
|
+
size: "sm",
|
|
135
|
+
onClick: () => F("now"),
|
|
136
|
+
"data-testid": "compare-now",
|
|
137
|
+
children: r("bigconsole.compare.picker.now", "Compare with now")
|
|
138
|
+
}), /* @__PURE__ */ p(s, {
|
|
139
|
+
size: "sm",
|
|
140
|
+
onClick: () => {
|
|
141
|
+
let t = e(k);
|
|
142
|
+
!t || !_ || t.getTime() <= _.getTime() ? M(!0) : F(t);
|
|
143
|
+
},
|
|
144
|
+
"data-testid": "compare-apply",
|
|
145
|
+
children: r("bigconsole.compare.picker.apply", "Compare")
|
|
146
|
+
})]
|
|
147
|
+
})]
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
function g(e) {
|
|
156
|
+
return e.toLocaleString([], {
|
|
157
|
+
day: "numeric",
|
|
158
|
+
month: "short",
|
|
159
|
+
year: "numeric",
|
|
160
|
+
hour: "2-digit",
|
|
161
|
+
minute: "2-digit"
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
export { h as AsOfControl, g as formatWhen };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { CompareTarget } from '../compare/compareParam';
|
|
3
|
+
export interface AsOfState {
|
|
4
|
+
/** The workspace has the as-of view on. */
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
/** The time being shown, or null for live data. */
|
|
7
|
+
asOf: Date | null;
|
|
8
|
+
/** Show the board as of a time. */
|
|
9
|
+
setAsOf: (date: Date) => void;
|
|
10
|
+
/** Go back to live data. */
|
|
11
|
+
clearAsOf: () => void;
|
|
12
|
+
/** What the board at `asOf` is compared with (BOFF-14758), or null when it is not a compare. */
|
|
13
|
+
compareTo: CompareTarget | null;
|
|
14
|
+
/** Compare the board at `asOf` with live data or another time. */
|
|
15
|
+
setCompareTo: (target: CompareTarget) => void;
|
|
16
|
+
/** Stop comparing; the board stays as of `asOf`. */
|
|
17
|
+
clearCompare: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface AsOfProviderProps {
|
|
20
|
+
workspaceId?: string | null;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare const AsOfProvider: FC<AsOfProviderProps>;
|
|
24
|
+
export declare function useAsOf(): AsOfState;
|
|
25
|
+
/**
|
|
26
|
+
* Renders its children only for a live view. For parts of a board that describe
|
|
27
|
+
* or act on current data (the AI digest, for one), which would contradict a past view.
|
|
28
|
+
*/
|
|
29
|
+
export declare const HideWhenAsOf: FC<{
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { COMPARE_PARAM as e, formatCompareTarget as t, parseCompareTarget as n } from "../compare/compareParam.js";
|
|
2
|
+
import { AS_OF_FEATURE_FLAG as r, AS_OF_PARAM as i, flagStatusForScope as a, formatAsOf as o, parseAsOf as s, shouldWaitForFlag as c } from "./asOfParam.js";
|
|
3
|
+
import { createContext as l, useCallback as u, useContext as d, useEffect as f, useMemo as p, useState as m } from "react";
|
|
4
|
+
import { useSearchParams as h } from "react-router";
|
|
5
|
+
import { FeatureFlagProvider as g, useFeatureFlag as _, useFeatureFlags as v } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
6
|
+
import { Spinner as y } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
8
|
+
// src/bigconsole/asof/AsOfProvider.tsx
|
|
9
|
+
var C = l({
|
|
10
|
+
enabled: !1,
|
|
11
|
+
asOf: null,
|
|
12
|
+
setAsOf: () => {},
|
|
13
|
+
clearAsOf: () => {},
|
|
14
|
+
compareTo: null,
|
|
15
|
+
setCompareTo: () => {},
|
|
16
|
+
clearCompare: () => {}
|
|
17
|
+
}), w = {
|
|
18
|
+
ready: !1,
|
|
19
|
+
enabled: !1
|
|
20
|
+
}, T = ({ onChange: e }) => {
|
|
21
|
+
let t = _(r, !1) === !0, { isLoading: n } = v(), i = !n;
|
|
22
|
+
return f(() => e({
|
|
23
|
+
ready: i,
|
|
24
|
+
enabled: t
|
|
25
|
+
}), [
|
|
26
|
+
i,
|
|
27
|
+
t,
|
|
28
|
+
e
|
|
29
|
+
]), null;
|
|
30
|
+
}, E = ({ workspaceId: r, children: l }) => {
|
|
31
|
+
let d = r ?? null, [f, _] = m({
|
|
32
|
+
...w,
|
|
33
|
+
workspaceId: d
|
|
34
|
+
}), { enabled: v, ready: b } = a(f, d), E = u((e) => _({
|
|
35
|
+
...e,
|
|
36
|
+
workspaceId: d
|
|
37
|
+
}), [d]), [D, O] = h(), k = D.get(i), A = c(b, k), j = p(() => v ? s(k) : null, [v, k]), M = D.get(e), N = p(() => n(M, j), [j, M]), P = u((r) => {
|
|
38
|
+
O((a) => {
|
|
39
|
+
let s = new URLSearchParams(a);
|
|
40
|
+
s.set(i, o(r));
|
|
41
|
+
let c = n(a.get(e), r);
|
|
42
|
+
return c ? s.set(e, t(c)) : s.delete(e), s;
|
|
43
|
+
}, { replace: !0 });
|
|
44
|
+
}, [O]), F = u(() => {
|
|
45
|
+
O((t) => {
|
|
46
|
+
let n = new URLSearchParams(t);
|
|
47
|
+
return n.delete(i), n.delete(e), n;
|
|
48
|
+
}, { replace: !0 });
|
|
49
|
+
}, [O]), I = u((n) => {
|
|
50
|
+
O((r) => {
|
|
51
|
+
let i = new URLSearchParams(r);
|
|
52
|
+
return i.set(e, t(n)), i;
|
|
53
|
+
}, { replace: !0 });
|
|
54
|
+
}, [O]), L = u(() => {
|
|
55
|
+
O((t) => {
|
|
56
|
+
let n = new URLSearchParams(t);
|
|
57
|
+
return n.delete(e), n;
|
|
58
|
+
}, { replace: !0 });
|
|
59
|
+
}, [O]), R = p(() => ({
|
|
60
|
+
enabled: v,
|
|
61
|
+
asOf: j,
|
|
62
|
+
setAsOf: P,
|
|
63
|
+
clearAsOf: F,
|
|
64
|
+
compareTo: N,
|
|
65
|
+
setCompareTo: I,
|
|
66
|
+
clearCompare: L
|
|
67
|
+
}), [
|
|
68
|
+
v,
|
|
69
|
+
j,
|
|
70
|
+
P,
|
|
71
|
+
F,
|
|
72
|
+
N,
|
|
73
|
+
I,
|
|
74
|
+
L
|
|
75
|
+
]);
|
|
76
|
+
return /* @__PURE__ */ S(C.Provider, {
|
|
77
|
+
value: R,
|
|
78
|
+
children: [/* @__PURE__ */ x(g, {
|
|
79
|
+
workspaceId: d,
|
|
80
|
+
gateway: "global",
|
|
81
|
+
defaultEnabled: !1,
|
|
82
|
+
children: /* @__PURE__ */ x(T, { onChange: E })
|
|
83
|
+
}, d ?? "none"), A ? /* @__PURE__ */ x("div", {
|
|
84
|
+
className: "flex flex-1 items-center justify-center p-8",
|
|
85
|
+
role: "status",
|
|
86
|
+
"data-testid": "as-of-pending",
|
|
87
|
+
children: /* @__PURE__ */ x(y, {})
|
|
88
|
+
}) : l]
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
function D() {
|
|
92
|
+
return d(C);
|
|
93
|
+
}
|
|
94
|
+
var O = ({ children: e }) => {
|
|
95
|
+
let { asOf: t } = D();
|
|
96
|
+
return t ? null : /* @__PURE__ */ x(b, { children: e });
|
|
97
|
+
};
|
|
98
|
+
export { E as AsOfProvider, O as HideWhenAsOf, D as useAsOf };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a widget has no data as of a past time, in words a viewer understands
|
|
3
|
+
* (BOFF-14757). The reasons come from the as-of read (BOFF-14755, BOFF-14756).
|
|
4
|
+
*/
|
|
5
|
+
type Translate = (key: string, fallback: string) => string;
|
|
6
|
+
/** The widget has nothing to show when the as-of read could not answer. */
|
|
7
|
+
export interface AsOfReadInfo {
|
|
8
|
+
historyAvailable: boolean;
|
|
9
|
+
reason?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export declare function asOfUnavailableMessage(info: AsOfReadInfo | null | undefined, t: Translate): string | null;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/bigconsole/asof/asOfMessage.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
if (!e || e.historyAvailable) return null;
|
|
4
|
+
switch (e.reason) {
|
|
5
|
+
case "NO_DATA_AT_DATE": return t("bigconsole.asOf.unavailable.noDataAtDate", "This data source has no data at the chosen date");
|
|
6
|
+
case "READ_FAILED": return t("bigconsole.asOf.unavailable.readFailed", "History could not be read for this data source");
|
|
7
|
+
case "PAYLOAD_TOO_LARGE": return t("bigconsole.asOf.unavailable.payloadTooLarge", "This data source is too large to read as of a past date");
|
|
8
|
+
case "PARSER_UNAVAILABLE": return t("bigconsole.asOf.unavailable.parserUnavailable", "The parser this widget uses was not available at the chosen date");
|
|
9
|
+
default: return t("bigconsole.asOf.unavailable.historyNotAvailable", "History is not available for this data source");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export { e as asOfUnavailableMessage };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The "as of" time of a dashboard view (BOFF-14757).
|
|
3
|
+
*
|
|
4
|
+
* It lives in the URL (`?asOf=2026-10-31T02:00:00.000Z`) so a view can be
|
|
5
|
+
* shared and survives a reload. Only a strict UTC ISO-8601 time is accepted,
|
|
6
|
+
* and never one in the future: anything else means a live view.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AS_OF_PARAM = "asOf";
|
|
9
|
+
/** Workspace feature flag that turns the as-of view on. Off unless set. */
|
|
10
|
+
export declare const AS_OF_FEATURE_FLAG = "bigconsole.as-of-view";
|
|
11
|
+
/**
|
|
12
|
+
* The time in an `asOf` URL value, or null when it is missing, malformed,
|
|
13
|
+
* not a real calendar time, or later than `now`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseAsOf(value: string | null | undefined, now?: Date): Date | null;
|
|
16
|
+
/** The URL value for a time: UTC, whole seconds. */
|
|
17
|
+
export declare function formatAsOf(date: Date): string;
|
|
18
|
+
/**
|
|
19
|
+
* The value of a `datetime-local` input (local time, minutes) for a time.
|
|
20
|
+
* An empty string when there is no time, so the input is cleared.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toLocalInputValue(date: Date | null): string;
|
|
23
|
+
/**
|
|
24
|
+
* The time a `datetime-local` value means, read as local time. Null when it is
|
|
25
|
+
* empty, not a real time, or later than `now`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function fromLocalInputValue(value: string, now?: Date): Date | null;
|
|
28
|
+
/**
|
|
29
|
+
* Whether a view must wait for the workspace flag before showing anything: a
|
|
30
|
+
* link to a past time must not render as live data first. A view with no valid
|
|
31
|
+
* time has nothing to protect and never waits.
|
|
32
|
+
*/
|
|
33
|
+
export declare function shouldWaitForFlag(flagReady: boolean, raw: string | null | undefined, now?: Date): boolean;
|
|
34
|
+
/** What the flag lookup last reported, and for which workspace. */
|
|
35
|
+
export interface ReportedFlag {
|
|
36
|
+
ready: boolean;
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
workspaceId: string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The flag status to trust for a workspace. What was reported for another
|
|
42
|
+
* workspace says nothing about this one, so after a workspace switch the flag is
|
|
43
|
+
* "not looked up yet" (and off) until this workspace reports.
|
|
44
|
+
*/
|
|
45
|
+
export declare function flagStatusForScope(reported: ReportedFlag, workspaceId: string | null): {
|
|
46
|
+
ready: boolean;
|
|
47
|
+
enabled: boolean;
|
|
48
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/bigconsole/asof/asOfParam.ts
|
|
2
|
+
var e = "asOf", t = "bigconsole.as-of-view", n = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?Z$/;
|
|
3
|
+
function r(e, t = /* @__PURE__ */ new Date()) {
|
|
4
|
+
if (!e || !n.test(e)) return null;
|
|
5
|
+
let r = new Date(e);
|
|
6
|
+
return Number.isNaN(r.getTime()) || r.toISOString().slice(0, 10) !== e.slice(0, 10) || r.getTime() > t.getTime() ? null : r;
|
|
7
|
+
}
|
|
8
|
+
function i(e) {
|
|
9
|
+
return e.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
10
|
+
}
|
|
11
|
+
function a(e) {
|
|
12
|
+
if (!e) return "";
|
|
13
|
+
let t = (e) => String(e).padStart(2, "0");
|
|
14
|
+
return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`;
|
|
15
|
+
}
|
|
16
|
+
function o(e, t = /* @__PURE__ */ new Date()) {
|
|
17
|
+
let n = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);
|
|
18
|
+
if (!n) return null;
|
|
19
|
+
let [r, i, a, o, s] = n.slice(1).map(Number), c = new Date(r, i - 1, a, o, s, 0, 0);
|
|
20
|
+
return c.getFullYear() !== r || c.getMonth() !== i - 1 || c.getDate() !== a || c.getHours() !== o || c.getMinutes() !== s || c.getTime() > t.getTime() ? null : c;
|
|
21
|
+
}
|
|
22
|
+
function s(e, t, n = /* @__PURE__ */ new Date()) {
|
|
23
|
+
return !e && r(t, n) !== null;
|
|
24
|
+
}
|
|
25
|
+
function c(e, t) {
|
|
26
|
+
return e.workspaceId === t ? {
|
|
27
|
+
ready: e.ready,
|
|
28
|
+
enabled: e.enabled
|
|
29
|
+
} : {
|
|
30
|
+
ready: !1,
|
|
31
|
+
enabled: !1
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export { t as AS_OF_FEATURE_FLAG, e as AS_OF_PARAM, c as flagStatusForScope, i as formatAsOf, o as fromLocalInputValue, r as parseAsOf, s as shouldWaitForFlag, a as toLocalInputValue };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AsOfBanner } from './AsOfBanner';
|
|
2
|
+
export { AsOfControl, formatWhen } from './AsOfControl';
|
|
3
|
+
export { AsOfProvider, HideWhenAsOf, useAsOf } from './AsOfProvider';
|
|
4
|
+
export type { AsOfState } from './AsOfProvider';
|
|
5
|
+
export { AS_OF_FEATURE_FLAG, AS_OF_PARAM, formatAsOf, fromLocalInputValue, parseAsOf, toLocalInputValue, } from './asOfParam';
|
|
6
|
+
export { asOfUnavailableMessage } from './asOfMessage';
|
|
7
|
+
export type { AsOfReadInfo } from './asOfMessage';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AS_OF_PARAM as e, formatAsOf as t } from "./asOfParam.js";
|
|
2
|
+
import { AsOfBanner as n } from "./AsOfBanner.js";
|
|
3
|
+
import { AsOfControl as r, formatWhen as i } from "./AsOfControl.js";
|
|
4
|
+
import { AsOfProvider as a, HideWhenAsOf as o, useAsOf as s } from "./AsOfProvider.js";
|
|
5
|
+
import { asOfUnavailableMessage as c } from "./asOfMessage.js";
|
|
6
|
+
export { e as AS_OF_PARAM, n as AsOfBanner, r as AsOfControl, a as AsOfProvider, o as HideWhenAsOf, c as asOfUnavailableMessage, t as formatAsOf, i as formatWhen, s as useAsOf };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { MetricCardData } from '../components/widgets/metric-card/MetricCardWidget';
|
|
2
|
+
/** What a widget returned at one of the two times. */
|
|
3
|
+
export type CompareSide =
|
|
4
|
+
/** The data source held data at that time. */
|
|
5
|
+
{
|
|
6
|
+
readonly available: true;
|
|
7
|
+
readonly data: unknown;
|
|
8
|
+
}
|
|
9
|
+
/** No data could be read at that time. The compare cannot say what changed. */
|
|
10
|
+
| {
|
|
11
|
+
readonly available: false;
|
|
12
|
+
};
|
|
13
|
+
export interface CompareInput {
|
|
14
|
+
/** The widget's `type`, for example `metric_card`. */
|
|
15
|
+
readonly widgetType: string;
|
|
16
|
+
/** The widget's saved config. */
|
|
17
|
+
readonly config: Record<string, unknown> | null | undefined;
|
|
18
|
+
/** The earlier time. */
|
|
19
|
+
readonly from: CompareSide;
|
|
20
|
+
/** The later time. */
|
|
21
|
+
readonly to: CompareSide;
|
|
22
|
+
}
|
|
23
|
+
/** The difference between two numbers. */
|
|
24
|
+
export interface Change {
|
|
25
|
+
/** `to - from`. Null when either side is not a number. */
|
|
26
|
+
readonly absolute: number | null;
|
|
27
|
+
/** `(to - from) / |from| × 100`. Null when `from` is 0 or either side is not a number. */
|
|
28
|
+
readonly percent: number | null;
|
|
29
|
+
readonly direction: 'up' | 'down' | 'same' | 'unknown';
|
|
30
|
+
}
|
|
31
|
+
export type CompareValue = number | string | null;
|
|
32
|
+
export interface ValuePair {
|
|
33
|
+
readonly from: CompareValue;
|
|
34
|
+
readonly to: CompareValue;
|
|
35
|
+
readonly change: Change;
|
|
36
|
+
}
|
|
37
|
+
export interface MetricCompare {
|
|
38
|
+
readonly kind: 'metric';
|
|
39
|
+
readonly value: ValuePair;
|
|
40
|
+
/** The card's data at each time as the card reads it (unit, currency flag), so the view can format it as the card does. */
|
|
41
|
+
readonly from: MetricCardData | null;
|
|
42
|
+
readonly to: MetricCardData | null;
|
|
43
|
+
}
|
|
44
|
+
export interface ChartComparePoint {
|
|
45
|
+
/** The x-axis label (a category, a date). */
|
|
46
|
+
readonly label: string;
|
|
47
|
+
/** One entry per series, in the order of `series`. */
|
|
48
|
+
readonly values: readonly ValuePair[];
|
|
49
|
+
}
|
|
50
|
+
export interface ChartCompare {
|
|
51
|
+
readonly kind: 'chart';
|
|
52
|
+
/** The numeric fields compared, for example `['revenue', 'orders']`. */
|
|
53
|
+
readonly series: readonly string[];
|
|
54
|
+
readonly points: readonly ChartComparePoint[];
|
|
55
|
+
}
|
|
56
|
+
export type TableRowStatus = 'added' | 'removed' | 'changed' | 'unchanged';
|
|
57
|
+
export interface TableCompareCell {
|
|
58
|
+
readonly column: string;
|
|
59
|
+
readonly from: unknown;
|
|
60
|
+
readonly to: unknown;
|
|
61
|
+
readonly changed: boolean;
|
|
62
|
+
/** The change for a numeric cell that moved. Unknown for text. */
|
|
63
|
+
readonly change: Change;
|
|
64
|
+
}
|
|
65
|
+
export interface TableCompareRow {
|
|
66
|
+
/** The value of the key column that matched this row across the two times. */
|
|
67
|
+
readonly key: string;
|
|
68
|
+
readonly status: TableRowStatus;
|
|
69
|
+
readonly cells: readonly TableCompareCell[];
|
|
70
|
+
}
|
|
71
|
+
export interface TableCompare {
|
|
72
|
+
readonly kind: 'table';
|
|
73
|
+
readonly columns: readonly string[];
|
|
74
|
+
/** The column whose value matches a row at the first time to the same row at the second. */
|
|
75
|
+
readonly keyColumn: string;
|
|
76
|
+
readonly rows: readonly TableCompareRow[];
|
|
77
|
+
readonly summary: Readonly<Record<TableRowStatus, number>>;
|
|
78
|
+
}
|
|
79
|
+
/** Why a widget cannot be compared right now. */
|
|
80
|
+
export type UnavailableReason =
|
|
81
|
+
/** No data at the earlier time. */
|
|
82
|
+
'no_data_from'
|
|
83
|
+
/** No data at the later time. */
|
|
84
|
+
| 'no_data_to'
|
|
85
|
+
/** The widget returned something the compare cannot read as this widget type. */
|
|
86
|
+
| 'unreadable_data'
|
|
87
|
+
/** Two rows share the same key, so a row cannot be matched to one row at the other time. */
|
|
88
|
+
| 'duplicate_keys'
|
|
89
|
+
/** The table has no column to match rows on. */
|
|
90
|
+
| 'no_key_column';
|
|
91
|
+
export type CompareResult = MetricCompare | ChartCompare | TableCompare | {
|
|
92
|
+
readonly kind: 'unavailable';
|
|
93
|
+
readonly reason: UnavailableReason;
|
|
94
|
+
}
|
|
95
|
+
/** The compare does not cover this kind of widget (yet). */
|
|
96
|
+
| {
|
|
97
|
+
readonly kind: 'unsupported';
|
|
98
|
+
readonly widgetType: string;
|
|
99
|
+
};
|
|
100
|
+
/** The change from one value to another. Only numbers have one. */
|
|
101
|
+
export declare function changeBetween(from: unknown, to: unknown): Change;
|
|
102
|
+
/** Whether the compare covers this widget type at all. A chart of an unsupported kind is only known from its config. */
|
|
103
|
+
export declare function isCompareSupported(widgetType: string): boolean;
|
|
104
|
+
export declare function compareWidget(input: CompareInput): CompareResult;
|