@overvis/hmi-workspace-ui 0.1.0 → 0.1.1

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 (115) hide show
  1. package/dist/alarm-list-sheAq-pb.js +414 -0
  2. package/dist/alarm-rule-dialog-D_ml7V0v.js +417 -0
  3. package/dist/{alarm-rule-lists-C5v1Kf7A.js → alarm-rule-lists-DaA4soF4.js} +123 -125
  4. package/dist/{alarm-rules-page-CqFzofPd.js → alarm-rules-page-OFjOQ-dm.js} +15 -18
  5. package/dist/alert-dialog-B60PF7S9.js +891 -0
  6. package/dist/{base-revision-YCO27zR4.js → base-revision-DYCOZS0R.js} +26 -29
  7. package/dist/{breadcrumbs-0cjsV2cq.js → breadcrumbs-D2u8KZQo.js} +6 -7
  8. package/dist/{catalog-list-DjZojYLJ.js → catalog-list-LXuRix0-.js} +2 -4
  9. package/dist/{code-editor-BVimvjDV.js → code-editor-BMSyzAxu.js} +5 -6
  10. package/dist/dashboard-bindings.js +1 -2
  11. package/dist/{dashboards-page-BlrJguNz.js → dashboards-page-wnmmLpVC.js} +335 -359
  12. package/dist/{de-14WdmJxZ.js → de-hkEr2usK.js} +1 -2
  13. package/dist/diagnostic-text-CsbENUNI.js +116 -0
  14. package/dist/{dialogs-B6BRnf3Q.js → dialogs-AtIYlNSy.js} +219 -227
  15. package/dist/{dialogs-D_v1LeH4.js → dialogs-DsHbKgZD.js} +2523 -2590
  16. package/dist/{display-DmOo23mi.js → display-DSyEwQt8.js} +4 -6
  17. package/dist/{editor-language-To9MxloY.js → editor-language-CTfJBXMs.js} +3 -5
  18. package/dist/editor-page-BWbVGJvU.js +1337 -0
  19. package/dist/{en-BgercpT0.js → en-UW_k-Bd6.js} +1 -2
  20. package/dist/entity-controls-BCuRx882.js +71 -0
  21. package/dist/errors-Cawve9yD.js +25 -0
  22. package/dist/{footer-DC-Q0052.js → footer-B9XdpVzq.js} +2404 -2515
  23. package/dist/host.js +8143 -675
  24. package/dist/{i18n-BgzakKoC.js → i18n-Dt6xbSK6.js} +77 -90
  25. package/dist/i18n.js +1 -2
  26. package/dist/index.js +5149 -5345
  27. package/dist/{lat-lng-B12P7QyY.js → lat-lng-Bl77AGSO.js} +1 -2
  28. package/dist/{list-page-CvsdZb86.js → list-page-agHupfNb.js} +116 -123
  29. package/dist/{location-map-renderer-DO5yfdSU.js → location-map-renderer-kxU6cgFl.js} +6 -6
  30. package/dist/{location-picker-renderer-CjCxg6ai.js → location-picker-renderer-B1_-n8lf.js} +3 -4
  31. package/dist/{model-B8gGi4OK.js → model-tpg_xpFB.js} +1 -2
  32. package/dist/{notice-card-DyGywFsW.js → notice-card-CH28rYUt.js} +54 -58
  33. package/dist/{page-v6LCwswN.js → page-CZPHJUmz.js} +92 -100
  34. package/dist/page-DpdkOGGb.js +449 -0
  35. package/dist/page-HCGXXGjy.js +507 -0
  36. package/dist/panel-BCwBlB_h.js +949 -0
  37. package/dist/parameter-values.js +3 -16
  38. package/dist/{pl-lQ9HXV9k.js → pl-BokvsP3J.js} +1 -2
  39. package/dist/presence-code-cT6wxlTg.js +73 -0
  40. package/dist/{query-gate-DVhNIkge.js → query-gate-DqmHsZ07.js} +6 -6
  41. package/dist/{provider-DoEpKcQ-.js → quick-report-DEqqwQxR.js} +9423 -5102
  42. package/dist/{retention-BYXNpYmR.js → retention-DZ0reGGe.js} +4 -6
  43. package/dist/retention-note-nequESpo.js +40 -0
  44. package/dist/{rolldown-runtime-Dy4uBu1J.js → rolldown-runtime-CGnMp29N.js} +1 -2
  45. package/dist/{ru-qTKINoUj.js → ru-DZSlsRHq.js} +1 -2
  46. package/dist/run-text-DneX9rWh.js +112 -0
  47. package/dist/{search-D4rDnE9T.js → search-DP9_alSQ.js} +26 -29
  48. package/dist/{sections-kCOyc4NR.js → sections-BU7NKUOQ.js} +2 -3
  49. package/dist/{select-BKiOWdSr.js → select-Te6Qv1Zu.js} +17 -23
  50. package/dist/{spinner-C-HPNxOc.js → spinner-BRcNKwjH.js} +182 -201
  51. package/dist/src/version.d.ts +1 -1
  52. package/dist/src/workspace/local-workspace-app.d.ts +1 -1
  53. package/dist/src/workspace/routes.d.ts +1 -1
  54. package/dist/{starter-fields-BRLX0z-v.js → starter-fields-yM4B49nd.js} +154 -157
  55. package/dist/{starter-handoff-BA3ucMKL.js → starter-handoff-BaK8Ss8I.js} +1 -2
  56. package/dist/styles.css +1 -1
  57. package/dist/ui.js +334 -374
  58. package/dist/{uk-CwpJAxmx.js → uk-CjXPq9Lk.js} +1 -2
  59. package/dist/{wireguard-docs-AfU6NzTL.js → wireguard-docs-CC8XKBR7.js} +14 -17
  60. package/package.json +15 -9
  61. package/dist/alarm-list-BL3xQ5Lf.js +0 -423
  62. package/dist/alarm-rule-dialog-S1ZUg-74.js +0 -423
  63. package/dist/alert-B8MAoIO8.js +0 -45
  64. package/dist/alert-dialog-CYkuMg5D.js +0 -129
  65. package/dist/api-error-9rQmUN5L.js +0 -93
  66. package/dist/breadcrumb-DzVL1yHa.js +0 -74
  67. package/dist/button-6SxPBYMz.js +0 -44
  68. package/dist/context-u9KJQmdB.js +0 -102
  69. package/dist/copyable-id-DYGiAcnq.js +0 -40
  70. package/dist/dashboard-context-CBfG6DoT.js +0 -191
  71. package/dist/date-time-picker-C3FhMXk6.js +0 -266
  72. package/dist/diagnostic-text-BAkzW0SE.js +0 -111
  73. package/dist/diagnostic-text-DiKd2i1w.js +0 -76
  74. package/dist/dialog-BIhQXcZC.js +0 -237
  75. package/dist/dialog-BqyIxMD-.js +0 -54
  76. package/dist/dropdown-menu-DSzbBq3v.js +0 -136
  77. package/dist/editor-page-BiSZJz5b.js +0 -1353
  78. package/dist/empty-B-QJ-06w.js +0 -59
  79. package/dist/entity-controls-D1K4Ot3O.js +0 -76
  80. package/dist/errors-CcsvDHu8.js +0 -26
  81. package/dist/history-page-sAAhG54V.js +0 -1400
  82. package/dist/icon-D-pR9htW.js +0 -57
  83. package/dist/index-page-DMH82fZe.js +0 -214
  84. package/dist/item-B5SaTFQU.js +0 -120
  85. package/dist/mutation-form-validators-BNz5bsv1.js +0 -2408
  86. package/dist/mutations-THtGG6Ai.js +0 -240
  87. package/dist/page-2KPemaAj.js +0 -328
  88. package/dist/page-6rIoTg2L.js +0 -459
  89. package/dist/page-C6giEoEd.js +0 -1935
  90. package/dist/page-DCbTxKsi.js +0 -313
  91. package/dist/page-DWO427hT.js +0 -208
  92. package/dist/page-LXu_2zm3.js +0 -137
  93. package/dist/page-aaUiVOnk.js +0 -513
  94. package/dist/page-header-RB2YFWlE.js +0 -55
  95. package/dist/page-title-CdCbiLt8.js +0 -14
  96. package/dist/panel-DDy8tUNR.js +0 -338
  97. package/dist/presence-code-BfSXr50g.js +0 -83
  98. package/dist/progress-C7cxNJA1.js +0 -83
  99. package/dist/provider-BOeYHi0n.js +0 -134
  100. package/dist/quick-report-CUVJnbKP.js +0 -416
  101. package/dist/radio-group-CZGqVbkJ.js +0 -26
  102. package/dist/retention-note-CHhA6gjY.js +0 -42
  103. package/dist/run-text-DvaO8LDF.js +0 -113
  104. package/dist/select-eNgZdZ30.js +0 -521
  105. package/dist/skeleton-6yk8Tdh5.js +0 -19
  106. package/dist/slider-DorDsoF8.js +0 -37
  107. package/dist/status-page-DAHiKM9P.js +0 -3286
  108. package/dist/switch-BqD0RH_G.js +0 -18
  109. package/dist/table-Q2-voLuw.js +0 -65
  110. package/dist/tabs-CSIucYFP.js +0 -57
  111. package/dist/theme-provider-BkRohQFU.js +0 -61
  112. package/dist/toggle-group-9Bs0Mm3r.js +0 -82
  113. package/dist/trpc-CvJUuUXp.js +0 -153
  114. package/dist/utils-CX-Pz5p6.js +0 -8
  115. package/dist/writability-BuH-spxv.js +0 -57
