Skip to content

Commit 93d4728

Browse files
committed
web: MqttComponents: add title to MqttChart
The title that is currently shown when hovering over a plot ("eh") is not _that_ helpful. Specify one when creating an MqttChart instance instead. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
1 parent 32a0924 commit 93d4728

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

web/src/DashboardDut.tsx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,17 @@ export default function DashboardDut() {
103103
<ColumnLayout columns={2} variant="text-grid">
104104
<Box>
105105
<Box variant="awsui-key-label">DUT voltage (V)</Box>
106-
<MqttChart topic="/v1/dut/feedback/voltage" />
106+
<MqttChart
107+
title="DUT Voltage"
108+
topic="/v1/dut/feedback/voltage"
109+
/>
107110
</Box>
108111
<Box>
109112
<Box variant="awsui-key-label">DUT current (A)</Box>
110-
<MqttChart topic="/v1/dut/feedback/current" />
113+
<MqttChart
114+
title="DUT Current"
115+
topic="/v1/dut/feedback/current"
116+
/>
111117
</Box>
112118
</ColumnLayout>
113119
<ColumnLayout columns={4} variant="text-grid">
@@ -239,7 +245,10 @@ export default function DashboardDut() {
239245
additionalInfo="The absolute voltage is independent of pin orientation"
240246
/>
241247
<UnloadingSection header={`OUT_${port} voltage plot (V)`}>
242-
<MqttChart topic={`/v1/output/out_${port}/feedback/voltage`} />
248+
<MqttChart
249+
title={`OUT_${port} Voltage`}
250+
topic={`/v1/output/out_${port}/feedback/voltage`}
251+
/>
243252
</UnloadingSection>
244253
</SpaceBetween>
245254
</ColumnLayout>
@@ -304,7 +313,10 @@ export default function DashboardDut() {
304313
additionalInfo="Too many devices may overload the bus"
305314
/>
306315
<UnloadingSection header="IOBus current plot">
307-
<MqttChart topic="/v1/iobus/feedback/current" />
316+
<MqttChart
317+
title="IOBus current"
318+
topic="/v1/iobus/feedback/current"
319+
/>
308320
</UnloadingSection>
309321
<MqttBarMeter
310322
topic="/v1/iobus/feedback/voltage"
@@ -318,7 +330,10 @@ export default function DashboardDut() {
318330
additionalInfo="The voltage will go down if the bus is overloaded"
319331
/>
320332
<UnloadingSection header="IOBus voltage plot">
321-
<MqttChart topic="/v1/iobus/feedback/voltage" />
333+
<MqttChart
334+
title="IOBus current"
335+
topic="/v1/iobus/feedback/voltage"
336+
/>
322337
</UnloadingSection>
323338
</SpaceBetween>
324339
</ColumnLayout>
@@ -380,6 +395,7 @@ export default function DashboardDut() {
380395
/>
381396
<UnloadingSection header={`USB Port ${port} current plot`}>
382397
<MqttChart
398+
title={`Port ${port} current`}
383399
topic={`/v1/usb/host/port${port}/feedback/current`}
384400
/>
385401
</UnloadingSection>

web/src/MqttComponents.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ function measToPoint(m: Measurement) {
260260
}
261261

262262
interface MqttChartProps {
263+
title: string;
263264
topic: string;
264265
}
265266

@@ -275,7 +276,7 @@ export function MqttChart(props: MqttChartProps) {
275276

276277
let series: MixedLineBarChartProps.ChartSeries<Date> = {
277278
type: "line",
278-
title: "eh",
279+
title: props.title,
279280
data: values,
280281
};
281282

0 commit comments

Comments
 (0)