Skip to content

Commit b0c90c2

Browse files
committed
Fix submitting new selection ranges from the Time Range Data View
Since commit d857eae where the vscode-messenger was introduced this feature has been broken. The request to update the selection range after submitting the new range from the Time Range Data view was not propagated to the trace viewer webview where the time axis and selection is updated. This PR fixes this. Note that this fix sends the selection range to the correct widget and handles the bigint values in the signal payload correctly. fixes #357 Signed-off-by: Bernd Hufmann <[email protected]>
1 parent 788d3fe commit b0c90c2

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import { TimeRange } from '../utils/time-range';
1+
import { ITimeRange, TimeRange } from '../utils/time-range';
2+
3+
import { createNormalizer } from 'tsp-typescript-client/lib/protocol/serialization';
4+
5+
export const TimeRangeUpdatePayload = createNormalizer<TimeRangeUpdatePayload>({
6+
timeRange: ITimeRange
7+
});
28

39
export interface TimeRangeUpdatePayload {
410
experimentUUID: string;
5-
timeRange?: TimeRange;
11+
timeRange?: ITimeRange;
612
}

base/src/utils/time-range.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
1+
import { createNormalizer } from 'tsp-typescript-client/lib/protocol/serialization';
2+
13
export interface TimeRangeString {
24
start: string;
35
end: string;
46
offset?: string;
57
}
68

7-
export class TimeRange {
8-
private start: bigint;
9-
private end: bigint;
10-
private offset: bigint | undefined;
9+
export const ITimeRange = createNormalizer<ITimeRange>({
10+
start: BigInt,
11+
end: BigInt,
12+
offset: BigInt
13+
});
14+
15+
export interface ITimeRange {
16+
start: bigint;
17+
end: bigint;
18+
offset: bigint | undefined;
19+
toString(): TimeRangeString;
20+
}
21+
22+
export class TimeRange implements ITimeRange {
23+
start: bigint;
24+
end: bigint;
25+
offset: bigint | undefined;
1126

1227
/**
1328
* Constructor.

react-components/src/components/trace-context-component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,8 @@ export class TraceContextComponent extends React.Component<TraceContextProps, Tr
935935
const { timeRange, experimentUUID } = payload;
936936
if (experimentUUID === this.props.experiment.UUID && timeRange) {
937937
this.unitController.selectionRange = {
938-
start: timeRange.getStart(),
939-
end: timeRange.getEnd()
938+
start: timeRange.start,
939+
end: timeRange.end
940940
};
941941
}
942942
};

0 commit comments

Comments
 (0)