Skip to content
Snippets Groups Projects
Commit 099b3793 authored by Xiao Gui's avatar Xiao Gui Committed by xgui3783
Browse files

additional layers potentially more informative

parent 07a7accc
No related merge requests found
import { Component, OnDestroy } from "@angular/core";
import { NgLayerInterface } from "../../atlasViewer/atlasViewer.component";
import { Store, select } from "@ngrx/store";
import { ViewerStateInterface, isDefined, REMOVE_NG_LAYER, FORCE_SHOW_SEGMENT } from "../../services/stateStore.service";
import { ViewerStateInterface, isDefined, REMOVE_NG_LAYER, FORCE_SHOW_SEGMENT, safeFilter } from "../../services/stateStore.service";
import { Subscription, Observable } from "rxjs";
import { filter, distinctUntilChanged, map, delay } from "rxjs/operators";
......@@ -20,9 +20,18 @@ export class LayerBrowser implements OnDestroy{
public forceShowSegment$ : Observable<boolean|null>
private subscriptions : Subscription[] = []
private disposeHandler : any
/* TODO temporary measure. when datasetID can be used, will use */
public fetchedDataEntries$ : Observable<any>
constructor(private store : Store<ViewerStateInterface>){
this.fetchedDataEntries$ = this.store.pipe(
select('dataStore'),
safeFilter('fetchedDataEntries'),
map(v=>v.fetchedDataEntries)
)
this.forceShowSegment$ = this.store.pipe(
select('ngViewerState'),
filter(state => isDefined(state) && typeof state.forceShowSegment !== 'undefined'),
......@@ -124,7 +133,6 @@ export class LayerBrowser implements OnDestroy{
${this.forceShowSegmentCurrentState === true ? 'always show' : this.forceShowSegmentCurrentState === false ? 'always hide' : 'auto'}`
}
get segmentationAdditionalClass(){
return this.forceShowSegmentCurrentState === null
? 'blue'
......
......@@ -42,7 +42,7 @@
[ngClass] = "{'muted-text muted' : !classVisible(ngLayer)}">
<div heading>
{{ ngLayer.name }} : {{ ngLayer.type }}
{{ ngLayer.name | getLayerNameFromDatasets : (fetchedDataEntries$ | async) }} : {{ ngLayer.type }}
</div>
<div body>
......
......@@ -30,6 +30,7 @@ import { LayerBrowser } from "./layerbrowser/layerbrowser.component";
import { TooltipModule } from "ngx-bootstrap/tooltip";
import { KgEntryViewer } from "./kgEntryViewer/kgentry.component";
import { SubjectViewer } from "./kgEntryViewer/subjectViewer/subjectViewer.component";
import { GetLayerNameFromDatasets } from "../util/pipes/getLayerNamePipe.pipe";
@NgModule({
......@@ -68,7 +69,7 @@ import { SubjectViewer } from "./kgEntryViewer/subjectViewer/subjectViewer.compo
GetUniqueProperty,
FilterDataEntriesbyType,
SafeStylePipe,
GetLayerNameFromDatasets
],
entryComponents : [
......
import { Pipe, PipeTransform } from "@angular/core";
@Pipe({
name : 'getLayerNameFromDatasets'
})
export class GetLayerNameFromDatasets implements PipeTransform{
public transform(ngLayerName:string, datasets? : any[]):string{
if(!datasets)
return ngLayerName
const foundDataset = datasets.find(ds => ds.files.findIndex(file => file.url === ngLayerName) >= 0)
return foundDataset
? foundDataset.name
: ngLayerName
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment