Skip to content

Commit 8860de9

Browse files
ankusht-workMatthewKhouzam
authored andcommitted
Apply default style to GAP states
Removed the text "GAP" from GAP states Fixes #148 Signed-off-by: Ankush Tyagi <[email protected]>
1 parent 582ee9b commit 8860de9

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

viewer-prototype/src/browser/trace-viewer/components/data-providers/tsp-data-provider.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { TspClient } from 'tsp-typescript-client/lib/protocol/tsp-client';
22
import { TimeGraphEntry, TimeGraphRow, TimeGraphState } from 'tsp-typescript-client/lib/models/timegraph';
33
import { TimelineChart } from 'timeline-chart/lib/time-graph-model';
44
import { QueryHelper } from 'tsp-typescript-client/lib/models/query/query-helper';
5+
import { OutputElementStyle } from 'tsp-typescript-client/lib/models/styles';
56

67
export class TspDataProvider {
78

@@ -79,15 +80,34 @@ export class TspDataProvider {
7980
if (timeGraphRow) {
8081
newTimeGraphRows.push(timeGraphRow);
8182
} else {
82-
const emptyRow: TimeGraphRow = {states: [{start: 0, end: 0, label: '', tags: 0}], entryId: id};
83+
const emptyRow: TimeGraphRow = { states: [{ start: 0, end: 0, label: '', tags: 0 }], entryId: id };
8384
newTimeGraphRows.push(emptyRow);
8485
}
8586
});
8687

8788
this.timeGraphRows = newTimeGraphRows;
8889
}
8990

91+
private getDefaultForGapStyle() {
92+
// Default color and height for the GAP state
93+
return {
94+
parentKey: '',
95+
values: {
96+
color: 0xCACACA,
97+
height: 1.0
98+
}
99+
};
100+
101+
}
102+
90103
private getRowModel(row: TimeGraphRow, chartStart: number, rowId: number, entry: TimeGraphEntry) {
104+
105+
let gapStyle: OutputElementStyle;
106+
if (!entry.style) {
107+
gapStyle = this.getDefaultForGapStyle();
108+
} else {
109+
gapStyle = entry.style;
110+
}
91111
const states: TimelineChart.TimeGraphRowElementModel[] = [];
92112
let prevPossibleState = entry.start;
93113
let nextPossibleState = entry.end;
@@ -114,13 +134,13 @@ export class TspDataProvider {
114134
states.push({
115135
// TODO: We should probably remove id from state. We don't use it anywhere.
116136
id: row.entryId + '-' + idx,
117-
label: 'GAP',
137+
label: '',
118138
range: {
119139
start: end,
120140
end: nextState.start - chartStart
121141
},
122142
data: {
123-
143+
style: gapStyle
124144
}
125145
});
126146
}

0 commit comments

Comments
 (0)