Skip to content

Commit 6c56b83

Browse files
siwei-zhang-workSiwei Zhangbhufmann
authored
Update parsing of sampling to match tsp specification (#354)
Update parsing of sampling to match tsp specification The tsp-typescript-client was modified to comply to tsp specification for sampling, update accordingly here. Account for new xRanges and xCategories for generic xy output component. Contributes to fix: eclipse-tracecompass-incubator/org.eclipse.tracecompass.incubator#236 Upgrade to tsp-typescript-client v0.9.0. Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com> Co-authored-by: Siwei Zhang <siwei.zhang@ericsson.com> Co-authored-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
1 parent 93e5cec commit 6c56b83

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

local-libs/traceviewer-libs/base/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"src"
1717
],
1818
"dependencies": {
19-
"tsp-typescript-client": "^0.8.0"
19+
"tsp-typescript-client": "^0.9.0"
2020
},
2121
"devDependencies": {
2222
"@typescript-eslint/eslint-plugin": "^6.0.0",

local-libs/traceviewer-libs/react-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"react-virtualized": "^9.21.0",
3737
"timeline-chart": "^0.4.2",
3838
"traceviewer-base": "0.9.1",
39-
"tsp-typescript-client": "^0.8.0"
39+
"tsp-typescript-client": "^0.9.0"
4040
},
4141
"devDependencies": {
4242
"@testing-library/react": "^15.0.6",

local-libs/traceviewer-libs/react-components/src/components/generic-xy-output-component.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ export class GenericXYOutputComponent extends AbstractTreeOutputComponent<Generi
320320

321321
const style = (series[0] as any)?.style?.values?.['series-type'] as string | undefined;
322322
const st = style?.toLowerCase();
323-
const xv = series[0].xValues as Sampling;
324-
this.isTimeAxis = isTimestampSampling(xv);
323+
this.isTimeAxis = !!series[0].xValues;
325324
this.mode = st === 'scatter' ? ChartMode.SCATTER : st === 'line' ? ChartMode.LINE : ChartMode.BAR;
326325

327326
const xy = this.buildXYData(series, this.mode);
@@ -342,9 +341,9 @@ export class GenericXYOutputComponent extends AbstractTreeOutputComponent<Generi
342341
}
343342

344343
private buildBarChartData(seriesObj: XYSeries[]): GenericXYData {
345-
const xValues = seriesObj[0].xValues;
344+
const xValues = seriesObj[0].xValues ?? seriesObj[0].xRanges ?? seriesObj[0].xCategories;
346345
const unit = seriesObj[0]?.xValuesDescription?.unit || '';
347-
const labels = this.buildLabels(xValues, unit);
346+
const labels = this.buildLabels(xValues as Sampling, unit);
348347
const datasets: GenericXYData['datasets'] = seriesObj.map(s => {
349348
const color = this.colors.get(s.seriesName);
350349
return {
@@ -361,9 +360,9 @@ export class GenericXYOutputComponent extends AbstractTreeOutputComponent<Generi
361360
}
362361

363362
private buildLineOrScatterChartData(seriesObj: XYSeries[], mode: ChartMode): GenericXYData {
364-
const xValues = seriesObj[0].xValues;
363+
const xValues = seriesObj[0].xValues ?? seriesObj[0].xRanges ?? seriesObj[0].xCategories;
365364
const unit = seriesObj[0]?.xValuesDescription?.unit || '';
366-
const labels = this.buildLabels(xValues, unit);
365+
const labels = this.buildLabels(xValues as Sampling, unit);
367366

368367
const datasets: GenericXYData['datasets'] = seriesObj.map(s => {
369368
const color = this.colors.get(s.seriesName);
@@ -388,7 +387,7 @@ export class GenericXYOutputComponent extends AbstractTreeOutputComponent<Generi
388387

389388
private buildLabels(xValues: Sampling, unit: string): string[] {
390389
if (isRangeSampling(xValues)) {
391-
return xValues.map(range => `[${range[0]} ${unit}, ${range[1]} ${unit}]`);
390+
return xValues.map(range => `[${range.start} ${unit}, ${range.end} ${unit}]`);
392391
} else if (isCategorySampling(xValues)) {
393392
return xValues.map(val => `${val} ${unit}`);
394393
} else if (isTimestampSampling(xValues)) {

vscode-trace-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"dependencies": {
1212
"traceviewer-base": "^0.9.1",
13-
"tsp-typescript-client": "^0.8.0",
13+
"tsp-typescript-client": "^0.9.0",
1414
"vscode-messenger": "^0.5.0"
1515
},
1616
"devDependencies": {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9786,10 +9786,10 @@ tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0:
97869786
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"
97879787
integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==
97889788

9789-
tsp-typescript-client@^0.8.0:
9790-
version "0.8.0"
9791-
resolved "https://registry.yarnpkg.com/tsp-typescript-client/-/tsp-typescript-client-0.8.0.tgz#954a58acf53e52e57796e5fc2e3fe1f512c2af45"
9792-
integrity sha512-dad+EVvP3bIosuskKzZxPwiuT47ewq0rXOrg/SMnFqdE5QVXyn3MhDcXFYH9iNxRvu2zQcb+DMigN/WOcdMrEQ==
9789+
tsp-typescript-client@^0.9.0:
9790+
version "0.9.0"
9791+
resolved "https://registry.npmjs.org/tsp-typescript-client/-/tsp-typescript-client-0.9.0.tgz#631b57635560f23a96dd8391db345bb0e645b7c5"
9792+
integrity sha512-tftuTbID6t9m+hJ6LRHbCC5dkRL//OcGladeDtbiwe1Te/HknO8XmYNvsx0xRa8MpPUG9Th15ON4whXfzzBUew==
97939793
dependencies:
97949794
json-bigint sidorares/json-bigint#2c0a5f896d7888e68e5f4ae3c7ea5cd42fd54473
97959795
node-fetch "^2.6.0"

0 commit comments

Comments
 (0)