Skip to content

Commit 1329f52

Browse files
author
Patricio Albizu
committed
Merge branch 'main' of github.com:hypertrace/hypertrace-ui into UnableToClickTopology
2 parents 5aadb52 + 11efdfb commit 1329f52

File tree

9 files changed

+80
-49
lines changed

9 files changed

+80
-49
lines changed

package-lock.json

Lines changed: 18 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"d3-transition": "^1.2.0",
5959
"d3-zoom": "^1.8.3",
6060
"graphql": "^15.5.0",
61-
"graphql-tag": "^2.12.1",
61+
"graphql-tag": "^2.12.3",
6262
"iso8601-duration": "^1.3.0",
6363
"lodash-es": "^4.17.21",
6464
"rxjs": "~6.6.7",
@@ -67,7 +67,7 @@
6767
"zone.js": "^0.11.4"
6868
},
6969
"devDependencies": {
70-
"@angular-builders/jest": "^11.0.0",
70+
"@angular-builders/jest": "^11.1.1",
7171
"@angular-devkit/build-angular": "~0.1102.0",
7272
"@angular/cli": "11.2.6",
7373
"@angular/compiler-cli": "~11.2.0",
@@ -102,7 +102,7 @@
102102
"jest-junit": "^12.0.0",
103103
"jest-preset-angular": "^8.4.0",
104104
"lodash": "^4.17.21",
105-
"ng-mocks": "^11.9.1",
105+
"ng-mocks": "^11.10.0",
106106
"ng-packagr": "^11.2.4",
107107
"prettier": "^2.2.1",
108108
"pretty-quick": "^3.0.0",

projects/components/src/table/cells/state-parsers/table-cell-state-parser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TableRowState } from '../../table-api';
1+
import { StatefulTableRow, TableRowState } from '../../table-api';
22
import { TableCellParser } from '../table-cell-parser';
33
import { TableCellParserBase } from '../table-cell-parser-base';
44
import { CoreTableCellParserType } from '../types/core-table-cell-parser-type';
@@ -7,8 +7,8 @@ import { CoreTableCellParserType } from '../types/core-table-cell-parser-type';
77
type: CoreTableCellParserType.State
88
})
99
export class TableCellStateParser extends TableCellParserBase<TableRowState, TableRowState, undefined> {
10-
public parseValue(cellData: TableRowState): TableRowState {
11-
return cellData;
10+
public parseValue(_: TableRowState, rowData: StatefulTableRow): TableRowState {
11+
return rowData.$$state;
1212
}
1313

1414
public parseFilterValue(): undefined {

projects/components/src/table/cells/types/core-table-cell-parser-type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const enum CoreTableCellParserType {
2-
State = 'state',
32
Boolean = 'boolean',
43
Number = 'number',
4+
State = 'state',
55
String = 'string',
66
Timestamp = 'timestamp',
77
Icon = 'icon',

projects/components/src/table/data/table-cdk-data-source.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class TableCdkDataSource implements DataSource<TableRow> {
5959
.pipe(
6060
tap(() => this.loadingStateSubject.next({ loading$: NEVER })),
6161
/**
62-
* Below debouce is needed to handle multiple emission from buildChangeObservable.
62+
* Below debounce is needed to handle multiple emission from buildChangeObservable.
6363
*/
6464
debounceTime(100),
6565
mergeMap(([columnConfigs, pageEvent, filters, queryProperties, changedColumn, changedRow]) =>

projects/components/src/table/table.component.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ describe('Table component', () => {
306306
expectObservable(spectator.component.columnConfigs$).toBe('x', {
307307
x: [
308308
expect.objectContaining({
309-
id: '$$state',
309+
id: '$$selected',
310310
display: CoreTableCellRendererType.Checkbox,
311311
visible: true
312312
}),
@@ -371,16 +371,21 @@ describe('Table component', () => {
371371
map(columnConfigs => columnConfigs.map(columnConfig => spectator.component.isExpanderColumn(columnConfig)))
372372
)
373373
).toBe('x', {
374-
x: [true, false, false]
374+
x: [true, false, false, false]
375375
});
376376

377377
expectObservable(spectator.component.columnConfigs$).toBe('x', {
378378
x: [
379379
expect.objectContaining({
380-
id: '$$state',
380+
id: '$$expanded',
381381
display: CoreTableCellRendererType.RowExpander,
382382
visible: true
383383
}),
384+
expect.objectContaining({
385+
id: '$$selected',
386+
display: CoreTableCellRendererType.Checkbox,
387+
visible: true
388+
}),
384389
expect.objectContaining({
385390
id: 'firstId'
386391
}),

projects/components/src/table/table.component.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ export class TableComponent
194194
private static readonly SORT_DIRECTION_URL_PARAM: string = 'sort-direction';
195195

196196
private readonly expandableToggleColumnConfig: TableColumnConfig = {
197-
id: '$$state',
197+
id: '$$expanded',
198198
width: '32px',
199199
visible: true,
200200
display: CoreTableCellRendererType.RowExpander,
201201
onClick: (row: StatefulTableRow) => this.toggleRowExpanded(row)
202202
};
203203

204204
private readonly multiSelectRowColumnConfig: TableColumnConfig = {
205-
id: '$$state',
205+
id: '$$selected',
206206
width: '32px',
207207
visible: true,
208208
display: CoreTableCellRendererType.Checkbox,
@@ -569,11 +569,15 @@ export class TableComponent
569569
}
570570

571571
private buildColumnConfigExtendeds(columnConfigs: TableColumnConfig[]): TableColumnConfigExtended[] {
572-
const stateColumns = this.hasExpandableRows()
573-
? [this.expandableToggleColumnConfig]
574-
: this.hasMultiSelect()
575-
? [this.multiSelectRowColumnConfig]
576-
: [];
572+
const stateColumns = [];
573+
574+
if (this.hasExpandableRows()) {
575+
stateColumns.push(this.expandableToggleColumnConfig);
576+
}
577+
578+
if (this.hasMultiSelect()) {
579+
stateColumns.push(this.multiSelectRowColumnConfig);
580+
}
577581

578582
return this.tableService.buildExtendedColumnConfigs(
579583
[...stateColumns, ...columnConfigs],

projects/distributed-tracing/src/shared/dashboard/widgets/trace-detail/data/api-trace-detail-data-source.model.test.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ModelApi } from '@hypertrace/hyperdash';
2+
import { ObservabilityTraceType } from '@hypertrace/observability';
23
import { spanIdKey } from '../../../../graphql/model/schema/span';
34
import { traceIdKey, traceTypeKey, TRACE_SCOPE } from '../../../../graphql/model/schema/trace';
45
import {
@@ -8,7 +9,7 @@ import {
89
import { ObservedGraphQlRequest } from '../../../data/graphql/graphql-query-event.service';
910
import { ApiTraceDetailDataSourceModel } from './api-trace-detail-data-source.model';
1011

11-
describe('Trace detail data source model', () => {
12+
describe('API Trace detail data source model', () => {
1213
const testTimeRange = { startTime: new Date(1568907645141), endTime: new Date(1568911245141) };
1314
let model!: ApiTraceDetailDataSourceModel;
1415
let emittedQueries: unknown;
@@ -66,7 +67,11 @@ describe('Trace detail data source model', () => {
6667
});
6768
});
6869

69-
test('builds expected request', () => {
70+
test('builds expected request for API_TRACE', () => {
71+
model.trace = {
72+
[traceIdKey]: 'test',
73+
[traceTypeKey]: ObservabilityTraceType.Api
74+
};
7075
const data$ = model.getData();
7176
data$.subscribe();
7277

@@ -86,6 +91,25 @@ describe('Trace detail data source model', () => {
8691
);
8792
});
8893

94+
test('builds expected request', () => {
95+
const data$ = model.getData();
96+
data$.subscribe();
97+
98+
expect(emittedQueries).toEqual(
99+
expect.objectContaining({
100+
requestType: TRACE_GQL_REQUEST,
101+
traceId: 'test',
102+
spanLimit: 0,
103+
timestamp: undefined,
104+
traceProperties: expect.arrayContaining([
105+
expect.objectContaining({ name: 'tags' }),
106+
expect.objectContaining({ name: 'traceId' }),
107+
expect.objectContaining({ name: 'statusCode' })
108+
])
109+
})
110+
);
111+
});
112+
89113
test('builds expected request with start time', () => {
90114
model.startTime = 1568907645141;
91115
const data$ = model.getData();
@@ -100,8 +124,7 @@ describe('Trace detail data source model', () => {
100124
traceProperties: expect.arrayContaining([
101125
expect.objectContaining({ name: 'tags' }),
102126
expect.objectContaining({ name: 'traceId' }),
103-
expect.objectContaining({ name: 'statusCode' }),
104-
expect.objectContaining({ name: 'apiCalleeNameCount' })
127+
expect.objectContaining({ name: 'statusCode' })
105128
])
106129
})
107130
);

projects/distributed-tracing/src/shared/dashboard/widgets/trace-detail/data/api-trace-detail-data-source.model.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import { Model } from '@hypertrace/hyperdash';
2-
import { Trace, traceIdKey } from '../../../../graphql/model/schema/trace';
2+
import { Trace, traceIdKey, traceTypeKey } from '../../../../graphql/model/schema/trace';
33

44
import { Dictionary } from '@hypertrace/common';
5+
import { ObservabilityTraceType } from '@hypertrace/observability';
56
import { TraceDetailData, TraceDetailDataSourceModel } from './trace-detail-data-source.model';
67

78
@Model({
89
type: 'api-trace-detail-data-source'
910
})
1011
export class ApiTraceDetailDataSourceModel extends TraceDetailDataSourceModel {
1112
protected getTraceAttributes(): string[] {
12-
return [...super.getTraceAttributes(), 'traceId', 'apiCalleeNameCount'];
13+
const attributes: string[] = [...super.getTraceAttributes(), 'traceId'];
14+
if (this.trace[traceTypeKey] === ObservabilityTraceType.Api) {
15+
attributes.push('apiCalleeNameCount');
16+
}
17+
18+
return attributes;
1319
}
1420

1521
protected constructTraceDetailData(trace: Trace): ApiTraceDetailData {

0 commit comments

Comments
 (0)