@@ -1,240 +0,0 @@
1
- import { r as e } from "./trpc-CvJUuUXp.js";
2
- import { useQueryClient as t } from "@tanstack/react-query";
3
- //#region src/workspace/dashboards/module-cache.ts
4
- var n = "dashboard-module", r = "dashboard-entrypoint";
5
- function i(e) {
6
- e.invalidateQueries({ queryKey: [n] }), e.invalidateQueries({ queryKey: [r] });
7
- }
8
- //#endregion
9
- //#region src/workspace/caches.ts
10
- function a(e) {
11
- let t = e.queryKey[1];
12
- return typeof t == "object" && t && "input" in t ? t.input : void 0;
13
- }
14
- function o(e) {
15
- return typeof e == "object" && e && "workspaceId" in e && typeof e.workspaceId == "string" ? e.workspaceId : void 0;
16
- }
17
- function s(e) {
18
- return typeof e == "object" && e && "id" in e && typeof e.id == "string" ? e.id : void 0;
19
- }
20
- function c(e) {
21
- let t = e.queryKey[0];
22
- return Array.isArray(t) && t.at(-1) === "get";
23
- }
24
- function l(e, t) {
25
- return { predicate: (n) => {
26
- let r = a(n), i = o(r);
27
- if (e != null && i != null && i !== e) return !1;
28
- if (t != null && c(n)) {
29
- let e = s(r);
30
- if (e != null && e !== t) return !1;
31
- }
32
- return !0;
33
- } };
34
- }
35
- function u(e, t) {
36
- let n = l(t.workspaceId, t.id), r = l(t.workspaceId, void 0), i = () => t.workspaceId == null ? e.workspace.get.invalidate() : e.workspace.get.invalidate({ id: t.workspaceId }), a = () => t.workspaceId == null ? e.workspace.automationLimits.invalidate() : e.workspace.automationLimits.invalidate({ id: t.workspaceId });
37
- switch (t.entity) {
38
- case "workspace": return [i(), e.workspace.list.invalidate()];
39
- case "workspaceList": return [e.workspace.list.invalidate()];
40
- case "member": return [e.workspace.members.invalidate(void 0, r)];
41
- case "cliKey": return [e.workspace.listCliKeys.invalidate(void 0, r)];
42
- case "checkpoint": return [e.workspace.checkpoint.invalidate(void 0, r), e.audit.list.invalidate(void 0, r)];
43
- case "branding": return [e.workspace.branding.invalidate(void 0, r)];
44
- case "file": return [e.workspace.uploads.invalidate(void 0, r), e.graphics.listImages.invalidate(void 0, r)];
45
- case "endpoint": return [e.endpoint.invalidate(void 0, n)];
46
- case "edgeProgram": return [e.edgeProgram.invalidate(void 0, n), e.endpoint.invalidate(void 0, r)];
47
- case "automation": return [
48
- e.automation.invalidate(void 0, r),
49
- e.alarmRule.invalidate(void 0, r),
50
- a()
51
- ];
52
- case "parameter": return [
53
- e.parameter.invalidate(void 0, n),
54
- e.report.preset.invalidate(void 0, r),
55
- e.deviceLog.invalidate(void 0, r)
56
- ];
57
- case "dashboard": return [
58
- e.dashboard.invalidate(void 0, n),
59
- e.graphics.get.invalidate(void 0, r),
60
- e.automation.invalidate(void 0, r),
61
- e.alarmRule.invalidate(void 0, r)
62
- ];
63
- case "report": return [e.report.preset.invalidate(void 0, n), e.report.comment.invalidate(void 0, r)];
64
- case "reportComment": return [e.report.comment.invalidate(void 0, r)];
65
- case "storage": return [e.storage.invalidate(void 0, r)];
66
- case "setup": return [
67
- i(),
68
- e.endpoint.invalidate(void 0, r),
69
- e.edgeProgram.invalidate(void 0, r),
70
- e.automation.invalidate(void 0, r),
71
- e.alarmRule.invalidate(void 0, r),
72
- a(),
73
- e.parameter.invalidate(void 0, r),
74
- e.deviceLog.invalidate(void 0, r),
75
- e.dashboard.invalidate(void 0, r),
76
- e.graphics.invalidate(void 0, r),
77
- e.report.invalidate(void 0, r),
78
- e.workspace.uploads.invalidate(void 0, r),
79
- e.workspace.branding.invalidate(void 0, r),
80
- e.templates.invalidate(void 0, r),
81
- e.audit.list.invalidate(void 0, r),
82
- e.workspace.checkpoint.invalidate(void 0, r)
83
- ];
84
- }
85
- }
86
- async function d(e, t) {
87
- await Promise.all(u(e, t));
88
- }
89
- var f = [
90
- ["workspace.branding.", "branding"],
91
- ["workspace.uploads.", "file"],
92
- ["workspace.deleteCliKey", "cliKey"],
93
- ["workspace.checkpoint.revertPreview", "checkpoint"],
94
- ["workspace.checkpoint.revert", "setup"],
95
- ["workspace.checkpoint.", "checkpoint"],
96
- ["workspace.invite", "member"],
97
- ["workspace.resendInvitation", "member"],
98
- ["workspace.revokeInvitation", "member"],
99
- ["workspace.updateMember", "member"],
100
- ["workspace.removeMember", "member"],
101
- ["workspace.leave", "workspaceList"],
102
- ["workspace.create", "workspaceList"],
103
- ["workspace.delete", "workspaceList"],
104
- ["workspace.push", "setup"],
105
- ["workspace.commitSandbox", "setup"],
106
- ["workspace.setAutomationLimits", "automation"],
107
- ["workspace.", "workspace"],
108
- ["dashboard.", "dashboard"],
109
- ["graphics.", "dashboard"],
110
- ["endpoint.", "endpoint"],
111
- ["edgeProgram.", "edgeProgram"],
112
- ["automation.", "automation"],
113
- ["alarmRule.", "automation"],
114
- ["parameter.", "parameter"],
115
- ["templates.parameter.", "parameter"],
116
- ["report.preset.", "report"],
117
- ["report.comment.", "reportComment"],
118
- ["storage.", "storage"],
119
- ["web.fetch", "file"]
120
- ];
121
- function p(e) {
122
- return f.find(([t]) => e.startsWith(t))?.[1] ?? null;
123
- }
124
- async function m(e, t) {
125
- p(t) === "checkpoint" && await d(e, { entity: "checkpoint" });
126
- }
127
- async function h(e, t, n) {
128
- if (n.startsWith("helpdesk.")) {
129
- await e.helpdesk.invalidate();
130
- return;
131
- }
132
- let r = p(n);
133
- r != null && (r === "setup" && i(t), await d(e, { entity: r }));
134
- }
135
- //#endregion
136
- //#region src/workspace/mutations.ts
137
- function g(t, n) {
138
- let r = e.useUtils();
139
- return (e) => d(r, {
140
- entity: t,
141
- ...n == null ? {} : { workspaceId: n },
142
- ...e == null ? {} : { id: e }
143
- });
144
- }
145
- function _(n) {
146
- let r = g("checkpoint", n), a = g("setup", n), o = t();
147
- return {
148
- create: e.workspace.checkpoint.create.useMutation({ onSuccess: () => r() }),
149
- rename: e.workspace.checkpoint.rename.useMutation({ onSuccess: () => r() }),
150
- remove: e.workspace.checkpoint.delete.useMutation({ onSuccess: () => r() }),
151
- revert: e.workspace.checkpoint.revert.useMutation({ onSuccess: () => (i(o), a()) })
152
- };
153
- }
154
- function v(t) {
155
- let n = g("endpoint", t);
156
- return {
157
- create: e.endpoint.create.useMutation({ onSuccess: () => n() }),
158
- update: e.endpoint.update.useMutation({ onSuccess: (e, t) => n(t.id) }),
159
- enable: e.endpoint.enable.useMutation({ onSuccess: (e, t) => n(t.id) }),
160
- disable: e.endpoint.disable.useMutation({ onSuccess: (e, t) => n(t.id) }),
161
- remove: e.endpoint.delete.useMutation({ onSuccess: (e, t) => n(t.id) })
162
- };
163
- }
164
- function y(t) {
165
- let n = g("edgeProgram", t);
166
- return {
167
- create: e.edgeProgram.create.useMutation({ onSuccess: () => n() }),
168
- update: e.edgeProgram.update.useMutation({ onSuccess: () => n() }),
169
- remove: e.edgeProgram.delete.useMutation({ onSuccess: () => n() }),
170
- updateSettings: e.edgeProgram.updateSettings.useMutation({ onSuccess: () => n() }),
171
- syncNow: e.edgeProgram.syncNow.useMutation()
172
- };
173
- }
174
- function b(t) {
175
- let n = g("parameter", t);
176
- return {
177
- create: e.parameter.create.useMutation({ onSuccess: () => n() }),
178
- update: e.parameter.update.useMutation({ onSuccess: (e, t) => n(t.id) }),
179
- removeSelection: e.parameter.deleteSelection.useMutation({ onSuccess: () => n() }),
180
- createBranch: e.parameter.createBranch.useMutation({ onSuccess: () => n() }),
181
- updateBranch: e.parameter.updateBranch.useMutation({ onSuccess: () => n() }),
182
- stampTemplate: e.templates.parameter.stamp.useMutation({ onSuccess: () => n() })
183
- };
184
- }
185
- function x(t) {
186
- let n = g("dashboard", t);
187
- return {
188
- create: e.dashboard.create.useMutation({ onSuccess: () => n() }),
189
- copy: e.dashboard.copy.useMutation({ onSuccess: () => n() }),
190
- update: e.dashboard.update.useMutation({ onSuccess: (e, t) => n(t.id) }),
191
- enable: e.dashboard.enable.useMutation({ onSuccess: (e, t) => n(t.id) }),
192
- disable: e.dashboard.disable.useMutation({ onSuccess: (e, t) => n(t.id) }),
193
- remove: e.dashboard.delete.useMutation({ onSuccess: (e, t) => n(t.id) }),
194
- saveDrawing: e.graphics.save.useMutation({ onSuccess: (e, t) => n(t.dashboardId) })
195
- };
196
- }
197
- function S(t) {
198
- let n = g("automation", t);
199
- return {
200
- create: e.automation.create.useMutation({ onSuccess: () => n() }),
201
- update: e.automation.update.useMutation({ onSuccess: (e, t) => n(t.id) }),
202
- setDisabled: e.automation.setDisabled.useMutation({ onSuccess: (e, t) => n(t.id) }),
203
- remove: e.automation.delete.useMutation({ onSuccess: (e, t) => n(t.id) })
204
- };
205
- }
206
- function C(t) {
207
- let n = g("automation", t);
208
- return {
209
- create: e.alarmRule.create.useMutation({ onSuccess: () => n() }),
210
- update: e.alarmRule.update.useMutation({ onSuccess: (e, t) => n(t.id) }),
211
- setDisabled: e.alarmRule.setDisabled.useMutation({ onSuccess: (e, t) => n(t.id) }),
212
- remove: e.alarmRule.delete.useMutation({ onSuccess: (e, t) => n(t.id) })
213
- };
214
- }
215
- function w(t) {
216
- let n = g("report", t);
217
- return {
218
- create: e.report.preset.create.useMutation({ onSuccess: () => n() }),
219
- update: e.report.preset.update.useMutation({ onSuccess: (e, t) => n(t.id) }),
220
- saveTemporary: e.report.preset.saveTemporary.useMutation({ onSuccess: (e, t) => n(t.id) }),
221
- remove: e.report.preset.delete.useMutation({ onSuccess: (e, t) => n(t.id) })
222
- };
223
- }
224
- function T() {
225
- let t = g("reportComment", void 0);
226
- return {
227
- create: e.report.comment.create.useMutation({ onSuccess: () => t() }),
228
- remove: e.report.comment.delete.useMutation({ onSuccess: () => t() })
229
- };
230
- }
231
- function E(t) {
232
- let n = g("file", t);
233
- return {
234
- uploaded: () => n(),
235
- ingest: e.workspace.uploads.ingest.useMutation({ onSuccess: () => n() }),
236
- remove: e.workspace.uploads.delete.useMutation({ onSuccess: () => n() })
237
- };
238
- }
239
- //#endregion
240
- export { y as a, b as c, h as d, m as f, n as h, x as i, T as l, r as m, S as n, v as o, d as p, _ as r, E as s, C as t, w as u };
@@ -1,328 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { r as t } from "./trpc-CvJUuUXp.js";
3
- import { h as n, m as r } from "./i18n-BgzakKoC.js";
4
- import { L as i } from "./mutation-form-validators-BNz5bsv1.js";
5
- import { t as a } from "./button-6SxPBYMz.js";
6
- import { n as o } from "./skeleton-6yk8Tdh5.js";
7
- import { a as s, o as c, r as l } from "./context-u9KJQmdB.js";
8
- import { r as u } from "./dialogs-D_v1LeH4.js";
9
- import { n as d } from "./api-error-9rQmUN5L.js";
10
- import { t as f } from "./notice-card-DyGywFsW.js";
11
- import { a as p, t as ee } from "./dashboard-context-CBfG6DoT.js";
12
- import { h as m } from "./mutations-THtGG6Ai.js";
13
- import { a as h, h as g, r as _, t as v } from "./dropdown-menu-DSzbBq3v.js";
14
- import { P as y, t as te } from "./provider-DoEpKcQ-.js";
15
- import { t as b } from "./page-header-RB2YFWlE.js";
16
- import { n as x } from "./theme-provider-BkRohQFU.js";
17
- import { n as S, r as C } from "./query-gate-DVhNIkge.js";
18
- import { c as w, d as T, f as E, h as D, l as O, m as k, p as A, u as j } from "./dashboards-page-BlrJguNz.js";
19
- import { useQuery as ne } from "@tanstack/react-query";
20
- import { useEffect as re, useState as M } from "react";
21
- import { DASHBOARD_DIAGNOSTICS_ATTR as N, DASHBOARD_SCOPE_ATTR as P, boundedDashboardHostDiagnostics as F, dashboardConfigurationIssues as I, dashboardStylesheetUrl as L, formatDashboardConfigurationIssues as R } from "@overvis/hmi-shared/dashboard";
22
- import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
23
- import { CloudDownloadIcon as H, CopyIcon as U, EllipsisIcon as W, SettingsIcon as G } from "lucide-react";
24
- import { resolveLocalized as K } from "@overvis/hmi-shared";
25
- //#region src/workspace/dashboards/actions-menu.tsx
26
- function q({ dashboard: e }) {
27
- let t = r(), n = l(), [i, o] = M(null);
28
- return n ? /* @__PURE__ */ V(z, { children: [
29
- /* @__PURE__ */ V(v, { children: [/* @__PURE__ */ B(g, {
30
- render: /* @__PURE__ */ B(a, {
31
- variant: "ghost",
32
- size: "icon",
33
- "aria-label": t("dashboard_actions")
34
- }),
35
- children: /* @__PURE__ */ B(W, {})
36
- }), /* @__PURE__ */ V(_, {
37
- align: "end",
38
- className: "w-auto",
39
- children: [/* @__PURE__ */ V(h, {
40
- onClick: () => {
41
- o("settings");
42
- },
43
- children: [/* @__PURE__ */ B(G, {}), t("dashboard_edit_settings")]
44
- }), /* @__PURE__ */ V(h, {
45
- onClick: () => {
46
- o("copy");
47
- },
48
- children: [/* @__PURE__ */ B(U, {}), t("dashboard_copy_action")]
49
- })]
50
- })] }),
51
- i === "settings" ? /* @__PURE__ */ B(u, {
52
- workspaceId: e.workspaceId,
53
- dashboardId: e.id,
54
- onClose: () => {
55
- o(null);
56
- }
57
- }) : null,
58
- i === "copy" ? /* @__PURE__ */ B(k, {
59
- workspaceId: e.workspaceId,
60
- dashboard: e,
61
- onClose: () => {
62
- o(null);
63
- }
64
- }) : null
65
- ] }) : null;
66
- }
67
- //#endregion
68
- //#region src/workspace/dashboards/mount-diagnostics.ts
69
- var J = {
70
- invalid_module: "Invalid dashboard module: check supportedLocales and graphicsSymbols exports",
71
- no_default: "Missing or invalid default export: expected a dashboard component function",
72
- no_config_type: "Missing or invalid dashboardConfigType export: expected a TypeBox schema",
73
- rebuild_required: "Dashboard build manifest is missing, invalid or incompatible with the host; rebuild required"
74
- }, Y = class extends Error {
75
- reason;
76
- constructor(e) {
77
- super(J[e]), this.reason = e;
78
- }
79
- };
80
- async function ie(e) {
81
- let t = w(), n = await E(j(e, t));
82
- if (!n.ok) {
83
- if (n.reason === "no_config_type") return {
84
- kind: "config-export",
85
- cacheNonce: t
86
- };
87
- if (n.reason === "rebuild_required") return {
88
- kind: "rebuild-required",
89
- cacheNonce: t
90
- };
91
- throw new Y(n.reason);
92
- }
93
- return {
94
- kind: "ok",
95
- ...n.module,
96
- cacheNonce: t
97
- };
98
- }
99
- function X(e) {
100
- return {
101
- stage: "exports",
102
- code: e,
103
- message: J[e]
104
- };
105
- }
106
- function ae(e) {
107
- return e instanceof Y ? X(e.reason) : {
108
- stage: "module-load",
109
- code: "load_failed",
110
- message: e instanceof Error ? e.message : typeof e == "string" ? e : "Dashboard module failed to load"
111
- };
112
- }
113
- //#endregion
114
- //#region src/workspace/dashboards/mount.tsx
115
- function oe(e) {
116
- return e.moduleStatus === "error" ? "error" : e.moduleStatus === "loading" || !e.cssReady ? "skeleton" : "ready";
117
- }
118
- function se(e) {
119
- return e === "ok" || e === "missing";
120
- }
121
- function ce(e) {
122
- return e.stylesheetUrl == null || e.cacheNonce != null && e.settledNonce === e.cacheNonce;
123
- }
124
- function Z(e) {
125
- if (e.loaded.kind === "config-export") return "/: missing dashboardConfigType export";
126
- let t;
127
- try {
128
- t = I(e.loaded.dashboardConfigType, e.configuration);
129
- } catch (e) {
130
- return `Configuration validation failed: ${e instanceof Error ? e.message : "invalid schema"}`;
131
- }
132
- return t.length === 0 ? null : R(t);
133
- }
134
- function le({ children: e }) {
135
- return /* @__PURE__ */ B("div", {
136
- "data-slot": "dashboard-mount-canvas",
137
- className: "flex min-h-full flex-col",
138
- children: e
139
- });
140
- }
141
- function ue({ workspaceId: e, dashboardId: t }) {
142
- let n = r(), i = l();
143
- return /* @__PURE__ */ B(f, {
144
- title: n("dashboard_config_error_title"),
145
- description: n("dashboard_config_error_description"),
146
- ...i ? { primaryAction: {
147
- label: n("parameter_diagnostic_open_dashboard"),
148
- href: `/workspace/${encodeURIComponent(e)}/setup/dashboards/${encodeURIComponent(t)}`
149
- } } : {}
150
- });
151
- }
152
- function Q({ entrypointUrl: e, stylesheetUrl: t, configuration: a, workspaceId: c, dashboardId: l, title: u }) {
153
- let d = r(), h = n(), { resolvedTheme: g } = x(), _ = s(), v = h, [b, S] = M(null), C = ne({
154
- queryKey: [
155
- m,
156
- e,
157
- t
158
- ],
159
- queryFn: () => ie(e),
160
- staleTime: Infinity,
161
- retry: !1
162
- }), w = C.data?.cacheNonce, T = ce({
163
- stylesheetUrl: t,
164
- cacheNonce: w,
165
- settledNonce: b
166
- });
167
- re(() => {
168
- if (t == null || w == null) return;
169
- let e = !1, n = O(t, w);
170
- return n.settled.then((t) => {
171
- !e && se(t) && S(w);
172
- }), () => {
173
- e = !0, n.stop();
174
- };
175
- }, [w, t]);
176
- let E = oe({
177
- moduleStatus: C.isError || !C.isLoading && C.data == null ? "error" : C.isFetching || C.data == null ? "loading" : "success",
178
- cssReady: T
179
- }), D, k = [], j = E === "skeleton" ? "loading" : "error";
180
- if (E === "skeleton") D = /* @__PURE__ */ B("div", {
181
- className: "p-4",
182
- children: /* @__PURE__ */ B(o, { className: "h-40 w-full" })
183
- });
184
- else if (E === "error" || C.data == null) k = [ae(C.error)], D = /* @__PURE__ */ B("div", {
185
- className: "p-4",
186
- children: /* @__PURE__ */ B(f, {
187
- title: d("dashboard_load_failed_title"),
188
- description: d("dashboard_load_failed_description"),
189
- onRetry: () => C.refetch(),
190
- retrying: C.isFetching
191
- })
192
- });
193
- else if (C.data.kind === "rebuild-required") k = [X("rebuild_required")], D = /* @__PURE__ */ B("div", {
194
- className: "p-4",
195
- children: /* @__PURE__ */ B(f, {
196
- title: d("dashboard_rebuild_required_title"),
197
- description: d("dashboard_rebuild_required_description")
198
- })
199
- });
200
- else if (C.data.kind === "config-export") {
201
- k = [X("no_config_type")];
202
- let e = Z({
203
- loaded: { kind: "config-export" },
204
- configuration: a
205
- });
206
- console.error(`Dashboard ${l} configuration error:\n${e}`), D = /* @__PURE__ */ B("div", {
207
- className: "p-4",
208
- children: /* @__PURE__ */ B(f, {
209
- title: d("dashboard_config_error_title"),
210
- description: d("dashboard_config_export_missing_description")
211
- })
212
- });
213
- } else {
214
- let e = C.data, t = Z({
215
- loaded: {
216
- kind: "ok",
217
- dashboardConfigType: e.dashboardConfigType
218
- },
219
- configuration: a
220
- });
221
- if (t != null) k = [{
222
- stage: "configuration",
223
- code: "invalid_configuration",
224
- message: t
225
- }], console.error(`Dashboard ${l} configuration error:\n${t}`), D = /* @__PURE__ */ B("div", {
226
- className: "p-4",
227
- children: /* @__PURE__ */ B(ue, {
228
- workspaceId: c,
229
- dashboardId: l
230
- })
231
- });
232
- else {
233
- j = "ready";
234
- let t = e.component, n = A({
235
- locale: v,
236
- supportedLocales: e.supportedLocales
237
- });
238
- D = /* @__PURE__ */ B(te, {
239
- symbols: e.graphicsSymbols,
240
- children: /* @__PURE__ */ B(i, {
241
- access: _.access,
242
- children: /* @__PURE__ */ B(p, {
243
- workspaceId: c,
244
- dashboardId: l,
245
- children: /* @__PURE__ */ B(ee, {
246
- dashboardId: l,
247
- title: u,
248
- children: /* @__PURE__ */ B(y, {
249
- locale: n,
250
- children: /* @__PURE__ */ B(t, {
251
- configuration: a,
252
- theme: g,
253
- locale: n,
254
- workspaceId: c,
255
- dashboardId: l
256
- })
257
- })
258
- })
259
- })
260
- })
261
- });
262
- }
263
- }
264
- return /* @__PURE__ */ B("div", {
265
- [P]: "",
266
- "data-context-dashboard-id": l,
267
- "data-dashboard-state": j,
268
- ...j === "error" && k.length > 0 ? { [N]: JSON.stringify(F(k)) } : {},
269
- className: "min-h-0 min-w-0 flex-1",
270
- children: /* @__PURE__ */ B(le, { children: D })
271
- });
272
- }
273
- //#endregion
274
- //#region src/workspace/dashboards/page.tsx
275
- var de = /* @__PURE__ */ e({ DashboardPage: () => $ });
276
- function $({ workspaceId: e, dashboardId: i }) {
277
- let a = r(), s = n(), { mode: l } = c(), u = t.dashboard.get.useQuery({ id: i }), p = T(i);
278
- return /* @__PURE__ */ B(C, {
279
- query: u,
280
- loading: /* @__PURE__ */ V("div", {
281
- className: "flex flex-1 flex-col gap-4 p-4",
282
- children: [/* @__PURE__ */ B(o, { className: "h-8 w-64" }), /* @__PURE__ */ B(o, { className: "h-40 w-full" })]
283
- }),
284
- error: (e) => /* @__PURE__ */ B(S, {
285
- className: "flex-1 justify-center p-8",
286
- message: d(e ?? "dashboard_not_found"),
287
- onRetry: () => u.refetch()
288
- }),
289
- children: (t) => {
290
- let n = p.data?.usingRemoteFallback === !0, r = l === "local" && typeof window < "u" && new URLSearchParams(window.location.search).get("hmi-preview") === "built", c = p.data?.url;
291
- return /* @__PURE__ */ V("div", {
292
- className: "flex min-h-0 flex-1 flex-col",
293
- children: [/* @__PURE__ */ B(b, {
294
- icon: /* @__PURE__ */ B(D, {
295
- icon: t.icon,
296
- strokeWidth: 1.75
297
- }),
298
- title: K(t.name, s),
299
- actions: /* @__PURE__ */ B(q, { dashboard: t }, t.id),
300
- description: t.description != null && K(t.description, s).length > 0 ? K(t.description, s) : void 0,
301
- children: n && !r ? /* @__PURE__ */ B(f, {
302
- severity: "warning",
303
- size: "compact",
304
- className: "max-w-xl",
305
- icon: /* @__PURE__ */ B(H, {}),
306
- title: a("dashboard_local_missing_title"),
307
- description: a("dashboard_local_missing_description")
308
- }) : null
309
- }), /* @__PURE__ */ B("div", {
310
- className: "flex min-h-0 flex-1 flex-col",
311
- children: p.isLoading || c == null ? /* @__PURE__ */ B("div", {
312
- className: "p-4",
313
- children: /* @__PURE__ */ B(o, { className: "h-40 w-full" })
314
- }) : /* @__PURE__ */ B(Q, {
315
- entrypointUrl: c,
316
- stylesheetUrl: l === "cloud" || n ? L(i) : null,
317
- configuration: t.configuration,
318
- workspaceId: e,
319
- dashboardId: i,
320
- title: K(t.name, s)
321
- })
322
- })]
323
- });
324
- }
325
- });
326
- }
327
- //#endregion
328
- export { de as n, $ as t };