Explorer groupby subpath support by aaron-steinfeld · Pull Request #1369 · hypertrace/hypertrace-ui · GitHub
Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export class ExplorerComponent {
private tryDecodeAttributeExpression(expressionString: string): [AttributeExpression] | [] {
const [key, subpath] = expressionString.split('__');

return [{ key: key, ...(isEmpty(subpath) ? { subpath: subpath } : {}) }];
return [{ key: key, ...(!isEmpty(subpath) ? { subpath: subpath } : {}) }];
}
}
interface ContextToggleItem extends ToggleItem<ExplorerContextScope> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ describe('Explore query editor', () => {
const options = spectator.queryAll('.select-option', { root: true });
spectator.click(options[1]);

spectator.tick(10);
spectator.tick(510); // Debounced

expect(onRequestChange).toHaveBeenLastCalledWith(
expect.objectContaining({
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('Explore query editor', () => {
const options = spectator.queryAll('.select-option', { root: true });
spectator.click(options[1]);

spectator.tick(10);
spectator.tick(510);

const limitInputEl = spectator.query('ht-explore-query-limit-editor input') as HTMLInputElement;
limitInputEl.value = '6';
Expand Down Expand Up @@ -271,7 +271,7 @@ describe('Explore query editor', () => {
const options = spectator.queryAll('.select-option', { root: true });
spectator.click(options[1]);

spectator.tick(10);
spectator.tick(510); // Debounced

spectator.click('.limit-include-rest-container input[type="checkbox"]');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnI
import { TypedSimpleChanges } from '@hypertrace/common';
import { Filter } from '@hypertrace/components';
import { Observable } from 'rxjs';
import { AttributeExpression } from '../../graphql/model/attribute/attribute-expression';
import { GraphQlGroupBy } from '../../graphql/model/schema/groupby/graphql-group-by';
import { IntervalValue } from '../interval-select/interval-select.component';
import {
Expand Down Expand Up @@ -39,8 +40,8 @@ import {
<ht-explore-query-group-by-editor
class="group-by"
[context]="currentVisualization.context"
[groupByKey]="(currentVisualization.groupBy?.keyExpressions)?.[0]?.key"
(groupByKeyChange)="this.updateGroupByKey(currentVisualization.groupBy, $event)"
[groupByExpression]="(currentVisualization.groupBy?.keyExpressions)[0]"
(groupByExpressionChange)="this.updateGroupByExpression(currentVisualization.groupBy, $event)"
></ht-explore-query-group-by-editor>

<ht-explore-query-limit-editor
Expand Down Expand Up @@ -104,22 +105,22 @@ export class ExploreQueryEditorComponent implements OnChanges, OnInit {
}

if (changeObject.groupBy && this.groupBy?.keyExpressions.length) {
this.updateGroupByKey(this.groupBy, this.groupBy.keyExpressions[0]?.key);
this.updateGroupByExpression(this.groupBy, this.groupBy.keyExpressions[0]);
}
}

public setSeries(series: ExploreSeries[]): void {
this.visualizationBuilder.setSeries(series);
}

public updateGroupByKey(groupBy?: GraphQlGroupBy, key?: string): void {
if (key === undefined) {
public updateGroupByExpression(groupBy?: GraphQlGroupBy, keyExpression?: AttributeExpression): void {
if (keyExpression === undefined) {
this.visualizationBuilder.groupBy();
} else {
this.visualizationBuilder.groupBy(
groupBy
? { ...groupBy, keyExpressions: [{ key: key }] }
: { keyExpressions: [{ key: key }], limit: ExploreQueryEditorComponent.DEFAULT_GROUP_LIMIT }
? { ...groupBy, keyExpressions: [keyExpression] }
: { keyExpressions: [keyExpression], limit: ExploreQueryEditorComponent.DEFAULT_GROUP_LIMIT }
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { ButtonModule, InputModule, SelectModule, TooltipModule, TraceCheckboxModule } from '@hypertrace/components';
import {
ButtonModule,
FormFieldModule,
InputModule,
LetAsyncModule,
SelectModule,
TooltipModule,
TraceCheckboxModule
} from '@hypertrace/components';
import { IntervalSelectModule } from '../interval-select/interval-select.module';
import { ExploreQueryEditorComponent } from './explore-query-editor.component';
import { ExploreQueryGroupByEditorComponent } from './group-by/explore-query-group-by-editor.component';
Expand All @@ -26,7 +34,9 @@ import { ExploreQuerySeriesGroupEditorComponent } from './series/explore-query-s
TooltipModule,
InputModule,
IntervalSelectModule,
TraceCheckboxModule
TraceCheckboxModule,
LetAsyncModule,
FormFieldModule
]
})
export class ExploreQueryEditorModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,29 @@

.group-by-container {
display: flex;
flex-direction: column;
flex-direction: row;
gap: 24px;

.group-by-label {
@include body-1-medium($gray-9);
height: 32px;
line-height: 32px;
margin-bottom: 12px;
.group-by-input-container {
display: flex;
flex-direction: column;

.group-by-label {
@include body-1-medium($gray-9);
height: 32px;
line-height: 32px;
margin-bottom: 12px;
}

.group-by-path-wrapper {
width: 100px;

.group-by-path-input {
@include body-2-regular($gray-9);
width: 100%;
height: 100%;
line-height: 32px;
}
}
}
}
Loading