Skip to content

Commit

Permalink
display timings in packet list
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Jan 5, 2024
1 parent 4649db4 commit 063e0fb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"microbit",
"microcontroller",
"microcontrollers",
"millis",
"pbuf",
"pixdata",
"qwiic",
Expand Down
2 changes: 1 addition & 1 deletion jacdac-ts
Submodule jacdac-ts updated 1 files
+4 −5 src/jdom/pretty.ts
2 changes: 1 addition & 1 deletion src/components/PacketListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default function PacketListItem(props: {
: ""
}`
const secondary = `${
showTime ? `${prettyDuration(packet.timestamp)}: ` : ""
showTime ? `${prettyDuration(packet.timestamp, true)}: ` : ""
}${packet.isCommand ? "to" : "from"} ${packet.friendlyDeviceName}/${
packet.friendlyServiceName
}${notImplemented ? `, not implemented` : ""}`
Expand Down
13 changes: 10 additions & 3 deletions src/components/tools/PacketInspector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import Alert from "../ui/Alert"
import PacketsContext from "../PacketsContext"
// tslint:disable-next-line: no-submodule-imports match-default-export-name
import HistoryIcon from "@mui/icons-material/History"
import { Box, Chip, Tooltip, useTheme } from "@mui/material"
import { Box, Chip, Tooltip, Typography, useTheme } from "@mui/material"
import PacketSpecification from "../specification/PacketSpecification"
import { printPacket } from "../../../jacdac-ts/src/jdom/pretty"
import { prettyDuration, printPacket } from "../../../jacdac-ts/src/jdom/pretty"
import PacketHeaderLayout from "../PacketHeaderLayout"
import {
META_ACK,
Expand Down Expand Up @@ -67,7 +67,14 @@ export default function PacketInspector() {
{`${name} ${packet.isCommand ? "to" : "from"} ${
packet.friendlyDeviceName
}/${packet.friendlyServiceName}`}

<Chip
sx={{ mr: 0.25 }}
aria-label={`timestamp: ${prettyDuration(
packet.timestamp,
true
)}`}
label={prettyDuration(packet.timestamp, true)}
/>
{packet.sender && (
<Chip
aria-label={`sender: ${packet.sender}`}
Expand Down
6 changes: 4 additions & 2 deletions src/components/trace/TraceTimeFilterRangeSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export default function TraceTimeFilterRangeSlider() {

if (!minMax || !debouncedValue) return <></>

const d = (ms: number) => prettyDuration(ms)

return (
<Box display="flex" pl={theme.spacing(0.25)} pr={theme.spacing(0.25)}>
<Slider
Expand All @@ -44,8 +46,8 @@ export default function TraceTimeFilterRangeSlider() {
value={value}
onChange={handleChange}
valueLabelDisplay="auto"
getAriaValueText={prettyDuration}
valueLabelFormat={prettyDuration}
getAriaValueText={d}
valueLabelFormat={d}
/>
</Box>
)
Expand Down

0 comments on commit 063e0fb

Please sign in to comment.