summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/graph/zones/zone-child.ts
blob: d6d71982221e95b210a785ec34d3be365e471edc (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Type, Component } from "@angular/core";
import { PolicyInstance } from "app/models/graph/zones/policy-instance";

export class ZoneConfig {
    title:string;
    defaultIconText:string;
    type:string; 'policy|group';
    tagModeId:string;
    instances:Array<ZoneInstanceConfig>;
    showZone:boolean;


    constructor (title:string, defaultText:string, type:string, showZone:boolean) {
        this.title = title;
        this.defaultIconText = defaultText;
        this.type = type;
        this.tagModeId = this.type + "-tagging";
        this.instances = [];
        this.showZone = showZone;
    }
}

export class ZoneInstanceConfig {

    name:string;
    assignments:Array<string>; //targets or members
    instanceData:PolicyInstance; // | GroupInstance;
    mode:ZoneInstanceMode;

    constructor(instance:PolicyInstance) { /* | GroupInstance */

        this.name = instance.name;
        this.instanceData = instance;
        this.mode = ZoneInstanceMode.NONE;

        if(instance instanceof PolicyInstance) {
            this.assignments = instance.targets;
        }
    }

}

export enum ZoneInstanceMode {
    NONE,
    HOVER,
    SELECTED,
    TAG
}