@tsplc/debug 0.2.17 → 0.2.19
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/format.js +36 -18
- package/dist/format.js.map +4 -4
- package/dist/index.js +768 -516
- package/dist/index.js.map +20 -17
- package/dist/manifest.js +6 -2
- package/dist/manifest.js.map +3 -3
- package/dist/paths.js +60 -28
- package/dist/paths.js.map +3 -3
- package/package.json +47 -46
- package/src/adapter.ts +43 -36
- package/src/api.ts +126 -123
- package/src/debugger.ts +584 -467
- package/src/errors.ts +3 -0
- package/src/hardware.ts +127 -96
- package/src/http.ts +147 -116
- package/src/index.ts +34 -4
- package/src/jobs.ts +102 -77
- package/src/login-value.ts +165 -0
- package/src/login.ts +233 -253
- package/src/manifest.ts +200 -194
- package/src/opcua.ts +55 -55
- package/src/paths.ts +230 -157
- package/src/requests.ts +86 -0
- package/src/telemetry.ts +104 -90
- package/src/timeline.ts +96 -61
- package/src/trace.ts +41 -31
- package/src/ui/bits.ts +45 -29
- package/src/ui/client.ts +33 -26
- package/src/ui/dom.ts +189 -108
- package/src/ui/format.ts +127 -72
- package/src/ui/hardware.ts +416 -343
- package/src/ui/header.ts +186 -164
- package/src/ui/index.ts +16 -9
- package/src/ui/jobs.ts +263 -214
- package/src/ui/main.ts +52 -48
- package/src/ui/overview.ts +152 -108
- package/src/ui/recent.ts +329 -276
- package/src/ui/requests.ts +69 -73
- package/src/ui/store.ts +236 -198
- package/src/ui/tree.ts +162 -130
- package/src/ui/variables.ts +557 -431
- package/src/watch.ts +22 -17
- package/src/ui/dev.ts +0 -579
- package/src/ui/fixture.ts +0 -548
package/src/ui/hardware.ts
CHANGED
|
@@ -2,367 +2,440 @@ import type { DebugDevice } from "../manifest.ts";
|
|
|
2
2
|
import { mapBits, readBits } from "./bits.ts";
|
|
3
3
|
import type { Quality } from "../api.ts";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
type View,
|
|
6
|
+
deviceHealth,
|
|
7
|
+
deviceHref,
|
|
8
|
+
devicesWithHealth,
|
|
9
|
+
empty,
|
|
10
|
+
fill,
|
|
11
|
+
h,
|
|
12
|
+
healthBadge,
|
|
13
|
+
pathLink,
|
|
14
|
+
sourceLink,
|
|
15
|
+
table,
|
|
13
16
|
} from "./dom.ts";
|
|
14
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
formatScalar,
|
|
19
|
+
formatValue,
|
|
20
|
+
valueState,
|
|
21
|
+
valueStateLabels,
|
|
22
|
+
} from "./format.ts";
|
|
15
23
|
import type { Store } from "./store.ts";
|
|
16
24
|
|
|
17
|
-
const deviceHref = (id: string) => `#/hardware/${encodeURIComponent(id)}`;
|
|
18
|
-
|
|
19
25
|
const assemblySummary = (device: DebugDevice) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
device.assemblies
|
|
27
|
+
.map(
|
|
28
|
+
(assembly) =>
|
|
29
|
+
`${assembly.direction === "input" ? "in" : "out"} ${assembly.bytes} B`,
|
|
30
|
+
)
|
|
31
|
+
.join(" · ");
|
|
32
|
+
|
|
33
|
+
/** Where an assembly's grid comes from, and how far to trust it. */
|
|
34
|
+
const rawBytesNote = (
|
|
35
|
+
bytes: number[] | null,
|
|
36
|
+
quality: string,
|
|
37
|
+
raw: string | undefined,
|
|
38
|
+
) => {
|
|
39
|
+
if (bytes) {
|
|
40
|
+
return quality === "good" ? " · raw bytes" : ` · raw bytes, ${quality}`;
|
|
41
|
+
}
|
|
42
|
+
if (raw) {
|
|
43
|
+
return " · raw bytes not read yet";
|
|
44
|
+
}
|
|
45
|
+
return " · no raw bytes in this build: it has no generated device tree";
|
|
46
|
+
};
|
|
23
47
|
|
|
24
48
|
const deviceList = (store: Store): View => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
49
|
+
const body = h("tbody");
|
|
50
|
+
const render = () =>
|
|
51
|
+
body.replaceChildren(
|
|
52
|
+
...store.manifest.devices.map((device) =>
|
|
53
|
+
h(
|
|
54
|
+
"tr",
|
|
55
|
+
{
|
|
56
|
+
class: "link-row",
|
|
57
|
+
onclick: () => (location.hash = deviceHref(device.id)),
|
|
58
|
+
},
|
|
59
|
+
h("td", {}, healthBadge(deviceHealth(store, device))),
|
|
60
|
+
h(
|
|
61
|
+
"td",
|
|
62
|
+
{},
|
|
63
|
+
h("a", { href: deviceHref(device.id), class: "mono" }, device.id),
|
|
64
|
+
),
|
|
65
|
+
h(
|
|
66
|
+
"td",
|
|
67
|
+
{},
|
|
68
|
+
[device.vendor, device.product].filter(Boolean).join(" "),
|
|
69
|
+
),
|
|
70
|
+
h(
|
|
71
|
+
"td",
|
|
72
|
+
{ class: "mono" },
|
|
73
|
+
device.network
|
|
74
|
+
? `${device.network.address}${device.network.rpiMs === undefined ? "" : ` · RPI ${device.network.rpiMs} ms`}`
|
|
75
|
+
: "",
|
|
76
|
+
),
|
|
77
|
+
h("td", {}, device.connection ?? ""),
|
|
78
|
+
h("td", { class: "mono" }, assemblySummary(device)),
|
|
79
|
+
h("td", { class: "num" }, String(device.channels.length)),
|
|
80
|
+
),
|
|
81
|
+
),
|
|
82
|
+
);
|
|
83
|
+
render();
|
|
84
|
+
store.show({ health: devicesWithHealth(store) });
|
|
85
|
+
return {
|
|
86
|
+
element: h(
|
|
87
|
+
"div",
|
|
88
|
+
{ class: "page" },
|
|
89
|
+
h("h1", {}, "Hardware"),
|
|
90
|
+
store.manifest.devices.length
|
|
91
|
+
? table(
|
|
92
|
+
{ class: "grid" },
|
|
93
|
+
[
|
|
94
|
+
"Health",
|
|
95
|
+
"Device",
|
|
96
|
+
"Product",
|
|
97
|
+
"Network",
|
|
98
|
+
"Connection",
|
|
99
|
+
"Assemblies",
|
|
100
|
+
"Channels",
|
|
101
|
+
],
|
|
102
|
+
body,
|
|
103
|
+
)
|
|
104
|
+
: empty("This build configures no devices."),
|
|
105
|
+
),
|
|
106
|
+
update(topics) {
|
|
107
|
+
if (
|
|
108
|
+
topics.has("devices") ||
|
|
109
|
+
topics.has("stream") ||
|
|
110
|
+
topics.has("session")
|
|
111
|
+
) {
|
|
112
|
+
render();
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
};
|
|
86
116
|
};
|
|
87
117
|
|
|
88
118
|
const deviceDetail = (store: Store, device: DebugDevice): View => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
119
|
+
const io = store.manifest.io.filter((entry) => entry.device === device.id);
|
|
120
|
+
const badge = h("span");
|
|
121
|
+
const status = h("dl", { class: "facts readings" });
|
|
122
|
+
const grids = h("div", { class: "assemblies" });
|
|
123
|
+
const channelBody = h("tbody");
|
|
94
124
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
125
|
+
/** The state for the manifest's `index`th assembly: the host lists them in the same order per direction. */
|
|
126
|
+
const bytesOf = (index: number) => {
|
|
127
|
+
const assembly = device.assemblies[index];
|
|
128
|
+
if (!assembly) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
const sameDirection = device.assemblies
|
|
132
|
+
.slice(0, index)
|
|
133
|
+
.filter((other) => other.direction === assembly.direction).length;
|
|
134
|
+
return store.devices
|
|
135
|
+
.get(device.id)
|
|
136
|
+
?.assemblies.filter((state) => state.direction === assembly.direction)[
|
|
137
|
+
sameDirection
|
|
138
|
+
];
|
|
139
|
+
};
|
|
106
140
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
141
|
+
const renderHealth = () => {
|
|
142
|
+
const health = deviceHealth(store, device);
|
|
143
|
+
badge.replaceChildren(
|
|
144
|
+
healthBadge(health),
|
|
145
|
+
health.detail ? h("span", { class: "dim" }, ` ${health.detail}`) : "",
|
|
146
|
+
);
|
|
147
|
+
};
|
|
114
148
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
149
|
+
/** Device states carry no sample time, so only the connection marks their values stale. */
|
|
150
|
+
const reading = (quality: Quality, value: string) => {
|
|
151
|
+
const state = valueState(quality, 0, {
|
|
152
|
+
connected: store.connected,
|
|
153
|
+
intervalMs: store.session.reading.intervalMs,
|
|
154
|
+
});
|
|
155
|
+
return [
|
|
156
|
+
h("span", { class: `value s-${state}` }, value),
|
|
157
|
+
h("span", { class: `meta s-${state}` }, valueStateLabels[state]),
|
|
158
|
+
];
|
|
159
|
+
};
|
|
126
160
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
161
|
+
const renderStatus = () => {
|
|
162
|
+
const values = store.devices.get(device.id)?.status ?? {};
|
|
163
|
+
fill(
|
|
164
|
+
status,
|
|
165
|
+
...Object.keys(device.status ?? {}).flatMap((label) => {
|
|
166
|
+
const entry = values[label];
|
|
167
|
+
return [
|
|
168
|
+
h("dt", {}, label),
|
|
169
|
+
h(
|
|
170
|
+
"dd",
|
|
171
|
+
{},
|
|
172
|
+
...(entry
|
|
173
|
+
? reading(entry.quality, formatScalar(entry.value))
|
|
174
|
+
: [h("span", { class: "value s-unavailable" }, "not read")]),
|
|
175
|
+
),
|
|
176
|
+
];
|
|
177
|
+
}),
|
|
178
|
+
);
|
|
179
|
+
};
|
|
146
180
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
181
|
+
const renderGrids = () =>
|
|
182
|
+
grids.replaceChildren(
|
|
183
|
+
...device.assemblies.map((assembly, index) => {
|
|
184
|
+
const state = bytesOf(index);
|
|
185
|
+
const bytes = state?.bytes ?? null;
|
|
186
|
+
const bits = mapBits(
|
|
187
|
+
device.id,
|
|
188
|
+
assembly.direction,
|
|
189
|
+
assembly.bytes,
|
|
190
|
+
device.channels,
|
|
191
|
+
io,
|
|
192
|
+
);
|
|
193
|
+
const quality = store.connected
|
|
194
|
+
? (state?.quality ?? "unavailable")
|
|
195
|
+
: "stale";
|
|
196
|
+
return h(
|
|
197
|
+
"section",
|
|
198
|
+
{ class: `panel assembly q-${quality}` },
|
|
199
|
+
h(
|
|
200
|
+
"h3",
|
|
201
|
+
{},
|
|
202
|
+
`${assembly.direction === "input" ? "Input" : "Output"} assembly · ${assembly.bytes} bytes`,
|
|
203
|
+
assembly.address
|
|
204
|
+
? h("span", { class: "mono dim" }, ` ${assembly.address}`)
|
|
205
|
+
: "",
|
|
206
|
+
h(
|
|
207
|
+
"span",
|
|
208
|
+
{ class: "dim" },
|
|
209
|
+
rawBytesNote(bytes, quality, assembly.raw),
|
|
210
|
+
),
|
|
211
|
+
),
|
|
212
|
+
h(
|
|
213
|
+
"div",
|
|
214
|
+
{ class: "bitgrid" },
|
|
215
|
+
h("span", { class: "bh" }, "byte"),
|
|
216
|
+
...Array.from({ length: 8 }, (_, bit) =>
|
|
217
|
+
h("span", { class: "bh" }, `.${bit}`),
|
|
218
|
+
),
|
|
219
|
+
h("span", { class: "bh" }, "hex"),
|
|
220
|
+
h("span", { class: "bh legend-head" }, "mapped"),
|
|
221
|
+
...Array.from({ length: assembly.bytes }, (_, byte) => {
|
|
222
|
+
const value = bytes?.[byte];
|
|
223
|
+
const starts = device.channels.filter(
|
|
224
|
+
(channel) =>
|
|
225
|
+
channel.direction === assembly.direction &&
|
|
226
|
+
channel.offsetBits >> 3 === byte,
|
|
227
|
+
);
|
|
228
|
+
return [
|
|
229
|
+
h("span", { class: "byte mono" }, `+${byte}`),
|
|
230
|
+
...Array.from({ length: 8 }, (_, bit) => {
|
|
231
|
+
const mapped = bits[byte * 8 + bit];
|
|
232
|
+
const on =
|
|
233
|
+
value === undefined ? undefined : (value >> bit) & 1;
|
|
234
|
+
const where = `byte ${byte} bit ${bit}`;
|
|
235
|
+
return h(
|
|
236
|
+
"span",
|
|
237
|
+
{
|
|
238
|
+
class: `bit${mapped ? " mapped" : ""}${on === 1 ? " on" : ""}${on === undefined ? " none" : ""}`,
|
|
239
|
+
title: mapped
|
|
240
|
+
? `${where} · ${mapped.channel.name} (${mapped.channel.id})${mapped.paths.map((path) => `\n${path}`).join("")}`
|
|
241
|
+
: `${where} · not mapped`,
|
|
242
|
+
},
|
|
243
|
+
on === undefined ? "·" : String(on),
|
|
244
|
+
mapped && mapped.channel.offsetBits === byte * 8 + bit
|
|
245
|
+
? h("small", {}, mapped.channel.id)
|
|
246
|
+
: undefined,
|
|
247
|
+
);
|
|
248
|
+
}),
|
|
249
|
+
h(
|
|
250
|
+
"span",
|
|
251
|
+
{ class: "hex mono" },
|
|
252
|
+
value === undefined
|
|
253
|
+
? "··"
|
|
254
|
+
: value.toString(16).padStart(2, "0").toUpperCase(),
|
|
255
|
+
),
|
|
256
|
+
h(
|
|
257
|
+
"span",
|
|
258
|
+
{ class: "legend" },
|
|
259
|
+
...starts.map((channel) =>
|
|
260
|
+
h(
|
|
261
|
+
"span",
|
|
262
|
+
{ class: "legend-item" },
|
|
263
|
+
h("b", {}, channel.id),
|
|
264
|
+
...io
|
|
265
|
+
.filter((entry) => entry.channel === channel.id)
|
|
266
|
+
.map((entry) =>
|
|
267
|
+
pathLink(
|
|
268
|
+
entry.path,
|
|
269
|
+
entry.path.split(".").slice(-3).join("."),
|
|
270
|
+
),
|
|
271
|
+
),
|
|
272
|
+
),
|
|
273
|
+
),
|
|
274
|
+
),
|
|
275
|
+
];
|
|
276
|
+
}).flat(),
|
|
277
|
+
),
|
|
278
|
+
);
|
|
279
|
+
}),
|
|
280
|
+
);
|
|
232
281
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
282
|
+
const renderChannels = () =>
|
|
283
|
+
channelBody.replaceChildren(
|
|
284
|
+
...device.channels.map((channel) => {
|
|
285
|
+
const index = device.assemblies.findIndex(
|
|
286
|
+
(assembly) => assembly.direction === channel.direction,
|
|
287
|
+
);
|
|
288
|
+
const bytes = index >= 0 ? bytesOf(index)?.bytes : undefined;
|
|
289
|
+
const raw = bytes
|
|
290
|
+
? readBits(bytes, channel.offsetBits, channel.bits)
|
|
291
|
+
: null;
|
|
292
|
+
const mapped = io.filter((entry) => entry.channel === channel.id);
|
|
293
|
+
return h(
|
|
294
|
+
"tr",
|
|
295
|
+
{},
|
|
296
|
+
h("td", { class: "mono" }, channel.id),
|
|
297
|
+
h(
|
|
298
|
+
"td",
|
|
299
|
+
{},
|
|
300
|
+
channel.name,
|
|
301
|
+
channel.description
|
|
302
|
+
? h("div", { class: "dim" }, channel.description)
|
|
303
|
+
: "",
|
|
304
|
+
),
|
|
305
|
+
h("td", {}, channel.direction),
|
|
306
|
+
h(
|
|
307
|
+
"td",
|
|
308
|
+
{ class: "mono" },
|
|
309
|
+
`${channel.offsetBits >> 3}.${channel.offsetBits & 7} · ${channel.bits} bit${channel.bits === 1 ? "" : "s"}`,
|
|
310
|
+
),
|
|
311
|
+
h("td", { class: "mono" }, channel.address ?? ""),
|
|
312
|
+
h(
|
|
313
|
+
"td",
|
|
314
|
+
{ class: "mono num", title: "Decoded from the raw assembly bytes" },
|
|
315
|
+
raw === null ? "—" : String(raw),
|
|
316
|
+
channel.unit ? ` ${channel.unit}` : "",
|
|
317
|
+
),
|
|
318
|
+
h(
|
|
319
|
+
"td",
|
|
320
|
+
{},
|
|
321
|
+
...(mapped.length
|
|
322
|
+
? mapped.map((entry) => {
|
|
323
|
+
const bound = store.devices
|
|
324
|
+
.get(device.id)
|
|
325
|
+
?.channels.find(
|
|
326
|
+
(candidate) =>
|
|
327
|
+
candidate.id === channel.id &&
|
|
328
|
+
candidate.path === entry.path,
|
|
329
|
+
);
|
|
330
|
+
const node = store.tree.resolve(entry.path);
|
|
331
|
+
return h(
|
|
332
|
+
"div",
|
|
333
|
+
{ class: "mapped-path" },
|
|
334
|
+
pathLink(entry.path),
|
|
335
|
+
entry.inverted
|
|
336
|
+
? h("span", { class: "tag" }, "inverted")
|
|
337
|
+
: "",
|
|
338
|
+
...(bound
|
|
339
|
+
? reading(
|
|
340
|
+
bound.quality,
|
|
341
|
+
formatValue(store.manifest, entry.type, bound.value),
|
|
342
|
+
)
|
|
343
|
+
: []),
|
|
344
|
+
node?.declaration
|
|
345
|
+
? sourceLink(store, node.declaration)
|
|
346
|
+
: "",
|
|
347
|
+
);
|
|
348
|
+
})
|
|
349
|
+
: [h("span", { class: "dim" }, "not mapped")]),
|
|
350
|
+
),
|
|
351
|
+
);
|
|
352
|
+
}),
|
|
353
|
+
);
|
|
292
354
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
355
|
+
renderHealth();
|
|
356
|
+
renderStatus();
|
|
357
|
+
renderGrids();
|
|
358
|
+
renderChannels();
|
|
359
|
+
store.show({ devices: [device.id] });
|
|
298
360
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
361
|
+
const identity: [string, string | undefined][] = [
|
|
362
|
+
["Vendor", device.vendor],
|
|
363
|
+
["Product", device.product],
|
|
364
|
+
["Product code", device.productCode],
|
|
365
|
+
["Address", device.network?.address],
|
|
366
|
+
[
|
|
367
|
+
"RPI",
|
|
368
|
+
device.network?.rpiMs === undefined
|
|
369
|
+
? undefined
|
|
370
|
+
: `${device.network.rpiMs} ms`,
|
|
371
|
+
],
|
|
372
|
+
["Connection", device.connection],
|
|
373
|
+
];
|
|
374
|
+
return {
|
|
375
|
+
element: h(
|
|
376
|
+
"div",
|
|
377
|
+
{ class: "page" },
|
|
378
|
+
h(
|
|
379
|
+
"div",
|
|
380
|
+
{ class: "crumbs" },
|
|
381
|
+
h("a", { href: "#/hardware" }, "Hardware"),
|
|
382
|
+
" / ",
|
|
383
|
+
),
|
|
384
|
+
h("h1", { class: "mono" }, device.id, " ", badge),
|
|
385
|
+
h(
|
|
386
|
+
"dl",
|
|
387
|
+
{ class: "facts" },
|
|
388
|
+
...identity.flatMap(([label, value]) =>
|
|
389
|
+
value === undefined
|
|
390
|
+
? []
|
|
391
|
+
: [h("dt", {}, label), h("dd", { class: "mono" }, value)],
|
|
392
|
+
),
|
|
393
|
+
),
|
|
394
|
+
device.status && h("h2", {}, "Status"),
|
|
395
|
+
status,
|
|
396
|
+
grids,
|
|
397
|
+
h("h2", {}, "Channels"),
|
|
398
|
+
device.channels.length
|
|
399
|
+
? table(
|
|
400
|
+
{ class: "grid" },
|
|
401
|
+
["Id", "Name", "Dir", "Bits", "Address", "Raw", "TypeScript"],
|
|
402
|
+
channelBody,
|
|
403
|
+
)
|
|
404
|
+
: empty("No channels configured."),
|
|
405
|
+
),
|
|
406
|
+
update(topics) {
|
|
407
|
+
if (
|
|
408
|
+
topics.has("devices") ||
|
|
409
|
+
topics.has("stream") ||
|
|
410
|
+
topics.has("session")
|
|
411
|
+
) {
|
|
412
|
+
renderHealth();
|
|
413
|
+
renderStatus();
|
|
414
|
+
renderGrids();
|
|
415
|
+
renderChannels();
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
};
|
|
352
419
|
};
|
|
353
420
|
|
|
354
421
|
export const hardwareView = (store: Store, id: string | undefined): View => {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
422
|
+
if (id === undefined) {
|
|
423
|
+
return deviceList(store);
|
|
424
|
+
}
|
|
425
|
+
const device = store.manifest.devices.find(
|
|
426
|
+
(candidate) => candidate.id === id,
|
|
427
|
+
);
|
|
428
|
+
if (device) {
|
|
429
|
+
return deviceDetail(store, device);
|
|
430
|
+
}
|
|
431
|
+
store.show();
|
|
432
|
+
return {
|
|
433
|
+
element: h(
|
|
434
|
+
"div",
|
|
435
|
+
{ class: "page" },
|
|
436
|
+
h("h1", {}, "Hardware"),
|
|
437
|
+
empty(`No device ${id} in this build.`),
|
|
438
|
+
),
|
|
439
|
+
update() {},
|
|
440
|
+
};
|
|
368
441
|
};
|