Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions projects/common/src/feature/feature.guard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { patchRouterNavigateForTest, runFakeRxjs } from '@hypertrace/test-utils'
import { createServiceFactory, mockProvider } from '@ngneat/spectator/jest';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { HtRoute } from '../navigation/ht-route';
import { NavigationService } from '../navigation/navigation.service';
import { TraceRoute } from '../navigation/trace-route';
import { FeatureGuard } from './feature.guard';
import { FeatureStateResolver } from './state/feature-state.resolver';
import { FeatureState } from './state/feature.state';

describe('Feature Guard', () => {
const buildRouteForFeatures = (features: string[]): TraceRoute => ({
const buildRouteForFeatures = (features: string[]): HtRoute => ({
data: {
features: features
}
Expand Down
8 changes: 4 additions & 4 deletions projects/common/src/feature/feature.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, CanLoad, UrlSegment, UrlTree } from '@angular/router';
import { Observable, of } from 'rxjs';
import { catchError, map, tap } from 'rxjs/operators';
import { HtRoute } from '../navigation/ht-route';
import { NavigationService } from '../navigation/navigation.service';
import { TraceRoute } from '../navigation/trace-route';
import { FeatureStateResolver } from './state/feature-state.resolver';
import { FeatureState } from './state/feature.state';

Expand All @@ -14,7 +14,7 @@ export class FeatureGuard implements CanLoad, CanActivate {
private readonly featureStateResolver: FeatureStateResolver
) {}

public canLoad(route: TraceRoute, segments: UrlSegment[]): Observable<boolean> {
public canLoad(route: HtRoute, segments: UrlSegment[]): Observable<boolean> {
// TODO as of ng8, canLoad has been pretty neglected. Doesn't have access to query params or returning a url tree
// Https://github.com/angular/angular/issues/30633 https://github.com/angular/angular/issues/28306
// For now, we'll work around by ignoring query params and doing a direct redirect
Expand Down Expand Up @@ -44,7 +44,7 @@ export class FeatureGuard implements CanLoad, CanActivate {
);
}

private checkRouteValidity(route: TraceRoute): Observable<boolean> {
private checkRouteValidity(route: HtRoute): Observable<boolean> {
return this.getCombinedFeatureState(this.getFeaturesForRoute(route)).pipe(
catchError(() => of(FeatureState.Disabled)),
map(state => state !== FeatureState.Disabled)
Expand All @@ -55,7 +55,7 @@ export class FeatureGuard implements CanLoad, CanActivate {
return this.featureStateResolver.getCombinedFeatureState(features);
}

private getFeaturesForRoute(route: TraceRoute): string[] {
private getFeaturesForRoute(route: HtRoute): string[] {
return (route.data && route.data.features) || [];
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from 'rxjs';
import { Breadcrumb } from './breadcrumb';

export interface RouteData {
export interface HtRouteData {
breadcrumb?: Breadcrumb | Observable<Breadcrumb>;
features?: string[];
}
7 changes: 7 additions & 0 deletions projects/common/src/navigation/ht-route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Route } from '@angular/router';
import { HtRouteData } from './ht-route-data';

export interface HtRoute extends Route {
data?: HtRouteData;
children?: HtRoute[];
}
10 changes: 5 additions & 5 deletions projects/common/src/navigation/navigation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { from, Observable, of } from 'rxjs';
import { distinctUntilChanged, filter, map, share, skip, startWith, switchMap, take } from 'rxjs/operators';
import { isEqualIgnoreFunctions, throwIfNil } from '../utilities/lang/lang-utils';
import { Dictionary } from '../utilities/types/types';
import { TraceRoute } from './trace-route';
import { HtRoute } from './ht-route';

@Injectable({ providedIn: 'root' })
export class NavigationService {
Expand Down Expand Up @@ -222,7 +222,7 @@ export class NavigationService {
public getRouteConfig(
path: string[],
relativeTo: ActivatedRoute = this.getCurrentActivatedRoute()
): TraceRoute | undefined {
): HtRoute | undefined {
const childRoutes =
relativeTo === this.rootRoute() ? this.router.config : relativeTo.routeConfig && relativeTo.routeConfig.children;

Expand All @@ -233,7 +233,7 @@ export class NavigationService {
return this.router.routerState.root;
}

public currentRouteConfig(): TraceRoute {
public currentRouteConfig(): HtRoute {
return throwIfNil(this.getCurrentActivatedRoute().routeConfig);
}

Expand Down Expand Up @@ -303,7 +303,7 @@ export class NavigationService {
});
}

private findRouteConfig(path: string[], routes: TraceRoute[]): TraceRoute | undefined {
private findRouteConfig(path: string[], routes: HtRoute[]): HtRoute | undefined {
if (path.length === 0) {
return undefined;
}
Expand All @@ -320,7 +320,7 @@ export class NavigationService {
return this.router.routerState.snapshot.root.queryParamMap;
}

private findMatchingRoute(pathSegment: string, routes: TraceRoute[]): TraceRoute | undefined {
private findMatchingRoute(pathSegment: string, routes: HtRoute[]): HtRoute | undefined {
return routes
.filter(
// First, filter to anything that potentially matches
Expand Down
7 changes: 0 additions & 7 deletions projects/common/src/navigation/trace-route.ts

This file was deleted.

4 changes: 2 additions & 2 deletions projects/common/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export * from './utilities/memoize/memoize.pipe';
// Navigation
export * from './navigation/breadcrumb';
export * from './navigation/navigation.service';
export * from './navigation/route-data';
export * from './navigation/trace-route';
export * from './navigation/ht-route-data';
export * from './navigation/ht-route';

// Operations
export * from './utilities/operations/operation-utilities';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IconType } from '@hypertrace/assets-library';
import { Breadcrumb, NavigationService, RouteData } from '@hypertrace/common';
import { Breadcrumb, HtRouteData, NavigationService } from '@hypertrace/common';
import { runFakeRxjs } from '@hypertrace/test-utils';
import { createServiceFactory, mockProvider } from '@ngneat/spectator/jest';
import { NEVER, Observable, of, throwError } from 'rxjs';
Expand Down Expand Up @@ -118,6 +118,6 @@ interface ActivatedRouteSnapshotBuildData {

interface ActivatedRouteSnapshotMock {
pathFromRoot: ActivatedRouteSnapshotMock[];
data: RouteData;
data: HtRouteData;
url: { path: string }[];
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';
import { NavigableDashboardModule } from '../../shared/dashboard/dashboard-wrapper/navigable-dashboard.module';
import { TracingDashboardModule } from '../../shared/dashboard/tracing-dashboard.module';
import { SpanListPageComponent } from './span-list.page.component';
import { spanListDashboard } from './span-list.page.dashboard';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: SpanListPageComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { FormattingModule, TraceRoute } from '@hypertrace/common';
import { FormattingModule, HtRoute } from '@hypertrace/common';
import {
CopyShareableLinkToClipboardModule,
DownloadJsonModule,
Expand All @@ -20,7 +20,7 @@ import { TraceSequenceComponent } from './sequence/trace-sequence.component';
import { traceSequenceDashboard } from './sequence/trace-sequence.dashboard';
import { TraceDetailPageComponent } from './trace-detail.page.component';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: `:${TraceDetailPageComponent.TRACE_ID_PARAM_NAME}`,
component: TraceDetailPageComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { FormattingModule, TraceRoute } from '@hypertrace/common';
import { FormattingModule, HtRoute } from '@hypertrace/common';
import {
ButtonModule,
CopyShareableLinkToClipboardModule,
Expand All @@ -18,7 +18,7 @@ import { ApiTraceLogsComponent } from './logs/api-trace-logs.component';
import { ApiTraceSequenceComponent } from './sequence/api-trace-sequence.component';
import { apiTraceSequenceDashboard } from './sequence/api-trace-sequence.dashboard';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: `:${ApiTraceDetailPageComponent.TRACE_ID_PARAM_NAME}`,
component: ApiTraceDetailPageComponent,
Expand Down
4 changes: 2 additions & 2 deletions src/app/home/home.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';
import { NavigableDashboardModule } from '@hypertrace/distributed-tracing';
import { ObservabilityDashboardModule } from '@hypertrace/observability';
import { TotalErrorsLabelDataSourceModule } from './data/label/total-errors-label-data-source.module';
import { ObserveSystemRadarDataSourceModule } from './data/system/observe-system-radar-data-source.module';
import { HomeComponent } from './home.component';
import { homeDashboard } from './home.dashboard';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: HomeComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { RouterModule } from '@angular/router';

import { NgModule } from '@angular/core';
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';
import { ApplicationFlowComponent, ApplicationFlowModule } from '@hypertrace/observability';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: ApplicationFlowComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
Expand All @@ -10,7 +10,7 @@ import {
BackendTraceListComponent
} from '@hypertrace/observability';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: BackendDetailComponent,
Expand Down
4 changes: 2 additions & 2 deletions src/app/routes/backends/backends-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { RouterModule } from '@angular/router';

import { NgModule } from '@angular/core';
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';
import {
BackendDetailBreadcrumbResolver,
BackendDetailService,
BackendListComponent,
BackendListModule
} from '@hypertrace/observability';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: BackendListComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
Expand All @@ -10,7 +10,7 @@ import {
ApiTraceListComponent
} from '@hypertrace/observability';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: ApiDetailComponent,
Expand Down
4 changes: 2 additions & 2 deletions src/app/routes/endpoints/endpoint-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';
import {
ApiDetailBreadcrumbResolver,
ApiDetailService,
EndpointListComponent,
EndpointListModule
} from '@hypertrace/observability';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: EndpointListComponent
Expand Down
4 changes: 2 additions & 2 deletions src/app/routes/explorer/explorer-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';
import { FilterBuilderLookupService } from '@hypertrace/components';
import { MetadataService } from '@hypertrace/distributed-tracing';
import { ExplorerComponent, ExplorerDashboardBuilder, ExplorerModule } from '@hypertrace/observability';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: ExplorerComponent
Expand Down
4 changes: 2 additions & 2 deletions src/app/routes/root-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule } from '@angular/router';
import { IconType } from '@hypertrace/assets-library';
import { ExternalUrlNavigator, TraceRoute } from '@hypertrace/common';
import { ExternalUrlNavigator, HtRoute } from '@hypertrace/common';
import { NotFoundComponent, NotFoundModule } from '@hypertrace/components';
import { ObservabilityIconType } from '@hypertrace/observability';
import { ApplicationFrameComponent } from '../application-frame/application-frame.component';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
children: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
Expand All @@ -11,7 +11,7 @@ import {
ServiceTraceListComponent
} from '@hypertrace/observability';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: ServiceDetailComponent,
Expand Down
4 changes: 2 additions & 2 deletions src/app/routes/services/services-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { TraceRoute } from '@hypertrace/common';
import { HtRoute } from '@hypertrace/common';
import {
ApiDetailBreadcrumbResolver,
ApiDetailService,
Expand All @@ -10,7 +10,7 @@ import {
ServiceListModule
} from '@hypertrace/observability';

const ROUTE_CONFIG: TraceRoute[] = [
const ROUTE_CONFIG: HtRoute[] = [
{
path: '',
component: ServiceListComponent
Expand Down
6 changes: 3 additions & 3 deletions src/app/shared/navigation/navigation.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { IconType } from '@hypertrace/assets-library';
import { NavigationService, PreferenceService, TraceRoute } from '@hypertrace/common';
import { HtRoute, NavigationService, PreferenceService } from '@hypertrace/common';
import { NavItemConfig, NavItemType } from '@hypertrace/components';
import { ObservabilityIconType } from '@hypertrace/observability';
import { uniq } from 'lodash-es';
Expand Down Expand Up @@ -93,7 +93,7 @@ export class NavigationComponent {
}
const features = navItem.matchPaths
.map(path => this.navigationService.getRouteConfig([path], this.activatedRoute))
.filter((maybeRoute): maybeRoute is TraceRoute => maybeRoute !== undefined)
.filter((maybeRoute): maybeRoute is HtRoute => maybeRoute !== undefined)
.flatMap(route => this.getFeaturesForRoute(route))
.concat(navItem.features || []);

Expand All @@ -103,7 +103,7 @@ export class NavigationComponent {
};
}

private getFeaturesForRoute(route: TraceRoute): string[] {
private getFeaturesForRoute(route: HtRoute): string[] {
return (route.data && route.data.features) || [];
}
}