Skip to content
Snippets Groups Projects
Commit 750303ca authored by Xiao Gui's avatar Xiao Gui
Browse files

Merge branch 'pr_feedbacckFix' into pr_fixes

parents 4f3056bc b43a5dfc
No related branches found
No related tags found
No related merge requests found
......@@ -133,6 +133,7 @@
</div>
<!-- TODO move to nehuba overlay container -->
<panel-component class="shadow" fixedMouseContextualContainerDirective #rClContextMenu>
<div heading>
<h5 class="pe-all p-2 m-0">
......@@ -147,14 +148,14 @@
data-toggle="tooltip"
data-placement="top"
[title]="onhoverSegmentFixed.name">
Search KG for {{ onhoverSegmentFixed.name }}
Search for data related to {{ onhoverSegmentFixed.name }}
</div>
<div
*ngIf="(selectedRegions$ | async)?.length > 0 && (selectedRegions$ | async); let selectedRegions"
(click)="searchRegion(selectedRegions)"
class="ws-no-wrap text-left pe-all mt-0 btn btn-sm btn-secondary btn-block">
Search KG for {{ selectedRegions && selectedRegions.length }} selected regions
Search for data related to all {{ selectedRegions && selectedRegions.length }} selected regions
</div>
<div
......
......@@ -72,8 +72,8 @@ export class MenuIconsBar{
dataBrowser.instance.template = template
dataBrowser.instance.parcellation = parcellation
const title = regions.length > 1
? `Data associated with ${regions.length} regions`
: `Data associated with ${regions[0].name}`
? `Search: ${regions.length} regions`
: `Search: ${regions[0].name}`
const widgetUnit = this.widgetServices.addNewWidget(dataBrowser, {
exitable: true,
persistency: true,
......
......@@ -71,7 +71,7 @@
<layout-floating-container *ngIf="viewerLoaded">
<!-- StatusCard container-->
<ui-status-card [selectedTemplate]="selectedTemplate" [isMobile]="isMobile"
<ui-status-card [selectedTemplate]="selectedTemplate" [isMobile]="isMobile"
[onHoverSegmentName]="onHoverSegmentName$ | async" [nehubaViewer]="nehubaViewer">
</ui-status-card>
</layout-floating-container>
......
......@@ -4,9 +4,10 @@ import { AuthService, User } from "src/services/auth.service";
import { Store, select } from "@ngrx/store";
import { ViewerConfiguration } from "src/services/state/viewerConfig.store";
import { Subscription, Observable } from "rxjs";
import { safeFilter, isDefined, NEWVIEWER, SELECT_REGIONS, SELECT_PARCELLATION } from "src/services/stateStore.service";
import { safeFilter, isDefined, NEWVIEWER, SELECT_REGIONS, SELECT_PARCELLATION, CHANGE_NAVIGATION } from "src/services/stateStore.service";
import { map, filter, distinctUntilChanged } from "rxjs/operators";
import { regionFlattener } from "src/util/regionFlattener";
import { ToastService } from "src/services/toastService.service";
@Component({
selector: 'signin-banner',
......@@ -31,7 +32,8 @@ export class SigninBanner implements OnInit, OnDestroy{
constructor(
private constantService: AtlasViewerConstantsServices,
private authService: AuthService,
private store: Store<ViewerConfiguration>
private store: Store<ViewerConfiguration>,
private toastService: ToastService
){
this.loadedTemplates$ = this.store.pipe(
select('viewerState'),
......@@ -98,16 +100,48 @@ export class SigninBanner implements OnInit, OnDestroy{
handleRegionClick({ mode = 'single', region }){
if (!region)
return
const flattenedRegion = regionFlattener(region).filter(r => isDefined(r.labelIndex))
const flattenedRegionNames = new Set(flattenedRegion.map(r => r.name))
const selectedRegionNames = new Set(this.selectedRegions.map(r => r.name))
const selectAll = flattenedRegion.every(r => !selectedRegionNames.has(r.name))
this.store.dispatch({
type: SELECT_REGIONS,
selectRegions: selectAll
? this.selectedRegions.concat(flattenedRegion)
: this.selectedRegions.filter(r => !flattenedRegionNames.has(r.name))
})
/**
* single click on region hierarchy => toggle selection
*/
if (mode === 'single') {
const flattenedRegion = regionFlattener(region).filter(r => isDefined(r.labelIndex))
const flattenedRegionNames = new Set(flattenedRegion.map(r => r.name))
const selectedRegionNames = new Set(this.selectedRegions.map(r => r.name))
const selectAll = flattenedRegion.every(r => !selectedRegionNames.has(r.name))
this.store.dispatch({
type: SELECT_REGIONS,
selectRegions: selectAll
? this.selectedRegions.concat(flattenedRegion)
: this.selectedRegions.filter(r => !flattenedRegionNames.has(r.name))
})
}
/**
* double click on region hierarchy => navigate to region area if it exists
*/
if (mode === 'double') {
/**
* if position is defined, go to position (in nm)
* if not, show error messagea s toast
*
* nb: currently, only supports a single triplet
*/
if (region.position) {
this.store.dispatch({
type: CHANGE_NAVIGATION,
navigation: {
position: region.position
}
})
} else {
this.toastService.showToast(`${region.name} does not have a position defined`, {
timeout: 5000,
dismissable: true
})
}
}
}
displayActiveParcellation(parcellation:any){
......
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