diff options
author | Ittay Stern <ittay.stern@att.com> | 2018-08-29 17:01:32 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-02-18 18:35:30 +0200 |
commit | 6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch) | |
tree | 936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/src/app/drawingBoard/drawing-board-tree/drawing-board-tree.component.ts | |
parent | 67d99f816cc583643c35193197594cf78d8ce60a (diff) |
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378
Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/drawing-board-tree/drawing-board-tree.component.ts')
-rw-r--r-- | vid-webpack-master/src/app/drawingBoard/drawing-board-tree/drawing-board-tree.component.ts | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/drawing-board-tree/drawing-board-tree.component.ts b/vid-webpack-master/src/app/drawingBoard/drawing-board-tree/drawing-board-tree.component.ts deleted file mode 100644 index 6b717a930..000000000 --- a/vid-webpack-master/src/app/drawingBoard/drawing-board-tree/drawing-board-tree.component.ts +++ /dev/null @@ -1,133 +0,0 @@ -import {AfterViewInit, Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; -import { ContextMenuService } from 'ngx-contextmenu'; -import { Constants } from '../../shared/utils/constants'; -import {ServicePlanningService} from "../../services/service-planning.service"; -import {ITreeNode} from "angular-tree-component/dist/defs/api"; -import {ITreeOptions, TreeComponent} from "angular-tree-component"; -import {VnfPopupComponent} from "../../components/vnf-popup/vnf-popup.components"; -import {DialogService} from "ng2-bootstrap-modal"; -import {ActivatedRoute} from "@angular/router"; -import {NgRedux} from "@angular-redux/store"; -import {AppState} from "../../store/reducers"; -import { MessageBoxData, ModalSize, ModalType } from '../../shared/components/messageBox/messageBox.data'; -import { MessageBoxService } from '../../shared/components/messageBox/messageBox.service'; -import { deleteVnfInstance, deleteVfModuleInstance } from '../../service.actions'; -import { isNullOrUndefined } from 'util'; -import {IframeService} from "../../shared/utils/iframe.service"; - - -@Component({ - selector: 'drawing-board-tree', - templateUrl: './drawing-board-tree.html', - styleUrls : ['./drawing-board-tree.scss'] -}) - - -export class DrawingBoardTreeComponent implements OnInit, AfterViewInit { - constructor(private _contextMenuService: ContextMenuService, - private _servicePlanningService: ServicePlanningService, - private _iframeService : IframeService, - private dialogService: DialogService, - private store: NgRedux<AppState>, - private route: ActivatedRoute) { - this.route - .queryParams - .subscribe(params => { - this.serviceModelId = params['serviceModelId']; - }); - } - - @Output() - highlightNode : EventEmitter<number> = new EventEmitter<number>(); - - @ViewChild('tree') tree: TreeComponent; - missingDataTooltip: string = Constants.Error.MISSING_VNF_DETAILS; - currentNode: ITreeNode = null; // - nodes = []; - serviceModelId: string; - options: ITreeOptions = { - nodeHeight: 45, - dropSlotHeight: 1 - }; - parentElementClassName = 'content'; - - ngOnInit(): void { - this.store.subscribe(() => {this.updateTree()}); - this.updateTree() - } - - updateTree() { - const serviceInstance = this.store.getState().service.serviceInstance[this.serviceModelId]; - this.nodes = this._servicePlanningService.convertServiceInstanceToTreeData(serviceInstance, this.serviceModelId); - } - - ngAfterViewInit():void { - // Expand drawing tree on init. - this.tree.treeModel.expandAll(); - } - - public onContextMenu($event: MouseEvent, node: ITreeNode): void { - this.currentNode = node; - node.focus(); - node.setActiveAndVisible(false); - this.selectNode(node); - this._contextMenuService.show.next({ - event: <any>$event, - item: node, - }); - $event.preventDefault(); - $event.stopPropagation(); - } - - public editItem(node: ITreeNode): void { - node = this.currentNode; - this._iframeService.addClassOpenModal(this.parentElementClassName); - this.dialogService.addDialog(VnfPopupComponent, { - serviceModelId: this.serviceModelId, - modelName: node.data.modelName, - modelType: node.data.type, - parentModelName: node.parent.data.modelName, - isNewVfModule : false - }) - } - - public deleteItem(node: ITreeNode): void { - if(this.currentNode.data.type === 'VF'){ - if(!isNullOrUndefined(this.currentNode.data.children) && this.currentNode.data.children.length === 0){ - this.store.dispatch(deleteVnfInstance(this.currentNode.data.modelName, this.serviceModelId)); - }else { - let messageBoxData : MessageBoxData = new MessageBoxData( - "Remove VNF", // modal title - "You are about to remove this VNF and all its children from this service. Are you sure you want to remove it?", - - ModalType.alert, - ModalSize.medium, - [ - {text:"Remove VNF", size:"large", callback: this.removeVnf.bind(this), closeModal:true}, - {text:"Don’t Remove", size:"medium", closeModal:true} - ]); - - MessageBoxService.openModal.next(messageBoxData); - } - }else { - this.store.dispatch(deleteVfModuleInstance(this.currentNode.data.modelName, this.serviceModelId, node.parent.data.modelName)); - } - } - - removeVnf() { - this.store.dispatch(deleteVnfInstance(this.currentNode.data.modelName, this.serviceModelId)); - } - - public selectNode(node: ITreeNode): void { - node.expand(); - this.highlightNode.emit(node.data.modelId); - } - - isDataMissing(node: ITreeNode) { - //todo: currently not showing the alert icon. will be implemented in upcoming story. - return false; - } - -} - - |