@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,4 +1,4 @@
1
- //#region src/i18n/catalogs/uk/messages.ts
1
+ // src/i18n/catalogs/uk/messages.ts
2
2
  var e = {
3
3
  messages_title: "Повідомлення та сповіщення",
4
4
  messages_tab: "Повідомлення",
@@ -4574,5 +4574,4 @@ var e = {
4574
4574
  ...k,
4575
4575
  ...A
4576
4576
  };
4577
- //#endregion
4578
4577
  export { F as default };
@@ -1,13 +1,11 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { r as t } from "./trpc-CvJUuUXp.js";
3
- import { m as n, n as r } from "./i18n-BgzakKoC.js";
4
- import { t as i } from "./button-6SxPBYMz.js";
5
- import { a, f as o, i as s, l as c, o as l, r as u, t as d } from "./dialog-BIhQXcZC.js";
6
- import { n as f, t as p } from "./api-error-9rQmUN5L.js";
1
+ import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
+ import { Un as t, Wn as n, ii as r } from "./quick-report-DEqqwQxR.js";
3
+ import { m as i, n as a } from "./i18n-Dt6xbSK6.js";
4
+ import { B as o, H as s, K as c, R as l, U as u, V as d, jt as f, yt as p } from "./alert-dialog-B60PF7S9.js";
7
5
  import { createContext as m, useContext as h, useState as g } from "react";
8
6
  import { jsx as _, jsxs as v } from "react/jsx-runtime";
9
7
  import { CheckIcon as y, CopyIcon as b } from "lucide-react";
10
- //#region src/workspace/setup/endpoints/wireguard-docs.tsx
8
+ // src/workspace/setup/endpoints/wireguard-docs.tsx
11
9
  var x = /* @__PURE__ */ e({
12
10
  WireGuardDocsDialog: () => E,
13
11
  WireGuardDocsProvider: () => T,
@@ -29,7 +27,7 @@ function T({ children: e }) {
29
27
  });
30
28
  }
31
29
  function E({ endpointId: e, onClose: m }) {
32
- let h = n(), x = r(), C = t.endpoint.wireGuardConfig.useQuery({ id: e }, { refetchInterval: (e) => p(e.state.error) === "endpoint_vpn_pending" && S }), w = p(C.error) === "endpoint_vpn_pending", [T, E] = g(!1);
30
+ let h = i(), x = a(), C = r.endpoint.wireGuardConfig.useQuery({ id: e }, { refetchInterval: (e) => t(e.state.error) === "endpoint_vpn_pending" && S }), w = t(C.error) === "endpoint_vpn_pending", [T, E] = g(!1);
33
31
  async function D(e) {
34
32
  try {
35
33
  await navigator.clipboard.writeText(e), E(!0), window.setTimeout(() => {
@@ -39,33 +37,33 @@ function E({ endpointId: e, onClose: m }) {
39
37
  x.error(h("endpoint_wireguard_docs_copy_failed"));
40
38
  }
41
39
  }
42
- return /* @__PURE__ */ _(d, {
40
+ return /* @__PURE__ */ _(l, {
43
41
  open: !0,
44
42
  onOpenChange: (e) => {
45
43
  e || m();
46
44
  },
47
- children: /* @__PURE__ */ v(u, {
45
+ children: /* @__PURE__ */ v(o, {
48
46
  className: "\n max-w-lg\n sm:max-w-lg\n ",
49
47
  children: [
50
- /* @__PURE__ */ v(l, { children: [/* @__PURE__ */ _(c, { children: h("endpoint_wireguard_docs_title") }), /* @__PURE__ */ _(s, { children: h("endpoint_wireguard_docs_steps") })] }),
48
+ /* @__PURE__ */ v(u, { children: [/* @__PURE__ */ _(c, { children: h("endpoint_wireguard_docs_title") }), /* @__PURE__ */ _(d, { children: h("endpoint_wireguard_docs_steps") })] }),
51
49
  w ? /* @__PURE__ */ _("p", {
52
50
  className: "text-sm text-muted-foreground",
53
- children: f(C.error)
51
+ children: n(C.error)
54
52
  }) : C.isError ? /* @__PURE__ */ _("p", {
55
53
  className: "text-sm text-destructive",
56
- children: f(C.error)
57
- }) : /* @__PURE__ */ _(o, {
54
+ children: n(C.error)
55
+ }) : /* @__PURE__ */ _(p, {
58
56
  readOnly: !0,
59
57
  spellCheck: !1,
60
58
  className: "\n min-h-48 font-mono\n md:text-xs\n ",
61
59
  value: C.data?.conf ?? h("endpoint_wireguard_docs_loading")
62
60
  }),
63
- /* @__PURE__ */ v(a, { children: [/* @__PURE__ */ _(i, {
61
+ /* @__PURE__ */ v(s, { children: [/* @__PURE__ */ _(f, {
64
62
  type: "button",
65
63
  variant: "outline",
66
64
  onClick: m,
67
65
  children: h("action_close")
68
- }), /* @__PURE__ */ v(i, {
66
+ }), /* @__PURE__ */ v(f, {
69
67
  type: "button",
70
68
  disabled: C.data == null,
71
69
  onClick: () => {
@@ -77,5 +75,4 @@ function E({ endpointId: e, onClose: m }) {
77
75
  })
78
76
  });
79
77
  }
80
- //#endregion
81
78
  export { x as n, w as t };
package/package.json CHANGED
@@ -1,35 +1,41 @@
1
1
  {
2
2
  "name": "@overvis/hmi-workspace-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "license": "BSD-3-Clause",
5
5
  "description": "React workspace UI and dashboard integration for Overvis HMI.",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
9
9
  "types": "./dist/src/index.d.ts",
10
- "import": "./dist/index.js"
10
+ "import": "./dist/index.js",
11
+ "default": "./dist/index.js"
11
12
  },
12
13
  "./ui": {
13
14
  "types": "./dist/src/entry/ui/index.d.ts",
14
- "import": "./dist/ui.js"
15
+ "import": "./dist/ui.js",
16
+ "default": "./dist/ui.js"
15
17
  },
16
18
  "./host": {
17
19
  "types": "./dist/src/entry/host/index.d.ts",
18
- "import": "./dist/host.js"
20
+ "import": "./dist/host.js",
21
+ "default": "./dist/host.js"
19
22
  },
20
23
  "./dashboard-bindings": {
21
24
  "types": "./dist/src/workspace/dashboards/bindings.d.ts",
22
- "import": "./dist/dashboard-bindings.js"
25
+ "import": "./dist/dashboard-bindings.js",
26
+ "default": "./dist/dashboard-bindings.js"
23
27
  },
24
28
  "./parameter-values": {
25
29
  "types": "./dist/src/workspace/parameters/live/model.d.ts",
26
- "import": "./dist/parameter-values.js"
30
+ "import": "./dist/parameter-values.js",
31
+ "default": "./dist/parameter-values.js"
27
32
  },
28
33
  "./styles.css": "./dist/styles.css",
29
34
  "./styles-reference.css": "./dist/styles-reference.css",
30
35
  "./i18n": {
31
36
  "types": "./dist/src/i18n/index.d.ts",
32
- "import": "./dist/i18n.js"
37
+ "import": "./dist/i18n.js",
38
+ "default": "./dist/i18n.js"
33
39
  }
34
40
  },
35
41
  "publishConfig": {
@@ -71,7 +77,7 @@
71
77
  "@dnd-kit/react": "^0.5.0",
72
78
  "@googlemaps/markerclusterer": "^2.6.2",
73
79
  "@lezer/highlight": "^1.2.5",
74
- "@overvis/hmi-shared": "0.1.0",
80
+ "@overvis/hmi-shared": "0.1.1",
75
81
  "@shadcn/react": "^0.3.1",
76
82
  "@tanstack/react-table": "^9.2.4",
77
83
  "@tanstack/react-virtual": "^3.14.9",
@@ -128,7 +134,7 @@
128
134
  "tailwindcss": "^4.3.3",
129
135
  "tw-animate-css": "^1.4.0",
130
136
  "typescript": "~7.0.2",
131
- "vite": "^8.1.5",
137
+ "vite": "^8.3.5",
132
138
  "vitest": "4.1.10"
133
139
  },
134
140
  "homepage": "https://docs.overvis.com",
@@ -1,423 +0,0 @@
1
- import { r as e } from "./trpc-CvJUuUXp.js";
2
- import { f as t, h as n, m as r } from "./i18n-BgzakKoC.js";
3
- import { a as i, at as a, d as o, t as s } from "./mutation-form-validators-BNz5bsv1.js";
4
- import { t as c } from "./utils-CX-Pz5p6.js";
5
- import { B as l, H as u, L as d, V as f, l as p } from "./spinner-C-HPNxOc.js";
6
- import { n as m, t as h } from "./button-6SxPBYMz.js";
7
- import { a as g, i as _, l as v, o as y, r as b, t as x } from "./dialog-BIhQXcZC.js";
8
- import { n as S } from "./skeleton-6yk8Tdh5.js";
9
- import { i as C } from "./context-u9KJQmdB.js";
10
- import { n as w, t as ee } from "./toggle-group-9Bs0Mm3r.js";
11
- import { a as te, c as ne, i as T, l as E, r as D, s as O, u as k } from "./provider-BOeYHi0n.js";
12
- import { useState as A } from "react";
13
- import { jsx as j, jsxs as M } from "react/jsx-runtime";
14
- import N from "typebox";
15
- import { BellOffIcon as P, CheckIcon as re, HistoryIcon as ie, SirenIcon as F, TriangleAlertIcon as I } from "lucide-react";
16
- import { formatAppDateTime as L, resolveLocalized as R, schema as z } from "@overvis/hmi-shared";
17
- import { canWriteParameterValues as B } from "@overvis/hmi-shared/workspace";
18
- import { ALARM_NOTE_MAX as V, ALARM_RULE_UNAVAILABLE_KEY as H } from "@overvis/hmi-shared/automation";
19
- import { Link as U } from "@tanstack/react-router";
20
- //#region src/workspace/alarms/actions.tsx
21
- var W = 6e4, G = 60 * W, K = [
22
- 15 * W,
23
- G,
24
- 8 * G,
25
- 24 * G,
26
- 168 * G
27
- ];
28
- function q(e) {
29
- return e === 15 * W ? t("alarm_shelve_15m") : e === G ? t("alarm_shelve_1h") : e === 8 * G ? t("alarm_shelve_8h") : e === 24 * G ? t("alarm_shelve_24h") : t("alarm_shelve_7d");
30
- }
31
- var J = z(N.Object({ comment: N.String({ maxLength: V }) })), ae = z(N.Object({
32
- durationMs: N.Integer({ minimum: W }),
33
- reason: N.String({
34
- minLength: 1,
35
- maxLength: V,
36
- pattern: "\\S"
37
- })
38
- }));
39
- function Y() {
40
- let t = e.useUtils();
41
- return () => {
42
- t.alarm.log.invalidate();
43
- };
44
- }
45
- function oe({ alarm: t, title: n, onClose: a }) {
46
- let c = r(), l = e.alarm.acknowledge.useMutation(), u = Y(), d = i({
47
- defaultValues: { comment: "" },
48
- validators: s({
49
- schema: J,
50
- submit: async (e) => {
51
- let n = e.comment.trim();
52
- return await l.mutateAsync({
53
- id: t.id,
54
- ...n.length === 0 ? {} : { comment: n }
55
- }), u(), null;
56
- }
57
- }),
58
- onSubmitInvalid: o,
59
- onSubmit: a
60
- });
61
- return /* @__PURE__ */ j(x, {
62
- open: !0,
63
- onOpenChange: (e) => {
64
- e || a();
65
- },
66
- children: /* @__PURE__ */ j(b, { children: /* @__PURE__ */ j(d.AppForm, { children: /* @__PURE__ */ M(d.FormRoot, {
67
- layout: "dialog",
68
- children: [
69
- /* @__PURE__ */ M(y, { children: [/* @__PURE__ */ j(v, { children: c("alarm_acknowledge_title") }), /* @__PURE__ */ j(_, { children: n })] }),
70
- /* @__PURE__ */ j(f, { children: /* @__PURE__ */ j(d.AppField, {
71
- name: "comment",
72
- children: (e) => /* @__PURE__ */ j(e.TextAreaField, {
73
- label: c("alarm_acknowledge_comment"),
74
- placeholder: c("alarm_acknowledge_comment_placeholder"),
75
- maxLength: V,
76
- autoFocus: !0
77
- })
78
- }) }),
79
- /* @__PURE__ */ M(g, { children: [/* @__PURE__ */ j(h, {
80
- type: "button",
81
- variant: "outline",
82
- onClick: a,
83
- children: c("action_cancel")
84
- }), /* @__PURE__ */ j(d.SubmitButton, {
85
- label: c("alarm_acknowledge"),
86
- pendingLabel: c("alarm_acknowledging")
87
- })] })
88
- ]
89
- }) }) })
90
- });
91
- }
92
- function se({ alarm: t, title: n, onClose: c }) {
93
- let p = r(), m = e.alarm.shelve.useMutation(), S = Y(), C = i({
94
- defaultValues: {
95
- durationMs: G,
96
- reason: ""
97
- },
98
- validators: s({
99
- schema: ae,
100
- submit: async (e) => (await m.mutateAsync({
101
- id: t.id,
102
- durationMs: e.durationMs,
103
- reason: e.reason.trim()
104
- }), S(), null)
105
- }),
106
- onSubmitInvalid: o,
107
- onSubmit: c
108
- });
109
- return /* @__PURE__ */ j(x, {
110
- open: !0,
111
- onOpenChange: (e) => {
112
- e || c();
113
- },
114
- children: /* @__PURE__ */ j(b, { children: /* @__PURE__ */ j(C.AppForm, { children: /* @__PURE__ */ M(C.FormRoot, {
115
- layout: "dialog",
116
- children: [
117
- /* @__PURE__ */ M(y, { children: [/* @__PURE__ */ j(v, { children: p("alarm_shelve_title") }), /* @__PURE__ */ j(_, { children: n })] }),
118
- /* @__PURE__ */ j("p", {
119
- className: "text-sm text-muted-foreground",
120
- children: p("alarm_shelve_explanation")
121
- }),
122
- /* @__PURE__ */ M(f, { children: [/* @__PURE__ */ j(C.Field, {
123
- name: "durationMs",
124
- children: (e) => /* @__PURE__ */ M(d, { children: [
125
- /* @__PURE__ */ j(u, {
126
- id: "alarm-shelve-duration",
127
- children: p("alarm_shelve_duration")
128
- }),
129
- /* @__PURE__ */ j(ee, {
130
- variant: "outline",
131
- size: "sm",
132
- spacing: 0,
133
- "aria-labelledby": "alarm-shelve-duration",
134
- className: "flex-wrap",
135
- value: [String(e.state.value)],
136
- onValueChange: (t) => {
137
- let n = K.find((e) => String(e) === t[0]);
138
- n != null && e.handleChange(n);
139
- },
140
- children: K.map((e) => /* @__PURE__ */ j(w, {
141
- value: String(e),
142
- children: q(e)
143
- }, e))
144
- }),
145
- /* @__PURE__ */ j(l, { errors: a(e.state.meta.errors, e.name) })
146
- ] })
147
- }), /* @__PURE__ */ j(C.AppField, {
148
- name: "reason",
149
- children: (e) => /* @__PURE__ */ j(e.TextAreaField, {
150
- label: p("alarm_shelve_reason"),
151
- placeholder: p("alarm_shelve_reason_placeholder"),
152
- maxLength: V,
153
- required: !0
154
- })
155
- })] }),
156
- /* @__PURE__ */ M(g, { children: [/* @__PURE__ */ j(h, {
157
- type: "button",
158
- variant: "outline",
159
- onClick: c,
160
- children: p("action_cancel")
161
- }), /* @__PURE__ */ j(C.SubmitButton, {
162
- label: p("alarm_shelve"),
163
- pendingLabel: p("alarm_shelving")
164
- })] })
165
- ]
166
- }) }) })
167
- });
168
- }
169
- function ce({ alarm: t, title: n, onClose: a }) {
170
- let c = r(), l = e.alarm.unshelve.useMutation(), u = Y(), d = i({
171
- defaultValues: {},
172
- validators: s({ submit: async () => (await l.mutateAsync({ id: t.id }), u(), null) }),
173
- onSubmitInvalid: o,
174
- onSubmit: a
175
- });
176
- return /* @__PURE__ */ j(x, {
177
- open: !0,
178
- onOpenChange: (e) => {
179
- e || a();
180
- },
181
- children: /* @__PURE__ */ j(b, { children: /* @__PURE__ */ j(d.AppForm, { children: /* @__PURE__ */ M(d.FormRoot, {
182
- layout: "dialog",
183
- children: [
184
- /* @__PURE__ */ M(y, { children: [/* @__PURE__ */ j(v, { children: c("alarm_unshelve_title") }), /* @__PURE__ */ j(_, { children: n })] }),
185
- /* @__PURE__ */ j("p", {
186
- className: "text-sm text-muted-foreground",
187
- children: c("alarm_unshelve_explanation")
188
- }),
189
- /* @__PURE__ */ M(g, { children: [/* @__PURE__ */ j(h, {
190
- type: "button",
191
- variant: "outline",
192
- onClick: a,
193
- children: c("action_cancel")
194
- }), /* @__PURE__ */ j(d.SubmitButton, {
195
- label: c("alarm_unshelve"),
196
- pendingLabel: c("alarm_unshelving")
197
- })] })
198
- ]
199
- }) }) })
200
- });
201
- }
202
- //#endregion
203
- //#region src/workspace/alarms/alarm-list.tsx
204
- function le(e) {
205
- return e.source.kind === "alarm_rule" && e.key === H;
206
- }
207
- function X(e, n) {
208
- let r = n.title.length > 0 ? n.title : t("alarm_untitled");
209
- return le(e) ? {
210
- title: t("alarm_unavailable_title", { name: r }),
211
- body: t("alarm_unavailable_body")
212
- } : {
213
- title: r,
214
- body: n.body
215
- };
216
- }
217
- function Z({ severity: e }) {
218
- let t = r();
219
- return e === "urgent" ? /* @__PURE__ */ M(p, {
220
- variant: "destructive",
221
- children: [/* @__PURE__ */ j(F, { "data-icon": "inline-start" }), t("automation_severity_urgent")]
222
- }) : e === "warning" ? /* @__PURE__ */ M(p, {
223
- variant: "warning",
224
- children: [/* @__PURE__ */ j(I, { "data-icon": "inline-start" }), t("automation_severity_warning")]
225
- }) : /* @__PURE__ */ j(p, {
226
- variant: "outline",
227
- children: t("automation_severity_info")
228
- });
229
- }
230
- function Q(t, r) {
231
- let i = n(), a = e.alarmRule.list.useQuery({ workspaceId: t }, { enabled: r }), o = e.automation.list.useQuery({ workspaceId: t }, { enabled: r }), s = /* @__PURE__ */ new Map();
232
- for (let e of a.data?.items ?? []) s.set(e.id, R(e.name, i));
233
- for (let e of o.data?.items ?? []) s.set(e.id, R(e.name, i));
234
- return {
235
- names: s,
236
- rules: a.data?.items ?? [],
237
- automations: o.data?.items ?? [],
238
- name: (e) => s.get(te(e)) ?? null
239
- };
240
- }
241
- function $({ alarm: e, workspaceId: t, now: i, canOperate: a, sourceName: o, showHistoryLink: s, compact: l, onOpen: u }) {
242
- let d = r(), f = n(), g = C()?.timezone ?? "UTC", { title: _, body: v } = X(e, T(e.message, f, g)), y = E(e, i), b = ne(e, i), x = [];
243
- x.push(/* @__PURE__ */ j("span", { children: e.clearedAt == null ? d("alarm_state_active") : d("alarm_state_cleared", { time: L(e.clearedAt) }) }, "state")), e.acknowledgedAt != null && x.push(/* @__PURE__ */ j("span", { children: e.acknowledgedByName == null ? d("alarm_state_acknowledged", { time: L(e.acknowledgedAt) }) : d("alarm_state_acknowledged_by", {
244
- name: e.acknowledgedByName,
245
- time: L(e.acknowledgedAt)
246
- }) }, "acknowledged")), b && e.shelvedUntil != null && x.push(/* @__PURE__ */ j("span", { children: e.shelvedByName == null ? d("alarm_state_shelved", { time: L(e.shelvedUntil) }) : d("alarm_state_shelved_by", {
247
- name: e.shelvedByName,
248
- time: L(e.shelvedUntil)
249
- }) }, "shelved"));
250
- let S = [e.acknowledgedAt != null && e.acknowledgeComment != null ? {
251
- key: "comment",
252
- label: d("alarm_acknowledge_comment"),
253
- text: e.acknowledgeComment
254
- } : null, b && e.shelveReason != null ? {
255
- key: "reason",
256
- label: d("alarm_shelve_reason"),
257
- text: e.shelveReason
258
- } : null].filter((e) => e != null);
259
- return /* @__PURE__ */ M("li", {
260
- className: c("flex flex-col gap-2 rounded-lg border bg-card p-3", y ? e.severity === "urgent" ? "border-destructive/40" : e.severity === "warning" ? "border-warning/50" : void 0 : "bg-muted/30"),
261
- children: [
262
- /* @__PURE__ */ M("div", {
263
- className: "flex flex-wrap items-start gap-x-2 gap-y-1",
264
- children: [
265
- /* @__PURE__ */ j(Z, { severity: e.severity }),
266
- y ? /* @__PURE__ */ j(p, {
267
- variant: "secondary",
268
- children: d("alarm_needs_acknowledgement")
269
- }) : null,
270
- b ? /* @__PURE__ */ M(p, {
271
- variant: "outline",
272
- children: [/* @__PURE__ */ j(P, { "data-icon": "inline-start" }), d("alarm_shelved")]
273
- }) : null
274
- ]
275
- }),
276
- /* @__PURE__ */ M("div", {
277
- className: "flex min-w-0 flex-col gap-1",
278
- children: [
279
- /* @__PURE__ */ j("p", {
280
- className: c("font-medium wrap-break-word", y ? "text-foreground" : "text-muted-foreground"),
281
- children: _
282
- }),
283
- v.length > 0 && !l ? /* @__PURE__ */ j("p", {
284
- className: "text-sm wrap-break-word whitespace-pre-line text-muted-foreground",
285
- children: v
286
- }) : null,
287
- /* @__PURE__ */ M("p", {
288
- className: "text-xs text-muted-foreground",
289
- children: [d("alarm_raised_at", { time: L(e.raisedAt) }), o == null ? null : ` · ${o}`]
290
- }),
291
- /* @__PURE__ */ j("p", {
292
- className: "flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground",
293
- children: x
294
- }),
295
- S.map((e) => /* @__PURE__ */ M("p", {
296
- className: "text-xs wrap-break-word text-muted-foreground",
297
- children: [
298
- /* @__PURE__ */ M("span", {
299
- className: "font-medium",
300
- children: [e.label, ":"]
301
- }),
302
- " ",
303
- e.text
304
- ]
305
- }, e.key))
306
- ]
307
- }),
308
- a || s ? /* @__PURE__ */ M("div", {
309
- className: "flex flex-wrap gap-2",
310
- children: [
311
- a && e.acknowledgedAt == null ? /* @__PURE__ */ M(h, {
312
- size: "sm",
313
- onClick: () => {
314
- u({
315
- kind: "acknowledge",
316
- alarm: e,
317
- title: _
318
- });
319
- },
320
- children: [/* @__PURE__ */ j(re, { "data-icon": "inline-start" }), d("alarm_acknowledge")]
321
- }) : null,
322
- a && !b ? /* @__PURE__ */ M(h, {
323
- size: "sm",
324
- variant: "outline",
325
- onClick: () => {
326
- u({
327
- kind: "shelve",
328
- alarm: e,
329
- title: _
330
- });
331
- },
332
- children: [/* @__PURE__ */ j(P, { "data-icon": "inline-start" }), d("alarm_shelve")]
333
- }) : null,
334
- a && b ? /* @__PURE__ */ j(h, {
335
- size: "sm",
336
- variant: "outline",
337
- onClick: () => {
338
- u({
339
- kind: "unshelve",
340
- alarm: e,
341
- title: _
342
- });
343
- },
344
- children: d("alarm_unshelve")
345
- }) : null,
346
- s ? /* @__PURE__ */ M(U, {
347
- to: "/workspace/$workspaceId/alarms",
348
- params: { workspaceId: t },
349
- search: {
350
- tab: "history",
351
- alarm: e.id
352
- },
353
- className: m({
354
- variant: "ghost",
355
- size: "sm"
356
- }),
357
- children: [/* @__PURE__ */ j(ie, { "data-icon": "inline-start" }), d("alarm_history_of_alarm")]
358
- }) : null
359
- ]
360
- }) : null
361
- ]
362
- });
363
- }
364
- function ue({ workspaceId: e, sourceIds: t, keyPrefix: n, parameterIds: i, compact: a = !1, empty: o, className: s }) {
365
- let l = r(), u = C(), d = e ?? u?.id;
366
- if (d == null) throw Error("AlarmList needs a workspaceId outside a workspace");
367
- let f = u?.id === d ? u.access : null, p = f != null && B(f), { alarms: m, failed: h, now: g } = D(d), _ = Q(d, !a), [v, y] = A(null), b = () => {
368
- y(null);
369
- };
370
- if (m == null) return h ? /* @__PURE__ */ j("p", {
371
- role: "alert",
372
- className: c("text-sm text-destructive", s),
373
- children: l("alarm_feed_failed")
374
- }) : /* @__PURE__ */ M("div", {
375
- className: c("flex flex-col gap-2", s),
376
- "aria-busy": !0,
377
- children: [/* @__PURE__ */ j(S, { className: "h-20 w-full" }), /* @__PURE__ */ j(S, { className: "h-20 w-full" })]
378
- });
379
- let x = k(O(m, {
380
- ...t == null ? {} : { sourceIds: t },
381
- ...n == null ? {} : { keyPrefix: n },
382
- ...i == null ? {} : { parameterIds: i }
383
- }), g);
384
- return /* @__PURE__ */ M("div", {
385
- className: c("flex flex-col gap-2", s),
386
- children: [
387
- x.length === 0 ? o ?? /* @__PURE__ */ j("p", {
388
- className: "rounded-lg border py-8 text-center text-sm text-muted-foreground",
389
- children: l("alarm_none_active")
390
- }) : /* @__PURE__ */ j("ul", {
391
- "aria-label": l("alarm_active_title"),
392
- className: "flex flex-col gap-2",
393
- children: x.map((e) => /* @__PURE__ */ j($, {
394
- alarm: e,
395
- workspaceId: d,
396
- now: g,
397
- canOperate: p,
398
- sourceName: a ? null : _.name(e.source),
399
- showHistoryLink: u?.id === d,
400
- compact: a,
401
- onOpen: y
402
- }, e.id))
403
- }),
404
- v?.kind === "acknowledge" ? /* @__PURE__ */ j(oe, {
405
- alarm: v.alarm,
406
- title: v.title,
407
- onClose: b
408
- }) : null,
409
- v?.kind === "shelve" ? /* @__PURE__ */ j(se, {
410
- alarm: v.alarm,
411
- title: v.title,
412
- onClose: b
413
- }) : null,
414
- v?.kind === "unshelve" ? /* @__PURE__ */ j(ce, {
415
- alarm: v.alarm,
416
- title: v.title,
417
- onClose: b
418
- }) : null
419
- ]
420
- });
421
- }
422
- //#endregion
423
- export { Q as i, Z as n, X as r, ue as t };