11import { Inject , Injectable } from '@angular/core' ;
22import { ActivatedRouteSnapshot } from '@angular/router' ;
3- import { NavigationService , TimeRangeService } from '@hypertrace/common' ;
3+ import { Breadcrumb , NavigationService , TimeRangeService } from '@hypertrace/common' ;
44import { BreadcrumbsService } from '@hypertrace/components' ;
55import { GraphQlRequestService } from '@hypertrace/graphql-client' ;
6+ import { entityIdKey } from '@hypertrace/observability' ;
67import { Observable } from 'rxjs' ;
78import { map , switchMap } from 'rxjs/operators' ;
89import { EntityMetadata , EntityMetadataMap , ENTITY_METADATA } from '../../../shared/constants/entity-metadata' ;
9- import { Entity , ObservabilityEntityType } from '../../../shared/graphql/model/schema/entity' ;
10+ import { Entity , entityTypeKey , ObservabilityEntityType } from '../../../shared/graphql/model/schema/entity' ;
1011import {
1112 EntityBreadcrumb ,
1213 EntityBreadcrumbResolver
@@ -29,7 +30,7 @@ export class ApiDetailBreadcrumbResolver<T extends EntityBreadcrumb> extends Ent
2930 this . apiEntityMetadata = this . entityMetadataMap . get ( ObservabilityEntityType . Api ) ;
3031 }
3132
32- public async resolve ( activatedRouteSnapshot : ActivatedRouteSnapshot ) : Promise < Observable < EntityBreadcrumb > > {
33+ public async resolve ( activatedRouteSnapshot : ActivatedRouteSnapshot ) : Promise < Observable < Breadcrumb > > {
3334 const id = activatedRouteSnapshot . paramMap . get ( 'id' ) as string ;
3435 const parentEntityMetadata = this . resolveParentType ( ) ;
3536
@@ -56,17 +57,20 @@ export class ApiDetailBreadcrumbResolver<T extends EntityBreadcrumb> extends Ent
5657 } ;
5758 }
5859
59- protected getParentBreadcrumbs ( api : EntityBreadcrumb , parentEntityMetadata ?: EntityMetadata ) : EntityBreadcrumb [ ] {
60+ protected getParentBreadcrumbs (
61+ api : EntityBreadcrumb ,
62+ parentEntityMetadata ?: EntityMetadata
63+ ) : ( EntityBreadcrumb | Breadcrumb ) [ ] {
6064 return parentEntityMetadata !== undefined
6165 ? [
6266 {
63- ...api ,
67+ [ entityIdKey ] : api . parentId as string ,
68+ [ entityTypeKey ] : parentEntityMetadata . entityType ,
6469 label : api . parentName as string ,
6570 icon : parentEntityMetadata ?. icon ,
6671 url : parentEntityMetadata ?. detailPath ( api . parentId as string )
6772 } ,
6873 {
69- ...api ,
7074 label : 'Endpoints' ,
7175 icon : this . apiEntityMetadata ?. icon ,
7276 url : parentEntityMetadata ?. apisListPath ?.( api . parentId as string )
0 commit comments