merge from ecomp a88f0072 - Modern UI
[vid.git] / vid-webpack-master / src / app / shared / models / treeNodeModel.ts
1 import {ChildNodeInstance} from "./nodeInstance";
2 import {NodeModel} from "./nodeModel";
3 import {ServiceNodeTypes} from "./ServiceNodeTypes";
4 import * as _ from 'lodash';
5 import {ServiceInstanceActions} from "./serviceInstanceActions";
6 export enum TreeLevel {
7   Level_0 , Level_1, Level_2
8
9 }
10 interface TreeNodeInstanceInterface {
11   treeLevel: TreeLevel;
12   getModel(): NodeModel;
13   convertToTreeNode(node: any): any;
14   type: ServiceNodeTypes;
15 }
16 export class TreeNodeModel {
17   type: String;
18   modelId: string;
19   modelCustomizationId?: string;
20   modelUniqueId?: string;
21   id: string;
22   name: string;
23   modelName: string;
24   missingData: boolean;
25   isEcompGeneratedNaming: boolean;
26   orchStatus?:string;
27   provStatus?:string;
28   inMaint?:boolean;
29   action : string ;
30
31   constructor(instance: ChildNodeInstance, nodeModel: NodeModel){
32     this.modelCustomizationId = nodeModel.customizationUuid;
33     this.modelId = nodeModel.uuid;
34     this.modelUniqueId = this.modelCustomizationId || this.modelId;
35     this.missingData = false;
36     this.id = instance.trackById;
37     this.action = !_.isNil(instance.action) ? instance.action : ServiceInstanceActions.Create;
38
39     if(!_.isNil(instance.orchStatus)){
40       this.orchStatus= instance.orchStatus;
41     }
42
43     if(!_.isNil(instance.provStatus)){
44       this.provStatus= instance.provStatus;
45     }
46
47     if(!_.isNil(instance.inMaint)){
48       this.inMaint= instance.inMaint;
49     }
50
51
52   }
53 }