Add another Network to the new view/edit screen
[vid.git] / vid-webpack-master / src / app / drawingBoard / service-planning / drawing-board-tree / drawing-board-tree.component.ts
index 0e2d8e2..18c3f72 100644 (file)
@@ -11,9 +11,8 @@ import {IframeService} from "../../../shared/utils/iframe.service";
 import {DuplicateService} from '../duplicate/duplicate.service';
 import {DrawingBoardTreeService, TreeNodeContextMenuModel} from "./drawing-board-tree.service";
 import {NetworkPopupService} from "../../../shared/components/genericFormPopup/genericFormServices/network/network.popup.service";
-import {VfModulePopuopService} from "../../../shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service";
+import {VfModulePopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service";
 import {VnfPopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service";
-import {SdcUiServices} from "onap-ui-angular";
 import {HighlightPipe} from "../../../shared/pipes/highlight/highlight-filter.pipe";
 import {VnfGroupPopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vnfGroup/vnfGroup.popup.service";
 import {ObjectToInstanceTreeService} from "../objectsToTree/objectToInstanceTree/objectToInstanceTree.service";
@@ -29,6 +28,7 @@ import {ComponentInfoModel} from "../component-info/component-info-model";
 import {ObjectToModelTreeService} from "../objectsToTree/objectToModelTree/objectToModelTree.service";
 import {DrawingBoardModes} from "../drawing-board.modes";
 import {ServiceInstanceActions} from "../../../shared/models/serviceInstanceActions";
+import {ModalService} from "../../../shared/components/customModal/services/modal.service";
 
 @Component({
   selector: 'drawing-board-tree',
@@ -51,8 +51,7 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit {
   @Input() pageMode : DrawingBoardModes;
   static triggerDeleteActionService: Subject<string> = new Subject<string>();
   static triggerUndoDeleteActionService: Subject<string> = new Subject<string>();
-  static triggerreCalculateIsDirty: Subject<string> = new Subject<string>();
-  @ViewChild(ContextMenuComponent) public contextMenu: ContextMenuComponent;
+  @ViewChild(ContextMenuComponent, {static: false}) public contextMenu: ContextMenuComponent;
 
   constructor(private _contextMenuService: ContextMenuService,
               private _iframeService: IframeService,
@@ -60,10 +59,10 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit {
               private store: NgRedux<AppState>,
               private route: ActivatedRoute,
               private _duplicateService: DuplicateService,
-              private modalService: SdcUiServices.ModalService,
+              private modalService: ModalService,
               private _drawingBoardTreeService: DrawingBoardTreeService,
               private _networkPopupService: NetworkPopupService,
-              private _vfModulePopuopService: VfModulePopuopService,
+              private _vfModulePopuopService: VfModulePopupService,
               private _vnfPopupService: VnfPopupService,
               private _vnfGroupPopupService: VnfGroupPopupService,
               private _errorMsgService: ErrorMsgService,
@@ -87,12 +86,12 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit {
       });
     });
 
-    DrawingBoardTreeComponent.triggerUndoDeleteActionService.subscribe((serviceModelId) => {
-      this.drawingBoardTreeService.undoDeleteActionService(this.nodes, serviceModelId);
+    DrawingBoardTreeService.triggerCheckIsDirty.subscribe((serviceModelId)=>{
       this.store.dispatch(changeServiceIsDirty(this.nodes, serviceModelId));
-    });
+    })
 
-    DrawingBoardTreeComponent.triggerreCalculateIsDirty.subscribe((serviceModelId) => {
+    DrawingBoardTreeComponent.triggerUndoDeleteActionService.subscribe((serviceModelId) => {
+      this.drawingBoardTreeService.undoDeleteActionService(this.nodes, serviceModelId);
       this.store.dispatch(changeServiceIsDirty(this.nodes, serviceModelId));
     });
 
@@ -120,18 +119,18 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit {
   @Output()
   highlightNode: EventEmitter<number> = new EventEmitter<number>();
 
-  @ViewChild('tree') tree: TreeComponent;
+  @ViewChild('tree', {static: false}) tree: TreeComponent;
   missingDataTooltip: string = Constants.Error.MISSING_VNF_DETAILS;
   currentNode: ITreeNode = null;
   flags: any;
   nodes = [];
   serviceModelId: string;
   options = {
-    allowDrag: this._dragAndDropService.isAllow(),
+    allowDrag: this._dragAndDropService.isFlagOn(),
     actionMapping: {
       mouse: {
         drop: (tree:TreeModel, node:TreeNode, $event:any, {from, to}) => {
-          this._dragAndDropService.drag(this.store, this.serviceModelId, this.nodes, {from, to});
+          this._dragAndDropService.drop(this.store, this.serviceModelId, this.nodes, {from, to});
         }
       }
     },
@@ -228,7 +227,13 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit {
     this.highlightNode.emit(node.data.modelUniqueId);
     if (FeatureFlagsService.getFlagState(Features.FLAG_1906_COMPONENT_INFO, this.store)) {
       const serviceHierarchy = this._store.getState().service.serviceHierarchy[this.serviceModelId];
-      const model = node.data.getModel(node.data.modelName, node.data, serviceHierarchy);
+
+      const instanceModel = this._sharedTreeService.modelByIdentifiers(
+        serviceHierarchy, node.data.modelTypeName,
+        this._sharedTreeService.modelUniqueNameOrId(node.data), node.data.modelName
+      );
+
+      const model = node.data.getModel(instanceModel);
       const modelInfoItems = node.data.getInfo(model, node.data);
       const componentInfoModel: ComponentInfoModel = this._sharedTreeService.addGeneralInfoItems(modelInfoItems, node.data.componentInfoType, model, node.data);
       ComponentInfoService.triggerComponentInfoChange.next(componentInfoModel);