@overvis/hmi-workspace-ui 0.1.0 → 0.1.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/alarm-list-DKFio0hg.js +414 -0
- package/dist/alarm-rule-dialog-mb4_nHRW.js +417 -0
- package/dist/{alarm-rule-lists-C5v1Kf7A.js → alarm-rule-lists-CfZXTWkK.js} +123 -125
- package/dist/{alarm-rules-page-CqFzofPd.js → alarm-rules-page-DBLSkrrG.js} +15 -18
- package/dist/alert-dialog-D_iDv2lQ.js +891 -0
- package/dist/{base-revision-YCO27zR4.js → base-revision-DLF9EnGV.js} +26 -29
- package/dist/{breadcrumbs-0cjsV2cq.js → breadcrumbs-D5R6Fz74.js} +6 -7
- package/dist/{catalog-list-DjZojYLJ.js → catalog-list-BkWosvh1.js} +2 -4
- package/dist/{code-editor-BVimvjDV.js → code-editor-DCM0KdMJ.js} +9 -6
- package/dist/dashboard-bindings.js +1 -2
- package/dist/{dashboards-page-BlrJguNz.js → dashboards-page-DLc11Vzu.js} +335 -359
- package/dist/{de-14WdmJxZ.js → de-Z2er-E5v.js} +4 -2
- package/dist/diagnostic-text-CYZFPiND.js +116 -0
- package/dist/{dialogs-D_v1LeH4.js → dialogs-BX023zml.js} +2523 -2590
- package/dist/{dialogs-B6BRnf3Q.js → dialogs-DEOg9lxy.js} +219 -227
- package/dist/{display-DmOo23mi.js → display-VYGzneE0.js} +4 -6
- package/dist/{editor-language-To9MxloY.js → editor-language-CGENZxbI.js} +3 -5
- package/dist/editor-page-CaN52OQh.js +1337 -0
- package/dist/{en-BgercpT0.js → en-CKPPL6bQ.js} +4 -2
- package/dist/entity-controls-DJT47yeV.js +71 -0
- package/dist/errors-BAWoH_5w.js +25 -0
- package/dist/{footer-DC-Q0052.js → footer-CbPMP8aq.js} +2404 -2515
- package/dist/host.js +8254 -675
- package/dist/{i18n-BgzakKoC.js → i18n-ChjEbYEg.js} +77 -90
- package/dist/i18n.js +1 -2
- package/dist/index.js +5168 -5353
- package/dist/{lat-lng-B12P7QyY.js → lat-lng-Bl77AGSO.js} +1 -2
- package/dist/{list-page-CvsdZb86.js → list-page-Fa29SkaJ.js} +116 -123
- package/dist/{location-map-renderer-DO5yfdSU.js → location-map-renderer-DvXIYc1Z.js} +6 -6
- package/dist/{location-picker-renderer-CjCxg6ai.js → location-picker-renderer-B1_-n8lf.js} +3 -4
- package/dist/{model-B8gGi4OK.js → model-tpg_xpFB.js} +1 -2
- package/dist/{notice-card-DyGywFsW.js → notice-card-V_0K0lO0.js} +54 -58
- package/dist/page-B5te_1Lc.js +449 -0
- package/dist/{page-v6LCwswN.js → page-BorlLnMX.js} +92 -100
- package/dist/page-DxF7FOve.js +507 -0
- package/dist/panel-DuZD-cBP.js +949 -0
- package/dist/parameter-values.js +3 -16
- package/dist/{pl-lQ9HXV9k.js → pl-DVABrn5G.js} +4 -2
- package/dist/presence-code-DsabLTZs.js +73 -0
- package/dist/{query-gate-DVhNIkge.js → query-gate-BbIo1Xrj.js} +6 -6
- package/dist/{provider-DoEpKcQ-.js → quick-report-BcZsfkCZ.js} +9423 -5102
- package/dist/{retention-BYXNpYmR.js → retention-C7EZsq8u.js} +4 -6
- package/dist/retention-note-CmMeHV_u.js +40 -0
- package/dist/{rolldown-runtime-Dy4uBu1J.js → rolldown-runtime-CGnMp29N.js} +1 -2
- package/dist/{ru-qTKINoUj.js → ru-CBRLC_xM.js} +8 -6
- package/dist/run-text-CDdfbKbg.js +112 -0
- package/dist/{search-D4rDnE9T.js → search-C6xQ_Hvo.js} +26 -29
- package/dist/{sections-kCOyc4NR.js → sections-D_SBfVzV.js} +2 -3
- package/dist/{select-BKiOWdSr.js → select-nNLG-AMz.js} +17 -23
- package/dist/{spinner-C-HPNxOc.js → spinner-B-KLtBjp.js} +182 -201
- package/dist/src/code-editor/code-editor.d.ts +3 -0
- package/dist/src/code-editor/taskfile-language.d.ts +22 -2
- package/dist/src/i18n/catalogs/de/edge-program.d.ts +3 -0
- package/dist/src/i18n/catalogs/de.d.ts +3 -0
- package/dist/src/i18n/catalogs/en/edge-program.d.ts +3 -0
- package/dist/src/i18n/catalogs/en.d.ts +3 -0
- package/dist/src/i18n/catalogs/pl/edge-program.d.ts +3 -0
- package/dist/src/i18n/catalogs/pl.d.ts +3 -0
- package/dist/src/i18n/catalogs/ru/edge-program.d.ts +5 -2
- package/dist/src/i18n/catalogs/ru/graphics.d.ts +2 -2
- package/dist/src/i18n/catalogs/ru.d.ts +7 -4
- package/dist/src/i18n/catalogs/uk/edge-program.d.ts +5 -2
- package/dist/src/i18n/catalogs/uk/graphics.d.ts +2 -2
- package/dist/src/i18n/catalogs/uk.d.ts +7 -4
- package/dist/src/version.d.ts +1 -1
- package/dist/src/workspace/graphics/inspector/item.d.ts +6 -6
- package/dist/src/workspace/local-workspace-app.d.ts +1 -1
- package/dist/src/workspace/routes.d.ts +1 -1
- package/dist/{starter-fields-BRLX0z-v.js → starter-fields-7S3LmtGa.js} +154 -157
- package/dist/{starter-handoff-BA3ucMKL.js → starter-handoff-BaK8Ss8I.js} +1 -2
- package/dist/styles.css +1 -1
- package/dist/ui.js +334 -374
- package/dist/{uk-CwpJAxmx.js → uk-17pbVYZa.js} +8 -6
- package/dist/{wireguard-docs-AfU6NzTL.js → wireguard-docs-Clb-7xRY.js} +14 -17
- package/package.json +15 -9
- package/dist/alarm-list-BL3xQ5Lf.js +0 -423
- package/dist/alarm-rule-dialog-S1ZUg-74.js +0 -423
- package/dist/alert-B8MAoIO8.js +0 -45
- package/dist/alert-dialog-CYkuMg5D.js +0 -129
- package/dist/api-error-9rQmUN5L.js +0 -93
- package/dist/breadcrumb-DzVL1yHa.js +0 -74
- package/dist/button-6SxPBYMz.js +0 -44
- package/dist/context-u9KJQmdB.js +0 -102
- package/dist/copyable-id-DYGiAcnq.js +0 -40
- package/dist/dashboard-context-CBfG6DoT.js +0 -191
- package/dist/date-time-picker-C3FhMXk6.js +0 -266
- package/dist/diagnostic-text-BAkzW0SE.js +0 -111
- package/dist/diagnostic-text-DiKd2i1w.js +0 -76
- package/dist/dialog-BIhQXcZC.js +0 -237
- package/dist/dialog-BqyIxMD-.js +0 -54
- package/dist/dropdown-menu-DSzbBq3v.js +0 -136
- package/dist/editor-page-BiSZJz5b.js +0 -1353
- package/dist/empty-B-QJ-06w.js +0 -59
- package/dist/entity-controls-D1K4Ot3O.js +0 -76
- package/dist/errors-CcsvDHu8.js +0 -26
- package/dist/history-page-sAAhG54V.js +0 -1400
- package/dist/icon-D-pR9htW.js +0 -57
- package/dist/index-page-DMH82fZe.js +0 -214
- package/dist/item-B5SaTFQU.js +0 -120
- package/dist/mutation-form-validators-BNz5bsv1.js +0 -2408
- package/dist/mutations-THtGG6Ai.js +0 -240
- package/dist/page-2KPemaAj.js +0 -328
- package/dist/page-6rIoTg2L.js +0 -459
- package/dist/page-C6giEoEd.js +0 -1935
- package/dist/page-DCbTxKsi.js +0 -313
- package/dist/page-DWO427hT.js +0 -208
- package/dist/page-LXu_2zm3.js +0 -137
- package/dist/page-aaUiVOnk.js +0 -513
- package/dist/page-header-RB2YFWlE.js +0 -55
- package/dist/page-title-CdCbiLt8.js +0 -14
- package/dist/panel-DDy8tUNR.js +0 -338
- package/dist/presence-code-BfSXr50g.js +0 -83
- package/dist/progress-C7cxNJA1.js +0 -83
- package/dist/provider-BOeYHi0n.js +0 -134
- package/dist/quick-report-CUVJnbKP.js +0 -416
- package/dist/radio-group-CZGqVbkJ.js +0 -26
- package/dist/retention-note-CHhA6gjY.js +0 -42
- package/dist/run-text-DvaO8LDF.js +0 -113
- package/dist/select-eNgZdZ30.js +0 -521
- package/dist/skeleton-6yk8Tdh5.js +0 -19
- package/dist/slider-DorDsoF8.js +0 -37
- package/dist/status-page-DAHiKM9P.js +0 -3286
- package/dist/switch-BqD0RH_G.js +0 -18
- package/dist/table-Q2-voLuw.js +0 -65
- package/dist/tabs-CSIucYFP.js +0 -57
- package/dist/theme-provider-BkRohQFU.js +0 -61
- package/dist/toggle-group-9Bs0Mm3r.js +0 -82
- package/dist/trpc-CvJUuUXp.js +0 -153
- package/dist/utils-CX-Pz5p6.js +0 -8
- package/dist/writability-BuH-spxv.js +0 -57
|
@@ -1,3286 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { r as t } from "./trpc-CvJUuUXp.js";
|
|
3
|
-
import { f as n, h as r, m as i, n as a } from "./i18n-BgzakKoC.js";
|
|
4
|
-
import { a as o, d as s, et as c, j as l, t as u } from "./mutation-form-validators-BNz5bsv1.js";
|
|
5
|
-
import { t as d } from "./utils-CX-Pz5p6.js";
|
|
6
|
-
import { A as f, M as p, V as m, a as h, l as g, n as _, r as v, t as y } from "./spinner-C-HPNxOc.js";
|
|
7
|
-
import { n as b, t as x } from "./button-6SxPBYMz.js";
|
|
8
|
-
import { a as S, i as C, l as w, o as T, r as E, t as D } from "./dialog-BIhQXcZC.js";
|
|
9
|
-
import { n as O } from "./skeleton-6yk8Tdh5.js";
|
|
10
|
-
import { i as k, o as A } from "./context-u9KJQmdB.js";
|
|
11
|
-
import { n as j, t as M } from "./api-error-9rQmUN5L.js";
|
|
12
|
-
import { c as N, i as P, n as F, o as I, s as L, t as R } from "./table-Q2-voLuw.js";
|
|
13
|
-
import { a as ee, i as te, n as ne, o as z, r as re, t as ie } from "./empty-B-QJ-06w.js";
|
|
14
|
-
import { i as B, n as V, r as H, t as U } from "./alert-B8MAoIO8.js";
|
|
15
|
-
import { t as ae } from "./switch-BqD0RH_G.js";
|
|
16
|
-
import { n as oe, t as se } from "./toggle-group-9Bs0Mm3r.js";
|
|
17
|
-
import { a as ce, l as le, o as ue, r as de, s as fe, t as pe } from "./progress-C7cxNJA1.js";
|
|
18
|
-
import { a as W, c as me } from "./mutations-THtGG6Ai.js";
|
|
19
|
-
import { a as he, d as ge, i as _e, n as ve, o as ye, r as be, s as xe, t as Se } from "./alert-dialog-CYkuMg5D.js";
|
|
20
|
-
import { t as Ce } from "./page-header-RB2YFWlE.js";
|
|
21
|
-
import { i as we, r as Te, t as Ee } from "./tabs-CSIucYFP.js";
|
|
22
|
-
import { n as De, r as Oe, t as ke } from "./query-gate-DVhNIkge.js";
|
|
23
|
-
import { a as Ae, i as je, n as Me, t as Ne } from "./display-DmOo23mi.js";
|
|
24
|
-
import { t as Pe } from "./breadcrumbs-0cjsV2cq.js";
|
|
25
|
-
import { n as Fe, r as Ie, t as Le } from "./presence-code-BfSXr50g.js";
|
|
26
|
-
import { n as Re, t as ze } from "./base-revision-YCO27zR4.js";
|
|
27
|
-
import { t as Be } from "./code-editor-BVimvjDV.js";
|
|
28
|
-
import { i as Ve, n as He, r as Ue, t as We } from "./starter-fields-BRLX0z-v.js";
|
|
29
|
-
import { skipToken as Ge } from "@tanstack/react-query";
|
|
30
|
-
import { useCallback as Ke, useDeferredValue as qe, useEffect as G, useMemo as Je, useRef as K, useState as q } from "react";
|
|
31
|
-
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
32
|
-
import Z from "typebox";
|
|
33
|
-
import { AlertCircleIcon as Ye, ArrowDownIcon as Xe, CableIcon as Ze, ChevronRightIcon as Qe, CircleAlertIcon as $e, CircleCheckIcon as et, ClockAlertIcon as tt, CpuIcon as nt, ExternalLinkIcon as rt, HistoryIcon as it, InfoIcon as at, LayoutTemplateIcon as ot, PencilIcon as st, PlusIcon as ct, RefreshCwIcon as lt, SearchIcon as ut, SettingsIcon as dt, Trash2Icon as ft, TriangleAlertIcon as pt, WifiOffIcon as mt } from "lucide-react";
|
|
34
|
-
import { formatAppDateTime as Q, resolveLocalized as ht, schema as gt } from "@overvis/hmi-shared";
|
|
35
|
-
import { Prec as _t } from "@codemirror/state";
|
|
36
|
-
import { keymap as vt } from "@codemirror/view";
|
|
37
|
-
import { canWriteSetup as yt } from "@overvis/hmi-shared/workspace";
|
|
38
|
-
import { useBlocker as bt } from "@tanstack/react-router";
|
|
39
|
-
import { flushSync as xt } from "react-dom";
|
|
40
|
-
import { deployedEdgePrograms as St, deviceUiSessionQuery as Ct, edgeDeployStatusOutputSchema as wt, edgeLiveStateSchema as Tt, edgeProgramHmiParameters as Et, edgeProgramParameterProblem as Dt, freeEdgeProgramFileName as Ot, isDeviceUiProgressMessage as kt, isDeviceUiUnreachableMessage as At, isEdgeProgramFileName as jt, isMc252Endpoint as Mt, normalizeEdgeProgramFileName as Nt } from "@overvis/hmi-shared/endpoint";
|
|
41
|
-
import { taskfileItemWord as Pt, taskfileLanguageDocsUrl as Ft, taskfileLanguageService as It, taskfileVocabulary as $ } from "@overvis/hmi-shared/taskfile";
|
|
42
|
-
import { StreamLanguage as Lt } from "@codemirror/language";
|
|
43
|
-
//#region src/workspace/edge-programs/deploy-status.ts
|
|
44
|
-
function Rt(e) {
|
|
45
|
-
let [n, r] = q(null), i = t.edgeProgram.watchDeployStatus.useSubscription(e == null ? Ge : { endpointId: e }, { onData: (e) => {
|
|
46
|
-
let t = wt["~standard"].validate(e);
|
|
47
|
-
t.issues ?? r(t.value);
|
|
48
|
-
} });
|
|
49
|
-
return {
|
|
50
|
-
status: n?.endpointId === e ? n : null,
|
|
51
|
-
live: i.status === "pending"
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/workspace/setup/endpoints/device-log-clock.tsx
|
|
56
|
-
var zt = 6e4;
|
|
57
|
-
function Bt({ endpointId: e }) {
|
|
58
|
-
let n = i(), r = t.deviceLog.status.useQuery({ endpointId: e }, { refetchInterval: zt }).data?.clock;
|
|
59
|
-
if (r == null) return null;
|
|
60
|
-
let a = Math.round(Math.abs(r.offsetMs) / 6e4);
|
|
61
|
-
return /* @__PURE__ */ X(U, {
|
|
62
|
-
variant: "warning",
|
|
63
|
-
children: [
|
|
64
|
-
/* @__PURE__ */ Y(tt, {}),
|
|
65
|
-
/* @__PURE__ */ Y(B, { children: n("endpoint_device_log_clock_title") }),
|
|
66
|
-
/* @__PURE__ */ X(H, { children: [/* @__PURE__ */ Y("p", { children: r.offsetMs > 0 ? n("endpoint_device_log_clock_ahead", {
|
|
67
|
-
minutes: a,
|
|
68
|
-
since: Q(r.since)
|
|
69
|
-
}) : n("endpoint_device_log_clock_behind", {
|
|
70
|
-
minutes: a,
|
|
71
|
-
since: Q(r.since)
|
|
72
|
-
}) }), /* @__PURE__ */ Y("p", { children: n("endpoint_device_log_clock_fix") })] })
|
|
73
|
-
]
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/workspace/setup/endpoints/connection-error.ts
|
|
78
|
-
function Vt(e) {
|
|
79
|
-
switch (e.reason) {
|
|
80
|
-
case "endpoint_vpn_pending": return n("parameter_runtime_error_vpn_pending_help");
|
|
81
|
-
case "protocol_error": return n("parameter_runtime_error_protocol_help");
|
|
82
|
-
default: return n("parameter_runtime_error_connection_help");
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/workspace/setup/endpoints/status-connection.tsx
|
|
87
|
-
var Ht = 2e3;
|
|
88
|
-
function Ut(e) {
|
|
89
|
-
if (e == null) return n("endpoint_status_state_unknown");
|
|
90
|
-
switch (e) {
|
|
91
|
-
case "connecting": return n("endpoint_status_state_connecting");
|
|
92
|
-
case "connected": return n("endpoint_status_state_connected");
|
|
93
|
-
case "disconnected": return n("endpoint_status_state_disconnected");
|
|
94
|
-
case "error": return n("endpoint_status_state_error");
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function Wt(e) {
|
|
98
|
-
if (e == null) return "bg-muted text-muted-foreground";
|
|
99
|
-
switch (e) {
|
|
100
|
-
case "connected": return "bg-emerald-500/15 text-emerald-700 dark:text-emerald-400";
|
|
101
|
-
case "connecting": return "bg-amber-500/15 text-amber-800 dark:text-amber-400";
|
|
102
|
-
case "disconnected": return "bg-muted text-muted-foreground";
|
|
103
|
-
case "error": return "bg-destructive/15 text-destructive";
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function Gt(e) {
|
|
107
|
-
let t = [];
|
|
108
|
-
for (let n = 0; n < e.length; n += 2) t.push(e.slice(n, n + 2).toUpperCase());
|
|
109
|
-
return t.join(" ");
|
|
110
|
-
}
|
|
111
|
-
function Kt(e) {
|
|
112
|
-
switch (e.channel) {
|
|
113
|
-
case "sent":
|
|
114
|
-
case "rx": return {
|
|
115
|
-
at: e.at,
|
|
116
|
-
channel: e.channel,
|
|
117
|
-
dataHex: Gt(e.data)
|
|
118
|
-
};
|
|
119
|
-
case "events": return {
|
|
120
|
-
at: e.at,
|
|
121
|
-
channel: "event",
|
|
122
|
-
kind: e.event.kind,
|
|
123
|
-
...e.event.kind === "error" ? { message: e.event.message } : {}
|
|
124
|
-
};
|
|
125
|
-
case "tx": return null;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function qt(e) {
|
|
129
|
-
let t = Q(e.at);
|
|
130
|
-
return e.channel === "sent" ? `${t} TX ${e.dataHex ?? ""}` : e.channel === "rx" ? `${t} RX ${e.dataHex ?? ""}` : `${t} EVT ${e.kind ?? "event"}${e.message != null && e.message.length > 0 ? ` ${e.message}` : ""}`;
|
|
131
|
-
}
|
|
132
|
-
function Jt(e) {
|
|
133
|
-
switch (e) {
|
|
134
|
-
case "sent": return "text-sky-700 dark:text-sky-400";
|
|
135
|
-
case "rx": return "text-violet-700 dark:text-violet-400";
|
|
136
|
-
case "event": return "text-amber-800 dark:text-amber-400";
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function Yt(e) {
|
|
140
|
-
switch (e) {
|
|
141
|
-
case "pending": return n("endpoint_status_stream_live");
|
|
142
|
-
case "connecting": return n("endpoint_status_stream_reconnecting");
|
|
143
|
-
case "error": return n("endpoint_status_stream_error");
|
|
144
|
-
case "idle": return n("endpoint_status_stream_reconnecting");
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function Xt(e, t) {
|
|
148
|
-
return e === "error" || t === "error" ? "error" : e === "connecting" || t === "connecting" ? "connecting" : e === "idle" || t === "idle" ? "idle" : "pending";
|
|
149
|
-
}
|
|
150
|
-
function Zt({ endpointId: e, endpoint: n, statusDetails: r }) {
|
|
151
|
-
let a = i(), o = je(e), s = Ae(), [c, l] = q([]), [u, f] = q(!0), p = K(null), m = K(!0), h = Xt(s, t.endpoint.traffic.useSubscription({
|
|
152
|
-
endpointId: e,
|
|
153
|
-
channels: [
|
|
154
|
-
"sent",
|
|
155
|
-
"rx",
|
|
156
|
-
"events"
|
|
157
|
-
]
|
|
158
|
-
}, { onData(e) {
|
|
159
|
-
let t = Kt(e);
|
|
160
|
-
t != null && l((e) => {
|
|
161
|
-
let n = [...e, t];
|
|
162
|
-
return n.length <= Ht ? n : n.slice(n.length - Ht);
|
|
163
|
-
});
|
|
164
|
-
} }).status);
|
|
165
|
-
G(() => {
|
|
166
|
-
m.current = u;
|
|
167
|
-
}, [u]), G(() => {
|
|
168
|
-
let e = p.current;
|
|
169
|
-
e == null || !m.current || (e.scrollTop = e.scrollHeight);
|
|
170
|
-
}, [c]);
|
|
171
|
-
let g = o?.state ?? null, _ = o?.remote ?? null, v = a("endpoint_status_value_none"), y = n.kind === "pin" ? Ne(n) : n.kind === "wireguard" ? Me(n.port) : `${n.hostname ?? "—"}:${String(n.port)}`, b = _ == null ? v : `${_.hostname}:${String(_.port)}`, S = o?.state === "connected" ? `${a("endpoint_status_connected_since")}: ${Q(o.connectedAt)}` : `${a("endpoint_status_last_error")}: ${o?.lastError == null ? v : Vt(o.lastError)}`;
|
|
172
|
-
return /* @__PURE__ */ X("div", {
|
|
173
|
-
className: "flex min-h-0 flex-1 flex-col gap-4",
|
|
174
|
-
children: [/* @__PURE__ */ X("div", {
|
|
175
|
-
className: "\n flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-md border px-3 py-2 text-sm\n ",
|
|
176
|
-
children: [
|
|
177
|
-
/* @__PURE__ */ Y("span", {
|
|
178
|
-
className: d("inline-flex items-center rounded-md px-2 py-0.5 text-sm font-medium", Wt(g)),
|
|
179
|
-
children: Ut(g)
|
|
180
|
-
}),
|
|
181
|
-
/* @__PURE__ */ Y("span", {
|
|
182
|
-
className: "text-muted-foreground",
|
|
183
|
-
children: Yt(h)
|
|
184
|
-
}),
|
|
185
|
-
/* @__PURE__ */ Y("span", {
|
|
186
|
-
className: "text-border",
|
|
187
|
-
children: "|"
|
|
188
|
-
}),
|
|
189
|
-
/* @__PURE__ */ Y(Qt, {
|
|
190
|
-
label: a("endpoint_status_setup_address"),
|
|
191
|
-
value: y
|
|
192
|
-
}),
|
|
193
|
-
/* @__PURE__ */ Y(Qt, {
|
|
194
|
-
label: a("endpoint_status_active_address"),
|
|
195
|
-
value: b
|
|
196
|
-
}),
|
|
197
|
-
/* @__PURE__ */ Y("span", {
|
|
198
|
-
className: "text-border",
|
|
199
|
-
children: "|"
|
|
200
|
-
}),
|
|
201
|
-
/* @__PURE__ */ Y("span", {
|
|
202
|
-
className: d("text-sm", o?.state === "connected" || o?.lastError == null ? "text-muted-foreground" : "text-destructive"),
|
|
203
|
-
children: S
|
|
204
|
-
}),
|
|
205
|
-
r
|
|
206
|
-
]
|
|
207
|
-
}), /* @__PURE__ */ X("div", {
|
|
208
|
-
className: "relative min-h-0 flex-1",
|
|
209
|
-
children: [/* @__PURE__ */ Y("div", {
|
|
210
|
-
ref: p,
|
|
211
|
-
className: "\n size-full min-h-48 overflow-auto rounded-md border bg-muted/30 p-3 font-mono text-xs\n ",
|
|
212
|
-
onScroll: () => {
|
|
213
|
-
let e = p.current;
|
|
214
|
-
if (e == null) return;
|
|
215
|
-
let t = e.scrollHeight - e.scrollTop - e.clientHeight < 24;
|
|
216
|
-
m.current = t, f(t);
|
|
217
|
-
},
|
|
218
|
-
children: c.length === 0 ? /* @__PURE__ */ Y("p", {
|
|
219
|
-
className: "text-muted-foreground",
|
|
220
|
-
children: a("endpoint_status_log_empty")
|
|
221
|
-
}) : /* @__PURE__ */ Y("div", {
|
|
222
|
-
className: "space-y-0.5",
|
|
223
|
-
children: c.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
224
|
-
className: d("break-all whitespace-pre-wrap", Jt(e.channel)),
|
|
225
|
-
children: qt(e)
|
|
226
|
-
}, `${e.at}-${String(t)}`))
|
|
227
|
-
})
|
|
228
|
-
}), u ? null : /* @__PURE__ */ X(x, {
|
|
229
|
-
type: "button",
|
|
230
|
-
size: "sm",
|
|
231
|
-
variant: "secondary",
|
|
232
|
-
className: "absolute right-4 bottom-4 shadow-md",
|
|
233
|
-
onClick: () => {
|
|
234
|
-
let e = p.current;
|
|
235
|
-
e != null && (e.scrollTop = e.scrollHeight), f(!0);
|
|
236
|
-
},
|
|
237
|
-
children: [/* @__PURE__ */ Y(Xe, { "data-icon": "inline-start" }), a("endpoint_status_jump_to_latest")]
|
|
238
|
-
})]
|
|
239
|
-
})]
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
function Qt({ label: e, value: t }) {
|
|
243
|
-
return /* @__PURE__ */ X("span", {
|
|
244
|
-
className: "text-muted-foreground",
|
|
245
|
-
children: [/* @__PURE__ */ X("span", {
|
|
246
|
-
className: "text-foreground/70",
|
|
247
|
-
children: [e, ": "]
|
|
248
|
-
}), t]
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
//#endregion
|
|
252
|
-
//#region src/workspace/setup/endpoints/status-device-ui-progress.tsx
|
|
253
|
-
function $t(e) {
|
|
254
|
-
return e == null || e.bytesExpected === 0 ? null : Math.min(100, e.bytesReceived / e.bytesExpected * 100);
|
|
255
|
-
}
|
|
256
|
-
function en(e) {
|
|
257
|
-
return e != null && e.filesDone < e.files;
|
|
258
|
-
}
|
|
259
|
-
function tn(e, t) {
|
|
260
|
-
return new Intl.NumberFormat(e, {
|
|
261
|
-
style: "unit",
|
|
262
|
-
unit: "kilobyte",
|
|
263
|
-
maximumFractionDigits: 0
|
|
264
|
-
}).format(t / 1e3);
|
|
265
|
-
}
|
|
266
|
-
function nn({ progress: e }) {
|
|
267
|
-
let t = i(), n = r(), a = e != null && e.files > 0;
|
|
268
|
-
return /* @__PURE__ */ Y("div", {
|
|
269
|
-
className: "\n absolute inset-0 z-10 flex items-center justify-center rounded-md border bg-background p-4\n ",
|
|
270
|
-
children: /* @__PURE__ */ X("div", {
|
|
271
|
-
role: "status",
|
|
272
|
-
className: "flex w-full max-w-sm flex-col gap-2",
|
|
273
|
-
children: [
|
|
274
|
-
/* @__PURE__ */ X(pe, {
|
|
275
|
-
value: $t(e),
|
|
276
|
-
children: [/* @__PURE__ */ Y(de, { children: t("endpoint_status_device_ui_loading") }), /* @__PURE__ */ Y(ce, {})]
|
|
277
|
-
}),
|
|
278
|
-
a ? /* @__PURE__ */ Y("p", {
|
|
279
|
-
className: "text-sm text-muted-foreground tabular-nums",
|
|
280
|
-
children: t("endpoint_status_device_ui_progress", {
|
|
281
|
-
done: String(e.filesDone),
|
|
282
|
-
files: String(e.files),
|
|
283
|
-
received: tn(n, e.bytesReceived),
|
|
284
|
-
expected: tn(n, e.bytesExpected)
|
|
285
|
-
})
|
|
286
|
-
}) : null,
|
|
287
|
-
/* @__PURE__ */ Y("p", {
|
|
288
|
-
className: "text-xs text-muted-foreground",
|
|
289
|
-
children: t("endpoint_status_device_ui_progress_hint")
|
|
290
|
-
})
|
|
291
|
-
]
|
|
292
|
-
})
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
//#endregion
|
|
296
|
-
//#region src/workspace/setup/endpoints/status-device-ui.tsx
|
|
297
|
-
var rn = 1e3;
|
|
298
|
-
function an({ mintTicket: e, endpointId: t, kind: n, onTicketUrl: r, resolveDeviceUiOrigin: a }) {
|
|
299
|
-
let o = i(), [s, c] = q(null), [l, u] = q(null), [d, f] = q(null), [p, m] = q(null), [h, g] = q(!1), [_, v] = q(!1), b = d == null ? null : d.kind === "request" ? j(d.error) : o("endpoint_status_device_ui_unreachable");
|
|
300
|
-
G(() => {
|
|
301
|
-
let n = !1;
|
|
302
|
-
return e({ id: t }).then((e) => {
|
|
303
|
-
if (n) return;
|
|
304
|
-
let i = a?.(e.origin) ?? e.origin, o = `${i}/?ticket=${encodeURIComponent(e.ticket)}`;
|
|
305
|
-
u(i), c(o), r(`${i}/?${Ct}=${encodeURIComponent(t)}`);
|
|
306
|
-
}, (e) => {
|
|
307
|
-
n || f({
|
|
308
|
-
kind: "request",
|
|
309
|
-
error: e
|
|
310
|
-
});
|
|
311
|
-
}), () => {
|
|
312
|
-
n = !0, r(null);
|
|
313
|
-
};
|
|
314
|
-
}, [t]), G(() => {
|
|
315
|
-
if (l == null) return;
|
|
316
|
-
let e = (e) => {
|
|
317
|
-
e.origin === l && (At(e.data) ? f({ kind: "unreachable" }) : kt(e.data) && m(e.data));
|
|
318
|
-
};
|
|
319
|
-
return window.addEventListener("message", e), () => {
|
|
320
|
-
window.removeEventListener("message", e);
|
|
321
|
-
};
|
|
322
|
-
}, [l]);
|
|
323
|
-
let x = b == null && s == null, S = b == null && s != null && (!h || en(p));
|
|
324
|
-
return G(() => {
|
|
325
|
-
if (!S) return;
|
|
326
|
-
let e = setTimeout(() => {
|
|
327
|
-
v(!0);
|
|
328
|
-
}, rn);
|
|
329
|
-
return () => {
|
|
330
|
-
clearTimeout(e);
|
|
331
|
-
};
|
|
332
|
-
}, [S]), /* @__PURE__ */ X("div", {
|
|
333
|
-
className: "flex min-h-0 flex-1 flex-col gap-2",
|
|
334
|
-
children: [b == null ? null : /* @__PURE__ */ X(U, {
|
|
335
|
-
variant: "destructive",
|
|
336
|
-
children: [
|
|
337
|
-
/* @__PURE__ */ Y(Ye, {}),
|
|
338
|
-
/* @__PURE__ */ Y(B, { children: o("error_request_failed_title") }),
|
|
339
|
-
/* @__PURE__ */ Y(H, { children: b })
|
|
340
|
-
]
|
|
341
|
-
}), /* @__PURE__ */ X("div", {
|
|
342
|
-
className: "relative min-h-0 flex-1",
|
|
343
|
-
children: [
|
|
344
|
-
x ? /* @__PURE__ */ X("div", {
|
|
345
|
-
className: "\n absolute inset-0 z-10 flex items-center justify-center gap-2 text-sm\n text-muted-foreground\n ",
|
|
346
|
-
children: [/* @__PURE__ */ Y(y, {}), o("endpoint_status_device_ui_loading")]
|
|
347
|
-
}) : null,
|
|
348
|
-
S && _ ? /* @__PURE__ */ Y(nn, { progress: p }) : null,
|
|
349
|
-
s != null && b == null ? /* @__PURE__ */ Y("iframe", {
|
|
350
|
-
title: o("endpoint_status_tab_device_ui"),
|
|
351
|
-
src: s,
|
|
352
|
-
className: "size-full min-h-80 rounded-md border bg-background",
|
|
353
|
-
onLoad: () => {
|
|
354
|
-
g(!0);
|
|
355
|
-
},
|
|
356
|
-
onError: () => {
|
|
357
|
-
n === "wireguard" && f({ kind: "unreachable" });
|
|
358
|
-
}
|
|
359
|
-
}) : null
|
|
360
|
-
]
|
|
361
|
-
})]
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
//#endregion
|
|
365
|
-
//#region src/workspace/edge-programs/diagnostic-text.ts
|
|
366
|
-
function on(e, t) {
|
|
367
|
-
switch (e) {
|
|
368
|
-
case "io": return n("taskfile_error_io");
|
|
369
|
-
case "mem": return n("taskfile_error_mem");
|
|
370
|
-
case "nopath": return n("taskfile_error_nopath");
|
|
371
|
-
case "nofile": return n("taskfile_error_nofile");
|
|
372
|
-
case "line_unrecognized": return n("taskfile_error_line_unrecognized");
|
|
373
|
-
case "item_name_too_big": return n("taskfile_error_item_name_too_big");
|
|
374
|
-
case "unexpected_value": return n("taskfile_error_unexpected_value");
|
|
375
|
-
case "too_many_items": return n("taskfile_error_too_many_items");
|
|
376
|
-
case "unknown_type": return n("taskfile_error_unknown_type");
|
|
377
|
-
case "expected_asterisk": return n("taskfile_error_expected_asterisk");
|
|
378
|
-
case "item_ref": return n("taskfile_error_item_ref");
|
|
379
|
-
case "arg_illegal": return n("taskfile_error_arg_illegal");
|
|
380
|
-
case "unexpected_item": return n("taskfile_error_unexpected_item");
|
|
381
|
-
case "value_bitsize_unsupported": return n("taskfile_error_value_bitsize_unsupported");
|
|
382
|
-
case "item_name": return n("taskfile_error_item_name");
|
|
383
|
-
case "expected_double_quotes": return n("taskfile_error_expected_double_quotes");
|
|
384
|
-
case "expected_eol": return n("taskfile_error_expected_eol");
|
|
385
|
-
case "expected_separator": return n("taskfile_error_expected_separator");
|
|
386
|
-
case "version_unsupported": return n("taskfile_error_version_unsupported");
|
|
387
|
-
case "crc": return n("taskfile_error_crc");
|
|
388
|
-
case "uid_broadcast": return n("taskfile_error_uid_broadcast");
|
|
389
|
-
case "file_format_unsupported": return n("taskfile_error_file_format_unsupported");
|
|
390
|
-
case "name_reserved": return n("taskfile_error_name_reserved");
|
|
391
|
-
case "name_doubled": return n("taskfile_error_name_doubled");
|
|
392
|
-
case "unsatisfied_forward_declaration": return n("taskfile_error_unsatisfied_forward_declaration", { name: String(t.name ?? t.token ?? "") });
|
|
393
|
-
case "item_ref_too_short": return n("taskfile_error_item_ref_too_short");
|
|
394
|
-
case "expected_value": return n("taskfile_error_expected_value");
|
|
395
|
-
case "array_idx": return n("taskfile_error_array_idx");
|
|
396
|
-
case "array_indirect_idx": return n("taskfile_error_array_indirect_idx");
|
|
397
|
-
case "array_undeclared": return n("taskfile_error_array_undeclared");
|
|
398
|
-
case "item_undeclared": return n("taskfile_error_item_undeclared");
|
|
399
|
-
case "out_of_param_mem": return n("taskfile_error_out_of_param_mem");
|
|
400
|
-
case "array_size": return n("taskfile_error_array_size");
|
|
401
|
-
case "item_ref_var": return n("taskfile_error_item_ref_var");
|
|
402
|
-
case "item_ref_cond": return n("taskfile_error_item_ref_cond");
|
|
403
|
-
case "index_bitsize_unsupported": return n("taskfile_error_index_bitsize_unsupported");
|
|
404
|
-
case "expected_closing_bracket": return n("taskfile_error_expected_closing_bracket");
|
|
405
|
-
case "unknown_string_function": return n("taskfile_error_unknown_string_function");
|
|
406
|
-
case "unmapped_param": return n("taskfile_error_unmapped_param");
|
|
407
|
-
case "param_map_partial_intersect": return n("taskfile_error_param_map_partial_intersect");
|
|
408
|
-
case "param_map_multiple_writers": return n("taskfile_error_param_map_multiple_writers");
|
|
409
|
-
case "obsolete_file_layout": return n("taskfile_error_obsolete_file_layout");
|
|
410
|
-
default: return n("taskfile_error_unknown", { code: e });
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
function sn(e) {
|
|
414
|
-
let t = String(e.args.filename ?? "");
|
|
415
|
-
switch (e.code) {
|
|
416
|
-
case "depends_on_invalid_definition": return n("taskfile_warning_depends_on_invalid_definition");
|
|
417
|
-
case "filename_ignored": return n("taskfile_warning_filename_ignored", { filename: t });
|
|
418
|
-
case "filename_invalid": return n("taskfile_warning_filename_invalid", { filename: t });
|
|
419
|
-
case "implicit_indirect_index": return n("taskfile_warning_implicit_indirect_index");
|
|
420
|
-
case "memory_log_target": return n("taskfile_warning_memory_log_target");
|
|
421
|
-
case "nonstandard_holding_name": return n("taskfile_warning_nonstandard_holding_name");
|
|
422
|
-
case "hmi_type_mismatch": return n("taskfile_warning_hmi_type_mismatch", {
|
|
423
|
-
parameter: String(e.args.parameter ?? ""),
|
|
424
|
-
type: String(e.args.type ?? ""),
|
|
425
|
-
actual: String(e.args.actual ?? "")
|
|
426
|
-
});
|
|
427
|
-
case "string_output_limit": return n("taskfile_warning_string_output_limit", { limit: String(e.args.limit ?? "") });
|
|
428
|
-
default: return n("taskfile_warning_unknown", { code: e.code });
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
function cn(e) {
|
|
432
|
-
return e.severity === "error" ? on(e.code, e.args) : sn(e);
|
|
433
|
-
}
|
|
434
|
-
var ln = {
|
|
435
|
-
ERROR_OUT_OF_MEMORY: "mem",
|
|
436
|
-
ERROR_NO_PATH: "nopath",
|
|
437
|
-
ERROR_NO_FILE: "nofile",
|
|
438
|
-
ERROR_ILLEGAL_ARGUMENT: "arg_illegal",
|
|
439
|
-
ERROR_EXPECTED_DOUBLE_QOUTES: "expected_double_quotes",
|
|
440
|
-
ERROR_NAME_ALREADY_DEFINED: "name_doubled",
|
|
441
|
-
ERROR_STRING_FUNCTION_ARGUMENT_TOO_SHORT: "item_ref_too_short",
|
|
442
|
-
ERROR_VALUE_FORMAT: "expected_value",
|
|
443
|
-
ERROR_ILLEGAL_ARRAY_INDEX: "array_idx",
|
|
444
|
-
ERROR_ARRAY_INDIRECT_INDEX_NOT_ALLOWED_HERE: "array_indirect_idx",
|
|
445
|
-
ERROR_OUT_OF_PARAMETER_STORAGE_MEMORY: "out_of_param_mem",
|
|
446
|
-
ERROR_ILLEGAL_ARRAY_SIZE: "array_size",
|
|
447
|
-
ERROR_UNEXPECTED_VARIABLE_REF: "item_ref_var",
|
|
448
|
-
ERROR_UNEXPECTED_CONDITION_REF: "item_ref_cond",
|
|
449
|
-
ERROR_LOGGING_UNMAPPED_PARAMETER: "unmapped_param",
|
|
450
|
-
ERROR_MAPPED_PARAMETER_INTERSECT_PARTIALLY: "param_map_partial_intersect",
|
|
451
|
-
ERROR_MULTIPLE_WRITERS_FOR_MAPPED_PARAMETER: "param_map_multiple_writers"
|
|
452
|
-
};
|
|
453
|
-
function un(e) {
|
|
454
|
-
return on(ln[e] ?? (e.startsWith("ERROR_") ? e.slice(6).toLowerCase() : e), {});
|
|
455
|
-
}
|
|
456
|
-
function dn(e) {
|
|
457
|
-
switch (e) {
|
|
458
|
-
case "EXC_MB_ILLEGAL_FUNCTION": return n("edge_task_error_mb_illegal_function");
|
|
459
|
-
case "EXC_MB_ILLEGAL_DATA_ADDRESS": return n("edge_task_error_mb_illegal_data_address");
|
|
460
|
-
case "EXC_MB_ILLEGAL_DATA_VALUE": return n("edge_task_error_mb_illegal_data_value");
|
|
461
|
-
case "EXC_MB_SLAVE_DEVICE_FAILURE": return n("edge_task_error_mb_slave_device_failure");
|
|
462
|
-
case "EXC_MB_ACKNOWLEDGE": return n("edge_task_error_mb_acknowledge");
|
|
463
|
-
case "EXC_MB_SLAVE_BUSY": return n("edge_task_error_mb_slave_busy");
|
|
464
|
-
case "EXC_MB_MEMORY_PARITY_ERROR": return n("edge_task_error_mb_memory_parity_error");
|
|
465
|
-
case "EXC_PARAM_PATH_UNAVAILABLE": return n("edge_task_error_param_path_unavailable");
|
|
466
|
-
case "EXC_PARAM_TARGET_FAILED": return n("edge_task_error_param_target_failed");
|
|
467
|
-
case "EXC_TYPE_UNKNOWN": return n("edge_task_error_type_unknown");
|
|
468
|
-
case "EXC_ACTION_UNKNOWN": return n("edge_task_error_action_unknown");
|
|
469
|
-
case "EXC_IO": return n("edge_task_error_io");
|
|
470
|
-
case "EXC_OUT_OF_MEMORY": return n("edge_task_error_out_of_memory");
|
|
471
|
-
case "EXC_STACK_OVERFLOW": return n("edge_task_error_stack_overflow");
|
|
472
|
-
case "EXC_STACK_UNDERFLOW": return n("edge_task_error_stack_underflow");
|
|
473
|
-
case "EXC_RESULT_INFINITY": return n("edge_task_error_result_infinity");
|
|
474
|
-
case "EXC_RESULT_COMPLEX": return n("edge_task_error_result_complex");
|
|
475
|
-
case "EXC_OUT_OF_BOUNDS": return n("edge_task_error_out_of_bounds");
|
|
476
|
-
case "EXC_UNKNOWN": return n("edge_task_error_unknown");
|
|
477
|
-
default: return e;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
function fn(e) {
|
|
481
|
-
switch (e) {
|
|
482
|
-
case "card_unavailable": return n("edge_deploy_error_card_unavailable");
|
|
483
|
-
case "settings_rejected": return n("edge_deploy_error_settings_rejected");
|
|
484
|
-
case "edge_deploy_interrupted": return n("edge_deploy_error_interrupted");
|
|
485
|
-
default: return n("edge_deploy_error_failed");
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
//#endregion
|
|
489
|
-
//#region src/workspace/setup/endpoints/programs/deploy-status-bar.tsx
|
|
490
|
-
var pn = {
|
|
491
|
-
never: "outline",
|
|
492
|
-
pending: "outline",
|
|
493
|
-
deploying: "secondary",
|
|
494
|
-
synced: "success",
|
|
495
|
-
failed: "destructive",
|
|
496
|
-
blocked: "destructive",
|
|
497
|
-
offline: "warning",
|
|
498
|
-
conflict: "destructive",
|
|
499
|
-
drift: "warning"
|
|
500
|
-
};
|
|
501
|
-
function mn() {
|
|
502
|
-
let e = i();
|
|
503
|
-
return (t) => {
|
|
504
|
-
switch (t) {
|
|
505
|
-
case "never": return e("edge_deploy_state_never");
|
|
506
|
-
case "pending": return e("edge_deploy_state_pending");
|
|
507
|
-
case "deploying": return e("edge_deploy_state_deploying");
|
|
508
|
-
case "synced": return e("edge_deploy_state_synced");
|
|
509
|
-
case "failed": return e("edge_deploy_state_failed");
|
|
510
|
-
case "blocked": return e("edge_deploy_state_blocked");
|
|
511
|
-
case "offline": return e("edge_deploy_state_offline");
|
|
512
|
-
case "conflict": return e("edge_deploy_state_conflict");
|
|
513
|
-
case "drift": return e("edge_deploy_state_drift");
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
function hn() {
|
|
518
|
-
let e = i();
|
|
519
|
-
return (t) => {
|
|
520
|
-
switch (t.state) {
|
|
521
|
-
case "never": return e("edge_deploy_state_never_description");
|
|
522
|
-
case "pending": return t.autoSync ? e("edge_deploy_state_pending_auto") : e("edge_deploy_state_pending_manual");
|
|
523
|
-
case "deploying": return e("edge_deploy_state_deploying_description");
|
|
524
|
-
case "synced": return e("edge_deploy_state_synced_description");
|
|
525
|
-
case "failed": return e("edge_deploy_state_failed_description");
|
|
526
|
-
case "blocked": return e("edge_deploy_state_blocked_description");
|
|
527
|
-
case "offline": return e("edge_deploy_state_offline_description");
|
|
528
|
-
case "conflict": return e("edge_deploy_state_conflict_description");
|
|
529
|
-
case "drift": return e("edge_deploy_state_drift_description");
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
function gn() {
|
|
534
|
-
let e = i();
|
|
535
|
-
return (t) => [
|
|
536
|
-
...t.deployedAt == null ? [] : [e("edge_deploy_meta_deployed", { time: Q(t.deployedAt) })],
|
|
537
|
-
...t.checkedAt == null ? [] : [e("edge_deploy_meta_checked", { time: Q(t.checkedAt) })],
|
|
538
|
-
...t.attemptedAt == null ? [] : [e("edge_deploy_meta_attempt", {
|
|
539
|
-
time: Q(t.attemptedAt),
|
|
540
|
-
attempts: String(t.attempts)
|
|
541
|
-
})]
|
|
542
|
-
];
|
|
543
|
-
}
|
|
544
|
-
function _n({ workspaceId: e, deploy: t, canEdit: n, onOpenSettings: r, onShowLine: o }) {
|
|
545
|
-
let s = i(), c = a(), l = mn(), u = hn(), d = gn(), { syncNow: f } = W(e), { status: p } = t;
|
|
546
|
-
if (p == null) return /* @__PURE__ */ Y(O, { className: "h-16 w-full shrink-0 rounded-lg" });
|
|
547
|
-
let m = p.deviceError, h = d(p);
|
|
548
|
-
return /* @__PURE__ */ X("div", {
|
|
549
|
-
className: "flex shrink-0 flex-col gap-3",
|
|
550
|
-
children: [
|
|
551
|
-
/* @__PURE__ */ X("section", {
|
|
552
|
-
"aria-label": s("edge_deploy_title"),
|
|
553
|
-
className: "\n flex flex-col gap-3 rounded-lg border bg-card px-4 py-3\n sm:flex-row sm:items-center\n ",
|
|
554
|
-
children: [/* @__PURE__ */ X("div", {
|
|
555
|
-
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
556
|
-
children: [
|
|
557
|
-
/* @__PURE__ */ X("p", {
|
|
558
|
-
"aria-live": "polite",
|
|
559
|
-
className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",
|
|
560
|
-
children: [/* @__PURE__ */ X(g, {
|
|
561
|
-
variant: pn[p.state],
|
|
562
|
-
children: [
|
|
563
|
-
p.state === "deploying" ? /* @__PURE__ */ Y(y, { "data-icon": "inline-start" }) : null,
|
|
564
|
-
p.state === "offline" ? /* @__PURE__ */ Y(mt, { "data-icon": "inline-start" }) : null,
|
|
565
|
-
l(p.state)
|
|
566
|
-
]
|
|
567
|
-
}), /* @__PURE__ */ Y("span", { children: u(p) })]
|
|
568
|
-
}),
|
|
569
|
-
h.length > 0 || !t.live ? /* @__PURE__ */ X("p", {
|
|
570
|
-
className: "flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground",
|
|
571
|
-
children: [h.map((e) => /* @__PURE__ */ Y("span", { children: e }, e)), t.live ? null : /* @__PURE__ */ Y("span", { children: s("edge_deploy_live_unavailable") })]
|
|
572
|
-
}) : null,
|
|
573
|
-
p.settingsPending ? /* @__PURE__ */ X("p", {
|
|
574
|
-
className: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
575
|
-
children: [/* @__PURE__ */ Y(at, { className: "size-3.5 shrink-0" }), s("edge_deploy_settings_pending")]
|
|
576
|
-
}) : null
|
|
577
|
-
]
|
|
578
|
-
}), n ? /* @__PURE__ */ X("div", {
|
|
579
|
-
className: "flex shrink-0 gap-2",
|
|
580
|
-
children: [/* @__PURE__ */ X(x, {
|
|
581
|
-
type: "button",
|
|
582
|
-
variant: "ghost",
|
|
583
|
-
size: "sm",
|
|
584
|
-
onClick: r,
|
|
585
|
-
children: [/* @__PURE__ */ Y(dt, { "data-icon": "inline-start" }), s("edge_settings_open")]
|
|
586
|
-
}), /* @__PURE__ */ X(x, {
|
|
587
|
-
type: "button",
|
|
588
|
-
variant: p.state === "synced" ? "ghost" : "outline",
|
|
589
|
-
size: "sm",
|
|
590
|
-
disabled: f.isPending || p.state === "deploying",
|
|
591
|
-
onClick: () => {
|
|
592
|
-
f.mutate({ endpointId: p.endpointId }, {
|
|
593
|
-
onSuccess: (e) => {
|
|
594
|
-
e.jobId == null ? c.info(s("edge_deploy_sync_now_disabled")) : c.success(s("edge_deploy_sync_now_toast"));
|
|
595
|
-
},
|
|
596
|
-
onError: (e) => {
|
|
597
|
-
c.error(j(e));
|
|
598
|
-
}
|
|
599
|
-
});
|
|
600
|
-
},
|
|
601
|
-
children: [/* @__PURE__ */ Y(lt, { "data-icon": "inline-start" }), s("edge_deploy_sync_now")]
|
|
602
|
-
})]
|
|
603
|
-
}) : null]
|
|
604
|
-
}),
|
|
605
|
-
m == null ? null : /* @__PURE__ */ X(U, {
|
|
606
|
-
variant: "destructive",
|
|
607
|
-
children: [
|
|
608
|
-
/* @__PURE__ */ Y($e, {}),
|
|
609
|
-
/* @__PURE__ */ Y(B, { children: s("edge_deploy_device_error_title", { file: m.fileName }) }),
|
|
610
|
-
/* @__PURE__ */ Y(H, { children: m.line == null ? un(m.code) : s("edge_deploy_device_error_line", {
|
|
611
|
-
line: String(m.line),
|
|
612
|
-
message: un(m.code)
|
|
613
|
-
}) }),
|
|
614
|
-
m.programId != null && m.line != null ? /* @__PURE__ */ Y(V, { children: /* @__PURE__ */ Y(x, {
|
|
615
|
-
type: "button",
|
|
616
|
-
variant: "outline",
|
|
617
|
-
size: "sm",
|
|
618
|
-
onClick: () => {
|
|
619
|
-
m.programId != null && m.line != null && o(m.programId, m.line);
|
|
620
|
-
},
|
|
621
|
-
children: s("edge_deploy_device_error_show")
|
|
622
|
-
}) }) : null
|
|
623
|
-
]
|
|
624
|
-
}),
|
|
625
|
-
p.error == null ? null : /* @__PURE__ */ X(U, {
|
|
626
|
-
variant: p.error.code === "settings_rejected" ? "warning" : "destructive",
|
|
627
|
-
children: [
|
|
628
|
-
/* @__PURE__ */ Y(pt, {}),
|
|
629
|
-
/* @__PURE__ */ Y(B, { children: s("edge_deploy_error_title") }),
|
|
630
|
-
/* @__PURE__ */ X(H, { children: [/* @__PURE__ */ Y("p", { children: fn(p.error.code) }), /* @__PURE__ */ Y("p", {
|
|
631
|
-
className: "font-mono text-xs break-all",
|
|
632
|
-
children: s("edge_deploy_error_detail", { message: p.error.message })
|
|
633
|
-
})] })
|
|
634
|
-
]
|
|
635
|
-
})
|
|
636
|
-
]
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
//#endregion
|
|
640
|
-
//#region src/workspace/setup/endpoints/programs/device-log.tsx
|
|
641
|
-
var vn = [
|
|
642
|
-
"error",
|
|
643
|
-
"message",
|
|
644
|
-
"system"
|
|
645
|
-
];
|
|
646
|
-
function yn(e) {
|
|
647
|
-
let n = t.useUtils(), [r, i] = q(null), [a, o] = q("latest"), [s, c] = q(null), l = K(null), u = Ke((t, r, a) => {
|
|
648
|
-
let s = (t) => n.client.edgeProgram.readDeviceLog.query({
|
|
649
|
-
endpointId: e,
|
|
650
|
-
...t
|
|
651
|
-
}, { signal: a.signal });
|
|
652
|
-
return (async () => {
|
|
653
|
-
if (t === "earlier" && r != null && r.start > 0) {
|
|
654
|
-
let e = await s({ before: r.start });
|
|
655
|
-
return e.size == null || e.size < r.cursor.offset ? {
|
|
656
|
-
result: await s({}),
|
|
657
|
-
merge: "replace"
|
|
658
|
-
} : {
|
|
659
|
-
result: e,
|
|
660
|
-
merge: "prepend"
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
if (t === "newer" && r != null) {
|
|
664
|
-
let e = await s({ after: r.cursor });
|
|
665
|
-
return {
|
|
666
|
-
result: e,
|
|
667
|
-
merge: e.reset ? "replace" : "append"
|
|
668
|
-
};
|
|
669
|
-
}
|
|
670
|
-
return {
|
|
671
|
-
result: await s({}),
|
|
672
|
-
merge: "latest"
|
|
673
|
-
};
|
|
674
|
-
})().then(({ result: e, merge: t }) => {
|
|
675
|
-
i((n) => {
|
|
676
|
-
if (t === "prepend" && n != null) return {
|
|
677
|
-
...n,
|
|
678
|
-
entries: [...e.entries, ...n.entries],
|
|
679
|
-
start: e.start
|
|
680
|
-
};
|
|
681
|
-
let r = t === "append" && n != null;
|
|
682
|
-
return {
|
|
683
|
-
entries: r ? [...n.entries, ...e.entries] : e.entries,
|
|
684
|
-
start: r ? n.start : e.start,
|
|
685
|
-
cursor: e.cursor,
|
|
686
|
-
size: e.size,
|
|
687
|
-
readAt: /* @__PURE__ */ new Date(),
|
|
688
|
-
replaced: t === "replace"
|
|
689
|
-
};
|
|
690
|
-
});
|
|
691
|
-
}, (e) => {
|
|
692
|
-
a.signal.aborted || c(e);
|
|
693
|
-
}).finally(() => {
|
|
694
|
-
l.current === a && (l.current = null, o(null));
|
|
695
|
-
});
|
|
696
|
-
}, [e, n]);
|
|
697
|
-
return G(() => {
|
|
698
|
-
let e = new AbortController();
|
|
699
|
-
return l.current = e, u("latest", null, e), () => {
|
|
700
|
-
l.current?.abort();
|
|
701
|
-
};
|
|
702
|
-
}, [u]), {
|
|
703
|
-
log: r,
|
|
704
|
-
reading: a,
|
|
705
|
-
error: s,
|
|
706
|
-
read: (e, t) => {
|
|
707
|
-
l.current?.abort();
|
|
708
|
-
let n = new AbortController();
|
|
709
|
-
l.current = n, o(e), c(null), u(e, t, n);
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
}
|
|
713
|
-
function bn() {
|
|
714
|
-
let e = i();
|
|
715
|
-
return (t) => {
|
|
716
|
-
switch (t) {
|
|
717
|
-
case "error": return e("edge_log_kind_error");
|
|
718
|
-
case "message": return e("edge_log_kind_message");
|
|
719
|
-
case "system": return e("edge_log_kind_system");
|
|
720
|
-
case "restart": return e("edge_log_restart");
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
}
|
|
724
|
-
function xn() {
|
|
725
|
-
let e = i();
|
|
726
|
-
return (t) => {
|
|
727
|
-
switch (t) {
|
|
728
|
-
case "error": return e("edge_log_filter_errors");
|
|
729
|
-
case "message": return e("edge_log_filter_messages");
|
|
730
|
-
case "system": return e("edge_log_filter_system");
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
function Sn({ at: e }) {
|
|
735
|
-
let t = i();
|
|
736
|
-
return /* @__PURE__ */ Y("time", {
|
|
737
|
-
className: "font-mono text-xs text-muted-foreground tabular-nums",
|
|
738
|
-
...e == null ? {} : { dateTime: e },
|
|
739
|
-
children: e == null ? t("edge_log_no_time") : Q(e)
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
function Cn({ entry: e, onShowLine: t }) {
|
|
743
|
-
let n = i(), { error: r } = e, a = String(r.line);
|
|
744
|
-
return /* @__PURE__ */ X("div", {
|
|
745
|
-
className: "flex flex-col gap-0.5",
|
|
746
|
-
children: [/* @__PURE__ */ Y("span", {
|
|
747
|
-
className: "text-destructive",
|
|
748
|
-
title: e.text,
|
|
749
|
-
children: n("edge_log_error", { message: dn(r.code) })
|
|
750
|
-
}), /* @__PURE__ */ Y("span", {
|
|
751
|
-
className: "flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs",
|
|
752
|
-
children: r.programs.length === 0 ? /* @__PURE__ */ Y("span", {
|
|
753
|
-
className: "text-muted-foreground",
|
|
754
|
-
children: n("edge_log_error_program_unknown", { line: a })
|
|
755
|
-
}) : /* @__PURE__ */ X(J, { children: [r.programs.length > 1 ? /* @__PURE__ */ Y("span", {
|
|
756
|
-
className: "text-muted-foreground",
|
|
757
|
-
children: n("edge_log_error_one_of")
|
|
758
|
-
}) : null, r.programs.map((e) => e.programId == null ? /* @__PURE__ */ Y("span", {
|
|
759
|
-
className: "font-mono text-muted-foreground",
|
|
760
|
-
children: n("edge_log_error_line", {
|
|
761
|
-
line: a,
|
|
762
|
-
file: e.fileName
|
|
763
|
-
})
|
|
764
|
-
}, e.fileName) : /* @__PURE__ */ Y(x, {
|
|
765
|
-
type: "button",
|
|
766
|
-
variant: "link",
|
|
767
|
-
size: "sm",
|
|
768
|
-
className: "h-auto p-0 font-mono text-xs",
|
|
769
|
-
onClick: () => {
|
|
770
|
-
e.programId != null && t(e.programId, r.line);
|
|
771
|
-
},
|
|
772
|
-
children: n("edge_log_error_line", {
|
|
773
|
-
line: a,
|
|
774
|
-
file: e.fileName
|
|
775
|
-
})
|
|
776
|
-
}, e.fileName))] })
|
|
777
|
-
})]
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
function wn({ entry: e, onShowLine: t }) {
|
|
781
|
-
let n = bn();
|
|
782
|
-
return e.kind === "restart" ? /* @__PURE__ */ X("li", {
|
|
783
|
-
className: "\n flex items-center gap-2 px-3 py-1 text-xs text-muted-foreground\n before:h-px before:flex-1 before:bg-border\n after:h-px after:flex-1 after:bg-border\n ",
|
|
784
|
-
title: e.text,
|
|
785
|
-
children: [/* @__PURE__ */ Y("span", { children: n("restart") }), /* @__PURE__ */ Y(Sn, { at: e.at })]
|
|
786
|
-
}) : /* @__PURE__ */ X("li", {
|
|
787
|
-
className: "\n grid grid-cols-[auto_minmax(0,1fr)] items-baseline gap-x-2 gap-y-0.5 px-3 py-1.5\n sm:grid-cols-[9.5rem_5.5rem_minmax(0,1fr)]\n ",
|
|
788
|
-
children: [
|
|
789
|
-
/* @__PURE__ */ Y(Sn, { at: e.at }),
|
|
790
|
-
/* @__PURE__ */ Y("span", {
|
|
791
|
-
className: "\n justify-self-end\n sm:justify-self-start\n ",
|
|
792
|
-
children: /* @__PURE__ */ Y(g, {
|
|
793
|
-
variant: e.kind === "error" ? "destructive" : e.kind === "system" ? "outline" : "secondary",
|
|
794
|
-
children: n(e.kind)
|
|
795
|
-
})
|
|
796
|
-
}),
|
|
797
|
-
/* @__PURE__ */ Y("div", {
|
|
798
|
-
className: "\n col-span-2 min-w-0 text-sm wrap-break-word\n sm:col-span-1\n ",
|
|
799
|
-
children: e.error == null ? /* @__PURE__ */ Y("span", {
|
|
800
|
-
className: d("font-mono", e.kind === "system" && "text-muted-foreground"),
|
|
801
|
-
children: e.text
|
|
802
|
-
}) : /* @__PURE__ */ Y(Cn, {
|
|
803
|
-
entry: {
|
|
804
|
-
...e,
|
|
805
|
-
error: e.error
|
|
806
|
-
},
|
|
807
|
-
onShowLine: t
|
|
808
|
-
})
|
|
809
|
-
})
|
|
810
|
-
]
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
function Tn(e, t, n) {
|
|
814
|
-
if (e.kind !== "restart" && !t.includes(e.kind)) return !1;
|
|
815
|
-
if (n.length === 0) return !0;
|
|
816
|
-
let r = n.toLocaleLowerCase();
|
|
817
|
-
return [e.text, ...e.error?.programs.map((e) => e.fileName) ?? []].some((e) => e.toLocaleLowerCase().includes(r));
|
|
818
|
-
}
|
|
819
|
-
function En({ endpointId: e, deviceLogging: t, settingsPending: n, canEdit: r, onOpenSettings: a, onShowLine: o }) {
|
|
820
|
-
let s = i(), c = xn(), { log: l, reading: u, error: d, read: f } = yn(e), [p, m] = q(["error", "message"]), [g, b] = q(""), S = (l?.entries ?? []).filter((e) => Tn(e, p, g.trim()));
|
|
821
|
-
S.reverse();
|
|
822
|
-
let C = `edge-device-log-${e}`, w;
|
|
823
|
-
return w = l == null ? d == null ? /* @__PURE__ */ X("div", {
|
|
824
|
-
className: "flex flex-col gap-2 p-3",
|
|
825
|
-
children: [
|
|
826
|
-
/* @__PURE__ */ Y(O, { className: "h-5" }),
|
|
827
|
-
/* @__PURE__ */ Y(O, { className: "h-5" }),
|
|
828
|
-
/* @__PURE__ */ Y(O, { className: "h-5" })
|
|
829
|
-
]
|
|
830
|
-
}) : null : l.size == null ? /* @__PURE__ */ Y("p", {
|
|
831
|
-
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
832
|
-
children: s("edge_log_no_file")
|
|
833
|
-
}) : S.length === 0 ? /* @__PURE__ */ Y("p", {
|
|
834
|
-
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
835
|
-
children: l.entries.length === 0 ? s("edge_log_empty") : s("edge_log_no_match")
|
|
836
|
-
}) : /* @__PURE__ */ Y("ol", {
|
|
837
|
-
className: "divide-y py-1",
|
|
838
|
-
children: S.map((e) => /* @__PURE__ */ Y(wn, {
|
|
839
|
-
entry: e,
|
|
840
|
-
onShowLine: o
|
|
841
|
-
}, e.offset))
|
|
842
|
-
}), /* @__PURE__ */ X("section", {
|
|
843
|
-
"aria-labelledby": C,
|
|
844
|
-
className: "flex shrink-0 flex-col overflow-hidden rounded-lg border bg-card",
|
|
845
|
-
children: [
|
|
846
|
-
/* @__PURE__ */ X("div", {
|
|
847
|
-
className: "flex min-h-12 flex-wrap items-center gap-x-3 gap-y-1 border-b px-3 py-1.5",
|
|
848
|
-
children: [
|
|
849
|
-
/* @__PURE__ */ Y("h2", {
|
|
850
|
-
id: C,
|
|
851
|
-
className: "text-sm font-medium",
|
|
852
|
-
children: s("edge_log_title")
|
|
853
|
-
}),
|
|
854
|
-
/* @__PURE__ */ Y("span", {
|
|
855
|
-
className: "flex-1 text-xs text-muted-foreground",
|
|
856
|
-
children: l == null ? null : s("edge_log_read_at", { time: Q(l.readAt) })
|
|
857
|
-
}),
|
|
858
|
-
/* @__PURE__ */ X(x, {
|
|
859
|
-
type: "button",
|
|
860
|
-
variant: "outline",
|
|
861
|
-
size: "sm",
|
|
862
|
-
disabled: u != null,
|
|
863
|
-
onClick: () => {
|
|
864
|
-
f(l == null ? "latest" : "newer", l);
|
|
865
|
-
},
|
|
866
|
-
children: [Y(u === "latest" || u === "newer" ? y : lt, { "data-icon": "inline-start" }), s("edge_log_refresh")]
|
|
867
|
-
})
|
|
868
|
-
]
|
|
869
|
-
}),
|
|
870
|
-
/* @__PURE__ */ X("div", {
|
|
871
|
-
className: "\n flex flex-col gap-2 px-3 pt-3\n empty:hidden\n ",
|
|
872
|
-
children: [
|
|
873
|
-
t ? n ? /* @__PURE__ */ X(U, {
|
|
874
|
-
variant: "warning",
|
|
875
|
-
children: [/* @__PURE__ */ Y(pt, {}), /* @__PURE__ */ Y(H, { children: s("edge_log_logging_pending") })]
|
|
876
|
-
}) : null : /* @__PURE__ */ X(U, { children: [
|
|
877
|
-
/* @__PURE__ */ Y(at, {}),
|
|
878
|
-
/* @__PURE__ */ Y(H, { children: s("edge_log_logging_off") }),
|
|
879
|
-
r ? /* @__PURE__ */ Y(V, { children: /* @__PURE__ */ X(x, {
|
|
880
|
-
type: "button",
|
|
881
|
-
variant: "outline",
|
|
882
|
-
size: "sm",
|
|
883
|
-
onClick: a,
|
|
884
|
-
children: [/* @__PURE__ */ Y(dt, { "data-icon": "inline-start" }), s("edge_settings_open")]
|
|
885
|
-
}) }) : null
|
|
886
|
-
] }),
|
|
887
|
-
l?.replaced === !0 ? /* @__PURE__ */ X(U, { children: [/* @__PURE__ */ Y(at, {}), /* @__PURE__ */ Y(H, { children: s("edge_log_replaced") })] }) : null,
|
|
888
|
-
d == null ? null : /* @__PURE__ */ Y(ke, {
|
|
889
|
-
message: j(d),
|
|
890
|
-
onRetry: () => {
|
|
891
|
-
f(l == null ? "latest" : "newer", l);
|
|
892
|
-
},
|
|
893
|
-
retrying: u != null
|
|
894
|
-
})
|
|
895
|
-
]
|
|
896
|
-
}),
|
|
897
|
-
/* @__PURE__ */ X("div", {
|
|
898
|
-
className: "flex flex-wrap items-center gap-2 border-b px-3 py-2",
|
|
899
|
-
children: [/* @__PURE__ */ Y(se, {
|
|
900
|
-
"aria-label": s("edge_log_filter_label"),
|
|
901
|
-
multiple: !0,
|
|
902
|
-
variant: "outline",
|
|
903
|
-
size: "sm",
|
|
904
|
-
spacing: 0,
|
|
905
|
-
value: [...p],
|
|
906
|
-
onValueChange: (e) => {
|
|
907
|
-
m(vn.filter((t) => e.includes(t)));
|
|
908
|
-
},
|
|
909
|
-
children: vn.map((e) => /* @__PURE__ */ Y(oe, {
|
|
910
|
-
value: e,
|
|
911
|
-
children: c(e)
|
|
912
|
-
}, e))
|
|
913
|
-
}), /* @__PURE__ */ X(_, {
|
|
914
|
-
className: "\n h-8 min-w-40 flex-1\n sm:max-w-64\n ",
|
|
915
|
-
children: [/* @__PURE__ */ Y(v, { children: /* @__PURE__ */ Y(ut, {}) }), /* @__PURE__ */ Y(h, {
|
|
916
|
-
type: "search",
|
|
917
|
-
"aria-label": s("edge_log_search"),
|
|
918
|
-
placeholder: s("edge_log_search"),
|
|
919
|
-
value: g,
|
|
920
|
-
onChange: (e) => {
|
|
921
|
-
b(e.target.value);
|
|
922
|
-
}
|
|
923
|
-
})]
|
|
924
|
-
})]
|
|
925
|
-
}),
|
|
926
|
-
/* @__PURE__ */ X("div", {
|
|
927
|
-
className: "max-h-96 min-h-24 overflow-y-auto",
|
|
928
|
-
"aria-busy": u != null,
|
|
929
|
-
children: [w, l != null && l.start > 0 ? /* @__PURE__ */ Y("div", {
|
|
930
|
-
className: "border-t px-3 py-2",
|
|
931
|
-
children: /* @__PURE__ */ X(x, {
|
|
932
|
-
type: "button",
|
|
933
|
-
variant: "ghost",
|
|
934
|
-
size: "sm",
|
|
935
|
-
disabled: u != null,
|
|
936
|
-
onClick: () => {
|
|
937
|
-
f("earlier", l);
|
|
938
|
-
},
|
|
939
|
-
children: [u === "earlier" ? /* @__PURE__ */ Y(y, { "data-icon": "inline-start" }) : null, s("edge_log_load_earlier")]
|
|
940
|
-
})
|
|
941
|
-
}) : null]
|
|
942
|
-
})
|
|
943
|
-
]
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
//#endregion
|
|
947
|
-
//#region src/workspace/setup/endpoints/programs/dialogs.tsx
|
|
948
|
-
var Dn = gt(Z.Object({ fileName: Z.String({ maxLength: 64 }) }, { additionalProperties: !1 }));
|
|
949
|
-
function On({ workspaceId: e, endpointId: t, program: n, onClose: r, onSaved: c }) {
|
|
950
|
-
let l = i(), d = a(), f = W(e), p = o({
|
|
951
|
-
defaultValues: { fileName: n?.fileName ?? "" },
|
|
952
|
-
validators: u({
|
|
953
|
-
schema: Dn,
|
|
954
|
-
submit: async (r) => {
|
|
955
|
-
let i = Nt(r.fileName);
|
|
956
|
-
if (!jt(i)) return { fields: { fileName: () => l("edge_program_file_name_invalid") } };
|
|
957
|
-
if (n == null) {
|
|
958
|
-
let n = await f.create.mutateAsync({
|
|
959
|
-
workspaceId: e,
|
|
960
|
-
endpointId: t,
|
|
961
|
-
fileName: i,
|
|
962
|
-
source: ""
|
|
963
|
-
});
|
|
964
|
-
d.success(l("edge_program_create_toast")), c(n.id);
|
|
965
|
-
} else await f.update.mutateAsync({
|
|
966
|
-
id: n.id,
|
|
967
|
-
fileName: i,
|
|
968
|
-
baseRevision: n.revision
|
|
969
|
-
}), d.success(l("edge_program_rename_toast")), c(n.id);
|
|
970
|
-
return null;
|
|
971
|
-
}
|
|
972
|
-
}),
|
|
973
|
-
onSubmitInvalid: s
|
|
974
|
-
});
|
|
975
|
-
return /* @__PURE__ */ Y(D, {
|
|
976
|
-
open: !0,
|
|
977
|
-
onOpenChange: (e) => {
|
|
978
|
-
e || r();
|
|
979
|
-
},
|
|
980
|
-
children: /* @__PURE__ */ Y(E, { children: /* @__PURE__ */ Y(p.AppForm, { children: /* @__PURE__ */ X(p.FormRoot, {
|
|
981
|
-
layout: "dialog",
|
|
982
|
-
children: [
|
|
983
|
-
/* @__PURE__ */ X(T, { children: [/* @__PURE__ */ Y(w, { children: l(n == null ? "edge_program_create_title" : "edge_program_rename_title") }), /* @__PURE__ */ Y(C, { children: l("edge_program_create_description") })] }),
|
|
984
|
-
/* @__PURE__ */ Y(m, { children: /* @__PURE__ */ Y(p.AppField, {
|
|
985
|
-
name: "fileName",
|
|
986
|
-
children: (e) => /* @__PURE__ */ Y(e.TextField, {
|
|
987
|
-
label: l("edge_program_file_name"),
|
|
988
|
-
maxLength: 64,
|
|
989
|
-
autoFocus: !0,
|
|
990
|
-
autoComplete: "off",
|
|
991
|
-
spellCheck: !1,
|
|
992
|
-
className: "font-mono uppercase",
|
|
993
|
-
description: e.state.value.trim() === "" ? void 0 : l("edge_program_file_name_description", { fileName: Nt(e.state.value) })
|
|
994
|
-
})
|
|
995
|
-
}) }),
|
|
996
|
-
/* @__PURE__ */ X(S, { children: [/* @__PURE__ */ Y(x, {
|
|
997
|
-
type: "button",
|
|
998
|
-
variant: "outline",
|
|
999
|
-
onClick: r,
|
|
1000
|
-
children: l("action_cancel")
|
|
1001
|
-
}), n == null ? /* @__PURE__ */ Y(p.SubmitButton, {
|
|
1002
|
-
label: l("edge_program_create"),
|
|
1003
|
-
pendingLabel: l("action_creating")
|
|
1004
|
-
}) : /* @__PURE__ */ Y(p.SubmitButton, {
|
|
1005
|
-
label: l("action_save"),
|
|
1006
|
-
pendingLabel: l("action_saving")
|
|
1007
|
-
})] })
|
|
1008
|
-
]
|
|
1009
|
-
}) }) })
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
function kn({ workspaceId: e, program: t, onClose: n, onDeleted: r }) {
|
|
1013
|
-
let c = i(), l = a(), { remove: d } = W(e), f = o({
|
|
1014
|
-
defaultValues: {},
|
|
1015
|
-
validators: u({ submit: async () => (await d.mutateAsync({
|
|
1016
|
-
id: t.id,
|
|
1017
|
-
baseRevision: t.revision
|
|
1018
|
-
}), null) }),
|
|
1019
|
-
onSubmitInvalid: s,
|
|
1020
|
-
onSubmit: () => {
|
|
1021
|
-
l.success(c("edge_program_delete_toast")), r();
|
|
1022
|
-
}
|
|
1023
|
-
});
|
|
1024
|
-
return /* @__PURE__ */ Y(D, {
|
|
1025
|
-
open: !0,
|
|
1026
|
-
onOpenChange: (e) => {
|
|
1027
|
-
e || n();
|
|
1028
|
-
},
|
|
1029
|
-
children: /* @__PURE__ */ Y(E, { children: /* @__PURE__ */ Y(f.AppForm, { children: /* @__PURE__ */ X(f.FormRoot, {
|
|
1030
|
-
layout: "dialog",
|
|
1031
|
-
children: [/* @__PURE__ */ X(T, { children: [/* @__PURE__ */ Y(w, { children: c("edge_program_delete_title", { file: t.fileName }) }), /* @__PURE__ */ Y(C, { children: c("edge_program_delete_description") })] }), /* @__PURE__ */ X(S, { children: [/* @__PURE__ */ Y(x, {
|
|
1032
|
-
type: "button",
|
|
1033
|
-
variant: "outline",
|
|
1034
|
-
onClick: n,
|
|
1035
|
-
children: c("action_cancel")
|
|
1036
|
-
}), /* @__PURE__ */ Y(f.SubmitButton, {
|
|
1037
|
-
label: c("edge_program_delete_submit"),
|
|
1038
|
-
pendingLabel: c("action_deleting"),
|
|
1039
|
-
variant: "destructive"
|
|
1040
|
-
})] })]
|
|
1041
|
-
}) }) })
|
|
1042
|
-
});
|
|
1043
|
-
}
|
|
1044
|
-
//#endregion
|
|
1045
|
-
//#region src/code-editor/taskfile-language.ts
|
|
1046
|
-
var An = /* @__PURE__ */ new Set([...$.statements, ...$.commands]), jn = new Set($.functions), Mn = /* @__PURE__ */ new Set([
|
|
1047
|
-
...$.parameterTypes,
|
|
1048
|
-
...$.devices,
|
|
1049
|
-
...$.itemTypes
|
|
1050
|
-
]), Nn = /* @__PURE__ */ new Set([...$.constants, ...$.runtimeErrors]), Pn = /^[^\s;#"[\]+:]+/u;
|
|
1051
|
-
function Fn(e, t) {
|
|
1052
|
-
if (e.sol() && (t.lineStart = !0, t.defining = !1), e.eatSpace()) return null;
|
|
1053
|
-
let n = e.peek();
|
|
1054
|
-
if (n === ";" || n === "#") return e.skipToEnd(), "comment";
|
|
1055
|
-
if (n === "\"") {
|
|
1056
|
-
for (e.next(); !e.eol() && e.next() !== "\"";);
|
|
1057
|
-
return t.lineStart = !1, "string";
|
|
1058
|
-
}
|
|
1059
|
-
if (t.lineStart && n === "@") return e.next(), e.match(/^[A-Za-z]+/u), t.lineStart = !1, "meta";
|
|
1060
|
-
if (e.match(/^-?\d+/u) !== null) return t.lineStart = !1, "number";
|
|
1061
|
-
let r = e.match(Pn);
|
|
1062
|
-
if (r === null || typeof r == "boolean") return e.next(), "punctuation";
|
|
1063
|
-
let i = r[0].toUpperCase();
|
|
1064
|
-
return t.lineStart && e.peek() === ":" ? (e.next(), "labelName") : (t.lineStart = !1, t.defining ? (t.defining = !1, "variableName.definition") : (i === "DEF" && (t.defining = !0), An.has(i) ? "keyword" : jn.has(i) ? "operator" : Mn.has(i) ? "typeName" : Nn.has(i) ? "atom" : "variableName"));
|
|
1065
|
-
}
|
|
1066
|
-
var In = Lt.define({
|
|
1067
|
-
name: "taskfile",
|
|
1068
|
-
startState: () => ({
|
|
1069
|
-
lineStart: !0,
|
|
1070
|
-
defining: !1
|
|
1071
|
-
}),
|
|
1072
|
-
token: Fn,
|
|
1073
|
-
languageData: { commentTokens: { line: ";" } }
|
|
1074
|
-
});
|
|
1075
|
-
function Ln() {
|
|
1076
|
-
return In;
|
|
1077
|
-
}
|
|
1078
|
-
//#endregion
|
|
1079
|
-
//#region src/workspace/edge-programs/item-descriptions.ts
|
|
1080
|
-
var Rn = {
|
|
1081
|
-
"option.PROTOCOLVERSION": "edge_program_item_option_protocolversion",
|
|
1082
|
-
"option.UPDATE": "edge_program_item_option_update",
|
|
1083
|
-
"option.UPDATEDIVISOR": "edge_program_item_option_updatedivisor",
|
|
1084
|
-
"option.PARAMLOADRATIO": "edge_program_item_option_paramloadratio",
|
|
1085
|
-
"option.PARAMTIMEOUT": "edge_program_item_option_paramtimeout",
|
|
1086
|
-
"option.VARBITS": "edge_program_item_option_varbits",
|
|
1087
|
-
"option.INDEXBITS": "edge_program_item_option_indexbits",
|
|
1088
|
-
"option.RESETDATA": "edge_program_item_option_resetdata",
|
|
1089
|
-
"option.SYNTAX": "edge_program_item_option_syntax",
|
|
1090
|
-
"statement.DEF": "edge_program_item_statement_def",
|
|
1091
|
-
"statement.PUT": "edge_program_item_statement_put",
|
|
1092
|
-
"statement.IF": "edge_program_item_statement_if",
|
|
1093
|
-
"statement.DO": "edge_program_item_statement_do",
|
|
1094
|
-
"holding.VAR": "edge_program_item_holding_var",
|
|
1095
|
-
"holding.VARS": "edge_program_item_holding_vars",
|
|
1096
|
-
"holding.COND": "edge_program_item_holding_cond",
|
|
1097
|
-
"holding.CONDS": "edge_program_item_holding_conds",
|
|
1098
|
-
"definition.string": "edge_program_item_definition_string",
|
|
1099
|
-
"device.MBWRDENIED": "edge_program_item_device_mbwrdenied",
|
|
1100
|
-
"device.MBWRSINGLE": "edge_program_item_device_mbwrsingle",
|
|
1101
|
-
"device.MBWRMULTI": "edge_program_item_device_mbwrmulti",
|
|
1102
|
-
"device.MBWRANY": "edge_program_item_device_mbwrany",
|
|
1103
|
-
"device.MBSELF": "edge_program_item_device_mbself",
|
|
1104
|
-
"device.LSADV": "edge_program_item_device_lsadv",
|
|
1105
|
-
"type.UINT16": "edge_program_item_type_uint16",
|
|
1106
|
-
"type.INT16": "edge_program_item_type_int16",
|
|
1107
|
-
"type.INT16BLE": "edge_program_item_type_int16ble",
|
|
1108
|
-
"type.INT32": "edge_program_item_type_int32",
|
|
1109
|
-
"type.INT32BLE": "edge_program_item_type_int32ble",
|
|
1110
|
-
"type.INT32WLE": "edge_program_item_type_int32wle",
|
|
1111
|
-
"type.BIT": "edge_program_item_type_bit",
|
|
1112
|
-
"type.INT32BE": "edge_program_item_type_int32be",
|
|
1113
|
-
"type.UINT16BLE": "edge_program_item_type_uint16ble",
|
|
1114
|
-
"type.UINT8": "edge_program_item_type_uint8",
|
|
1115
|
-
"type.INT8": "edge_program_item_type_int8",
|
|
1116
|
-
"type.UINT32": "edge_program_item_type_uint32",
|
|
1117
|
-
"type.UINT32BLE": "edge_program_item_type_uint32ble",
|
|
1118
|
-
"type.UINT32WLE": "edge_program_item_type_uint32wle",
|
|
1119
|
-
"type.INT64": "edge_program_item_type_int64",
|
|
1120
|
-
"type.INT64BLE": "edge_program_item_type_int64ble",
|
|
1121
|
-
"type.INT64WLE": "edge_program_item_type_int64wle",
|
|
1122
|
-
"memory.MEMTEMP": "edge_program_item_memory_memtemp",
|
|
1123
|
-
"memory.MEMBAT": "edge_program_item_memory_membat",
|
|
1124
|
-
"memory.MEMFILE": "edge_program_item_memory_memfile",
|
|
1125
|
-
"memory.MEMFLASH": "edge_program_item_memory_memflash",
|
|
1126
|
-
"table.C": "edge_program_item_table_c",
|
|
1127
|
-
"table.D": "edge_program_item_table_d",
|
|
1128
|
-
"table.H": "edge_program_item_table_h",
|
|
1129
|
-
"table.I": "edge_program_item_table_i",
|
|
1130
|
-
"command.EXIT": "edge_program_item_command_exit",
|
|
1131
|
-
"command.CALL": "edge_program_item_command_call",
|
|
1132
|
-
"command.RETURN": "edge_program_item_command_return",
|
|
1133
|
-
"command.WRITE": "edge_program_item_command_write",
|
|
1134
|
-
"command.GO": "edge_program_item_command_go",
|
|
1135
|
-
"command.SYSLOG": "edge_program_item_command_syslog",
|
|
1136
|
-
"command.SENDSMS": "edge_program_item_command_sendsms",
|
|
1137
|
-
"command.TRYCALL": "edge_program_item_command_trycall",
|
|
1138
|
-
"command.PARAMLOGNOCOMMENT": "edge_program_item_command_paramlognocomment",
|
|
1139
|
-
"command.PARAMLOG": "edge_program_item_command_paramlog",
|
|
1140
|
-
"command.RAISE": "edge_program_item_command_raise",
|
|
1141
|
-
"function.ADD": "edge_program_item_function_add",
|
|
1142
|
-
"function.SUB": "edge_program_item_function_sub",
|
|
1143
|
-
"function.MUL": "edge_program_item_function_mul",
|
|
1144
|
-
"function.DIV": "edge_program_item_function_div",
|
|
1145
|
-
"function.MOD": "edge_program_item_function_mod",
|
|
1146
|
-
"function.AND": "edge_program_item_function_and",
|
|
1147
|
-
"function.NAND": "edge_program_item_function_nand",
|
|
1148
|
-
"function.BITSAND": "edge_program_item_function_bitsand",
|
|
1149
|
-
"function.OR": "edge_program_item_function_or",
|
|
1150
|
-
"function.NOR": "edge_program_item_function_nor",
|
|
1151
|
-
"function.BITSOR": "edge_program_item_function_bitsor",
|
|
1152
|
-
"function.EQ": "edge_program_item_function_eq",
|
|
1153
|
-
"function.NE": "edge_program_item_function_ne",
|
|
1154
|
-
"function.NOT": "edge_program_item_function_not",
|
|
1155
|
-
"function.BITSNOT": "edge_program_item_function_bitsnot",
|
|
1156
|
-
"function.SHR": "edge_program_item_function_shr",
|
|
1157
|
-
"function.GE": "edge_program_item_function_ge",
|
|
1158
|
-
"function.LS": "edge_program_item_function_ls",
|
|
1159
|
-
"function.GR": "edge_program_item_function_gr",
|
|
1160
|
-
"function.LE": "edge_program_item_function_le",
|
|
1161
|
-
"function.SHL": "edge_program_item_function_shl",
|
|
1162
|
-
"function.READ": "edge_program_item_function_read",
|
|
1163
|
-
"function.ERR": "edge_program_item_function_err",
|
|
1164
|
-
"function.ERREQ": "edge_program_item_function_erreq",
|
|
1165
|
-
"function.ERRNE": "edge_program_item_function_errne",
|
|
1166
|
-
"function.SQRT": "edge_program_item_function_sqrt",
|
|
1167
|
-
"function.BITSBIT": "edge_program_item_function_bitsbit",
|
|
1168
|
-
"function.MAX": "edge_program_item_function_max",
|
|
1169
|
-
"function.MAXIDX": "edge_program_item_function_maxidx",
|
|
1170
|
-
"function.MIN": "edge_program_item_function_min",
|
|
1171
|
-
"function.MINIDX": "edge_program_item_function_minidx",
|
|
1172
|
-
"function.SUM": "edge_program_item_function_sum",
|
|
1173
|
-
"function.SELECTBY": "edge_program_item_function_selectby",
|
|
1174
|
-
"function.ISKNOWN": "edge_program_item_function_isknown",
|
|
1175
|
-
"function.ISNOTKNOWN": "edge_program_item_function_isnotknown",
|
|
1176
|
-
"function.SMSRCVD": "edge_program_item_function_smsrcvd",
|
|
1177
|
-
"function.NOSMSRCVD": "edge_program_item_function_nosmsrcvd",
|
|
1178
|
-
"function.VAL": "edge_program_item_function_val",
|
|
1179
|
-
"function.GETUPDPERIODSEC": "edge_program_item_function_getupdperiodsec",
|
|
1180
|
-
"function.GETUPDPERIODMSEC": "edge_program_item_function_getupdperiodmsec",
|
|
1181
|
-
"function.GETRTC": "edge_program_item_function_getrtc",
|
|
1182
|
-
"function.GETYEAR": "edge_program_item_function_getyear",
|
|
1183
|
-
"function.GETMONTH": "edge_program_item_function_getmonth",
|
|
1184
|
-
"function.GETDAY": "edge_program_item_function_getday",
|
|
1185
|
-
"function.GETHOURS": "edge_program_item_function_gethours",
|
|
1186
|
-
"function.GETMINUTES": "edge_program_item_function_getminutes",
|
|
1187
|
-
"function.GETSECONDS": "edge_program_item_function_getseconds",
|
|
1188
|
-
"function.GETDOW": "edge_program_item_function_getdow",
|
|
1189
|
-
"function.GETDAYTIME": "edge_program_item_function_getdaytime",
|
|
1190
|
-
"function.GETSUNRISE": "edge_program_item_function_getsunrise",
|
|
1191
|
-
"function.GETSUNSET": "edge_program_item_function_getsunset",
|
|
1192
|
-
"function.GETVOLTAGE": "edge_program_item_function_getvoltage",
|
|
1193
|
-
"function.GETTEMPERATURE": "edge_program_item_function_gettemperature",
|
|
1194
|
-
"function.GETUPDNAMEIDX": "edge_program_item_function_getupdnameidx",
|
|
1195
|
-
"error.OK": "edge_program_item_error_ok",
|
|
1196
|
-
"constant.LASTERROR": "edge_program_item_constant_lasterror",
|
|
1197
|
-
"constant.EMPTYSTRING": "edge_program_item_constant_emptystring",
|
|
1198
|
-
"constant.TRUE": "edge_program_item_constant_true",
|
|
1199
|
-
"constant.FALSE": "edge_program_item_constant_false",
|
|
1200
|
-
"label.RUN": "edge_program_item_label_run",
|
|
1201
|
-
"label.ONERROR": "edge_program_item_label_onerror",
|
|
1202
|
-
"reference.VAR": "edge_program_item_reference_var",
|
|
1203
|
-
"reference.ERR": "edge_program_item_reference_err",
|
|
1204
|
-
"reference.PHONE": "edge_program_item_reference_phone",
|
|
1205
|
-
"error.EXC_MB_ILLEGAL_FUNCTION": "edge_task_error_mb_illegal_function",
|
|
1206
|
-
"error.EXC_MB_ILLEGAL_DATA_ADDRESS": "edge_task_error_mb_illegal_data_address",
|
|
1207
|
-
"error.EXC_MB_ILLEGAL_DATA_VALUE": "edge_task_error_mb_illegal_data_value",
|
|
1208
|
-
"error.EXC_MB_SLAVE_DEVICE_FAILURE": "edge_task_error_mb_slave_device_failure",
|
|
1209
|
-
"error.EXC_MB_ACKNOWLEDGE": "edge_task_error_mb_acknowledge",
|
|
1210
|
-
"error.EXC_MB_SLAVE_BUSY": "edge_task_error_mb_slave_busy",
|
|
1211
|
-
"error.EXC_MB_MEMORY_PARITY_ERROR": "edge_task_error_mb_memory_parity_error",
|
|
1212
|
-
"error.EXC_PARAM_PATH_UNAVAILABLE": "edge_task_error_param_path_unavailable",
|
|
1213
|
-
"error.EXC_PARAM_TARGET_FAILED": "edge_task_error_param_target_failed",
|
|
1214
|
-
"error.EXC_TYPE_UNKNOWN": "edge_task_error_type_unknown",
|
|
1215
|
-
"error.EXC_ACTION_UNKNOWN": "edge_task_error_action_unknown",
|
|
1216
|
-
"error.EXC_IO": "edge_task_error_io",
|
|
1217
|
-
"error.EXC_OUT_OF_MEMORY": "edge_task_error_out_of_memory",
|
|
1218
|
-
"error.EXC_STACK_OVERFLOW": "edge_task_error_stack_overflow",
|
|
1219
|
-
"error.EXC_STACK_UNDERFLOW": "edge_task_error_stack_underflow",
|
|
1220
|
-
"error.EXC_RESULT_INFINITY": "edge_task_error_result_infinity",
|
|
1221
|
-
"error.EXC_RESULT_COMPLEX": "edge_task_error_result_complex",
|
|
1222
|
-
"error.EXC_OUT_OF_BOUNDS": "edge_task_error_out_of_bounds",
|
|
1223
|
-
"error.EXC_UNKNOWN": "edge_task_error_unknown"
|
|
1224
|
-
};
|
|
1225
|
-
function zn(e) {
|
|
1226
|
-
return Object.hasOwn(Rn, e);
|
|
1227
|
-
}
|
|
1228
|
-
function Bn(e) {
|
|
1229
|
-
return n(e === "BLE" ? "edge_program_language_order_bytes" : e === "WLE" ? "edge_program_language_order_words" : "edge_program_language_order_big");
|
|
1230
|
-
}
|
|
1231
|
-
function Vn(e) {
|
|
1232
|
-
if (zn(e)) return n(Rn[e]);
|
|
1233
|
-
let t = /^type\.F(32|64)(BLE|WLE)?EP(\d)R$/u.exec(e);
|
|
1234
|
-
if (t === null) return "";
|
|
1235
|
-
let r = t[1] ?? "", i = Bn(t[2]), a = Number(t[3] ?? "0");
|
|
1236
|
-
return a === 0 ? n("edge_program_language_float", {
|
|
1237
|
-
bits: r,
|
|
1238
|
-
order: i
|
|
1239
|
-
}) : n("edge_program_language_float_scaled", {
|
|
1240
|
-
bits: r,
|
|
1241
|
-
order: i,
|
|
1242
|
-
scale: String(10 ** a)
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
|
-
//#endregion
|
|
1246
|
-
//#region src/workspace/edge-programs/editor-language.ts
|
|
1247
|
-
function Hn(e, t = !1) {
|
|
1248
|
-
if (e === void 0) return {};
|
|
1249
|
-
let r = Vn(e);
|
|
1250
|
-
return {
|
|
1251
|
-
description: t ? `${n("edge_program_language_unsupported")} ${r}` : r,
|
|
1252
|
-
docsUrl: Ft(e)
|
|
1253
|
-
};
|
|
1254
|
-
}
|
|
1255
|
-
function Un(e) {
|
|
1256
|
-
return [...e.path, e.name].join(" / ");
|
|
1257
|
-
}
|
|
1258
|
-
function Wn(e) {
|
|
1259
|
-
let { kind: t, count: r } = e.definition;
|
|
1260
|
-
switch (t) {
|
|
1261
|
-
case "label": return n("edge_program_language_symbol_label");
|
|
1262
|
-
case "device": return n("edge_program_language_symbol_device");
|
|
1263
|
-
case "parameter": return n("edge_program_language_symbol_parameter");
|
|
1264
|
-
case "string": return n("edge_program_language_symbol_string");
|
|
1265
|
-
case "variable": return r > 1 ? n("edge_program_language_symbol_variables", { count: String(r) }) : n("edge_program_language_symbol_variable");
|
|
1266
|
-
case "condition": return r > 1 ? n("edge_program_language_symbol_conditions", { count: String(r) }) : n("edge_program_language_symbol_condition");
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
function Gn(e) {
|
|
1270
|
-
let { symbol: t, parameter: r, shared: i } = e, a = [Wn(t)];
|
|
1271
|
-
if (t.definition.implicit && a.push(n("edge_program_language_implicit")), r === null ? a.push(n("edge_program_language_hmi_none")) : r !== void 0 && (a.push(n("edge_program_language_hmi", { parameter: Un(r) })), e.mismatch === !0 && a.push(n("edge_program_language_hmi_mismatch", {
|
|
1272
|
-
type: r.type ?? "",
|
|
1273
|
-
actual: t.definition.dataType ?? ""
|
|
1274
|
-
}))), i !== void 0 && i.length > 0) {
|
|
1275
|
-
let e = i.map((e) => e.writes ? n("edge_program_language_shared_writer", { file: e.symbol.filename }) : e.symbol.filename);
|
|
1276
|
-
a.push(n("edge_program_language_shared", { programs: e.join(", ") }));
|
|
1277
|
-
}
|
|
1278
|
-
return {
|
|
1279
|
-
code: [t.declaration],
|
|
1280
|
-
description: a.join(" ")
|
|
1281
|
-
};
|
|
1282
|
-
}
|
|
1283
|
-
function Kn(e) {
|
|
1284
|
-
let t = {
|
|
1285
|
-
from: e.from,
|
|
1286
|
-
to: e.to
|
|
1287
|
-
};
|
|
1288
|
-
switch (e.kind) {
|
|
1289
|
-
case "item": {
|
|
1290
|
-
let r = [
|
|
1291
|
-
...e.unsupported ? [n("edge_program_language_unsupported")] : [],
|
|
1292
|
-
Vn(e.item),
|
|
1293
|
-
...e.memory === void 0 ? [] : [n("edge_program_language_memory", {
|
|
1294
|
-
used: String(e.memory.used),
|
|
1295
|
-
limit: String(e.memory.limit)
|
|
1296
|
-
})]
|
|
1297
|
-
];
|
|
1298
|
-
return {
|
|
1299
|
-
...t,
|
|
1300
|
-
code: e.signatures.length > 0 ? e.signatures : [Pt(e.item)],
|
|
1301
|
-
description: r.join(" "),
|
|
1302
|
-
docsUrl: Ft(e.item)
|
|
1303
|
-
};
|
|
1304
|
-
}
|
|
1305
|
-
case "symbol": return {
|
|
1306
|
-
...t,
|
|
1307
|
-
...Gn(e)
|
|
1308
|
-
};
|
|
1309
|
-
case "address": {
|
|
1310
|
-
let r = `${e.table} ${String(e.address)}`;
|
|
1311
|
-
return {
|
|
1312
|
-
...t,
|
|
1313
|
-
code: [e.unitId === null ? r : `${r} · unit ${String(e.unitId)}`],
|
|
1314
|
-
description: e.parameter === null ? n("edge_program_language_hmi_none") : n("edge_program_language_hmi", { parameter: Un(e.parameter) })
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
case "undefined": return {
|
|
1318
|
-
...t,
|
|
1319
|
-
code: [e.name],
|
|
1320
|
-
description: n("edge_program_language_undefined")
|
|
1321
|
-
};
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
function qn(e) {
|
|
1325
|
-
return e === null ? null : {
|
|
1326
|
-
from: e.from,
|
|
1327
|
-
to: e.to,
|
|
1328
|
-
filtered: e.filtered,
|
|
1329
|
-
items: e.items.map((e) => {
|
|
1330
|
-
let t = e.detail;
|
|
1331
|
-
return e.free === !0 && (t = n("edge_program_language_free_register")), e.parameters !== void 0 && (t = n("edge_program_language_unit_parameters", { count: String(e.parameters) })), {
|
|
1332
|
-
label: e.label,
|
|
1333
|
-
kind: e.kind,
|
|
1334
|
-
insert: e.insert,
|
|
1335
|
-
...e.snippet === !0 ? { snippet: !0 } : {},
|
|
1336
|
-
...t === void 0 || t === "" ? {} : { detail: t },
|
|
1337
|
-
...e.boost === void 0 ? {} : { boost: e.boost },
|
|
1338
|
-
...e.additionalEdits === void 0 ? {} : { additionalEdits: e.additionalEdits },
|
|
1339
|
-
...e.parameter === void 0 ? Hn(e.item, e.unsupported === !0) : { description: Un(e.parameter) }
|
|
1340
|
-
};
|
|
1341
|
-
})
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
function Jn(e) {
|
|
1345
|
-
switch (e) {
|
|
1346
|
-
case "name_empty": return n("edge_program_rename_name_empty");
|
|
1347
|
-
case "name_too_long": return n("edge_program_rename_name_too_long");
|
|
1348
|
-
case "name_invalid": return n("edge_program_rename_name_invalid");
|
|
1349
|
-
case "name_reserved": return n("edge_program_rename_name_reserved");
|
|
1350
|
-
case "name_taken": return n("edge_program_rename_name_taken");
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
function Yn(e, t, r, i) {
|
|
1354
|
-
let a = (e) => e.filename === t ? {
|
|
1355
|
-
from: e.from,
|
|
1356
|
-
to: e.to
|
|
1357
|
-
} : r === null ? null : { open: () => {
|
|
1358
|
-
r(e);
|
|
1359
|
-
} };
|
|
1360
|
-
return {
|
|
1361
|
-
docsLabel: i.docs,
|
|
1362
|
-
referencesLabel: i.references,
|
|
1363
|
-
renameLabel: i.rename,
|
|
1364
|
-
completions: (t, n) => qn(e.completions(t, n)),
|
|
1365
|
-
info: (t, r) => {
|
|
1366
|
-
let i = e.hover(t, r);
|
|
1367
|
-
if (i === null) return null;
|
|
1368
|
-
let o = Kn(i), s = e.definition(t, r), c = s === null ? null : a(s);
|
|
1369
|
-
return c === null ? o : {
|
|
1370
|
-
...o,
|
|
1371
|
-
actions: [{
|
|
1372
|
-
label: n("edge_program_language_go_to_definition"),
|
|
1373
|
-
run: (e) => {
|
|
1374
|
-
if ("open" in c) {
|
|
1375
|
-
c.open();
|
|
1376
|
-
return;
|
|
1377
|
-
}
|
|
1378
|
-
e.dispatch({
|
|
1379
|
-
selection: {
|
|
1380
|
-
anchor: c.from,
|
|
1381
|
-
head: c.to
|
|
1382
|
-
},
|
|
1383
|
-
scrollIntoView: !0
|
|
1384
|
-
}), e.focus();
|
|
1385
|
-
}
|
|
1386
|
-
}]
|
|
1387
|
-
};
|
|
1388
|
-
},
|
|
1389
|
-
signatureHelp: (t, n) => {
|
|
1390
|
-
let r = e.signatureHelp(t, n);
|
|
1391
|
-
return r === null ? null : {
|
|
1392
|
-
signatures: r.signatures,
|
|
1393
|
-
active: r.activeSignature,
|
|
1394
|
-
parameter: r.activeParameter,
|
|
1395
|
-
...Hn(r.item)
|
|
1396
|
-
};
|
|
1397
|
-
},
|
|
1398
|
-
nameHints: (t) => e.nameHints(t).map((e) => ({
|
|
1399
|
-
offset: e.offset,
|
|
1400
|
-
text: e.parameter.name
|
|
1401
|
-
})),
|
|
1402
|
-
definition: (t, n) => {
|
|
1403
|
-
let r = e.definition(t, n);
|
|
1404
|
-
return r === null ? null : a(r);
|
|
1405
|
-
},
|
|
1406
|
-
references: (t, n) => {
|
|
1407
|
-
let r = e.references(t, n);
|
|
1408
|
-
return r === null ? null : r.flatMap((e) => {
|
|
1409
|
-
let t = a(e);
|
|
1410
|
-
return t === null ? [] : [{
|
|
1411
|
-
location: `${e.filename}:${String(e.line)}`,
|
|
1412
|
-
text: e.text,
|
|
1413
|
-
definition: e.definition,
|
|
1414
|
-
target: t
|
|
1415
|
-
}];
|
|
1416
|
-
});
|
|
1417
|
-
},
|
|
1418
|
-
rename: {
|
|
1419
|
-
prepare: (t, n) => e.prepareRename(t, n),
|
|
1420
|
-
apply: (t, r, i) => {
|
|
1421
|
-
let a = e.rename(t, r, i);
|
|
1422
|
-
return a === null ? { problem: n("edge_program_language_undefined") } : "problem" in a ? { problem: Jn(a.problem) } : { edits: a.edits };
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
};
|
|
1426
|
-
}
|
|
1427
|
-
function Xn(e) {
|
|
1428
|
-
return {
|
|
1429
|
-
label: e.parameter === void 0 ? n("edge_program_fix_replace", { value: e.value }) : n("edge_program_fix_type", {
|
|
1430
|
-
value: e.value,
|
|
1431
|
-
parameter: e.parameter.name
|
|
1432
|
-
}),
|
|
1433
|
-
edit: {
|
|
1434
|
-
...e.edit,
|
|
1435
|
-
cursor: e.cursor
|
|
1436
|
-
}
|
|
1437
|
-
};
|
|
1438
|
-
}
|
|
1439
|
-
function Zn(e, t, n) {
|
|
1440
|
-
return e.fixes(t, n).map(Xn);
|
|
1441
|
-
}
|
|
1442
|
-
//#endregion
|
|
1443
|
-
//#region src/workspace/setup/endpoints/programs/program-editor.tsx
|
|
1444
|
-
var Qn = _t.highest(vt.of([{
|
|
1445
|
-
key: "Mod-s",
|
|
1446
|
-
preventDefault: !0,
|
|
1447
|
-
run: (e) => {
|
|
1448
|
-
let t = e.dom.closest("form"), n = t?.querySelector("button[type=submit]");
|
|
1449
|
-
return t != null && n != null && !n.disabled && (t.requestSubmit(n), e.focus()), !0;
|
|
1450
|
-
}
|
|
1451
|
-
}])), $n = 20, er = [], tr = "@PROTOCOLVERSION 12\n@UPDATE 60\n\nDEF counter VAR\n\nrun:\nIF ISNOTKNOWN counter\nPUT counter 0\nPUT counter ADD counter 1\nEXIT OK\n";
|
|
1452
|
-
function nr(e, t, n, r, i) {
|
|
1453
|
-
return It({
|
|
1454
|
-
filename: e,
|
|
1455
|
-
programs: St([...n ?? [], {
|
|
1456
|
-
fileName: e,
|
|
1457
|
-
enabled: t && n != null,
|
|
1458
|
-
source: "\n"
|
|
1459
|
-
}]),
|
|
1460
|
-
programsKnown: n != null,
|
|
1461
|
-
parameters: r,
|
|
1462
|
-
ownUnitId: i
|
|
1463
|
-
});
|
|
1464
|
-
}
|
|
1465
|
-
var rr = 10 * 6e4;
|
|
1466
|
-
function ir(e, n) {
|
|
1467
|
-
return t.edgeProgram.readOwnUnitId.useQuery({ endpointId: e }, {
|
|
1468
|
-
enabled: n,
|
|
1469
|
-
staleTime: rr,
|
|
1470
|
-
retry: !1
|
|
1471
|
-
}).data?.ownUnitId ?? null;
|
|
1472
|
-
}
|
|
1473
|
-
function ar(e, n) {
|
|
1474
|
-
let i = r(), a = t.parameter.listTree.useQuery({ workspaceId: e });
|
|
1475
|
-
return Je(() => a.data == null ? null : Et({
|
|
1476
|
-
endpointId: n,
|
|
1477
|
-
locale: i,
|
|
1478
|
-
branches: a.data.branches,
|
|
1479
|
-
parameters: a.data.parameters
|
|
1480
|
-
}), [
|
|
1481
|
-
a.data,
|
|
1482
|
-
n,
|
|
1483
|
-
i
|
|
1484
|
-
]);
|
|
1485
|
-
}
|
|
1486
|
-
function or(e) {
|
|
1487
|
-
return e.replace(/\r\n?/gu, "\n");
|
|
1488
|
-
}
|
|
1489
|
-
function sr(e, t) {
|
|
1490
|
-
let n = 0;
|
|
1491
|
-
for (let r = 1; r < t; r += 1) {
|
|
1492
|
-
let t = e.indexOf("\n", n);
|
|
1493
|
-
if (t < 0) return {
|
|
1494
|
-
from: e.length,
|
|
1495
|
-
to: e.length
|
|
1496
|
-
};
|
|
1497
|
-
n = t + 1;
|
|
1498
|
-
}
|
|
1499
|
-
let r = e.indexOf("\n", n), i = r < 0 ? e.length : r;
|
|
1500
|
-
return {
|
|
1501
|
-
from: n,
|
|
1502
|
-
to: e[i - 1] === "\r" ? i - 1 : i
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
function cr({ severity: e }) {
|
|
1506
|
-
return e === "error" ? /* @__PURE__ */ Y($e, { className: "size-4 shrink-0 text-destructive" }) : /* @__PURE__ */ Y(pt, { className: "\n size-4 shrink-0 text-amber-600\n dark:text-amber-400\n " });
|
|
1507
|
-
}
|
|
1508
|
-
function lr({ fileName: e, onKeep: t, onDiscard: n }) {
|
|
1509
|
-
let r = i();
|
|
1510
|
-
return /* @__PURE__ */ Y(Se, {
|
|
1511
|
-
open: !0,
|
|
1512
|
-
onOpenChange: (e) => {
|
|
1513
|
-
e || t();
|
|
1514
|
-
},
|
|
1515
|
-
children: /* @__PURE__ */ X(_e, { children: [/* @__PURE__ */ X(xe, { children: [/* @__PURE__ */ Y(ge, { children: r("edge_program_discard_title") }), /* @__PURE__ */ Y(he, { children: r("edge_program_discard_description", { file: e }) })] }), /* @__PURE__ */ X(ye, {
|
|
1516
|
-
className: "sm:flex-wrap",
|
|
1517
|
-
children: [/* @__PURE__ */ Y(be, {
|
|
1518
|
-
onClick: t,
|
|
1519
|
-
children: r("edge_program_keep_editing")
|
|
1520
|
-
}), /* @__PURE__ */ Y(ve, {
|
|
1521
|
-
variant: "destructive",
|
|
1522
|
-
onClick: n,
|
|
1523
|
-
children: r("edge_program_discard_confirm")
|
|
1524
|
-
})]
|
|
1525
|
-
})] })
|
|
1526
|
-
});
|
|
1527
|
-
}
|
|
1528
|
-
function ur({ children: e }) {
|
|
1529
|
-
return /* @__PURE__ */ X("div", {
|
|
1530
|
-
className: "\n flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b bg-muted/40 px-3 py-1.5\n text-xs text-muted-foreground\n ",
|
|
1531
|
-
children: [/* @__PURE__ */ Y(at, { className: "size-3.5 shrink-0" }), e]
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
function dr({ workspaceId: e, detail: t, others: n, autoSync: r, canEdit: c, editorRef: l, title: d, actions: f, tasks: p, taskCount: m, variables: h, onReload: g, fetchLatest: _, onDirtyChange: v, onOpenLocation: y }) {
|
|
1535
|
-
let b = i(), x = a(), { update: S } = W(e), C = Re(t.revision), [w, T] = q(() => or(t.source)), [E, D] = q(t.sourceSha256), O = o({
|
|
1536
|
-
defaultValues: { text: w },
|
|
1537
|
-
validators: u({
|
|
1538
|
-
submit: async (e) => {
|
|
1539
|
-
let n = await S.mutateAsync({
|
|
1540
|
-
id: t.id,
|
|
1541
|
-
source: e.text,
|
|
1542
|
-
baseSourceSha256: E
|
|
1543
|
-
});
|
|
1544
|
-
return D(n.sourceSha256), T(e.text), x.success(n.errorCount > 0 && n.enabled ? b("edge_program_save_has_errors") : b("edge_program_save_toast")), null;
|
|
1545
|
-
},
|
|
1546
|
-
mapError: C.mapError(),
|
|
1547
|
-
onError: C.onError
|
|
1548
|
-
}),
|
|
1549
|
-
onSubmitInvalid: s
|
|
1550
|
-
}), [k, A] = q(t.sourceSha256), [j, M] = q(null);
|
|
1551
|
-
if (t.sourceSha256 !== k && (A(t.sourceSha256), t.sourceSha256 !== E && O.state.values.text === w)) {
|
|
1552
|
-
let e = or(t.source);
|
|
1553
|
-
T(e), D(t.sourceSha256), C.rebase(t.revision), M({ text: e });
|
|
1554
|
-
}
|
|
1555
|
-
return G(() => {
|
|
1556
|
-
j !== null && O.reset({ text: j.text });
|
|
1557
|
-
}, [j, O]), /* @__PURE__ */ Y(O.AppForm, { children: /* @__PURE__ */ Y(O.FormRoot, {
|
|
1558
|
-
banner: !1,
|
|
1559
|
-
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
1560
|
-
children: /* @__PURE__ */ Y(O.Subscribe, {
|
|
1561
|
-
selector: (e) => e.values.text,
|
|
1562
|
-
children: (i) => /* @__PURE__ */ Y(pr, {
|
|
1563
|
-
workspaceId: e,
|
|
1564
|
-
endpointId: t.endpointId,
|
|
1565
|
-
fileName: t.fileName,
|
|
1566
|
-
enabled: t.enabled,
|
|
1567
|
-
editorId: `edge-program-${t.id}`,
|
|
1568
|
-
text: i,
|
|
1569
|
-
dirty: i !== w,
|
|
1570
|
-
others: n,
|
|
1571
|
-
autoSync: r,
|
|
1572
|
-
canEdit: c,
|
|
1573
|
-
editorRef: l,
|
|
1574
|
-
title: d,
|
|
1575
|
-
actions: f,
|
|
1576
|
-
tasks: p,
|
|
1577
|
-
taskCount: m,
|
|
1578
|
-
variables: h,
|
|
1579
|
-
save: c ? /* @__PURE__ */ Y(O.SubmitButton, {
|
|
1580
|
-
size: "sm",
|
|
1581
|
-
label: b("action_save"),
|
|
1582
|
-
pendingLabel: b("action_saving"),
|
|
1583
|
-
disabled: i === w
|
|
1584
|
-
}) : null,
|
|
1585
|
-
notices: c ? /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(ze, {
|
|
1586
|
-
base: C,
|
|
1587
|
-
onReload: g,
|
|
1588
|
-
onKeepMine: async () => {
|
|
1589
|
-
let e = await _();
|
|
1590
|
-
D(e.sourceSha256), C.rebase(e.revision);
|
|
1591
|
-
}
|
|
1592
|
-
}), /* @__PURE__ */ Y(O.FormErrorBanner, {})] }) : null,
|
|
1593
|
-
onDirtyChange: v,
|
|
1594
|
-
onText: (e) => {
|
|
1595
|
-
O.setFieldValue("text", e);
|
|
1596
|
-
},
|
|
1597
|
-
...y === void 0 ? {} : { onOpenLocation: y }
|
|
1598
|
-
})
|
|
1599
|
-
})
|
|
1600
|
-
}) });
|
|
1601
|
-
}
|
|
1602
|
-
function fr({ workspaceId: e, endpointId: t, draft: n, others: c, autoSync: l, editorRef: d, tasks: f, taskCount: p, onDiscard: m, onCreated: h, onDirtyChange: g }) {
|
|
1603
|
-
let _ = i(), v = r(), y = a(), { create: b } = W(e), S = me(e), [C, w] = q(!1), T = o({
|
|
1604
|
-
defaultValues: { text: or(n.source) },
|
|
1605
|
-
validators: u({ submit: async (r) => {
|
|
1606
|
-
let i = await b.mutateAsync({
|
|
1607
|
-
workspaceId: e,
|
|
1608
|
-
endpointId: t,
|
|
1609
|
-
fileName: n.fileName,
|
|
1610
|
-
description: n.description,
|
|
1611
|
-
source: r.text
|
|
1612
|
-
});
|
|
1613
|
-
for (let e of n.parameters) try {
|
|
1614
|
-
await S.create.mutateAsync(e);
|
|
1615
|
-
} catch {
|
|
1616
|
-
y.error(_("edge_program_draft_parameter_failed", { name: ht(e.name, v) }));
|
|
1617
|
-
}
|
|
1618
|
-
return y.success(_("edge_program_draft_saved_toast")), xt(() => {
|
|
1619
|
-
w(!0);
|
|
1620
|
-
}), h(i.id), null;
|
|
1621
|
-
} }),
|
|
1622
|
-
onSubmitInvalid: s
|
|
1623
|
-
}), E = n.parameters.map((e) => ht(e.name, v)).join(", ");
|
|
1624
|
-
return /* @__PURE__ */ Y(T.AppForm, { children: /* @__PURE__ */ Y(T.FormRoot, {
|
|
1625
|
-
banner: !1,
|
|
1626
|
-
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
1627
|
-
children: /* @__PURE__ */ Y(T.Subscribe, {
|
|
1628
|
-
selector: (e) => e.isSubmitting,
|
|
1629
|
-
children: (r) => /* @__PURE__ */ Y(T.Subscribe, {
|
|
1630
|
-
selector: (e) => e.values.text,
|
|
1631
|
-
children: (i) => /* @__PURE__ */ Y(pr, {
|
|
1632
|
-
workspaceId: e,
|
|
1633
|
-
endpointId: t,
|
|
1634
|
-
fileName: n.fileName,
|
|
1635
|
-
enabled: !0,
|
|
1636
|
-
editorId: `edge-program-draft-${n.fileName}`,
|
|
1637
|
-
text: i,
|
|
1638
|
-
dirty: !C,
|
|
1639
|
-
others: c,
|
|
1640
|
-
autoSync: l,
|
|
1641
|
-
canEdit: !0,
|
|
1642
|
-
locked: r,
|
|
1643
|
-
editorRef: d,
|
|
1644
|
-
title: /* @__PURE__ */ Y("h2", {
|
|
1645
|
-
className: "min-w-0 truncate font-mono text-sm font-medium",
|
|
1646
|
-
children: n.fileName
|
|
1647
|
-
}),
|
|
1648
|
-
actions: /* @__PURE__ */ Y(x, {
|
|
1649
|
-
type: "button",
|
|
1650
|
-
variant: "ghost",
|
|
1651
|
-
size: "sm",
|
|
1652
|
-
disabled: r,
|
|
1653
|
-
onClick: m,
|
|
1654
|
-
children: _("edge_program_draft_discard")
|
|
1655
|
-
}),
|
|
1656
|
-
tasks: f,
|
|
1657
|
-
taskCount: p,
|
|
1658
|
-
variables: null,
|
|
1659
|
-
save: /* @__PURE__ */ Y(T.SubmitButton, {
|
|
1660
|
-
size: "sm",
|
|
1661
|
-
label: _("action_save"),
|
|
1662
|
-
pendingLabel: _("action_saving")
|
|
1663
|
-
}),
|
|
1664
|
-
notices: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X(ur, { children: [/* @__PURE__ */ Y("span", { children: _("edge_program_draft_notice", { starter: ht(n.starterName, v) }) }), E === "" ? null : /* @__PURE__ */ Y("span", { children: _("edge_program_draft_parameters", { names: E }) })] }), /* @__PURE__ */ Y(T.FormErrorBanner, {})] }),
|
|
1665
|
-
onDirtyChange: g,
|
|
1666
|
-
onText: (e) => {
|
|
1667
|
-
T.setFieldValue("text", e);
|
|
1668
|
-
}
|
|
1669
|
-
})
|
|
1670
|
-
})
|
|
1671
|
-
})
|
|
1672
|
-
}) });
|
|
1673
|
-
}
|
|
1674
|
-
function pr({ workspaceId: e, endpointId: t, fileName: n, enabled: r, editorId: a, text: o, dirty: s, others: l, autoSync: u, canEdit: f, locked: p = !1, editorRef: m, title: h, actions: g, tasks: _, taskCount: v, variables: y, save: b, notices: S, onDirtyChange: C, onText: w, onOpenLocation: T }) {
|
|
1675
|
-
let E = i(), [D, O] = q("problems"), k = ar(e, t), j = ir(t, f), M = r && o.length > 0, N = Je(() => nr(n, M, l, k, j), [
|
|
1676
|
-
n,
|
|
1677
|
-
M,
|
|
1678
|
-
l,
|
|
1679
|
-
k,
|
|
1680
|
-
j
|
|
1681
|
-
]), P = T ?? null, F = E("edge_program_language_docs"), I = E("edge_program_language_references"), L = E("edge_program_language_rename"), R = Je(() => [
|
|
1682
|
-
Ln(),
|
|
1683
|
-
Qn,
|
|
1684
|
-
c(Yn(N, n, P, {
|
|
1685
|
-
docs: F,
|
|
1686
|
-
references: I,
|
|
1687
|
-
rename: L
|
|
1688
|
-
}))
|
|
1689
|
-
], [
|
|
1690
|
-
N,
|
|
1691
|
-
n,
|
|
1692
|
-
P,
|
|
1693
|
-
F,
|
|
1694
|
-
I,
|
|
1695
|
-
L
|
|
1696
|
-
]), { openAssistant: ee } = A();
|
|
1697
|
-
G(() => {
|
|
1698
|
-
C(s);
|
|
1699
|
-
}, [s, C]), G(() => () => {
|
|
1700
|
-
C(!1);
|
|
1701
|
-
}, [C]);
|
|
1702
|
-
let te = bt({
|
|
1703
|
-
shouldBlockFn: () => s,
|
|
1704
|
-
enableBeforeUnload: s,
|
|
1705
|
-
withResolver: !0
|
|
1706
|
-
}), ne = qe(o), z = Je(() => N.diagnostics(ne), [N, ne]), re = z.map((e, r) => {
|
|
1707
|
-
let i = cn(e), a = ee === void 0 ? [] : [{
|
|
1708
|
-
label: E("edge_program_ask_assistant"),
|
|
1709
|
-
run: () => {
|
|
1710
|
-
let r = sr(ne, e.range.line);
|
|
1711
|
-
ee(E("edge_program_ask_assistant_message", {
|
|
1712
|
-
file: n,
|
|
1713
|
-
device: t,
|
|
1714
|
-
problem: i,
|
|
1715
|
-
line: String(e.range.line),
|
|
1716
|
-
column: String(e.range.column),
|
|
1717
|
-
excerpt: ne.slice(r.from, r.to).trim()
|
|
1718
|
-
}));
|
|
1719
|
-
}
|
|
1720
|
-
}], o = f && !p && r < $n ? Zn(N, ne, e) : [];
|
|
1721
|
-
return {
|
|
1722
|
-
from: e.range.offset,
|
|
1723
|
-
to: e.range.endOffset,
|
|
1724
|
-
severity: e.severity,
|
|
1725
|
-
message: i,
|
|
1726
|
-
actions: [...o, ...a]
|
|
1727
|
-
};
|
|
1728
|
-
}), ie = z.filter((e) => e.severity === "error").length, B = z.length - ie, V = `${a}-status`;
|
|
1729
|
-
return /* @__PURE__ */ X(J, { children: [
|
|
1730
|
-
/* @__PURE__ */ X("div", {
|
|
1731
|
-
className: "\n flex min-h-12 shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b px-3 py-1.5\n ",
|
|
1732
|
-
children: [/* @__PURE__ */ X("div", {
|
|
1733
|
-
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
1734
|
-
children: [h, s ? /* @__PURE__ */ Y("span", {
|
|
1735
|
-
className: "size-2 shrink-0 rounded-full bg-amber-500",
|
|
1736
|
-
title: E("edge_program_unsaved"),
|
|
1737
|
-
children: /* @__PURE__ */ Y("span", {
|
|
1738
|
-
className: "sr-only",
|
|
1739
|
-
children: E("edge_program_unsaved")
|
|
1740
|
-
})
|
|
1741
|
-
}) : null]
|
|
1742
|
-
}), /* @__PURE__ */ X("div", {
|
|
1743
|
-
className: "flex shrink-0 items-center gap-1",
|
|
1744
|
-
children: [g, b]
|
|
1745
|
-
})]
|
|
1746
|
-
}),
|
|
1747
|
-
S,
|
|
1748
|
-
r ? null : /* @__PURE__ */ Y(ur, { children: E("edge_program_disabled_hint") }),
|
|
1749
|
-
f ? null : /* @__PURE__ */ Y(ur, { children: E("edge_program_read_only") }),
|
|
1750
|
-
o.length === 0 ? /* @__PURE__ */ X(ur, { children: [/* @__PURE__ */ Y("span", { children: E("edge_program_empty_hint") }), f ? /* @__PURE__ */ Y(x, {
|
|
1751
|
-
type: "button",
|
|
1752
|
-
variant: "link",
|
|
1753
|
-
size: "sm",
|
|
1754
|
-
className: "h-auto p-0 text-xs",
|
|
1755
|
-
onClick: () => {
|
|
1756
|
-
w(tr);
|
|
1757
|
-
},
|
|
1758
|
-
children: E("edge_program_insert_example")
|
|
1759
|
-
}) : null] }) : null,
|
|
1760
|
-
/* @__PURE__ */ Y(Be, {
|
|
1761
|
-
ref: m,
|
|
1762
|
-
id: a,
|
|
1763
|
-
ariaLabel: E("edge_program_editor_label", { file: n }),
|
|
1764
|
-
ariaDescribedBy: V,
|
|
1765
|
-
value: o,
|
|
1766
|
-
onChange: w,
|
|
1767
|
-
readOnly: !f || p,
|
|
1768
|
-
extensions: R,
|
|
1769
|
-
diagnostics: ne === o ? re : er,
|
|
1770
|
-
className: "\n min-h-64 flex-1 rounded-none border-0 shadow-none\n focus-within:ring-0\n dark:bg-transparent\n "
|
|
1771
|
-
}),
|
|
1772
|
-
/* @__PURE__ */ X("div", {
|
|
1773
|
-
id: V,
|
|
1774
|
-
className: "\n flex min-h-8 shrink-0 flex-wrap items-center gap-x-4 gap-y-1 border-t bg-muted/30 px-3\n py-1 text-xs text-muted-foreground\n ",
|
|
1775
|
-
children: [
|
|
1776
|
-
/* @__PURE__ */ X("button", {
|
|
1777
|
-
type: "button",
|
|
1778
|
-
className: d("\n flex items-center gap-1.5 rounded-sm\n hover:text-foreground\n focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none\n ", ie > 0 && "text-destructive"),
|
|
1779
|
-
onClick: () => {
|
|
1780
|
-
O("problems");
|
|
1781
|
-
},
|
|
1782
|
-
children: [z.length === 0 ? /* @__PURE__ */ Y(et, { className: "\n size-3.5 text-emerald-600\n dark:text-emerald-400\n " }) : /* @__PURE__ */ Y(cr, { severity: ie > 0 ? "error" : "warning" }), z.length === 0 ? E("edge_program_no_problems") : E("edge_program_problem_counts", {
|
|
1783
|
-
errors: String(ie),
|
|
1784
|
-
warnings: String(B)
|
|
1785
|
-
})]
|
|
1786
|
-
}),
|
|
1787
|
-
s ? /* @__PURE__ */ Y("span", { children: E("edge_program_unsaved") }) : null,
|
|
1788
|
-
/* @__PURE__ */ Y("span", { className: "flex-1" }),
|
|
1789
|
-
f && s && u && r ? /* @__PURE__ */ X("span", {
|
|
1790
|
-
className: "\n flex items-center gap-1.5 text-amber-700\n dark:text-amber-400\n ",
|
|
1791
|
-
children: [/* @__PURE__ */ Y(pt, { className: "size-3.5 shrink-0" }), E("edge_deploy_restart_warning")]
|
|
1792
|
-
}) : null,
|
|
1793
|
-
f ? /* @__PURE__ */ Y("span", { children: E("edge_program_keys_hint") }) : null
|
|
1794
|
-
]
|
|
1795
|
-
}),
|
|
1796
|
-
/* @__PURE__ */ X(Ee, {
|
|
1797
|
-
className: d("flex shrink-0 flex-col gap-0 border-t", D === "variables" && y != null ? "\n h-80\n md:h-96\n " : "h-44"),
|
|
1798
|
-
value: D,
|
|
1799
|
-
onValueChange: (e) => {
|
|
1800
|
-
(e === "problems" || e === "tasks" || e === "variables") && O(e);
|
|
1801
|
-
},
|
|
1802
|
-
children: [/* @__PURE__ */ X(Te, {
|
|
1803
|
-
variant: "line",
|
|
1804
|
-
className: "h-9 shrink-0 px-3",
|
|
1805
|
-
children: [
|
|
1806
|
-
/* @__PURE__ */ X(we, {
|
|
1807
|
-
value: "problems",
|
|
1808
|
-
children: [E("edge_program_problems"), z.length > 0 ? /* @__PURE__ */ Y("span", {
|
|
1809
|
-
className: "text-xs text-muted-foreground tabular-nums",
|
|
1810
|
-
children: z.length
|
|
1811
|
-
}) : null]
|
|
1812
|
-
}),
|
|
1813
|
-
/* @__PURE__ */ X(we, {
|
|
1814
|
-
value: "tasks",
|
|
1815
|
-
children: [E("edge_tasks_title"), v > 0 ? /* @__PURE__ */ Y("span", {
|
|
1816
|
-
className: "text-xs text-muted-foreground tabular-nums",
|
|
1817
|
-
children: v
|
|
1818
|
-
}) : null]
|
|
1819
|
-
}),
|
|
1820
|
-
y == null ? null : /* @__PURE__ */ Y(we, {
|
|
1821
|
-
value: "variables",
|
|
1822
|
-
children: E("edge_live_title")
|
|
1823
|
-
})
|
|
1824
|
-
]
|
|
1825
|
-
}), /* @__PURE__ */ Y("div", {
|
|
1826
|
-
className: "min-h-0 flex-1 overflow-y-auto border-t",
|
|
1827
|
-
children: D === "variables" && y != null ? y : D === "tasks" ? _ : z.length === 0 ? /* @__PURE__ */ Y("p", {
|
|
1828
|
-
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
1829
|
-
children: E("edge_program_no_problems")
|
|
1830
|
-
}) : /* @__PURE__ */ Y("ul", {
|
|
1831
|
-
className: "py-1",
|
|
1832
|
-
children: z.map((e, t) => /* @__PURE__ */ Y("li", { children: /* @__PURE__ */ X("button", {
|
|
1833
|
-
type: "button",
|
|
1834
|
-
className: "\n grid w-full grid-cols-[1rem_4.5rem_minmax(0,1fr)] items-start gap-2 px-3 py-1\n text-left text-sm\n hover:bg-muted\n focus-visible:bg-muted focus-visible:outline-none\n ",
|
|
1835
|
-
onClick: () => {
|
|
1836
|
-
m.current?.reveal(e.range.offset, e.range.endOffset);
|
|
1837
|
-
},
|
|
1838
|
-
children: [
|
|
1839
|
-
/* @__PURE__ */ Y("span", {
|
|
1840
|
-
className: "pt-0.5",
|
|
1841
|
-
children: /* @__PURE__ */ Y(cr, { severity: e.severity })
|
|
1842
|
-
}),
|
|
1843
|
-
/* @__PURE__ */ Y("span", {
|
|
1844
|
-
className: "pt-px font-mono text-xs text-muted-foreground tabular-nums",
|
|
1845
|
-
children: E("edge_program_problem_line", { line: String(e.range.line) })
|
|
1846
|
-
}),
|
|
1847
|
-
/* @__PURE__ */ Y("span", {
|
|
1848
|
-
className: "wrap-break-word",
|
|
1849
|
-
children: cn(e)
|
|
1850
|
-
})
|
|
1851
|
-
]
|
|
1852
|
-
}) }, t))
|
|
1853
|
-
})
|
|
1854
|
-
})]
|
|
1855
|
-
}),
|
|
1856
|
-
te.status === "blocked" ? /* @__PURE__ */ Y(lr, {
|
|
1857
|
-
fileName: n,
|
|
1858
|
-
onKeep: te.reset,
|
|
1859
|
-
onDiscard: te.proceed
|
|
1860
|
-
}) : null
|
|
1861
|
-
] });
|
|
1862
|
-
}
|
|
1863
|
-
//#endregion
|
|
1864
|
-
//#region src/workspace/setup/endpoints/programs/settings-dialog.tsx
|
|
1865
|
-
var mr = gt(Z.Object({
|
|
1866
|
-
autoSync: Z.Boolean(),
|
|
1867
|
-
deviceLogging: Z.Boolean(),
|
|
1868
|
-
readingsPullMinutes: Z.String()
|
|
1869
|
-
}, { additionalProperties: !1 }));
|
|
1870
|
-
function hr(e) {
|
|
1871
|
-
let t = e.trim();
|
|
1872
|
-
if (!/^\d+$/u.test(t)) return null;
|
|
1873
|
-
let n = Number(t);
|
|
1874
|
-
return n >= 1 && n <= 1440 ? n : null;
|
|
1875
|
-
}
|
|
1876
|
-
function gr({ workspaceId: e, settings: t, onReload: n, onClose: r }) {
|
|
1877
|
-
let c = i(), l = a(), { updateSettings: d } = W(e), f = Re(t.revision), p = o({
|
|
1878
|
-
defaultValues: {
|
|
1879
|
-
autoSync: t.settings.autoSync,
|
|
1880
|
-
deviceLogging: t.settings.deviceLogging,
|
|
1881
|
-
readingsPullMinutes: String(t.settings.readingsPullMinutes)
|
|
1882
|
-
},
|
|
1883
|
-
validators: u({
|
|
1884
|
-
schema: mr,
|
|
1885
|
-
submit: async (e) => {
|
|
1886
|
-
let n = hr(e.readingsPullMinutes);
|
|
1887
|
-
return n == null ? { fields: { readingsPullMinutes: () => c("edge_settings_pull_minutes_invalid") } } : (await d.mutateAsync({
|
|
1888
|
-
endpointId: t.endpointId,
|
|
1889
|
-
autoSync: e.autoSync,
|
|
1890
|
-
deviceLogging: e.deviceLogging,
|
|
1891
|
-
readingsPullMinutes: n,
|
|
1892
|
-
...f.baseRevision === void 0 ? {} : { baseRevision: f.baseRevision }
|
|
1893
|
-
}), null);
|
|
1894
|
-
},
|
|
1895
|
-
mapError: f.mapError(),
|
|
1896
|
-
onError: f.onError
|
|
1897
|
-
}),
|
|
1898
|
-
onSubmitInvalid: s,
|
|
1899
|
-
onSubmit: () => {
|
|
1900
|
-
l.success(c("edge_settings_save_toast")), r();
|
|
1901
|
-
}
|
|
1902
|
-
});
|
|
1903
|
-
return /* @__PURE__ */ Y(D, {
|
|
1904
|
-
open: !0,
|
|
1905
|
-
onOpenChange: (e) => {
|
|
1906
|
-
e || r();
|
|
1907
|
-
},
|
|
1908
|
-
children: /* @__PURE__ */ Y(E, { children: /* @__PURE__ */ Y(p.AppForm, { children: /* @__PURE__ */ X(p.FormRoot, {
|
|
1909
|
-
layout: "dialog",
|
|
1910
|
-
children: [
|
|
1911
|
-
/* @__PURE__ */ X(T, { children: [/* @__PURE__ */ Y(w, { children: c("edge_settings_title") }), /* @__PURE__ */ Y(C, { children: c("edge_settings_description") })] }),
|
|
1912
|
-
/* @__PURE__ */ X(m, { children: [
|
|
1913
|
-
/* @__PURE__ */ Y(p.AppField, {
|
|
1914
|
-
name: "autoSync",
|
|
1915
|
-
children: (e) => /* @__PURE__ */ Y(e.CheckboxField, {
|
|
1916
|
-
label: c("edge_settings_auto_sync"),
|
|
1917
|
-
description: c("edge_settings_auto_sync_description")
|
|
1918
|
-
})
|
|
1919
|
-
}),
|
|
1920
|
-
/* @__PURE__ */ Y(p.AppField, {
|
|
1921
|
-
name: "deviceLogging",
|
|
1922
|
-
children: (e) => /* @__PURE__ */ Y(e.CheckboxField, {
|
|
1923
|
-
label: c("edge_settings_device_logging"),
|
|
1924
|
-
description: c("edge_settings_device_logging_description")
|
|
1925
|
-
})
|
|
1926
|
-
}),
|
|
1927
|
-
/* @__PURE__ */ Y(p.AppField, {
|
|
1928
|
-
name: "readingsPullMinutes",
|
|
1929
|
-
children: (e) => /* @__PURE__ */ Y(e.TextField, {
|
|
1930
|
-
label: c("edge_settings_pull_minutes"),
|
|
1931
|
-
description: c("edge_settings_pull_minutes_description"),
|
|
1932
|
-
inputMode: "numeric",
|
|
1933
|
-
className: "w-32"
|
|
1934
|
-
})
|
|
1935
|
-
})
|
|
1936
|
-
] }),
|
|
1937
|
-
/* @__PURE__ */ Y(ze, {
|
|
1938
|
-
base: f,
|
|
1939
|
-
onReload: n
|
|
1940
|
-
}),
|
|
1941
|
-
/* @__PURE__ */ X(S, { children: [/* @__PURE__ */ Y(x, {
|
|
1942
|
-
type: "button",
|
|
1943
|
-
variant: "outline",
|
|
1944
|
-
onClick: r,
|
|
1945
|
-
children: c("action_cancel")
|
|
1946
|
-
}), /* @__PURE__ */ Y(p.SubmitButton, {
|
|
1947
|
-
label: c("action_save"),
|
|
1948
|
-
pendingLabel: c("action_saving")
|
|
1949
|
-
})] })
|
|
1950
|
-
]
|
|
1951
|
-
}) }) })
|
|
1952
|
-
});
|
|
1953
|
-
}
|
|
1954
|
-
//#endregion
|
|
1955
|
-
//#region src/workspace/edge-programs/live-state.ts
|
|
1956
|
-
function _r() {
|
|
1957
|
-
return typeof document > "u" || document.visibilityState === "visible";
|
|
1958
|
-
}
|
|
1959
|
-
function vr(e) {
|
|
1960
|
-
let [n, r] = q(_r), [i, a] = q(null);
|
|
1961
|
-
G(() => {
|
|
1962
|
-
let e = () => {
|
|
1963
|
-
r(_r());
|
|
1964
|
-
};
|
|
1965
|
-
return document.addEventListener("visibilitychange", e), () => {
|
|
1966
|
-
document.removeEventListener("visibilitychange", e);
|
|
1967
|
-
};
|
|
1968
|
-
}, []);
|
|
1969
|
-
let o = t.edgeProgram.watchLiveState.useSubscription(n ? { programId: e } : Ge, {
|
|
1970
|
-
onStarted: () => {
|
|
1971
|
-
a(null);
|
|
1972
|
-
},
|
|
1973
|
-
onData: (t) => {
|
|
1974
|
-
let n = Tt["~standard"].validate(t);
|
|
1975
|
-
n.issues ?? a({
|
|
1976
|
-
programId: e,
|
|
1977
|
-
state: n.value
|
|
1978
|
-
});
|
|
1979
|
-
}
|
|
1980
|
-
});
|
|
1981
|
-
return {
|
|
1982
|
-
state: o.status === "pending" && i?.programId === e ? i.state : null,
|
|
1983
|
-
failed: o.status === "error"
|
|
1984
|
-
};
|
|
1985
|
-
}
|
|
1986
|
-
//#endregion
|
|
1987
|
-
//#region src/workspace/setup/endpoints/programs/live-state-pane.tsx
|
|
1988
|
-
function yr({ programId: e }) {
|
|
1989
|
-
let t = i(), { state: n, failed: r } = vr(e);
|
|
1990
|
-
return r ? /* @__PURE__ */ Y(br, { children: t("edge_live_failed") }) : n == null ? /* @__PURE__ */ X(br, { children: [/* @__PURE__ */ Y(y, { className: "size-3.5" }), t("edge_live_reading")] }) : n.status === "not_running" ? /* @__PURE__ */ Y(br, { children: t("edge_live_not_running") }) : n.status === "unavailable" ? /* @__PURE__ */ Y(br, { children: n.reason === "own_unit_off" ? t("edge_live_own_unit_off") : n.reason === "device_refused" ? t("edge_live_device_refused") : t("edge_live_offline") }) : /* @__PURE__ */ Y(xr, { state: n });
|
|
1991
|
-
}
|
|
1992
|
-
function br({ children: e }) {
|
|
1993
|
-
return /* @__PURE__ */ Y("p", {
|
|
1994
|
-
className: "flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground",
|
|
1995
|
-
children: e
|
|
1996
|
-
});
|
|
1997
|
-
}
|
|
1998
|
-
function xr({ state: e }) {
|
|
1999
|
-
let t = i();
|
|
2000
|
-
return /* @__PURE__ */ X("div", {
|
|
2001
|
-
className: "flex flex-col",
|
|
2002
|
-
children: [
|
|
2003
|
-
/* @__PURE__ */ Y(Sr, {
|
|
2004
|
-
stats: e.stats,
|
|
2005
|
-
at: e.at
|
|
2006
|
-
}),
|
|
2007
|
-
e.namesCurrent ? null : /* @__PURE__ */ Y("p", {
|
|
2008
|
-
className: "\n px-3 pb-1 text-xs text-amber-700\n dark:text-amber-400\n ",
|
|
2009
|
-
children: t("edge_live_names_pending")
|
|
2010
|
-
}),
|
|
2011
|
-
e.unreadable.variables > 0 || e.unreadable.conditions > 0 ? /* @__PURE__ */ Y("p", {
|
|
2012
|
-
className: "px-3 pb-1 text-xs text-muted-foreground",
|
|
2013
|
-
children: t("edge_live_unreadable", {
|
|
2014
|
-
variables: String(e.unreadable.variables),
|
|
2015
|
-
conditions: String(e.unreadable.conditions)
|
|
2016
|
-
})
|
|
2017
|
-
}) : null,
|
|
2018
|
-
/* @__PURE__ */ X("div", {
|
|
2019
|
-
className: "\n grid grid-cols-1 border-t\n md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] md:divide-x\n ",
|
|
2020
|
-
children: [/* @__PURE__ */ Y(Tr, { variables: e.variables }), /* @__PURE__ */ Y(Dr, { conditions: e.conditions })]
|
|
2021
|
-
})
|
|
2022
|
-
]
|
|
2023
|
-
});
|
|
2024
|
-
}
|
|
2025
|
-
function Sr({ stats: e, at: t }) {
|
|
2026
|
-
let n = i(), r = (e) => n("edge_live_stats_range", {
|
|
2027
|
-
min: String(e.min),
|
|
2028
|
-
avg: String(e.avg),
|
|
2029
|
-
max: String(e.max)
|
|
2030
|
-
});
|
|
2031
|
-
return /* @__PURE__ */ X("dl", {
|
|
2032
|
-
className: "\n flex flex-wrap items-center gap-x-4 gap-y-1 px-3 py-2 text-xs text-muted-foreground\n ",
|
|
2033
|
-
children: [
|
|
2034
|
-
/* @__PURE__ */ X("div", {
|
|
2035
|
-
className: "flex items-center gap-1.5",
|
|
2036
|
-
children: [
|
|
2037
|
-
/* @__PURE__ */ Y("span", {
|
|
2038
|
-
className: "\n size-2 rounded-full bg-emerald-500\n motion-safe:animate-pulse\n ",
|
|
2039
|
-
"aria-hidden": !0
|
|
2040
|
-
}),
|
|
2041
|
-
/* @__PURE__ */ Y("dt", {
|
|
2042
|
-
className: "sr-only",
|
|
2043
|
-
children: n("edge_live_updated")
|
|
2044
|
-
}),
|
|
2045
|
-
/* @__PURE__ */ Y("dd", {
|
|
2046
|
-
className: "tabular-nums",
|
|
2047
|
-
children: n("edge_live_updated_at", { time: new Date(t).toLocaleTimeString() })
|
|
2048
|
-
})
|
|
2049
|
-
]
|
|
2050
|
-
}),
|
|
2051
|
-
/* @__PURE__ */ X("div", {
|
|
2052
|
-
className: "flex gap-1",
|
|
2053
|
-
children: [/* @__PURE__ */ Y("dt", { children: n("edge_live_period") }), /* @__PURE__ */ Y("dd", {
|
|
2054
|
-
className: "text-foreground tabular-nums",
|
|
2055
|
-
children: r(e.period)
|
|
2056
|
-
})]
|
|
2057
|
-
}),
|
|
2058
|
-
/* @__PURE__ */ X("div", {
|
|
2059
|
-
className: "flex gap-1",
|
|
2060
|
-
children: [/* @__PURE__ */ Y("dt", { children: n("edge_live_duration") }), /* @__PURE__ */ Y("dd", {
|
|
2061
|
-
className: "text-foreground tabular-nums",
|
|
2062
|
-
children: r(e.duration)
|
|
2063
|
-
})]
|
|
2064
|
-
})
|
|
2065
|
-
]
|
|
2066
|
-
});
|
|
2067
|
-
}
|
|
2068
|
-
function Cr() {
|
|
2069
|
-
return /* @__PURE__ */ Y("span", {
|
|
2070
|
-
className: "text-muted-foreground italic",
|
|
2071
|
-
children: i()("edge_live_unknown")
|
|
2072
|
-
});
|
|
2073
|
-
}
|
|
2074
|
-
function wr(e, t, n) {
|
|
2075
|
-
return e ?? n(String(t));
|
|
2076
|
-
}
|
|
2077
|
-
function Tr({ variables: e }) {
|
|
2078
|
-
let t = i(), [n, r] = q(/* @__PURE__ */ new Set()), a = (e) => {
|
|
2079
|
-
r((t) => {
|
|
2080
|
-
let n = new Set(t);
|
|
2081
|
-
return n.delete(e) || n.add(e), n;
|
|
2082
|
-
});
|
|
2083
|
-
};
|
|
2084
|
-
return /* @__PURE__ */ X(R, { children: [/* @__PURE__ */ Y(L, { children: /* @__PURE__ */ X(N, { children: [/* @__PURE__ */ Y(I, {
|
|
2085
|
-
className: "pl-3",
|
|
2086
|
-
children: t("edge_live_variable")
|
|
2087
|
-
}), /* @__PURE__ */ Y(I, {
|
|
2088
|
-
className: "pr-3 text-right",
|
|
2089
|
-
children: t("edge_live_value")
|
|
2090
|
-
})] }) }), /* @__PURE__ */ X(F, { children: [e.length === 0 ? /* @__PURE__ */ Y(N, { children: /* @__PURE__ */ Y(P, {
|
|
2091
|
-
colSpan: 2,
|
|
2092
|
-
className: "pl-3 text-muted-foreground",
|
|
2093
|
-
children: t("edge_live_no_variables")
|
|
2094
|
-
}) }) : null, e.map((e) => {
|
|
2095
|
-
let r = wr(e.name, e.index, (e) => t("edge_live_unnamed_variable", { index: e }));
|
|
2096
|
-
if (e.values.length === 1) return /* @__PURE__ */ X(N, { children: [/* @__PURE__ */ Y(P, {
|
|
2097
|
-
className: "pl-3 font-mono",
|
|
2098
|
-
children: r
|
|
2099
|
-
}), /* @__PURE__ */ Y(P, {
|
|
2100
|
-
className: "pr-3 text-right font-mono tabular-nums",
|
|
2101
|
-
children: e.values[0] ?? /* @__PURE__ */ Y(Cr, {})
|
|
2102
|
-
})] }, e.index);
|
|
2103
|
-
let i = n.has(e.index);
|
|
2104
|
-
return [/* @__PURE__ */ X(N, { children: [/* @__PURE__ */ Y(P, {
|
|
2105
|
-
className: "pl-3 font-mono",
|
|
2106
|
-
children: /* @__PURE__ */ X("button", {
|
|
2107
|
-
type: "button",
|
|
2108
|
-
className: "\n flex items-center gap-1 rounded-sm\n hover:text-foreground\n focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none\n ",
|
|
2109
|
-
"aria-expanded": i,
|
|
2110
|
-
onClick: () => {
|
|
2111
|
-
a(e.index);
|
|
2112
|
-
},
|
|
2113
|
-
children: [
|
|
2114
|
-
/* @__PURE__ */ Y(Qe, {
|
|
2115
|
-
className: d("size-3.5 shrink-0 transition-transform", i && "rotate-90"),
|
|
2116
|
-
"aria-hidden": !0
|
|
2117
|
-
}),
|
|
2118
|
-
r,
|
|
2119
|
-
/* @__PURE__ */ X("span", {
|
|
2120
|
-
className: "text-muted-foreground",
|
|
2121
|
-
children: [
|
|
2122
|
-
"[",
|
|
2123
|
-
e.values.length,
|
|
2124
|
-
"]"
|
|
2125
|
-
]
|
|
2126
|
-
})
|
|
2127
|
-
]
|
|
2128
|
-
})
|
|
2129
|
-
}), /* @__PURE__ */ Y(P, {
|
|
2130
|
-
className: "\n max-w-0 truncate pr-3 text-right font-mono text-muted-foreground tabular-nums\n ",
|
|
2131
|
-
children: i ? null : e.values.map((e) => e ?? "?").join(", ")
|
|
2132
|
-
})] }, e.index), ...i ? e.values.map((t, n) => /* @__PURE__ */ X(N, { children: [/* @__PURE__ */ X(P, {
|
|
2133
|
-
className: "pl-8 font-mono text-muted-foreground",
|
|
2134
|
-
children: [
|
|
2135
|
-
r,
|
|
2136
|
-
"[",
|
|
2137
|
-
n,
|
|
2138
|
-
"]"
|
|
2139
|
-
]
|
|
2140
|
-
}), /* @__PURE__ */ Y(P, {
|
|
2141
|
-
className: "pr-3 text-right font-mono tabular-nums",
|
|
2142
|
-
children: t ?? /* @__PURE__ */ Y(Cr, {})
|
|
2143
|
-
})] }, `${String(e.index)}:${String(n)}`)) : []];
|
|
2144
|
-
})] })] });
|
|
2145
|
-
}
|
|
2146
|
-
function Er({ value: e }) {
|
|
2147
|
-
let t = i();
|
|
2148
|
-
return e == null ? /* @__PURE__ */ Y(g, {
|
|
2149
|
-
variant: "outline",
|
|
2150
|
-
children: t("edge_live_unknown")
|
|
2151
|
-
}) : /* @__PURE__ */ Y(g, {
|
|
2152
|
-
variant: e ? "default" : "secondary",
|
|
2153
|
-
children: t(e ? "edge_live_true" : "edge_live_false")
|
|
2154
|
-
});
|
|
2155
|
-
}
|
|
2156
|
-
function Dr({ conditions: e }) {
|
|
2157
|
-
let t = i(), n = e.flatMap((e) => {
|
|
2158
|
-
let n = wr(e.name, e.index, (e) => t("edge_live_unnamed_condition", { index: e }));
|
|
2159
|
-
return e.values.length === 1 ? [{
|
|
2160
|
-
key: String(e.index),
|
|
2161
|
-
name: n,
|
|
2162
|
-
value: e.values[0] ?? null
|
|
2163
|
-
}] : e.values.map((t, r) => ({
|
|
2164
|
-
key: `${String(e.index)}:${String(r)}`,
|
|
2165
|
-
name: `${n}[${String(r)}]`,
|
|
2166
|
-
value: t
|
|
2167
|
-
}));
|
|
2168
|
-
});
|
|
2169
|
-
return /* @__PURE__ */ X(R, { children: [/* @__PURE__ */ Y(L, { children: /* @__PURE__ */ X(N, { children: [/* @__PURE__ */ Y(I, {
|
|
2170
|
-
className: "pl-3",
|
|
2171
|
-
children: t("edge_live_condition")
|
|
2172
|
-
}), /* @__PURE__ */ Y(I, {
|
|
2173
|
-
className: "pr-3 text-right",
|
|
2174
|
-
children: t("edge_live_value")
|
|
2175
|
-
})] }) }), /* @__PURE__ */ X(F, { children: [n.length === 0 ? /* @__PURE__ */ Y(N, { children: /* @__PURE__ */ Y(P, {
|
|
2176
|
-
colSpan: 2,
|
|
2177
|
-
className: "pl-3 text-muted-foreground",
|
|
2178
|
-
children: t("edge_live_no_conditions")
|
|
2179
|
-
}) }) : null, n.map((e) => /* @__PURE__ */ X(N, { children: [/* @__PURE__ */ Y(P, {
|
|
2180
|
-
className: "pl-3 font-mono",
|
|
2181
|
-
children: e.name
|
|
2182
|
-
}), /* @__PURE__ */ Y(P, {
|
|
2183
|
-
className: "pr-3 text-right",
|
|
2184
|
-
children: /* @__PURE__ */ Y(Er, { value: e.value })
|
|
2185
|
-
})] }, e.key))] })] });
|
|
2186
|
-
}
|
|
2187
|
-
//#endregion
|
|
2188
|
-
//#region src/workspace/setup/endpoints/programs/starter-dialog.tsx
|
|
2189
|
-
function Or({ workspaceId: e, endpointId: n, fileNames: r, onClose: a, onBuilt: o }) {
|
|
2190
|
-
let s = i(), [c, l] = q(null), [u, d] = q(!1), f = t.templates.edgeProgram.list.useQuery({ workspaceId: e }, { enabled: c == null });
|
|
2191
|
-
return /* @__PURE__ */ Y(D, {
|
|
2192
|
-
open: !0,
|
|
2193
|
-
onOpenChange: (e) => {
|
|
2194
|
-
!e && !u && a();
|
|
2195
|
-
},
|
|
2196
|
-
children: /* @__PURE__ */ Y(E, {
|
|
2197
|
-
className: "sm:max-w-xl",
|
|
2198
|
-
showCloseButton: !u,
|
|
2199
|
-
children: c == null ? /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X(T, { children: [/* @__PURE__ */ Y(w, { children: s("edge_program_starter_title") }), /* @__PURE__ */ Y(C, { children: s("edge_program_starter_pick_description") })] }), /* @__PURE__ */ Y(Oe, {
|
|
2200
|
-
query: f,
|
|
2201
|
-
loading: /* @__PURE__ */ X("div", {
|
|
2202
|
-
className: "flex flex-col gap-2",
|
|
2203
|
-
children: [/* @__PURE__ */ Y(O, { className: "h-14 w-full" }), /* @__PURE__ */ Y(O, { className: "h-14 w-full" })]
|
|
2204
|
-
}),
|
|
2205
|
-
error: (e) => /* @__PURE__ */ Y(ke, { message: j(e) }),
|
|
2206
|
-
isEmpty: (e) => e.starters.length === 0,
|
|
2207
|
-
empty: /* @__PURE__ */ Y("p", {
|
|
2208
|
-
className: "text-muted-foreground",
|
|
2209
|
-
children: s("edge_program_starter_empty")
|
|
2210
|
-
}),
|
|
2211
|
-
children: ({ starters: e }) => /* @__PURE__ */ Y(We, {
|
|
2212
|
-
starters: e,
|
|
2213
|
-
onPick: l
|
|
2214
|
-
})
|
|
2215
|
-
})] }) : /* @__PURE__ */ Y(Ar, {
|
|
2216
|
-
workspaceId: e,
|
|
2217
|
-
endpointId: n,
|
|
2218
|
-
starterId: c,
|
|
2219
|
-
fileNames: r,
|
|
2220
|
-
onBack: () => {
|
|
2221
|
-
l(null);
|
|
2222
|
-
},
|
|
2223
|
-
onBuilt: o,
|
|
2224
|
-
onBuilding: d
|
|
2225
|
-
})
|
|
2226
|
-
})
|
|
2227
|
-
});
|
|
2228
|
-
}
|
|
2229
|
-
function kr(e, t) {
|
|
2230
|
-
let n = new Map(e.map((e) => [e.id, e])), r = (e, i) => {
|
|
2231
|
-
let a = e == null ? void 0 : n.get(e);
|
|
2232
|
-
return a == null || i.has(a.id) ? [] : (i.add(a.id), [...r(a.parentId, i), ht(a.name, t)]);
|
|
2233
|
-
};
|
|
2234
|
-
return e.map((e) => ({
|
|
2235
|
-
id: e.id,
|
|
2236
|
-
name: r(e.id, /* @__PURE__ */ new Set()).join(" / ")
|
|
2237
|
-
})).sort((e, n) => e.name.localeCompare(n.name, t));
|
|
2238
|
-
}
|
|
2239
|
-
function Ar({ workspaceId: e, endpointId: n, starterId: a, fileNames: o, onBack: s, onBuilt: c, onBuilding: l }) {
|
|
2240
|
-
let u = i(), d = r(), f = t.templates.edgeProgram.get.useQuery({
|
|
2241
|
-
workspaceId: e,
|
|
2242
|
-
starterId: a
|
|
2243
|
-
}), p = t.parameter.listTree.useQuery({ workspaceId: e }), m = p.data, h = Je(() => {
|
|
2244
|
-
if (m == null) return;
|
|
2245
|
-
let e = new Map(m.parameters.map((e) => [e.id, e])), t = (t, r) => {
|
|
2246
|
-
let i = e.get(r);
|
|
2247
|
-
return i === void 0 ? null : Dt(t, r, i, n, "");
|
|
2248
|
-
};
|
|
2249
|
-
return {
|
|
2250
|
-
parameterFits: (n, r) => e.has(r) && t(n, r) == null,
|
|
2251
|
-
parameterProblem: t,
|
|
2252
|
-
endpoints: [],
|
|
2253
|
-
alarmRules: [],
|
|
2254
|
-
branches: kr(m.branches, d),
|
|
2255
|
-
members: []
|
|
2256
|
-
};
|
|
2257
|
-
}, [
|
|
2258
|
-
m,
|
|
2259
|
-
n,
|
|
2260
|
-
d
|
|
2261
|
-
]), g = Je(() => {
|
|
2262
|
-
if (m == null) return;
|
|
2263
|
-
let e = new Map(m.branches.map((e) => [e.id, e.parentId])), t = (t) => {
|
|
2264
|
-
let n = [];
|
|
2265
|
-
for (let r = t; r != null && !n.includes(r); r = e.get(r)) n.unshift(r);
|
|
2266
|
-
return n;
|
|
2267
|
-
}, r;
|
|
2268
|
-
for (let e of m.parameters) {
|
|
2269
|
-
let { source: i } = e;
|
|
2270
|
-
if (i.kind !== "modbus-tcp" || i.endpointId !== n) continue;
|
|
2271
|
-
let a = t(e.branchId);
|
|
2272
|
-
if (r === void 0) {
|
|
2273
|
-
r = a;
|
|
2274
|
-
continue;
|
|
2275
|
-
}
|
|
2276
|
-
let o = r.findIndex((e, t) => a[t] !== e);
|
|
2277
|
-
o >= 0 && (r = r.slice(0, o));
|
|
2278
|
-
}
|
|
2279
|
-
return r?.at(-1);
|
|
2280
|
-
}, [m, n]), _ = f.data;
|
|
2281
|
-
return /* @__PURE__ */ Y(Oe, {
|
|
2282
|
-
query: {
|
|
2283
|
-
isLoading: f.isLoading || p.isLoading,
|
|
2284
|
-
isError: (_ == null || h == null) && (f.isError || p.isError),
|
|
2285
|
-
error: f.error ?? p.error,
|
|
2286
|
-
data: _ != null && h != null ? {
|
|
2287
|
-
starter: _,
|
|
2288
|
-
data: h
|
|
2289
|
-
} : void 0
|
|
2290
|
-
},
|
|
2291
|
-
loading: /* @__PURE__ */ X("div", {
|
|
2292
|
-
className: "flex flex-col gap-4",
|
|
2293
|
-
children: [/* @__PURE__ */ Y(O, { className: "h-6 w-48" }), /* @__PURE__ */ Y(O, { className: "h-40 w-full" })]
|
|
2294
|
-
}),
|
|
2295
|
-
error: (e) => /* @__PURE__ */ Y(ke, { message: e == null ? u("error_request_failed") : j(e) }),
|
|
2296
|
-
children: (t) => /* @__PURE__ */ Y(Mr, {
|
|
2297
|
-
workspaceId: e,
|
|
2298
|
-
endpointId: n,
|
|
2299
|
-
starter: t.starter,
|
|
2300
|
-
data: t.data,
|
|
2301
|
-
fileNames: o,
|
|
2302
|
-
deviceBranch: g,
|
|
2303
|
-
onBack: s,
|
|
2304
|
-
onBuilt: c,
|
|
2305
|
-
onBuilding: l
|
|
2306
|
-
})
|
|
2307
|
-
});
|
|
2308
|
-
}
|
|
2309
|
-
function jr(e, t, n) {
|
|
2310
|
-
let r = Ue(e.placeholders);
|
|
2311
|
-
for (let i of e.placeholders) i.kind === "fileName" ? r[i.name] = Ot(i.default, t) : i.kind === "branch" && n !== void 0 && (r[i.name] = n);
|
|
2312
|
-
return r;
|
|
2313
|
-
}
|
|
2314
|
-
function Mr({ workspaceId: e, endpointId: n, starter: a, data: c, fileNames: l, deviceBranch: d, onBack: f, onBuilt: p, onBuilding: m }) {
|
|
2315
|
-
let h = i(), g = r(), _ = t.useUtils(), [v, y] = q([]), b = K(1e3), E = () => `row-${String(b.current++)}`, D = o({
|
|
2316
|
-
defaultValues: { values: jr(a, l, d) },
|
|
2317
|
-
validators: u({ submit: async (t) => {
|
|
2318
|
-
let r = Ve(a.placeholders, t.values), i;
|
|
2319
|
-
m(!0);
|
|
2320
|
-
try {
|
|
2321
|
-
i = r.ok ? await _.client.templates.edgeProgram.instantiate.query({
|
|
2322
|
-
workspaceId: e,
|
|
2323
|
-
endpointId: n,
|
|
2324
|
-
starterId: a.id,
|
|
2325
|
-
values: r.values
|
|
2326
|
-
}) : r;
|
|
2327
|
-
} finally {
|
|
2328
|
-
m(!1);
|
|
2329
|
-
}
|
|
2330
|
-
return i.ok ? (y([]), p({
|
|
2331
|
-
starterName: a.name,
|
|
2332
|
-
fileName: i.fileName,
|
|
2333
|
-
description: i.description,
|
|
2334
|
-
source: i.source,
|
|
2335
|
-
parameters: i.parameters
|
|
2336
|
-
}), null) : (y(i.problems), {
|
|
2337
|
-
form: () => h("starter_fix_problems"),
|
|
2338
|
-
fields: {}
|
|
2339
|
-
});
|
|
2340
|
-
} }),
|
|
2341
|
-
onSubmitInvalid: s
|
|
2342
|
-
}), O = (e) => {
|
|
2343
|
-
y((t) => t.filter((t) => t.path !== e && !t.path.startsWith(`${e}/`)));
|
|
2344
|
-
};
|
|
2345
|
-
return /* @__PURE__ */ Y(D.AppForm, { children: /* @__PURE__ */ X(D.FormRoot, {
|
|
2346
|
-
layout: "dialog",
|
|
2347
|
-
children: [
|
|
2348
|
-
/* @__PURE__ */ X(T, { children: [/* @__PURE__ */ Y(w, { children: ht(a.name, g) }), /* @__PURE__ */ Y(C, { children: ht(a.description, g) })] }),
|
|
2349
|
-
/* @__PURE__ */ Y(D.AppField, {
|
|
2350
|
-
name: "values",
|
|
2351
|
-
children: (t) => /* @__PURE__ */ Y(He, {
|
|
2352
|
-
workspaceId: e,
|
|
2353
|
-
placeholders: a.placeholders,
|
|
2354
|
-
values: t.state.value,
|
|
2355
|
-
onChange: (e, n) => {
|
|
2356
|
-
O(n), t.handleChange(e);
|
|
2357
|
-
},
|
|
2358
|
-
problems: v,
|
|
2359
|
-
data: c,
|
|
2360
|
-
newKey: E
|
|
2361
|
-
})
|
|
2362
|
-
}),
|
|
2363
|
-
/* @__PURE__ */ X(S, { children: [/* @__PURE__ */ Y(D.Subscribe, {
|
|
2364
|
-
selector: (e) => e.isSubmitting,
|
|
2365
|
-
children: (e) => /* @__PURE__ */ Y(x, {
|
|
2366
|
-
type: "button",
|
|
2367
|
-
variant: "outline",
|
|
2368
|
-
disabled: e,
|
|
2369
|
-
onClick: f,
|
|
2370
|
-
children: h("starter_back")
|
|
2371
|
-
})
|
|
2372
|
-
}), /* @__PURE__ */ Y(D.SubmitButton, {
|
|
2373
|
-
label: h("starter_continue"),
|
|
2374
|
-
pendingLabel: h("starter_continue_pending")
|
|
2375
|
-
})] })
|
|
2376
|
-
]
|
|
2377
|
-
}) });
|
|
2378
|
-
}
|
|
2379
|
-
//#endregion
|
|
2380
|
-
//#region src/workspace/setup/endpoints/programs/tasks-table.tsx
|
|
2381
|
-
function Nr(e) {
|
|
2382
|
-
return e.slice(e.lastIndexOf("/") + 1);
|
|
2383
|
-
}
|
|
2384
|
-
function Pr(e, t) {
|
|
2385
|
-
return new Intl.NumberFormat(t, { maximumFractionDigits: 3 }).format(e / 1e3);
|
|
2386
|
-
}
|
|
2387
|
-
function Fr({ tasks: e }) {
|
|
2388
|
-
let t = i(), n = r();
|
|
2389
|
-
return e.length === 0 ? /* @__PURE__ */ Y("p", {
|
|
2390
|
-
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
2391
|
-
children: t("edge_tasks_empty")
|
|
2392
|
-
}) : /* @__PURE__ */ X(R, { children: [/* @__PURE__ */ Y(L, { children: /* @__PURE__ */ X(N, { children: [
|
|
2393
|
-
/* @__PURE__ */ Y(I, {
|
|
2394
|
-
className: "pl-3",
|
|
2395
|
-
children: t("edge_tasks_program")
|
|
2396
|
-
}),
|
|
2397
|
-
/* @__PURE__ */ Y(I, { children: t("edge_tasks_state") }),
|
|
2398
|
-
/* @__PURE__ */ Y(I, {
|
|
2399
|
-
className: "\n hidden\n sm:table-cell\n ",
|
|
2400
|
-
children: t("edge_tasks_period")
|
|
2401
|
-
}),
|
|
2402
|
-
/* @__PURE__ */ Y(I, {
|
|
2403
|
-
className: "\n hidden\n md:table-cell\n ",
|
|
2404
|
-
children: t("edge_tasks_last_run")
|
|
2405
|
-
}),
|
|
2406
|
-
/* @__PURE__ */ Y(I, {
|
|
2407
|
-
className: "pr-3",
|
|
2408
|
-
children: t("edge_tasks_last_error")
|
|
2409
|
-
})
|
|
2410
|
-
] }) }), /* @__PURE__ */ Y(F, { children: e.map((e) => /* @__PURE__ */ X(N, { children: [
|
|
2411
|
-
/* @__PURE__ */ Y(P, {
|
|
2412
|
-
className: "pl-3 font-mono",
|
|
2413
|
-
children: Nr(e.sourceFile)
|
|
2414
|
-
}),
|
|
2415
|
-
/* @__PURE__ */ Y(P, { children: /* @__PURE__ */ Y(g, {
|
|
2416
|
-
variant: e.state === "running" ? "secondary" : "outline",
|
|
2417
|
-
children: e.state === "running" ? t("edge_task_state_running") : e.state === "idle" ? t("edge_task_state_idle") : e.state
|
|
2418
|
-
}) }),
|
|
2419
|
-
/* @__PURE__ */ Y(P, {
|
|
2420
|
-
className: "\n hidden tabular-nums\n sm:table-cell\n ",
|
|
2421
|
-
children: t("edge_task_period_seconds", { seconds: Pr(e.periodMs, n) })
|
|
2422
|
-
}),
|
|
2423
|
-
/* @__PURE__ */ Y(P, {
|
|
2424
|
-
className: "\n hidden\n md:table-cell\n ",
|
|
2425
|
-
children: e.lastRunOn == null ? "—" : Q(e.lastRunOn)
|
|
2426
|
-
}),
|
|
2427
|
-
/* @__PURE__ */ Y(P, {
|
|
2428
|
-
className: "pr-3 whitespace-normal",
|
|
2429
|
-
children: e.lastErrorCode == null || e.lastErrorCode === "OK" ? /* @__PURE__ */ Y("span", {
|
|
2430
|
-
className: "text-muted-foreground",
|
|
2431
|
-
children: t("edge_task_no_error")
|
|
2432
|
-
}) : /* @__PURE__ */ Y("span", {
|
|
2433
|
-
className: "text-destructive",
|
|
2434
|
-
title: e.lastErrorCode,
|
|
2435
|
-
children: dn(e.lastErrorCode)
|
|
2436
|
-
})
|
|
2437
|
-
})
|
|
2438
|
-
] }, e.sourceFile)) })] });
|
|
2439
|
-
}
|
|
2440
|
-
//#endregion
|
|
2441
|
-
//#region src/workspace/setup/endpoints/programs/programs-tab.tsx
|
|
2442
|
-
function Ir(e) {
|
|
2443
|
-
let t = e == null ? null : e.map((e) => `${e.fileName}\u0000${String(e.enabled)}\u0000${e.source}`).join(""), [n, r] = q({
|
|
2444
|
-
key: t,
|
|
2445
|
-
sources: e
|
|
2446
|
-
});
|
|
2447
|
-
return n.key !== t && r({
|
|
2448
|
-
key: t,
|
|
2449
|
-
sources: e
|
|
2450
|
-
}), n.key === t ? n.sources : e;
|
|
2451
|
-
}
|
|
2452
|
-
function Lr({ program: e }) {
|
|
2453
|
-
let t = i();
|
|
2454
|
-
return e.errorCount === 0 && e.warningCount === 0 ? null : /* @__PURE__ */ X("span", {
|
|
2455
|
-
className: "flex items-center gap-1.5 text-xs tabular-nums",
|
|
2456
|
-
"aria-label": t("edge_program_problem_counts", {
|
|
2457
|
-
errors: String(e.errorCount),
|
|
2458
|
-
warnings: String(e.warningCount)
|
|
2459
|
-
}),
|
|
2460
|
-
children: [e.errorCount > 0 ? /* @__PURE__ */ X("span", {
|
|
2461
|
-
className: "flex items-center gap-0.5 text-destructive",
|
|
2462
|
-
children: [/* @__PURE__ */ Y($e, { className: "size-3.5" }), e.errorCount]
|
|
2463
|
-
}) : null, e.warningCount > 0 ? /* @__PURE__ */ X("span", {
|
|
2464
|
-
className: "\n flex items-center gap-0.5 text-amber-600\n dark:text-amber-400\n ",
|
|
2465
|
-
children: [/* @__PURE__ */ Y(pt, { className: "size-3.5" }), e.warningCount]
|
|
2466
|
-
}) : null]
|
|
2467
|
-
});
|
|
2468
|
-
}
|
|
2469
|
-
function Rr({ workspaceId: e, program: t }) {
|
|
2470
|
-
let n = i(), r = a(), { update: o } = W(e);
|
|
2471
|
-
return /* @__PURE__ */ X("label", {
|
|
2472
|
-
className: "flex items-center gap-2 text-sm text-muted-foreground",
|
|
2473
|
-
children: [/* @__PURE__ */ Y(ae, {
|
|
2474
|
-
size: "sm",
|
|
2475
|
-
checked: t.enabled,
|
|
2476
|
-
disabled: o.isPending,
|
|
2477
|
-
"aria-label": n("edge_program_enabled_label"),
|
|
2478
|
-
onCheckedChange: (e) => {
|
|
2479
|
-
o.mutate({
|
|
2480
|
-
id: t.id,
|
|
2481
|
-
enabled: e,
|
|
2482
|
-
baseRevision: t.revision
|
|
2483
|
-
}, {
|
|
2484
|
-
onSuccess: () => {
|
|
2485
|
-
r.success(n(e ? "edge_program_enable_toast" : "edge_program_disable_toast"));
|
|
2486
|
-
},
|
|
2487
|
-
onError: (e) => {
|
|
2488
|
-
r.error(j(e));
|
|
2489
|
-
}
|
|
2490
|
-
});
|
|
2491
|
-
}
|
|
2492
|
-
}), /* @__PURE__ */ Y("span", {
|
|
2493
|
-
className: "\n hidden\n sm:inline\n ",
|
|
2494
|
-
children: t.enabled ? n("edge_program_enabled") : n("edge_program_disabled")
|
|
2495
|
-
})]
|
|
2496
|
-
});
|
|
2497
|
-
}
|
|
2498
|
-
function zr({ workspaceId: e, endpointId: n, deploy: r, canEdit: a, programId: o, onProgramChange: s }) {
|
|
2499
|
-
let c = i(), l = t.useUtils(), u = K(null), [m, h] = q(null), [g, _] = q(0), [v, y] = q(0), [b, S] = q(null), [C, w] = q(null), T = K(0), E = K(null);
|
|
2500
|
-
G(() => (E.current = C?.build ?? null, () => {
|
|
2501
|
-
E.current = null;
|
|
2502
|
-
}), [C]), C != null && C.over !== o && w(null);
|
|
2503
|
-
let D = t.edgeProgram.list.useQuery({
|
|
2504
|
-
workspaceId: e,
|
|
2505
|
-
endpointId: n
|
|
2506
|
-
}), k = t.edgeProgram.getSettings.useQuery({ endpointId: n }), A = Je(() => D.data?.items ?? [], [D.data]), [M, N] = q(void 0);
|
|
2507
|
-
o == null && A.length > 0 && (M == null || !A.some((e) => e.id === M)) && N(A[0]?.id);
|
|
2508
|
-
let P = A.find((e) => e.id === (o ?? M)), F = t.edgeProgram.get.useQuery({ id: P?.id ?? "" }, { enabled: P != null }), I = A.filter((e) => e.id !== P?.id && e.enabled && e.sourceBytes > 0), L = t.useQueries((e) => I.map((t) => e.edgeProgram.get({ id: t.id }))), R = Ir(L.every((e) => e.isSuccess) ? L.map((e, t) => ({
|
|
2509
|
-
fileName: I[t]?.fileName ?? e.data.fileName,
|
|
2510
|
-
enabled: I[t]?.enabled ?? e.data.enabled,
|
|
2511
|
-
source: e.data.source
|
|
2512
|
-
})) : null), B = F.data?.id === P?.id ? F.data : void 0, V = new Set((r.status?.programs ?? []).flatMap((e) => e.programId == null ? [] : [e.programId]));
|
|
2513
|
-
G(() => {
|
|
2514
|
-
if (C != null || b == null || B == null || B.id !== b.programId) return;
|
|
2515
|
-
let e = u.current;
|
|
2516
|
-
if (e == null) return;
|
|
2517
|
-
let t = sr(e.text(), b.line), { column: n, length: r } = b;
|
|
2518
|
-
n === void 0 || r === void 0 ? e.reveal(t.from, t.to) : e.reveal(t.from + n - 1, t.from + n - 1 + r), S(null);
|
|
2519
|
-
}, [
|
|
2520
|
-
b,
|
|
2521
|
-
B,
|
|
2522
|
-
C
|
|
2523
|
-
]);
|
|
2524
|
-
let H = r.status?.tasks ?? [], U = (e, t) => {
|
|
2525
|
-
S({
|
|
2526
|
-
programId: e,
|
|
2527
|
-
line: t
|
|
2528
|
-
}), e !== P?.id && s(e);
|
|
2529
|
-
}, ae = (e) => {
|
|
2530
|
-
let t = A.find((t) => t.fileName === e.filename);
|
|
2531
|
-
t !== void 0 && (S({
|
|
2532
|
-
programId: t.id,
|
|
2533
|
-
line: e.line,
|
|
2534
|
-
column: e.column,
|
|
2535
|
-
length: e.to - e.from
|
|
2536
|
-
}), t.id !== P?.id && s(t.id));
|
|
2537
|
-
}, oe = (e, t) => {
|
|
2538
|
-
if (C == null) {
|
|
2539
|
-
U(e, t);
|
|
2540
|
-
return;
|
|
2541
|
-
}
|
|
2542
|
-
h({
|
|
2543
|
-
kind: "discard-for-line",
|
|
2544
|
-
fileName: C.draft.fileName,
|
|
2545
|
-
programId: e,
|
|
2546
|
-
line: t
|
|
2547
|
-
});
|
|
2548
|
-
}, se = () => {
|
|
2549
|
-
h({ kind: "create" });
|
|
2550
|
-
}, ce = K(!1), le = Ke((e) => {
|
|
2551
|
-
ce.current = e;
|
|
2552
|
-
}, []), ue = () => {
|
|
2553
|
-
let e = C?.draft.fileName ?? P?.fileName;
|
|
2554
|
-
h(ce.current && e !== void 0 ? {
|
|
2555
|
-
kind: "discard-for-starter",
|
|
2556
|
-
fileName: e
|
|
2557
|
-
} : { kind: "starter" });
|
|
2558
|
-
}, de = R == null || P != null && P.enabled && P.sourceBytes > 0 && B == null ? null : [...R, ...P != null && P.enabled && B != null ? [{
|
|
2559
|
-
fileName: P.fileName,
|
|
2560
|
-
enabled: !0,
|
|
2561
|
-
source: B.source
|
|
2562
|
-
}] : []];
|
|
2563
|
-
if (D.isError && D.data == null) return /* @__PURE__ */ Y(De, {
|
|
2564
|
-
message: j(D.error),
|
|
2565
|
-
onRetry: () => D.refetch()
|
|
2566
|
-
});
|
|
2567
|
-
let fe = a ? /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(x, {
|
|
2568
|
-
type: "button",
|
|
2569
|
-
variant: "ghost",
|
|
2570
|
-
size: "icon-sm",
|
|
2571
|
-
"aria-label": c("edge_program_starter_title"),
|
|
2572
|
-
title: c("edge_program_starter_title"),
|
|
2573
|
-
onClick: ue,
|
|
2574
|
-
children: /* @__PURE__ */ Y(ot, {})
|
|
2575
|
-
}), /* @__PURE__ */ Y(x, {
|
|
2576
|
-
type: "button",
|
|
2577
|
-
variant: "ghost",
|
|
2578
|
-
size: "icon-sm",
|
|
2579
|
-
"aria-label": c("edge_program_create"),
|
|
2580
|
-
title: c("edge_program_create"),
|
|
2581
|
-
onClick: se,
|
|
2582
|
-
children: /* @__PURE__ */ Y(ct, {})
|
|
2583
|
-
})] }) : null, pe;
|
|
2584
|
-
if (C != null && k.data != null) {
|
|
2585
|
-
let { build: t } = C;
|
|
2586
|
-
pe = /* @__PURE__ */ Y(fr, {
|
|
2587
|
-
workspaceId: e,
|
|
2588
|
-
endpointId: n,
|
|
2589
|
-
draft: C.draft,
|
|
2590
|
-
others: de,
|
|
2591
|
-
autoSync: k.data.settings.autoSync,
|
|
2592
|
-
editorRef: u,
|
|
2593
|
-
tasks: /* @__PURE__ */ Y(Fr, { tasks: H }),
|
|
2594
|
-
taskCount: H.length,
|
|
2595
|
-
onDiscard: () => {
|
|
2596
|
-
w(null);
|
|
2597
|
-
},
|
|
2598
|
-
onCreated: (e) => {
|
|
2599
|
-
E.current === t && (w(null), s(e));
|
|
2600
|
-
},
|
|
2601
|
-
onDirtyChange: le
|
|
2602
|
-
}, C.build);
|
|
2603
|
-
} else pe = A.length === 0 ? /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X(ie, {
|
|
2604
|
-
className: "flex-1",
|
|
2605
|
-
children: [/* @__PURE__ */ X(te, { children: [
|
|
2606
|
-
/* @__PURE__ */ Y(ee, {
|
|
2607
|
-
variant: "icon",
|
|
2608
|
-
children: /* @__PURE__ */ Y(nt, {})
|
|
2609
|
-
}),
|
|
2610
|
-
/* @__PURE__ */ Y(z, { children: c("edge_programs_empty_title") }),
|
|
2611
|
-
/* @__PURE__ */ Y(re, { children: c("edge_programs_empty_description") })
|
|
2612
|
-
] }), a ? /* @__PURE__ */ Y(ne, { children: /* @__PURE__ */ X("div", {
|
|
2613
|
-
className: "flex flex-wrap justify-center gap-2",
|
|
2614
|
-
children: [/* @__PURE__ */ X(x, {
|
|
2615
|
-
type: "button",
|
|
2616
|
-
variant: "outline",
|
|
2617
|
-
onClick: ue,
|
|
2618
|
-
children: [/* @__PURE__ */ Y(ot, { "data-icon": "inline-start" }), c("edge_program_starter_action")]
|
|
2619
|
-
}), /* @__PURE__ */ X(x, {
|
|
2620
|
-
type: "button",
|
|
2621
|
-
onClick: se,
|
|
2622
|
-
children: [/* @__PURE__ */ Y(ct, { "data-icon": "inline-start" }), c("edge_program_create")]
|
|
2623
|
-
})]
|
|
2624
|
-
}) }) : null]
|
|
2625
|
-
}), H.length > 0 ? /* @__PURE__ */ X("section", {
|
|
2626
|
-
"aria-label": c("edge_tasks_title"),
|
|
2627
|
-
className: "flex h-44 shrink-0 flex-col border-t",
|
|
2628
|
-
children: [/* @__PURE__ */ Y("h2", {
|
|
2629
|
-
className: "flex h-9 shrink-0 items-center border-b px-3 text-sm font-medium",
|
|
2630
|
-
children: c("edge_tasks_title")
|
|
2631
|
-
}), /* @__PURE__ */ Y("div", {
|
|
2632
|
-
className: "min-h-0 flex-1 overflow-y-auto",
|
|
2633
|
-
children: /* @__PURE__ */ Y(Fr, { tasks: H })
|
|
2634
|
-
})]
|
|
2635
|
-
}) : null] }) : P == null ? /* @__PURE__ */ Y(De, {
|
|
2636
|
-
className: "flex-1 justify-center",
|
|
2637
|
-
message: j("edge_program_not_found"),
|
|
2638
|
-
onRetry: () => {
|
|
2639
|
-
s(void 0);
|
|
2640
|
-
}
|
|
2641
|
-
}) : F.isError && B == null ? /* @__PURE__ */ Y(De, {
|
|
2642
|
-
className: "flex-1 justify-center",
|
|
2643
|
-
message: j(F.error),
|
|
2644
|
-
onRetry: () => F.refetch()
|
|
2645
|
-
}) : k.isError && k.data == null ? /* @__PURE__ */ Y(De, {
|
|
2646
|
-
className: "flex-1 justify-center",
|
|
2647
|
-
message: j(k.error),
|
|
2648
|
-
onRetry: () => k.refetch()
|
|
2649
|
-
}) : B == null || k.data == null ? /* @__PURE__ */ Y(O, { className: "m-3 flex-1" }) : /* @__PURE__ */ X(J, { children: [F.isError ? /* @__PURE__ */ Y(ke, {
|
|
2650
|
-
className: "m-3",
|
|
2651
|
-
message: j(F.error),
|
|
2652
|
-
onRetry: () => F.refetch()
|
|
2653
|
-
}) : null, /* @__PURE__ */ Y(dr, {
|
|
2654
|
-
workspaceId: e,
|
|
2655
|
-
detail: B,
|
|
2656
|
-
others: R,
|
|
2657
|
-
autoSync: k.data.settings.autoSync,
|
|
2658
|
-
canEdit: a,
|
|
2659
|
-
editorRef: u,
|
|
2660
|
-
onOpenLocation: ae,
|
|
2661
|
-
title: /* @__PURE__ */ X(J, { children: [
|
|
2662
|
-
/* @__PURE__ */ Y("h2", {
|
|
2663
|
-
className: "\n hidden min-w-0 truncate font-mono text-sm font-medium\n lg:block\n ",
|
|
2664
|
-
children: P.fileName
|
|
2665
|
-
}),
|
|
2666
|
-
/* @__PURE__ */ Y(f, {
|
|
2667
|
-
size: "sm",
|
|
2668
|
-
className: "\n min-w-0 font-mono\n lg:hidden\n ",
|
|
2669
|
-
"aria-label": c("edge_program_select"),
|
|
2670
|
-
value: P.id,
|
|
2671
|
-
onChange: (e) => {
|
|
2672
|
-
s(e.target.value);
|
|
2673
|
-
},
|
|
2674
|
-
children: A.map((e) => /* @__PURE__ */ Y(p, {
|
|
2675
|
-
value: e.id,
|
|
2676
|
-
children: e.fileName
|
|
2677
|
-
}, e.id))
|
|
2678
|
-
}),
|
|
2679
|
-
/* @__PURE__ */ Y("span", {
|
|
2680
|
-
className: "\n flex\n lg:hidden\n ",
|
|
2681
|
-
children: fe
|
|
2682
|
-
})
|
|
2683
|
-
] }),
|
|
2684
|
-
actions: a ? /* @__PURE__ */ X(J, { children: [
|
|
2685
|
-
/* @__PURE__ */ Y(Rr, {
|
|
2686
|
-
workspaceId: e,
|
|
2687
|
-
program: P
|
|
2688
|
-
}),
|
|
2689
|
-
/* @__PURE__ */ Y(x, {
|
|
2690
|
-
type: "button",
|
|
2691
|
-
variant: "ghost",
|
|
2692
|
-
size: "icon-sm",
|
|
2693
|
-
"aria-label": c("edge_program_rename"),
|
|
2694
|
-
title: c("edge_program_rename"),
|
|
2695
|
-
onClick: () => {
|
|
2696
|
-
h({
|
|
2697
|
-
kind: "rename",
|
|
2698
|
-
program: P
|
|
2699
|
-
});
|
|
2700
|
-
},
|
|
2701
|
-
children: /* @__PURE__ */ Y(st, {})
|
|
2702
|
-
}),
|
|
2703
|
-
/* @__PURE__ */ Y(x, {
|
|
2704
|
-
type: "button",
|
|
2705
|
-
variant: "ghost",
|
|
2706
|
-
size: "icon-sm",
|
|
2707
|
-
"aria-label": c("edge_program_delete"),
|
|
2708
|
-
title: c("edge_program_delete"),
|
|
2709
|
-
onClick: () => {
|
|
2710
|
-
h({
|
|
2711
|
-
kind: "delete",
|
|
2712
|
-
program: P
|
|
2713
|
-
});
|
|
2714
|
-
},
|
|
2715
|
-
children: /* @__PURE__ */ Y(ft, {})
|
|
2716
|
-
})
|
|
2717
|
-
] }) : null,
|
|
2718
|
-
tasks: /* @__PURE__ */ Y(Fr, { tasks: H }),
|
|
2719
|
-
taskCount: H.length,
|
|
2720
|
-
variables: a ? /* @__PURE__ */ Y(yr, { programId: B.id }) : null,
|
|
2721
|
-
fetchLatest: () => l.client.edgeProgram.get.query({ id: B.id }),
|
|
2722
|
-
onDirtyChange: le,
|
|
2723
|
-
onReload: async () => {
|
|
2724
|
-
let e = await l.client.edgeProgram.get.query({ id: B.id });
|
|
2725
|
-
l.edgeProgram.get.setData({ id: B.id }, e), _((e) => e + 1);
|
|
2726
|
-
}
|
|
2727
|
-
}, `${B.id}-${String(g)}`)] });
|
|
2728
|
-
return /* @__PURE__ */ X("div", {
|
|
2729
|
-
className: "flex min-h-0 flex-1 flex-col gap-3",
|
|
2730
|
-
children: [
|
|
2731
|
-
/* @__PURE__ */ Y(_n, {
|
|
2732
|
-
workspaceId: e,
|
|
2733
|
-
deploy: r,
|
|
2734
|
-
canEdit: a,
|
|
2735
|
-
onOpenSettings: () => {
|
|
2736
|
-
h({ kind: "settings" });
|
|
2737
|
-
},
|
|
2738
|
-
onShowLine: oe
|
|
2739
|
-
}),
|
|
2740
|
-
D.data == null ? /* @__PURE__ */ Y(O, { className: "min-h-144 flex-1 rounded-lg" }) : /* @__PURE__ */ X("div", {
|
|
2741
|
-
className: "flex min-h-144 flex-1 overflow-hidden rounded-lg border bg-card",
|
|
2742
|
-
children: [A.length > 0 ? /* @__PURE__ */ X("aside", {
|
|
2743
|
-
className: "\n hidden w-56 shrink-0 flex-col border-r\n lg:flex\n ",
|
|
2744
|
-
children: [
|
|
2745
|
-
/* @__PURE__ */ X("div", {
|
|
2746
|
-
className: "flex h-12 shrink-0 items-center gap-2 border-b pr-1.5 pl-3",
|
|
2747
|
-
children: [/* @__PURE__ */ Y("h2", {
|
|
2748
|
-
className: "flex-1 text-sm font-medium",
|
|
2749
|
-
children: c("edge_programs_title")
|
|
2750
|
-
}), fe]
|
|
2751
|
-
}),
|
|
2752
|
-
/* @__PURE__ */ Y("nav", {
|
|
2753
|
-
"aria-label": c("edge_programs_list_label"),
|
|
2754
|
-
className: "flex min-h-0 flex-1 flex-col gap-px overflow-y-auto p-1.5",
|
|
2755
|
-
children: A.map((e) => /* @__PURE__ */ X("button", {
|
|
2756
|
-
type: "button",
|
|
2757
|
-
"aria-current": e.id === P?.id ? "page" : void 0,
|
|
2758
|
-
className: d("\n flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm\n hover:bg-muted\n focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none\n ", e.id === P?.id && "bg-muted font-medium"),
|
|
2759
|
-
onClick: () => {
|
|
2760
|
-
s(e.id);
|
|
2761
|
-
},
|
|
2762
|
-
children: [
|
|
2763
|
-
/* @__PURE__ */ Y("span", {
|
|
2764
|
-
className: d("size-1.5 shrink-0 rounded-full", V.has(e.id) ? "bg-emerald-500" : "bg-transparent"),
|
|
2765
|
-
title: V.has(e.id) ? c("edge_program_runs") : void 0
|
|
2766
|
-
}),
|
|
2767
|
-
/* @__PURE__ */ Y("span", {
|
|
2768
|
-
className: d("min-w-0 flex-1 truncate font-mono", !e.enabled && "text-muted-foreground line-through"),
|
|
2769
|
-
children: e.fileName
|
|
2770
|
-
}),
|
|
2771
|
-
V.has(e.id) ? /* @__PURE__ */ Y("span", {
|
|
2772
|
-
className: "sr-only",
|
|
2773
|
-
children: c("edge_program_runs")
|
|
2774
|
-
}) : null,
|
|
2775
|
-
e.enabled ? null : /* @__PURE__ */ Y("span", {
|
|
2776
|
-
className: "text-xs text-muted-foreground",
|
|
2777
|
-
children: c("edge_program_disabled_badge")
|
|
2778
|
-
}),
|
|
2779
|
-
/* @__PURE__ */ Y(Lr, { program: e })
|
|
2780
|
-
]
|
|
2781
|
-
}, e.id))
|
|
2782
|
-
}),
|
|
2783
|
-
/* @__PURE__ */ Y("p", {
|
|
2784
|
-
className: "shrink-0 border-t px-3 py-2 text-xs text-muted-foreground",
|
|
2785
|
-
children: c("edge_programs_description")
|
|
2786
|
-
})
|
|
2787
|
-
]
|
|
2788
|
-
}) : null, /* @__PURE__ */ Y("div", {
|
|
2789
|
-
className: "flex min-w-0 flex-1 flex-col",
|
|
2790
|
-
children: pe
|
|
2791
|
-
})]
|
|
2792
|
-
}),
|
|
2793
|
-
/* @__PURE__ */ Y(En, {
|
|
2794
|
-
endpointId: n,
|
|
2795
|
-
deviceLogging: k.data?.settings.deviceLogging ?? !0,
|
|
2796
|
-
settingsPending: r.status?.settingsPending ?? !1,
|
|
2797
|
-
canEdit: a,
|
|
2798
|
-
onOpenSettings: () => {
|
|
2799
|
-
h({ kind: "settings" });
|
|
2800
|
-
},
|
|
2801
|
-
onShowLine: oe
|
|
2802
|
-
}, n),
|
|
2803
|
-
m?.kind === "create" || m?.kind === "rename" ? /* @__PURE__ */ Y(On, {
|
|
2804
|
-
workspaceId: e,
|
|
2805
|
-
endpointId: n,
|
|
2806
|
-
...m.kind === "rename" ? { program: m.program } : {},
|
|
2807
|
-
onClose: () => {
|
|
2808
|
-
h(null);
|
|
2809
|
-
},
|
|
2810
|
-
onSaved: (e) => {
|
|
2811
|
-
h(null), s(e);
|
|
2812
|
-
}
|
|
2813
|
-
}) : null,
|
|
2814
|
-
m?.kind === "discard-for-line" ? /* @__PURE__ */ Y(lr, {
|
|
2815
|
-
fileName: m.fileName,
|
|
2816
|
-
onKeep: () => {
|
|
2817
|
-
h((e) => e?.kind === "discard-for-line" ? null : e);
|
|
2818
|
-
},
|
|
2819
|
-
onDiscard: () => {
|
|
2820
|
-
h(null), xt(() => {
|
|
2821
|
-
w(null);
|
|
2822
|
-
}), U(m.programId, m.line);
|
|
2823
|
-
}
|
|
2824
|
-
}) : null,
|
|
2825
|
-
m?.kind === "discard-for-starter" ? /* @__PURE__ */ Y(lr, {
|
|
2826
|
-
fileName: m.fileName,
|
|
2827
|
-
onKeep: () => {
|
|
2828
|
-
h((e) => e?.kind === "discard-for-starter" ? null : e);
|
|
2829
|
-
},
|
|
2830
|
-
onDiscard: () => {
|
|
2831
|
-
h({ kind: "starter" });
|
|
2832
|
-
}
|
|
2833
|
-
}) : null,
|
|
2834
|
-
m?.kind === "starter" ? /* @__PURE__ */ Y(Or, {
|
|
2835
|
-
workspaceId: e,
|
|
2836
|
-
endpointId: n,
|
|
2837
|
-
fileNames: A.map((e) => e.fileName),
|
|
2838
|
-
onClose: () => {
|
|
2839
|
-
h(null);
|
|
2840
|
-
},
|
|
2841
|
-
onBuilt: (e) => {
|
|
2842
|
-
h(null), T.current += 1, w({
|
|
2843
|
-
draft: e,
|
|
2844
|
-
over: o,
|
|
2845
|
-
build: T.current
|
|
2846
|
-
});
|
|
2847
|
-
}
|
|
2848
|
-
}) : null,
|
|
2849
|
-
m?.kind === "delete" ? /* @__PURE__ */ Y(kn, {
|
|
2850
|
-
workspaceId: e,
|
|
2851
|
-
program: m.program,
|
|
2852
|
-
onClose: () => {
|
|
2853
|
-
h(null);
|
|
2854
|
-
},
|
|
2855
|
-
onDeleted: () => {
|
|
2856
|
-
h(null), s(void 0);
|
|
2857
|
-
}
|
|
2858
|
-
}) : null,
|
|
2859
|
-
m?.kind === "settings" && k.data != null ? /* @__PURE__ */ Y(gr, {
|
|
2860
|
-
workspaceId: e,
|
|
2861
|
-
settings: k.data,
|
|
2862
|
-
onReload: async () => {
|
|
2863
|
-
await k.refetch({ throwOnError: !0 }), y((e) => e + 1);
|
|
2864
|
-
},
|
|
2865
|
-
onClose: () => {
|
|
2866
|
-
h(null);
|
|
2867
|
-
}
|
|
2868
|
-
}, v) : null
|
|
2869
|
-
]
|
|
2870
|
-
});
|
|
2871
|
-
}
|
|
2872
|
-
//#endregion
|
|
2873
|
-
//#region src/workspace/setup/endpoints/status-recorded.tsx
|
|
2874
|
-
function Br({ endpointId: e, onCreateParameter: n }) {
|
|
2875
|
-
let r = i(), a = t.deviceLog.listAddresses.useQuery({ endpointId: e });
|
|
2876
|
-
return /* @__PURE__ */ Y(Oe, {
|
|
2877
|
-
query: {
|
|
2878
|
-
isLoading: a.isLoading,
|
|
2879
|
-
isError: a.isError,
|
|
2880
|
-
error: a.error,
|
|
2881
|
-
data: a.data
|
|
2882
|
-
},
|
|
2883
|
-
loading: /* @__PURE__ */ Y(O, { className: "h-48 w-full" }),
|
|
2884
|
-
error: (e) => /* @__PURE__ */ Y(De, {
|
|
2885
|
-
message: e == null ? r("error_request_failed") : j(e),
|
|
2886
|
-
onRetry: () => a.refetch()
|
|
2887
|
-
}),
|
|
2888
|
-
isEmpty: (e) => e.addresses.length === 0,
|
|
2889
|
-
empty: /* @__PURE__ */ Y(ie, { children: /* @__PURE__ */ X(te, { children: [
|
|
2890
|
-
/* @__PURE__ */ Y(ee, {
|
|
2891
|
-
variant: "icon",
|
|
2892
|
-
children: /* @__PURE__ */ Y(it, {})
|
|
2893
|
-
}),
|
|
2894
|
-
/* @__PURE__ */ Y(z, { children: r("endpoint_recorded_empty_title") }),
|
|
2895
|
-
/* @__PURE__ */ Y(re, { children: r("endpoint_recorded_empty_description") })
|
|
2896
|
-
] }) }),
|
|
2897
|
-
children: (t) => /* @__PURE__ */ X("div", {
|
|
2898
|
-
className: "flex flex-col gap-3",
|
|
2899
|
-
children: [/* @__PURE__ */ Y("p", {
|
|
2900
|
-
className: "text-sm text-muted-foreground",
|
|
2901
|
-
children: r("endpoint_recorded_description")
|
|
2902
|
-
}), /* @__PURE__ */ X(R, { children: [/* @__PURE__ */ Y(L, { children: /* @__PURE__ */ X(N, { children: [
|
|
2903
|
-
/* @__PURE__ */ Y(I, { children: r("endpoint_recorded_unit") }),
|
|
2904
|
-
/* @__PURE__ */ Y(I, { children: r("endpoint_recorded_table") }),
|
|
2905
|
-
/* @__PURE__ */ Y(I, { children: r("endpoint_recorded_address") }),
|
|
2906
|
-
/* @__PURE__ */ Y(I, {
|
|
2907
|
-
className: "\n hidden\n sm:table-cell\n ",
|
|
2908
|
-
children: r("endpoint_recorded_records")
|
|
2909
|
-
}),
|
|
2910
|
-
/* @__PURE__ */ Y(I, {
|
|
2911
|
-
className: "\n hidden\n md:table-cell\n ",
|
|
2912
|
-
children: r("endpoint_recorded_last_at")
|
|
2913
|
-
}),
|
|
2914
|
-
/* @__PURE__ */ Y(I, {
|
|
2915
|
-
className: "\n hidden\n md:table-cell\n ",
|
|
2916
|
-
children: r("endpoint_recorded_last_value")
|
|
2917
|
-
}),
|
|
2918
|
-
/* @__PURE__ */ Y(I, { children: /* @__PURE__ */ Y("span", {
|
|
2919
|
-
className: "sr-only",
|
|
2920
|
-
children: r("endpoint_recorded_actions")
|
|
2921
|
-
}) })
|
|
2922
|
-
] }) }), /* @__PURE__ */ Y(F, { children: t.addresses.map((t) => /* @__PURE__ */ X(N, { children: [
|
|
2923
|
-
/* @__PURE__ */ Y(P, {
|
|
2924
|
-
className: "tabular-nums",
|
|
2925
|
-
children: t.unitId
|
|
2926
|
-
}),
|
|
2927
|
-
/* @__PURE__ */ Y(P, { children: l(t.table) }),
|
|
2928
|
-
/* @__PURE__ */ Y(P, {
|
|
2929
|
-
className: "tabular-nums",
|
|
2930
|
-
children: t.address
|
|
2931
|
-
}),
|
|
2932
|
-
/* @__PURE__ */ Y(P, {
|
|
2933
|
-
className: "\n hidden tabular-nums\n sm:table-cell\n ",
|
|
2934
|
-
children: t.records
|
|
2935
|
-
}),
|
|
2936
|
-
/* @__PURE__ */ Y(P, {
|
|
2937
|
-
className: "\n hidden\n md:table-cell\n ",
|
|
2938
|
-
children: Q(t.lastAt)
|
|
2939
|
-
}),
|
|
2940
|
-
/* @__PURE__ */ Y(P, {
|
|
2941
|
-
className: "\n hidden tabular-nums\n md:table-cell\n ",
|
|
2942
|
-
children: t.lastValue
|
|
2943
|
-
}),
|
|
2944
|
-
/* @__PURE__ */ Y(P, {
|
|
2945
|
-
className: "text-right",
|
|
2946
|
-
children: n == null ? null : /* @__PURE__ */ X(x, {
|
|
2947
|
-
type: "button",
|
|
2948
|
-
variant: "outline",
|
|
2949
|
-
size: "sm",
|
|
2950
|
-
"aria-label": r("endpoint_recorded_create_parameter"),
|
|
2951
|
-
onClick: () => {
|
|
2952
|
-
n({
|
|
2953
|
-
endpointId: e,
|
|
2954
|
-
unitId: t.unitId,
|
|
2955
|
-
table: t.table,
|
|
2956
|
-
address: t.address
|
|
2957
|
-
});
|
|
2958
|
-
},
|
|
2959
|
-
children: [/* @__PURE__ */ Y(ct, { "data-icon": "inline-start" }), /* @__PURE__ */ Y("span", {
|
|
2960
|
-
className: "\n hidden\n sm:inline\n ",
|
|
2961
|
-
children: r("endpoint_recorded_create_parameter")
|
|
2962
|
-
})]
|
|
2963
|
-
})
|
|
2964
|
-
})
|
|
2965
|
-
] }, `${String(t.unitId)}:${t.table}:${String(t.address)}`)) })] })]
|
|
2966
|
-
})
|
|
2967
|
-
});
|
|
2968
|
-
}
|
|
2969
|
-
//#endregion
|
|
2970
|
-
//#region src/workspace/setup/endpoints/sharing.tsx
|
|
2971
|
-
var Vr = gt(Z.Object({ authorizationCode: Z.String({ maxLength: 8 }) }));
|
|
2972
|
-
function Hr({ workspaceId: e, endpointId: n, pinCode: r }) {
|
|
2973
|
-
let a = i(), o = t.endpoint.listConnectedWorkspaces.useQuery({ endpointId: n }), [s, c] = q(!1), l = (o.data?.workspaces ?? []).filter((e) => !e.current);
|
|
2974
|
-
return l.length === 0 ? null : /* @__PURE__ */ X("div", {
|
|
2975
|
-
className: "flex w-full flex-wrap items-center gap-x-3 gap-y-1.5 border-t pt-2",
|
|
2976
|
-
children: [
|
|
2977
|
-
/* @__PURE__ */ X("span", {
|
|
2978
|
-
className: "min-w-0 text-muted-foreground",
|
|
2979
|
-
children: [/* @__PURE__ */ X("span", {
|
|
2980
|
-
className: "text-foreground/70",
|
|
2981
|
-
children: [a("endpoint_sharing_label"), ": "]
|
|
2982
|
-
}), l.map((e, t) => /* @__PURE__ */ X("span", { children: [t > 0 ? ", " : null, /* @__PURE__ */ X(ue, { children: [/* @__PURE__ */ Y(le, {
|
|
2983
|
-
render: /* @__PURE__ */ Y("span", { className: "underline decoration-dotted" }),
|
|
2984
|
-
children: e.name
|
|
2985
|
-
}), /* @__PURE__ */ Y(fe, {
|
|
2986
|
-
className: "font-mono",
|
|
2987
|
-
children: e.id
|
|
2988
|
-
})] })] }, e.id))]
|
|
2989
|
-
}),
|
|
2990
|
-
r == null ? null : /* @__PURE__ */ Y(x, {
|
|
2991
|
-
type: "button",
|
|
2992
|
-
variant: "ghost",
|
|
2993
|
-
size: "sm",
|
|
2994
|
-
className: "\n ml-auto text-destructive\n hover:text-destructive\n ",
|
|
2995
|
-
onClick: () => {
|
|
2996
|
-
c(!0);
|
|
2997
|
-
},
|
|
2998
|
-
children: a("endpoint_disconnect_others_action")
|
|
2999
|
-
}),
|
|
3000
|
-
s && r != null ? /* @__PURE__ */ Y(Wr, {
|
|
3001
|
-
workspaceId: e,
|
|
3002
|
-
endpointId: n,
|
|
3003
|
-
pinCode: r,
|
|
3004
|
-
onClose: () => {
|
|
3005
|
-
c(!1);
|
|
3006
|
-
}
|
|
3007
|
-
}) : null
|
|
3008
|
-
]
|
|
3009
|
-
});
|
|
3010
|
-
}
|
|
3011
|
-
function Ur({ endpointId: e, challengeId: n, codeDisplayed: r, onClose: c, onDisconnected: l, onChallengeGone: d }) {
|
|
3012
|
-
let f = i(), p = a(), h = t.endpoint.disconnectOtherWorkspaces.useMutation(), g = o({
|
|
3013
|
-
defaultValues: { authorizationCode: "" },
|
|
3014
|
-
validators: u({
|
|
3015
|
-
schema: Vr,
|
|
3016
|
-
submit: async (t) => {
|
|
3017
|
-
let r = Le(t.authorizationCode);
|
|
3018
|
-
if (!r.ok) return { fields: { authorizationCode: () => f("endpoint_presence_code_invalid") } };
|
|
3019
|
-
try {
|
|
3020
|
-
await h.mutateAsync({
|
|
3021
|
-
endpointId: e,
|
|
3022
|
-
challengeId: n,
|
|
3023
|
-
...r.code == null ? {} : { authorizationCode: r.code }
|
|
3024
|
-
});
|
|
3025
|
-
} catch (e) {
|
|
3026
|
-
throw M(e) === "endpoint_presence_invalid" && d(), e;
|
|
3027
|
-
}
|
|
3028
|
-
return await l(), null;
|
|
3029
|
-
},
|
|
3030
|
-
mapError: (e, t) => Ie(e, t, r)
|
|
3031
|
-
}),
|
|
3032
|
-
onSubmitInvalid: s,
|
|
3033
|
-
onSubmit: () => {
|
|
3034
|
-
p.success(f("endpoint_disconnect_others_toast")), c();
|
|
3035
|
-
}
|
|
3036
|
-
});
|
|
3037
|
-
return /* @__PURE__ */ Y(g.AppForm, { children: /* @__PURE__ */ X(g.FormRoot, {
|
|
3038
|
-
layout: "dialog",
|
|
3039
|
-
children: [
|
|
3040
|
-
/* @__PURE__ */ X(T, { children: [/* @__PURE__ */ Y(w, { children: f("endpoint_presence_title") }), /* @__PURE__ */ Y(C, { children: f("endpoint_presence_button") })] }),
|
|
3041
|
-
/* @__PURE__ */ X(m, { children: [
|
|
3042
|
-
/* @__PURE__ */ Y(g.Subscribe, {
|
|
3043
|
-
selector: (e) => e.isSubmitting,
|
|
3044
|
-
children: (e) => /* @__PURE__ */ Y(Fe, {
|
|
3045
|
-
challengeId: n,
|
|
3046
|
-
paused: e,
|
|
3047
|
-
onDone: () => {
|
|
3048
|
-
g.setFieldValue("authorizationCode", ""), g.handleSubmit();
|
|
3049
|
-
}
|
|
3050
|
-
})
|
|
3051
|
-
}),
|
|
3052
|
-
/* @__PURE__ */ Y("p", {
|
|
3053
|
-
className: "text-sm text-destructive",
|
|
3054
|
-
children: f("endpoint_disconnect_others_description")
|
|
3055
|
-
}),
|
|
3056
|
-
/* @__PURE__ */ Y("p", {
|
|
3057
|
-
className: "text-sm",
|
|
3058
|
-
children: f(r ? "endpoint_presence_or_code" : "endpoint_presence_button_only")
|
|
3059
|
-
}),
|
|
3060
|
-
r ? /* @__PURE__ */ Y(g.AppField, {
|
|
3061
|
-
name: "authorizationCode",
|
|
3062
|
-
children: (e) => /* @__PURE__ */ Y(e.TextField, {
|
|
3063
|
-
label: f("endpoint_presence_code_label"),
|
|
3064
|
-
id: "endpoint-disconnect-code",
|
|
3065
|
-
autoComplete: "off",
|
|
3066
|
-
spellCheck: !1,
|
|
3067
|
-
inputMode: "numeric",
|
|
3068
|
-
autoFocus: !0
|
|
3069
|
-
})
|
|
3070
|
-
}) : null
|
|
3071
|
-
] }),
|
|
3072
|
-
/* @__PURE__ */ X(S, { children: [/* @__PURE__ */ Y(x, {
|
|
3073
|
-
type: "button",
|
|
3074
|
-
variant: "outline",
|
|
3075
|
-
onClick: () => {
|
|
3076
|
-
c();
|
|
3077
|
-
},
|
|
3078
|
-
children: f("action_cancel")
|
|
3079
|
-
}), /* @__PURE__ */ Y(g.SubmitButton, {
|
|
3080
|
-
label: f(r ? "endpoint_disconnect_others_submit" : "endpoint_presence_waiting"),
|
|
3081
|
-
pendingLabel: f("endpoint_disconnect_others_pending"),
|
|
3082
|
-
disabled: !r
|
|
3083
|
-
})] })
|
|
3084
|
-
]
|
|
3085
|
-
}) });
|
|
3086
|
-
}
|
|
3087
|
-
function Wr({ workspaceId: e, endpointId: n, pinCode: r, onClose: a }) {
|
|
3088
|
-
let o = i(), s = t.useUtils(), c = t.endpoint.beginPinPresence.useMutation(), l = t.endpoint.cancelPinPresence.useMutation(), [u, d] = q(null), [f, p] = q(null), [m, h] = q(!1), [g, _] = q(0), v = K(l.mutate), y = K(c.mutateAsync);
|
|
3089
|
-
return G(() => {
|
|
3090
|
-
v.current = l.mutate, y.current = c.mutateAsync;
|
|
3091
|
-
}), G(() => {
|
|
3092
|
-
let t = !0, i = null;
|
|
3093
|
-
return y.current({
|
|
3094
|
-
workspaceId: e,
|
|
3095
|
-
pinCode: r,
|
|
3096
|
-
endpointId: n
|
|
3097
|
-
}).then((e) => {
|
|
3098
|
-
if (!e.presenceRequired) {
|
|
3099
|
-
t && h(!0);
|
|
3100
|
-
return;
|
|
3101
|
-
}
|
|
3102
|
-
if (i = e.challengeId, !t) {
|
|
3103
|
-
v.current({ challengeId: e.challengeId });
|
|
3104
|
-
return;
|
|
3105
|
-
}
|
|
3106
|
-
d({
|
|
3107
|
-
challengeId: e.challengeId,
|
|
3108
|
-
codeDisplayed: e.codeDisplayed
|
|
3109
|
-
});
|
|
3110
|
-
}).catch((e) => {
|
|
3111
|
-
t && p(j(e));
|
|
3112
|
-
}), () => {
|
|
3113
|
-
t = !1, i != null && v.current({ challengeId: i });
|
|
3114
|
-
};
|
|
3115
|
-
}, [
|
|
3116
|
-
g,
|
|
3117
|
-
n,
|
|
3118
|
-
r,
|
|
3119
|
-
e
|
|
3120
|
-
]), /* @__PURE__ */ Y(D, {
|
|
3121
|
-
open: !0,
|
|
3122
|
-
onOpenChange: (e) => {
|
|
3123
|
-
e || a();
|
|
3124
|
-
},
|
|
3125
|
-
children: /* @__PURE__ */ Y(E, { children: u == null ? /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X(T, { children: [/* @__PURE__ */ Y(w, { children: o("endpoint_presence_title") }), /* @__PURE__ */ Y(C, { children: f ?? o(m ? "error_endpoint_presence_unavailable" : "endpoint_presence_waiting") })] }), /* @__PURE__ */ Y(S, { children: /* @__PURE__ */ Y(x, {
|
|
3126
|
-
type: "button",
|
|
3127
|
-
variant: "outline",
|
|
3128
|
-
onClick: () => {
|
|
3129
|
-
a();
|
|
3130
|
-
},
|
|
3131
|
-
children: o("action_cancel")
|
|
3132
|
-
}) })] }) : /* @__PURE__ */ Y(Ur, {
|
|
3133
|
-
endpointId: n,
|
|
3134
|
-
challengeId: u.challengeId,
|
|
3135
|
-
codeDisplayed: u.codeDisplayed,
|
|
3136
|
-
onClose: a,
|
|
3137
|
-
onDisconnected: async () => {
|
|
3138
|
-
await s.endpoint.listConnectedWorkspaces.invalidate({ endpointId: n }), await s.endpoint.list.invalidate();
|
|
3139
|
-
},
|
|
3140
|
-
onChallengeGone: () => {
|
|
3141
|
-
d(null), _((e) => e + 1);
|
|
3142
|
-
}
|
|
3143
|
-
}) })
|
|
3144
|
-
});
|
|
3145
|
-
}
|
|
3146
|
-
//#endregion
|
|
3147
|
-
//#region src/workspace/setup/endpoints/status-page.tsx
|
|
3148
|
-
var Gr = /* @__PURE__ */ e({ SetupEndpointStatusPage: () => Kr });
|
|
3149
|
-
function Kr({ workspaceId: e, endpointId: n, tab: a = "connection", onTabChange: o, programId: s, onProgramChange: c, onCreateParameter: l, resolveDeviceUiOrigin: u }) {
|
|
3150
|
-
let f = i(), p = r(), { mintDeviceUiTicket: m } = A(), h = t.endpoint.get.useQuery({ id: n }), [g, _] = q(null), v = k(), y = v != null && yt(v.access), S = Rt(h.data != null && Mt(h.data) ? n : null);
|
|
3151
|
-
return /* @__PURE__ */ Y(Oe, {
|
|
3152
|
-
query: {
|
|
3153
|
-
isLoading: h.isLoading,
|
|
3154
|
-
isError: h.isError && h.data == null,
|
|
3155
|
-
error: h.error,
|
|
3156
|
-
data: h.data
|
|
3157
|
-
},
|
|
3158
|
-
loading: /* @__PURE__ */ X("div", {
|
|
3159
|
-
className: "mx-auto flex w-full max-w-5xl flex-col gap-4 p-4",
|
|
3160
|
-
children: [
|
|
3161
|
-
/* @__PURE__ */ Y(O, { className: "h-8 w-64" }),
|
|
3162
|
-
/* @__PURE__ */ Y(O, { className: "h-24 w-full" }),
|
|
3163
|
-
/* @__PURE__ */ Y(O, { className: "h-96 w-full" })
|
|
3164
|
-
]
|
|
3165
|
-
}),
|
|
3166
|
-
error: (e) => /* @__PURE__ */ Y(De, {
|
|
3167
|
-
className: "flex-1 justify-center p-8",
|
|
3168
|
-
message: j(e ?? "endpoint_not_found"),
|
|
3169
|
-
onRetry: () => h.refetch()
|
|
3170
|
-
}),
|
|
3171
|
-
children: (t) => {
|
|
3172
|
-
let r = m != null && t.publicKey != null, i = Mt(t), v = i, C = r && a === "device-ui" ? "device-ui" : v && a === "recorded" ? "recorded" : i && a === "programs" ? "programs" : "connection";
|
|
3173
|
-
return /* @__PURE__ */ X("div", {
|
|
3174
|
-
className: "flex size-full min-h-0 flex-col",
|
|
3175
|
-
children: [/* @__PURE__ */ Y(Ce, {
|
|
3176
|
-
icon: /* @__PURE__ */ Y(Ze, {}),
|
|
3177
|
-
breadcrumbs: /* @__PURE__ */ Y(Pe, {
|
|
3178
|
-
workspaceId: e,
|
|
3179
|
-
section: "endpoints"
|
|
3180
|
-
}),
|
|
3181
|
-
title: ht(t.name, p)
|
|
3182
|
-
}), /* @__PURE__ */ X("div", {
|
|
3183
|
-
className: d("mx-auto flex min-h-0 w-full flex-1 flex-col gap-4 p-4", C === "programs" ? "min-h-auto max-w-7xl" : "max-w-5xl"),
|
|
3184
|
-
children: [
|
|
3185
|
-
r || v ? /* @__PURE__ */ X("div", {
|
|
3186
|
-
className: "flex items-center justify-between gap-2",
|
|
3187
|
-
children: [/* @__PURE__ */ Y(Ee, {
|
|
3188
|
-
className: "min-w-0",
|
|
3189
|
-
value: C,
|
|
3190
|
-
onValueChange: (e) => {
|
|
3191
|
-
typeof e == "string" && (e === "connection" || e === "programs" || e === "recorded" || e === "device-ui") && o?.(e);
|
|
3192
|
-
},
|
|
3193
|
-
children: /* @__PURE__ */ X(Te, {
|
|
3194
|
-
variant: "line",
|
|
3195
|
-
children: [
|
|
3196
|
-
/* @__PURE__ */ Y(we, {
|
|
3197
|
-
value: "connection",
|
|
3198
|
-
children: f("endpoint_status_tab_connection")
|
|
3199
|
-
}),
|
|
3200
|
-
i ? /* @__PURE__ */ Y(we, {
|
|
3201
|
-
value: "programs",
|
|
3202
|
-
children: f("endpoint_status_tab_programs")
|
|
3203
|
-
}) : null,
|
|
3204
|
-
v ? /* @__PURE__ */ Y(we, {
|
|
3205
|
-
value: "recorded",
|
|
3206
|
-
children: f("endpoint_status_tab_recorded")
|
|
3207
|
-
}) : null,
|
|
3208
|
-
r ? /* @__PURE__ */ Y(we, {
|
|
3209
|
-
value: "device-ui",
|
|
3210
|
-
children: f("endpoint_status_tab_device_ui")
|
|
3211
|
-
}) : null
|
|
3212
|
-
]
|
|
3213
|
-
})
|
|
3214
|
-
}), C === "device-ui" && g != null ? /* @__PURE__ */ X("a", {
|
|
3215
|
-
className: d("shrink-0", b({
|
|
3216
|
-
variant: "outline",
|
|
3217
|
-
size: "sm"
|
|
3218
|
-
})),
|
|
3219
|
-
href: g,
|
|
3220
|
-
target: "_blank",
|
|
3221
|
-
rel: "noreferrer",
|
|
3222
|
-
children: [/* @__PURE__ */ Y(rt, { "data-icon": "inline-start" }), f("endpoint_status_device_ui_open_window")]
|
|
3223
|
-
}) : null]
|
|
3224
|
-
}) : null,
|
|
3225
|
-
h.isError ? /* @__PURE__ */ Y(ke, {
|
|
3226
|
-
message: j(h.error),
|
|
3227
|
-
onRetry: () => h.refetch()
|
|
3228
|
-
}) : null,
|
|
3229
|
-
S.status?.state === "conflict" ? /* @__PURE__ */ X(U, {
|
|
3230
|
-
variant: "destructive",
|
|
3231
|
-
children: [
|
|
3232
|
-
/* @__PURE__ */ Y(Ye, {}),
|
|
3233
|
-
/* @__PURE__ */ Y(B, { children: f("edge_deploy_conflict_title") }),
|
|
3234
|
-
/* @__PURE__ */ Y(H, { children: f("edge_deploy_state_conflict_description") }),
|
|
3235
|
-
C === "connection" ? null : /* @__PURE__ */ Y(V, { children: /* @__PURE__ */ Y(x, {
|
|
3236
|
-
type: "button",
|
|
3237
|
-
variant: "outline",
|
|
3238
|
-
size: "sm",
|
|
3239
|
-
onClick: () => {
|
|
3240
|
-
o?.("connection");
|
|
3241
|
-
},
|
|
3242
|
-
children: f("edge_deploy_conflict_show_connection")
|
|
3243
|
-
}) })
|
|
3244
|
-
]
|
|
3245
|
-
}) : null,
|
|
3246
|
-
v && C !== "device-ui" ? /* @__PURE__ */ Y(Bt, { endpointId: n }) : null,
|
|
3247
|
-
t.disabledSince != null && C === "connection" ? /* @__PURE__ */ X(U, { children: [
|
|
3248
|
-
/* @__PURE__ */ Y(Ye, {}),
|
|
3249
|
-
/* @__PURE__ */ Y(B, { children: f("endpoint_disabled_banner_title") }),
|
|
3250
|
-
/* @__PURE__ */ Y(H, { children: f("endpoint_disabled_since", { since: Q(t.disabledSince) }) })
|
|
3251
|
-
] }) : null,
|
|
3252
|
-
C === "programs" ? /* @__PURE__ */ Y(zr, {
|
|
3253
|
-
workspaceId: e,
|
|
3254
|
-
endpointId: n,
|
|
3255
|
-
deploy: S,
|
|
3256
|
-
canEdit: y,
|
|
3257
|
-
...s == null ? {} : { programId: s },
|
|
3258
|
-
onProgramChange: (e) => {
|
|
3259
|
-
c?.(e);
|
|
3260
|
-
}
|
|
3261
|
-
}) : C === "recorded" ? /* @__PURE__ */ Y(Br, {
|
|
3262
|
-
endpointId: n,
|
|
3263
|
-
...l == null ? {} : { onCreateParameter: l }
|
|
3264
|
-
}) : C === "device-ui" && m != null ? /* @__PURE__ */ Y(an, {
|
|
3265
|
-
mintTicket: m,
|
|
3266
|
-
endpointId: n,
|
|
3267
|
-
kind: t.kind,
|
|
3268
|
-
onTicketUrl: _,
|
|
3269
|
-
...u == null ? {} : { resolveDeviceUiOrigin: u }
|
|
3270
|
-
}) : /* @__PURE__ */ Y(Zt, {
|
|
3271
|
-
endpointId: n,
|
|
3272
|
-
endpoint: t,
|
|
3273
|
-
statusDetails: t.kind === "pin" ? /* @__PURE__ */ Y(Hr, {
|
|
3274
|
-
workspaceId: e,
|
|
3275
|
-
endpointId: n,
|
|
3276
|
-
pinCode: t.pinCode
|
|
3277
|
-
}) : null
|
|
3278
|
-
})
|
|
3279
|
-
]
|
|
3280
|
-
})]
|
|
3281
|
-
});
|
|
3282
|
-
}
|
|
3283
|
-
});
|
|
3284
|
-
}
|
|
3285
|
-
//#endregion
|
|
3286
|
-
export { Gr as n, Kr as t };
|