aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.ts
blob: 8057ae908a391691d3e01fba74f967a294582448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Component, Input, Output, EventEmitter, ViewEncapsulation } from '@angular/core';
import { ZoneInstanceConfig, ZoneInstanceMode } from 'app/models/graph/zones/zone-child';

@Component({
    selector: 'zone-instance',
    templateUrl: './zone-instance.component.html',
    styleUrls: ['./zone-instance.component.less'],
    encapsulation: ViewEncapsulation.None
})
export class ZoneInstanceComponent {

    @Input() config:ZoneInstanceConfig;
    @Input() defaultIconText:string;
    @Input() isActive:boolean;
    @Input() activeInstanceMode: ZoneInstanceMode;
    @Output() modeChange: EventEmitter<any> = new EventEmitter<any>();
    private MODE = ZoneInstanceMode;

    private setMode = (mode:ZoneInstanceMode, event?:any):void => {
        if(!this.isActive || this.isActive && mode == ZoneInstanceMode.TAG){ //when active, do not allow hover/select mode toggling
            this.modeChange.emit({newMode: mode, instance: this.config});
        }
        if(event){
            event.stopPropagation();
        }
    }

}