@burdenoff/microfe-bigconsole 2026.1124.3 → 2026.1124.5

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.
Files changed (26) hide show
  1. package/dist/bigconsole/components/builder/inspector/AppearanceSection.js +12 -6
  2. package/dist/bigconsole/components/builder/inspector/DataBindingSection.d.ts +2 -1
  3. package/dist/bigconsole/components/builder/inspector/DataBindingSection.js +34 -34
  4. package/dist/bigconsole/components/fleet/FleetBindingsDialog.d.ts +19 -0
  5. package/dist/bigconsole/components/fleet/FleetBindingsDialog.js +287 -0
  6. package/dist/bigconsole/components/fleet/FleetChildrenPanel.js +194 -170
  7. package/dist/bigconsole/components/widgets/PropertiesPanel.js +489 -474
  8. package/dist/bigconsole/components/widgets/chart/ChartConfig.d.ts +1 -0
  9. package/dist/bigconsole/components/widgets/chart/ChartConfig.js +111 -107
  10. package/dist/bigconsole/components/widgets/chart/ChartFieldMappings.d.ts +8 -0
  11. package/dist/bigconsole/components/widgets/chart/ChartFieldMappings.js +85 -0
  12. package/dist/bigconsole/components/widgets/chart/chartMappingFields.d.ts +9 -0
  13. package/dist/bigconsole/components/widgets/chart/chartMappingFields.js +30 -0
  14. package/dist/bigconsole/components/widgets/chart/charts/funnelData.d.ts +2 -0
  15. package/dist/bigconsole/components/widgets/chart/charts/funnelData.js +11 -13
  16. package/dist/bigconsole/hooks/useFleetBindingActions.d.ts +23 -0
  17. package/dist/bigconsole/hooks/useFleetBindingActions.js +50 -0
  18. package/dist/bigconsole/hooks/useFleetBindings.d.ts +19 -0
  19. package/dist/bigconsole/hooks/useFleetBindings.js +140 -0
  20. package/dist/bigconsole/utils/fleetBindings.d.ts +49 -0
  21. package/dist/bigconsole/utils/fleetBindings.js +52 -0
  22. package/dist/bigconsole/utils/widgetBinding.js +57 -44
  23. package/dist/generated/wspace-operations.d.ts +109 -0
  24. package/dist/generated/wspace-operations.js +634 -131
  25. package/dist/generated/wspace-types.js +12 -10
  26. package/package.json +1 -1
@@ -19,15 +19,21 @@ function p(e) {
19
19
  function m(e) {
20
20
  return /* @__PURE__ */ f(r, {
21
21
  ...e,
22
- fixedChartType: "funnel"
22
+ showFieldMappings: !1
23
23
  });
24
24
  }
25
25
  function h(e) {
26
+ return /* @__PURE__ */ f(m, {
27
+ ...e,
28
+ fixedChartType: "funnel"
29
+ });
30
+ }
31
+ function g(e) {
26
32
  switch (e) {
27
33
  case "metric_card": return p(t);
28
34
  case "kpi_card_comparison": return p(n);
29
- case "chart": return p(r);
30
- case "funnel_chart": return p(m);
35
+ case "chart": return p(m);
36
+ case "funnel_chart": return p(h);
31
37
  case "table":
32
38
  case "pivot_table": return p(i);
33
39
  case "gauge": return p(a);
@@ -37,8 +43,8 @@ function h(e) {
37
43
  default: return null;
38
44
  }
39
45
  }
40
- var g = u(function({ widgetType: t, config: n, onChange: r }) {
41
- let { t: i } = d(), a = h(t);
46
+ var _ = u(function({ widgetType: t, config: n, onChange: r }) {
47
+ let { t: i } = d(), a = g(t);
42
48
  return [
43
49
  "map",
44
50
  "waterfall",
@@ -73,4 +79,4 @@ var g = u(function({ widgetType: t, config: n, onChange: r }) {
73
79
  })
74
80
  });
75
81
  });
76
- export { g as AppearanceSection };
82
+ export { _ as AppearanceSection };
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { FC, ReactNode } from 'react';
2
2
  import { WidgetBinding, WidgetBindingStatus, Parser } from '../../../types';
3
3
  export interface DataBindingSectionProps {
4
4
  consoleId: string;
@@ -10,6 +10,7 @@ export interface DataBindingSectionProps {
10
10
  resolving?: boolean;
11
11
  missingFields?: string[];
12
12
  preview?: unknown;
13
+ fieldMappings?: ReactNode;
13
14
  error?: string | null;
14
15
  onDataSinkChange: (key: string | null) => void;
15
16
  onParserChange: (parserId: string | null) => void;
@@ -16,59 +16,59 @@ var u = {
16
16
  parser_required: "warning",
17
17
  invalid_sample: "danger",
18
18
  shape_mismatch: "warning"
19
- }, d = ({ consoleId: d, binding: f, resolvedParser: p, dataSinkKey: m, dataPath: h, status: g, resolving: _ = !1, missingFields: v = [], preview: y, error: b, onDataSinkChange: x, onParserChange: S, onDataPathChange: C }) => {
20
- let { t: w } = s(), T = {
21
- unbound: w("bigconsole.builder.dataBinding.status.unbound", "Select a DataSink to begin"),
22
- loading: _ ? w("bigconsole.parsers.selector.loading", "Loading parsers...") : w("bigconsole.builder.dataBinding.status.loading", "Testing parser and detecting fields…"),
23
- bound: w("bigconsole.builder.dataBinding.status.bound", "Binding ready"),
24
- no_data: w("bigconsole.builder.dataBinding.status.noData", "Parser returned no data"),
25
- parser_error: w("bigconsole.builder.dataBinding.status.parserError", "Parser test failed"),
26
- field_mismatch: w("bigconsole.builder.dataBinding.status.fieldMismatch", "Some mapped fields were not found"),
27
- parser_required: w("bigconsole.builder.dataBinding.status.parserRequired", "Select a parser so this widget can draw data"),
28
- invalid_sample: w("bigconsole.builder.dataBinding.status.invalidSample", "Sample JSON is not valid JSON"),
29
- shape_mismatch: w("bigconsole.builder.dataBinding.status.shapeMismatch", "Data does not match this widget's required shape")
19
+ }, d = ({ consoleId: d, binding: f, resolvedParser: p, dataSinkKey: m, dataPath: h, status: g, resolving: _ = !1, missingFields: v = [], preview: y, fieldMappings: b, error: x, onDataSinkChange: S, onParserChange: C, onDataPathChange: w }) => {
20
+ let { t: T } = s(), E = {
21
+ unbound: T("bigconsole.builder.dataBinding.status.unbound", "Select a DataSink to begin"),
22
+ loading: _ ? T("bigconsole.parsers.selector.loading", "Loading parsers...") : T("bigconsole.builder.dataBinding.status.loading", "Testing parser and detecting fields…"),
23
+ bound: T("bigconsole.builder.dataBinding.status.bound", "Binding ready"),
24
+ no_data: T("bigconsole.builder.dataBinding.status.noData", "Parser returned no data"),
25
+ parser_error: T("bigconsole.builder.dataBinding.status.parserError", "Parser test failed"),
26
+ field_mismatch: T("bigconsole.builder.dataBinding.status.fieldMismatch", "Some mapped fields were not found"),
27
+ parser_required: T("bigconsole.builder.dataBinding.status.parserRequired", "Select a parser so this widget can draw data"),
28
+ invalid_sample: T("bigconsole.builder.dataBinding.status.invalidSample", "Sample JSON is not valid JSON"),
29
+ shape_mismatch: T("bigconsole.builder.dataBinding.status.shapeMismatch", "Data does not match this widget's required shape")
30
30
  };
31
31
  return /* @__PURE__ */ l(t, { children: [
32
32
  /* @__PURE__ */ c(e, {
33
33
  title: "Data source",
34
- description: w("bigconsole.builder.dataBinding.intro", "Connect this widget to a DataSink and Parser to display transformed data."),
34
+ description: T("bigconsole.builder.dataBinding.intro", "Connect this widget to a DataSink and Parser to display transformed data."),
35
35
  "data-testid": "widget-inspector-data-source",
36
36
  children: /* @__PURE__ */ l("div", {
37
37
  className: "flex flex-col gap-form-gap",
38
38
  children: [/* @__PURE__ */ l("div", {
39
39
  className: "space-y-2",
40
40
  children: [
41
- /* @__PURE__ */ c(a, { children: w("bigconsole.builder.dataBinding.dataSinkLabel", "DataSink") }),
41
+ /* @__PURE__ */ c(a, { children: T("bigconsole.builder.dataBinding.dataSinkLabel", "DataSink") }),
42
42
  /* @__PURE__ */ c(n, {
43
43
  value: m,
44
- onChange: x,
45
- placeholder: w("bigconsole.builder.dataBinding.dataSinkPlaceholder", "Select a DataSink...")
44
+ onChange: S,
45
+ placeholder: T("bigconsole.builder.dataBinding.dataSinkPlaceholder", "Select a DataSink...")
46
46
  }),
47
47
  m && /* @__PURE__ */ l("p", {
48
48
  className: "text-xs text-text-secondary",
49
- children: [w("bigconsole.builder.dataBinding.keyLabel", "Key: {{key}}", { key: m }), f.source.ref && /* @__PURE__ */ c("span", {
49
+ children: [T("bigconsole.builder.dataBinding.keyLabel", "Key: {{key}}", { key: m }), f.source.ref && /* @__PURE__ */ c("span", {
50
50
  className: "ml-2 text-text-muted",
51
- children: w("bigconsole.builder.dataBinding.idLabel", "ID: {{id}}...", { id: f.source.ref.slice(0, 8) })
51
+ children: T("bigconsole.builder.dataBinding.idLabel", "ID: {{id}}...", { id: f.source.ref.slice(0, 8) })
52
52
  })]
53
53
  })
54
54
  ]
55
55
  }), /* @__PURE__ */ l("div", {
56
56
  className: "space-y-2",
57
- children: [/* @__PURE__ */ c(a, { children: w("bigconsole.builder.dataBinding.parserLabel", "Parser") }), /* @__PURE__ */ c(r, {
57
+ children: [/* @__PURE__ */ c(a, { children: T("bigconsole.builder.dataBinding.parserLabel", "Parser") }), /* @__PURE__ */ c(r, {
58
58
  consoleId: d,
59
59
  value: f.parserId ?? null,
60
60
  resolvedParser: p,
61
- onChange: S,
61
+ onChange: C,
62
62
  filterInputSinkKey: m ?? void 0,
63
63
  filterStatus: void 0,
64
- placeholder: m ? w("bigconsole.builder.dataBinding.parserPlaceholder", "Select a parser...") : w("bigconsole.builder.dataBinding.parserPlaceholderNoSink", "Select a DataSink first..."),
64
+ placeholder: m ? T("bigconsole.builder.dataBinding.parserPlaceholder", "Select a parser...") : T("bigconsole.builder.dataBinding.parserPlaceholderNoSink", "Select a DataSink first..."),
65
65
  disabled: !m
66
66
  })]
67
67
  })]
68
68
  })
69
69
  }),
70
70
  /* @__PURE__ */ c(e, {
71
- title: T[g],
71
+ title: E[g],
72
72
  tone: u[g],
73
73
  padding: "compact",
74
74
  headingLevel: 3,
@@ -84,27 +84,27 @@ var u = {
84
84
  children: [
85
85
  /* @__PURE__ */ c("p", {
86
86
  className: "sr-only",
87
- children: T[g]
87
+ children: E[g]
88
88
  }),
89
- b && /* @__PURE__ */ c("p", {
89
+ x && /* @__PURE__ */ c("p", {
90
90
  className: "break-words text-xs text-[var(--color-status-error-text)]",
91
- children: b
91
+ children: x
92
92
  }),
93
93
  v.length > 0 && /* @__PURE__ */ c("p", {
94
94
  className: "break-words text-xs text-[var(--color-status-warning-text)]",
95
- children: w("bigconsole.builder.dataBinding.missingFields", "Missing: {{fields}}", { fields: v.join(", ") })
95
+ children: T("bigconsole.builder.dataBinding.missingFields", "Missing: {{fields}}", { fields: v.join(", ") })
96
96
  }),
97
- !b && v.length === 0 && g === "bound" && y !== void 0 && /* @__PURE__ */ c("p", {
97
+ !x && v.length === 0 && g === "bound" && y !== void 0 && /* @__PURE__ */ c("p", {
98
98
  className: "text-xs text-text-secondary",
99
99
  children: "The parser ran and its output matches the fields this widget expects."
100
100
  })
101
101
  ]
102
102
  })
103
103
  }),
104
- f.parserId && Object.keys(f.fields).length > 0 && /* @__PURE__ */ c(e, {
104
+ b ?? (f.parserId && Object.keys(f.fields).length > 0 && /* @__PURE__ */ c(e, {
105
105
  emphasis: "muted",
106
106
  padding: "compact",
107
- title: w("bigconsole.builder.dataBinding.fieldMappingsConfigured", "Field mappings configured"),
107
+ title: T("bigconsole.builder.dataBinding.fieldMappingsConfigured", "Field mappings configured"),
108
108
  headingLevel: 3,
109
109
  children: /* @__PURE__ */ c("div", {
110
110
  className: "min-w-0 space-y-1 text-xs text-text-secondary",
@@ -120,11 +120,11 @@ var u = {
120
120
  ]
121
121
  }, e))
122
122
  })
123
- }),
123
+ })),
124
124
  y !== void 0 && /* @__PURE__ */ c(e, {
125
125
  emphasis: "muted",
126
126
  padding: "compact",
127
- title: w("bigconsole.builder.dataBinding.livePreviewLabel", "Live Preview"),
127
+ title: T("bigconsole.builder.dataBinding.livePreviewLabel", "Live Preview"),
128
128
  description: "Raw parser output, exactly as the widget receives it.",
129
129
  headingLevel: 3,
130
130
  children: /* @__PURE__ */ c("pre", {
@@ -142,17 +142,17 @@ var u = {
142
142
  children: [
143
143
  /* @__PURE__ */ c(a, {
144
144
  htmlFor: "widget-inspector-data-path",
145
- children: w("bigconsole.builder.dataBinding.dataPathLabel", "Data Path (Optional)")
145
+ children: T("bigconsole.builder.dataBinding.dataPathLabel", "Data Path (Optional)")
146
146
  }),
147
147
  /* @__PURE__ */ c(i, {
148
148
  id: "widget-inspector-data-path",
149
149
  value: h ?? "",
150
- onChange: (e) => C(e.target.value || void 0),
151
- placeholder: w("bigconsole.builder.dataBinding.dataPathPlaceholder", "e.g., summary.totalRevenue")
150
+ onChange: (e) => w(e.target.value || void 0),
151
+ placeholder: T("bigconsole.builder.dataBinding.dataPathPlaceholder", "e.g., summary.totalRevenue")
152
152
  }),
153
153
  /* @__PURE__ */ c("p", {
154
154
  className: "text-xs text-text-secondary",
155
- children: w("bigconsole.builder.dataBinding.dataPathHelp", "Path to extract specific data from the parser output (dot notation)")
155
+ children: T("bigconsole.builder.dataBinding.dataPathHelp", "Path to extract specific data from the parser output (dot notation)")
156
156
  })
157
157
  ]
158
158
  })
@@ -0,0 +1,19 @@
1
+ import { FC } from 'react';
2
+ import { ActionLock } from '../../hooks/useOwnerBoundRun';
3
+ export interface FleetBindingCopy {
4
+ id: string;
5
+ name: string;
6
+ }
7
+ export interface FleetBindingsDialogProps {
8
+ isOpen: boolean;
9
+ masterId: string;
10
+ masterName: string;
11
+ /** The active copies of the master, the ones whose data sources can be changed. */
12
+ copies: readonly FleetBindingCopy[];
13
+ /** Shared with the rest of the Children panel, so a change holds the buttons of the other actions. */
14
+ lock?: ActionLock;
15
+ onClose: () => void;
16
+ /** Called after the copies' data sources changed, so the panel reads the board again. Awaited. */
17
+ onChanged?: () => Promise<unknown> | void;
18
+ }
19
+ export declare const FleetBindingsDialog: FC<FleetBindingsDialogProps>;
@@ -0,0 +1,287 @@
1
+ import { useBigConsole as e } from "../../context/BigConsoleContext.js";
2
+ import { useTr as t } from "../../../shared/hooks/useTr.js";
3
+ import "../../context/index.js";
4
+ import { useFleetBindingActions as n } from "../../hooks/useFleetBindingActions.js";
5
+ import { useFleetBindings as ee } from "../../hooks/useFleetBindings.js";
6
+ import { useOwnerBoundRun as te } from "../../hooks/useOwnerBoundRun.js";
7
+ import { bindingsInput as ne, chosenSink as re, withChoice as ie } from "../../utils/fleetBindings.js";
8
+ import { memo as r, useCallback as i, useMemo as a, useRef as ae, useState as o } from "react";
9
+ import { Button as s, Input as oe, ResponsiveDialog as se, ResponsiveDialogContent as ce, ResponsiveDialogDescription as le, ResponsiveDialogFooter as ue, ResponsiveDialogHeader as de, ResponsiveDialogTitle as fe, Select as c, SelectContent as l, SelectItem as u, SelectTrigger as d, SelectValue as f, Spinner as p } from "@burdenoff/fe-libs/ui";
10
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
11
+ // src/bigconsole/components/fleet/FleetBindingsDialog.tsx
12
+ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message : t, y = r(function({ isOpen: r, masterId: y, masterName: pe, copies: b, lock: me, onClose: x, onChanged: S }) {
13
+ let C = t(), { workspaceId: he, currentUser: ge } = e(), _e = `${he ?? ""}:${ge?.id ?? ""}:${y}`, w = a(() => b.map((e) => e.id), [b]), { loading: T, error: E, master: D, sinks: O, sinksTruncated: ve, bindings: k, refetch: A } = ee(y, w, r), j = n(), [M, N] = o(null), [P, F] = o({}), [I, L] = o(""), [R, z] = o("edit"), [B, V] = o(null), [H, U] = o(null), W = ae(!1), [G, K] = o(null), ye = i(() => {
14
+ N(null), F({}), L(""), z("edit"), V(null), U(null), K(null);
15
+ }, []), be = i(async () => {
16
+ W.current || (await A(), await S?.());
17
+ }, [S, A]), { acting: xe, run: q } = te(_e, be, ye, me), J = xe || j.busy, Y = M && D.sinks.some((e) => e.id === M) ? M : D.sinks[0]?.id ?? null, X = i((e) => O.get(e)?.name ?? C("bigconsole.fleet.bindings.unknownSink", "A data source you cannot see"), [O, C]), Z = a(() => {
18
+ let e = I.trim().toLowerCase();
19
+ return b.filter((t) => !e || t.name.toLowerCase().includes(e));
20
+ }, [b, I]), Q = a(() => ne(y, P, w), [
21
+ w,
22
+ P,
23
+ y
24
+ ]), Se = i((e, t) => b.find((t) => t.id === e)?.name ?? t ?? e, [b]), Ce = i((e, t) => {
25
+ Y !== null && F((n) => ie(n, k, e, Y, t === _ ? null : t));
26
+ }, [k, Y]), we = i(async () => {
27
+ if (Q) {
28
+ K(null), W.current = !0;
29
+ try {
30
+ await q(() => j.preview(Q), (e) => {
31
+ V(e), U(Q), z("preview");
32
+ }, (e) => K(v(e, C("bigconsole.fleet.bindings.error.preview", "The preview could not be made."))));
33
+ } finally {
34
+ W.current = !1;
35
+ }
36
+ }
37
+ }, [
38
+ j,
39
+ Q,
40
+ q,
41
+ C
42
+ ]), Te = i(async () => {
43
+ H && (K(null), await q(() => j.apply(H), (e) => {
44
+ V(e), z("done"), F({});
45
+ }, (e) => K(v(e, C("bigconsole.fleet.bindings.error.apply", "The data sources could not be changed.")))));
46
+ }, [
47
+ j,
48
+ H,
49
+ q,
50
+ C
51
+ ]), Ee = (e, t) => e === "APPLIED" ? t ? C("bigconsole.fleet.bindings.state.willUse", "Will use it") : C("bigconsole.fleet.bindings.state.uses", "Uses it now") : e === "UNCHANGED" ? C("bigconsole.fleet.bindings.state.unchanged", "Already uses it") : C("bigconsole.fleet.bindings.state.incompatible", "Cannot take it"), $ = {
52
+ color: "var(--color-text-secondary)",
53
+ fontSize: "var(--font-size-body-sm)"
54
+ }, De = Q?.copies.length ?? 0, Oe = [...O.values()].filter((e) => e.isActive && e.id !== Y);
55
+ return /* @__PURE__ */ h(se, {
56
+ open: r,
57
+ onOpenChange: (e) => !e && !J && x(),
58
+ children: /* @__PURE__ */ g(ce, { children: [
59
+ /* @__PURE__ */ g(de, { children: [/* @__PURE__ */ h(fe, { children: C("bigconsole.fleet.bindings.title", "Copies' data sources") }), /* @__PURE__ */ h(le, { children: C("bigconsole.fleet.bindings.description", "Each copy of \"{{name}}\" can read its own data source where the master reads one, so the board is designed once and shows each place its own data. A push keeps them.", { name: pe }) })] }),
60
+ T && /* @__PURE__ */ g("p", {
61
+ className: "flex items-center gap-2",
62
+ style: $,
63
+ "data-testid": "fleet-bindings-loading",
64
+ children: [/* @__PURE__ */ h(p, { style: {
65
+ height: "var(--size-icon-sm)",
66
+ width: "var(--size-icon-sm)"
67
+ } }), C("bigconsole.fleet.bindings.loading", "Reading the data sources…")]
68
+ }),
69
+ !T && E && /* @__PURE__ */ g("div", {
70
+ className: "flex flex-col gap-form-gap",
71
+ role: "alert",
72
+ "data-testid": "fleet-bindings-load-error",
73
+ children: [/* @__PURE__ */ h("p", {
74
+ style: {
75
+ margin: 0,
76
+ color: "var(--color-status-error-text)"
77
+ },
78
+ children: C("bigconsole.fleet.bindings.loadError", "The data sources could not be read.")
79
+ }), /* @__PURE__ */ h("div", { children: /* @__PURE__ */ h(s, {
80
+ variant: "outline",
81
+ onClick: () => void A(),
82
+ children: C("bigconsole.fleet.bindings.retry", "Try again")
83
+ }) })]
84
+ }),
85
+ !T && !E && Y === null && /* @__PURE__ */ h("p", {
86
+ style: {
87
+ ...$,
88
+ margin: 0
89
+ },
90
+ "data-testid": "fleet-bindings-none",
91
+ children: C("bigconsole.fleet.bindings.none", "None of this board's widgets read from a data source of their own, so there is nothing to change.")
92
+ }),
93
+ !T && !E && Y !== null && R === "edit" && /* @__PURE__ */ g("div", {
94
+ className: "flex flex-col gap-form-gap",
95
+ children: [
96
+ /* @__PURE__ */ g("div", {
97
+ className: "flex flex-col gap-1",
98
+ children: [/* @__PURE__ */ h("span", {
99
+ style: $,
100
+ children: C("bigconsole.fleet.bindings.master", "The master reads")
101
+ }), /* @__PURE__ */ g(c, {
102
+ value: Y,
103
+ onValueChange: N,
104
+ children: [/* @__PURE__ */ h(d, {
105
+ "aria-label": C("bigconsole.fleet.bindings.master", "The master reads"),
106
+ children: /* @__PURE__ */ h(f, {})
107
+ }), /* @__PURE__ */ h(l, { children: D.sinks.map((e) => /* @__PURE__ */ h(u, {
108
+ value: e.id,
109
+ children: C("bigconsole.fleet.bindings.masterSink", "{{name}} ({{count}} widgets)", {
110
+ name: X(e.id),
111
+ count: e.widgetCount
112
+ })
113
+ }, e.id)) })]
114
+ })]
115
+ }),
116
+ D.otherSourceWidgets > 0 && /* @__PURE__ */ h("p", {
117
+ style: {
118
+ ...$,
119
+ margin: 0
120
+ },
121
+ "data-testid": "fleet-bindings-other",
122
+ children: C("bigconsole.fleet.bindings.other", "{{count}} widgets read through a parser or a saved query. Those are not changed here.", { count: D.otherSourceWidgets })
123
+ }),
124
+ ve && /* @__PURE__ */ h("p", {
125
+ style: {
126
+ ...$,
127
+ margin: 0
128
+ },
129
+ children: C("bigconsole.fleet.bindings.truncated", "There are more data sources than can be listed. Only the first ones are offered.")
130
+ }),
131
+ b.length > 6 && /* @__PURE__ */ h(oe, {
132
+ value: I,
133
+ onChange: (e) => L(e.target.value),
134
+ placeholder: C("bigconsole.fleet.bindings.search", "Search copies"),
135
+ "aria-label": C("bigconsole.fleet.bindings.search", "Search copies")
136
+ }),
137
+ /* @__PURE__ */ g("ul", {
138
+ className: "flex flex-col gap-2",
139
+ "data-testid": "fleet-bindings-copies",
140
+ style: {
141
+ margin: 0,
142
+ padding: 0,
143
+ listStyle: "none",
144
+ maxHeight: "18rem",
145
+ overflowY: "auto"
146
+ },
147
+ children: [Z.length === 0 && /* @__PURE__ */ h("li", {
148
+ style: $,
149
+ children: C("bigconsole.fleet.bindings.noCopies", "No copy matches.")
150
+ }), Z.map((e) => {
151
+ let t = re(P, k, e.id, Y), n = P[Y]?.[e.id] !== void 0;
152
+ return /* @__PURE__ */ g("li", {
153
+ className: "flex flex-wrap items-center justify-between gap-form-gap rounded-input border px-3 py-2",
154
+ style: {
155
+ borderColor: n ? "var(--color-action-primary-bg)" : "var(--color-border-subtle)",
156
+ color: "var(--color-text-primary)"
157
+ },
158
+ children: [/* @__PURE__ */ h("span", {
159
+ className: "min-w-0 flex-1 truncate",
160
+ children: e.name
161
+ }), /* @__PURE__ */ h("div", {
162
+ style: { minWidth: "min(100%, 14rem)" },
163
+ children: /* @__PURE__ */ g(c, {
164
+ value: t ?? _,
165
+ onValueChange: (t) => Ce(e.id, t),
166
+ children: [/* @__PURE__ */ h(d, {
167
+ "aria-label": C("bigconsole.fleet.bindings.copyReads", "{{name}} reads", { name: e.name }),
168
+ children: /* @__PURE__ */ h(f, {})
169
+ }), /* @__PURE__ */ g(l, { children: [
170
+ /* @__PURE__ */ h(u, {
171
+ value: _,
172
+ children: C("bigconsole.fleet.bindings.mastersOwn", "The master's ({{name}})", { name: X(Y) })
173
+ }),
174
+ t !== null && !Oe.some((e) => e.id === t) && /* @__PURE__ */ h(u, {
175
+ value: t,
176
+ children: X(t)
177
+ }),
178
+ Oe.map((e) => /* @__PURE__ */ h(u, {
179
+ value: e.id,
180
+ children: e.name
181
+ }, e.id))
182
+ ] })]
183
+ })
184
+ })]
185
+ }, e.id);
186
+ })]
187
+ })
188
+ ]
189
+ }),
190
+ (R === "preview" || R === "done") && B && /* @__PURE__ */ g("div", {
191
+ className: "flex flex-col gap-form-gap",
192
+ "data-testid": "fleet-bindings-result",
193
+ children: [/* @__PURE__ */ h("strong", {
194
+ style: { color: "var(--color-text-primary)" },
195
+ children: R === "preview" ? C("bigconsole.fleet.bindings.previewTitle", "Preview: nothing has been changed yet") : C("bigconsole.fleet.bindings.doneTitle", "Data sources changed for {{count}} copies.", { count: B.appliedCount })
196
+ }), /* @__PURE__ */ h("ul", {
197
+ style: {
198
+ margin: 0,
199
+ padding: 0,
200
+ listStyle: "none",
201
+ maxHeight: "18rem",
202
+ overflowY: "auto"
203
+ },
204
+ children: B.copies.map((e) => /* @__PURE__ */ g("li", {
205
+ className: "flex flex-col gap-1 border-b py-2",
206
+ style: { borderColor: "var(--color-border-subtle)" },
207
+ children: [
208
+ /* @__PURE__ */ g("div", {
209
+ className: "flex items-center justify-between gap-form-gap",
210
+ children: [/* @__PURE__ */ h("span", {
211
+ className: "min-w-0 truncate",
212
+ style: { color: "var(--color-text-primary)" },
213
+ children: Se(e.dashboardId, e.name)
214
+ }), /* @__PURE__ */ h("span", {
215
+ style: {
216
+ fontSize: "var(--font-size-body-sm)",
217
+ color: e.state === "INCOMPATIBLE" ? "var(--color-status-error-text)" : e.state === "APPLIED" ? "var(--color-status-success-text)" : "var(--color-text-secondary)"
218
+ },
219
+ children: Ee(e.state, B.preview)
220
+ })]
221
+ }),
222
+ e.state === "APPLIED" && /* @__PURE__ */ g("span", {
223
+ style: $,
224
+ children: [B.preview ? C("bigconsole.fleet.bindings.willRebind", "{{count}} widgets would read it.", { count: e.widgetsRebound }) : C("bigconsole.fleet.bindings.rebound", "{{count}} widgets read it now.", { count: e.widgetsRebound }), e.widgetsKeptLocal > 0 && " " + C("bigconsole.fleet.bindings.keptLocal", "{{count}} the copy pointed elsewhere itself stay as they are.", { count: e.widgetsKeptLocal })]
225
+ }),
226
+ e.state === "INCOMPATIBLE" && e.reason && /* @__PURE__ */ h("span", {
227
+ role: "alert",
228
+ style: {
229
+ ...$,
230
+ color: "var(--color-status-error-text)"
231
+ },
232
+ children: e.reason
233
+ })
234
+ ]
235
+ }, e.dashboardId))
236
+ })]
237
+ }),
238
+ G && /* @__PURE__ */ h("p", {
239
+ role: "alert",
240
+ "data-testid": "fleet-bindings-error",
241
+ style: {
242
+ margin: 0,
243
+ color: "var(--color-status-error-text)"
244
+ },
245
+ children: G
246
+ }),
247
+ /* @__PURE__ */ g(ue, { children: [
248
+ R === "edit" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
249
+ variant: "ghost",
250
+ onClick: x,
251
+ disabled: J,
252
+ children: C("bigconsole.fleet.link.cancel", "Cancel")
253
+ }), /* @__PURE__ */ g(s, {
254
+ onClick: () => void we(),
255
+ disabled: J || !Q,
256
+ "data-testid": "fleet-bindings-preview",
257
+ children: [J && /* @__PURE__ */ h(p, { style: {
258
+ height: "var(--size-icon-sm)",
259
+ width: "var(--size-icon-sm)"
260
+ } }), C("bigconsole.fleet.bindings.preview", "Preview {{count}} copies", { count: De })]
261
+ })] }),
262
+ R === "preview" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
263
+ variant: "ghost",
264
+ onClick: () => {
265
+ z("edit"), V(null), U(null), K(null);
266
+ },
267
+ disabled: J,
268
+ children: C("bigconsole.fleet.bindings.back", "Back")
269
+ }), /* @__PURE__ */ g(s, {
270
+ onClick: () => void Te(),
271
+ disabled: J || !H || !B || B.appliedCount === 0,
272
+ "data-testid": "fleet-bindings-apply",
273
+ children: [J && /* @__PURE__ */ h(p, { style: {
274
+ height: "var(--size-icon-sm)",
275
+ width: "var(--size-icon-sm)"
276
+ } }), C("bigconsole.fleet.bindings.apply", "Apply")]
277
+ })] }),
278
+ R === "done" && /* @__PURE__ */ h(s, {
279
+ onClick: x,
280
+ disabled: J,
281
+ children: C("bigconsole.fleet.bindings.close", "Close")
282
+ })
283
+ ] })
284
+ ] })
285
+ });
286
+ });
287
+ export { y as FleetBindingsDialog };