Map: diosplay of layers in the tree with viewableRole
This commit is contained in:
parent
4eb4c0d0dd
commit
21f6e27c7f
3 changed files with 11 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit } from '@angular/core'
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'
|
||||
|
||||
import { FormControl } from '@angular/forms'
|
||||
import { MatSnackBar } from '@angular/material/snack-bar'
|
||||
|
@ -18,6 +18,7 @@ import { BaseMapWithStores } from '../../openapi'
|
|||
selector: 'gisaf-map-controls',
|
||||
templateUrl: './map-controls.component.html',
|
||||
styleUrls: ['./map-controls.component.css'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class MapControlsComponent implements OnInit {
|
||||
baseUrl: string = '/gj/'
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
matTooltip="{{ node.description || node.title || node.name }} ({{ node.gisType }}, {{ node.count }})"
|
||||
matTooltipPosition="right"
|
||||
[class.hasPlugins]="!!node.tagPlugins"
|
||||
[hidden]='isHidden()'
|
||||
[hidden]='isHidden() | async'
|
||||
>
|
||||
<div class="gisaf-intext"
|
||||
[matMenuTriggerFor]="layerNodeMenu"
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Component, OnInit, Input, Output, EventEmitter,
|
|||
import { AuthenticationService } from '../../_services/authentication.service'
|
||||
import { Node, LayerNode } from '../models'
|
||||
import { MapControlService } from '../map-control.service'
|
||||
import { Observable, map, of } from 'rxjs'
|
||||
|
||||
@Component({
|
||||
selector: 'gisaf-tree-layer-item',
|
||||
|
@ -35,13 +36,15 @@ export class TreeLayerItemComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
isHidden(): boolean {
|
||||
let node = <LayerNode>this.node
|
||||
if (!node.viewableRole) {
|
||||
return false
|
||||
isHidden(): Observable<boolean> {
|
||||
let role: string = (<LayerNode>this.node).viewableRole
|
||||
if (!role) {
|
||||
return of(false)
|
||||
}
|
||||
else {
|
||||
return !this.authenticationService.isAuthorized([node.viewableRole])
|
||||
return this.authenticationService.isAuthorized([role]).pipe(map(
|
||||
a => !a
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue