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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
import {ILevelNodeInfo} from "../basic.model.info";
import {ComponentInfoType} from "../../../component-info/component-info-model";
import {ITreeNode} from "angular-tree-component/dist/defs/api";
import {AvailableNodeIcons} from "../../../available-models-tree/available-models-tree.service";
import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component";
import {Level1Model} from "../../../../../shared/models/nodeModel";
import {NcfTreeNode} from "../../../../../shared/models/ncfTreeNode";
import {Level1Instance} from "../../../../../shared/models/level1Instance";
import {NgRedux} from "@angular-redux/store";
import {AppState} from "../../../../../shared/store/reducers";
import {
deleteActionNcfInstance,
undoDeleteActionNcfInstance
} from "../../../../../shared/storeUtil/utils/ncf/ncf.actions";
import * as _ from 'lodash';
import {NcfModelInterface} from "../../../../../shared/models/ncfModel";
export class NcfModelInfo implements ILevelNodeInfo {
constructor(private _store: NgRedux<AppState>){
}
name: string = 'ncfs';
type: string = 'NCF';
typeName: string = 'NCF';
childNames: string[] = [];
componentInfoType = ComponentInfoType.NCF;
isEcompGeneratedNaming(currentModel): boolean {
return false;
}
updateDynamicInputsDataFromModel = (currentModel): any => [];
getModel = (modelId: string, instance: any, serviceHierarchy): any => {
return new Level1Model();
};
createInstanceTreeNode = (instance: Level1Instance, model: Level1Model, parentModel, storeKey: string): NcfTreeNode => {
let modelVersion: string = null;
if (parentModel.networksCollection && instance.originalName) {
const ncfRealModel: NcfModelInterface = parentModel.networksCollection[instance.originalName];
if (ncfRealModel) {
modelVersion = ncfRealModel.version;
}
}
let node = new NcfTreeNode(instance, model, storeKey, modelVersion);
node.menuActions = this.getMenuAction(<any>node, model.uuid);
node.typeName = this.typeName;
return node;
};
getNextLevelObject = (): any => {
return null;
};
getTooltip = (): string => 'NCF';
getType = (): string => 'NCF';
hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean): boolean {
return false;
}
onClickAdd(node, serviceModelId: string): void {
}
getNodeCount(node: ITreeNode, serviceModelId: string): number {
return 0;
}
showNodeIcons(node: ITreeNode, serviceModelId: string): AvailableNodeIcons {
return null;
}
getMenuAction(node: ITreeNode, serviceModelId: string): { [methodName: string]: { method: Function, visible: Function, enable: Function } } {
return <any>{
delete: {
method: (node, serviceModelId) => {
this._store.dispatch(deleteActionNcfInstance(node.data.parent.collectionResourceStoreKey, node.data.storeKey, serviceModelId));
},
visible: (node) => false,
enable: (node) => false
},
undoDelete: {
method: (node, serviceModelId) => {
this._store.dispatch(undoDeleteActionNcfInstance(node.data.parent.collectionResourceStoreKey, node.data.storeKey, serviceModelId));
},
visible: (node) => false,
enable: (node) => false
}
};
}
updatePosition(that, node, instanceId): void {
}
getNodePosition(instance): number {
return 0;
}
getInfo(model, instance: NcfTreeNode): ModelInformationItem[] {
if (_.isNil(instance)) {
return [];
}
return [
ModelInformationItem.createInstance("Model version", instance.modelVersion),
ModelInformationItem.createInstance('Role', instance.instanceGroupRole),
ModelInformationItem.createInstance('Collection function', instance.instanceGroupFunction),
ModelInformationItem.createInstance('Number of networks', instance.numberOfNetworks),
];
}
}
|