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