Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: minor updates to explorer field accessors #2416

Merged
merged 7 commits into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions projects/observability/src/pages/explorer/explorer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
styleUrls: ['./explorer.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="explorer" *htLetAsync="this.initialState$ as initialState">
<div class="explorer" *htLetAsync="this.currentState$ as currentState">
<ht-page-header class="explorer-header"></ht-page-header>
<ht-toggle-group
class="explorer-data-toggle"
[items]="this.contextItems"
[activeItem]="initialState.contextToggle"
[activeItem]="currentState.contextToggle"
(activeItemChange)="this.onContextUpdated($event.value)"
></ht-toggle-group>

Expand Down Expand Up @@ -78,10 +78,10 @@
*ngIf="this.attributes$ | async as attributes"
[context]="this.currentContext$ | async"
[filters]="this.filters"
[series]="initialState.series"
[interval]="initialState.interval"
[groupBy]="initialState.groupBy"
[orderBy]="initialState.orderBy"
[series]="currentState.series"
[interval]="currentState.interval"
[groupBy]="currentState.groupBy"
[orderBy]="currentState.orderBy"
(visualizationRequestChange)="this.onVisualizationRequestUpdated($event, attributes)"
></ht-explore-query-editor>

Expand Down Expand Up @@ -127,8 +127,8 @@
private readonly explorerDashboardBuilder: ExplorerDashboardBuilder;
public readonly resultsDashboard$: Observable<ExplorerGeneratedDashboard>;
public readonly vizDashboard$: Observable<ExplorerGeneratedDashboard>;
public readonly initialState$: Observable<InitialExplorerState>;
public readonly currentContext$: Observable<ExplorerGeneratedDashboardContext>;
public currentState$!: Observable<InitialExplorerState>;
public currentContext$!: Observable<ExplorerGeneratedDashboardContext>;
public attributes$: Observable<FilterAttribute[]> = EMPTY;

public readonly contextItems: ContextToggleItem[] = [
Expand Down Expand Up @@ -156,23 +156,27 @@

public constructor(
private readonly metadataService: MetadataService,
private readonly navigationService: NavigationService,
protected readonly navigationService: NavigationService,

Check warning on line 159 in projects/observability/src/pages/explorer/explorer.component.ts

View check run for this annotation

Codecov / codecov/patch

projects/observability/src/pages/explorer/explorer.component.ts#L159

Added line #L159 was not covered by tests
private readonly timeDurationService: TimeDurationService,
private readonly preferenceService: PreferenceService,
@Inject(EXPLORER_DASHBOARD_BUILDER_FACTORY) explorerDashboardBuilderFactory: ExplorerDashboardBuilderFactory,
activatedRoute: ActivatedRoute
private readonly activatedRoute: ActivatedRoute

Check warning on line 163 in projects/observability/src/pages/explorer/explorer.component.ts

View check run for this annotation

Codecov / codecov/patch

projects/observability/src/pages/explorer/explorer.component.ts#L163

Added line #L163 was not covered by tests
) {
this.explorerDashboardBuilder = explorerDashboardBuilderFactory.build();
this.visualizationExpanded$ = this.preferenceService.get(ExplorerComponent.VISUALIZATION_EXPANDED_PREFERENCE, true);
this.resultsExpanded$ = this.preferenceService.get(ExplorerComponent.RESULTS_EXPANDED_PREFERENCE, true);
this.resultsDashboard$ = this.explorerDashboardBuilder.resultsDashboard$;
this.vizDashboard$ = this.explorerDashboardBuilder.visualizationDashboard$;
this.initialState$ = activatedRoute.queryParamMap.pipe(
this.buildState();

Check warning on line 170 in projects/observability/src/pages/explorer/explorer.component.ts

View check run for this annotation

Codecov / codecov/patch

projects/observability/src/pages/explorer/explorer.component.ts#L170

Added line #L170 was not covered by tests
}

protected buildState(): void {
this.currentState$ = this.activatedRoute.queryParamMap.pipe(

Check warning on line 174 in projects/observability/src/pages/explorer/explorer.component.ts

View check run for this annotation

Codecov / codecov/patch

projects/observability/src/pages/explorer/explorer.component.ts#L173-L174

Added lines #L173 - L174 were not covered by tests
take(1),
map(paramMap => this.mapToInitialState(paramMap))
);
this.currentContext$ = concat(
this.initialState$.pipe(map(value => value.contextToggle.value.dashboardContext)),
this.currentState$.pipe(map(value => value.contextToggle.value.dashboardContext)),

Check warning on line 179 in projects/observability/src/pages/explorer/explorer.component.ts

View check run for this annotation

Codecov / codecov/patch

projects/observability/src/pages/explorer/explorer.component.ts#L179

Added line #L179 was not covered by tests
this.contextChangeSubject
);
}
Expand Down Expand Up @@ -398,12 +402,14 @@
EndpointTraces = 'endpoint-traces',
Spans = 'spans'
}
const enum ExplorerQueryParam {

export const enum ExplorerQueryParam {
Scope = 'scope',
Interval = 'interval',
Group = 'group',
OtherGroup = 'other',
GroupLimit = 'limit',
Series = 'series',
Order = 'order'
Order = 'order',
Filters = 'filter'
}
Loading