aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree
diff options
context:
space:
mode:
authorikram <ikram@research.att.com>2020-08-07 15:49:11 -0400
committerKruthi Bhat <krutbhat@att.com>2020-08-10 19:21:30 +0000
commit32af6479c686d217204de3a86940ac1256da4b9f (patch)
tree98eb5135887c5bf5943099a783c9cd3d7dbbd8a4 /vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree
parent09a6562a16715a2b89be11c941486be783c72364 (diff)
Visualization of the VF Module Sequencing
Issue-ID: VID-860 More scenarios covered in VID-860 for vf-module sequencing. Signed-off-by: ikram <ikram@research.att.com> Change-Id: Ie138ba2616961fba7856eaaf5f17b5dc63a08e6e
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.spec.ts112
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.ts41
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts9
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html2
4 files changed, 156 insertions, 8 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.spec.ts
index 425568b68..2053e6df1 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.spec.ts
@@ -13,10 +13,22 @@ class MockAppStore<T> {
return {
global: {
flags: {
- "FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE": true
+ "FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE": true,
+ "FLAG_2008_DISABLE_DRAG_FOR_BASE_MODULE":true
}
},
service: {
+ serviceHierarchy:{
+ "serviceInstanceId":{
+ vfModules: {
+ "vfModulesName":{
+ properties:{
+ baseModule:true
+ }
+ }
+ }
+ }
+ },
serviceInstance: {
"serviceInstanceId": {
vnfs: {
@@ -123,6 +135,7 @@ describe('Drag and drop service', () => {
index: 0,
data: {
instanceName: 'puwesovabe',
+ modelName: 'vocggrapitesting0..VocgGrapiTesting..ocgmgr..module-1'
},
parent: {
data: {
@@ -167,6 +180,7 @@ describe('Drag and drop service', () => {
index: 0,
data: {
instanceName: '2017-488_PASQUALE-vPE',
+ modelName: 'vocggrapitesting0..VocgGrapiTesting..ocgmgr..module-1'
},
parent: {}
};
@@ -207,4 +221,100 @@ describe('Drag and drop service', () => {
expect(arr[1]).toMatchObject({instanceName: "puwesovabe", position: 2});
});
+
+ test('drag shouldnt execute isAllowDrop when the to index is 0 & the drop node is a base module', () => {
+
+ let from = {
+ id: "04686zg11ur2",
+ index: 1,
+ data: {
+ instanceName: 'puwesovabe',
+ modelName: 'vocggrapitesting0..VocgGrapiTesting..ocgmgr..module-1'
+ },
+ parent: {
+ data: {
+ type: 'VF',
+ index: 0,
+ trackById: 'ckfqe3sb3y8',
+ vnfStoreKey: '2017-488_PASQUALE-vPE 0',
+ }
+ }
+ };
+
+ let to = {
+ parent: {
+ id: "4637423092446",
+ index: 0,
+ data: {
+ instanceName: 'bnmgtrx',
+ },
+ parent: {
+ data: {
+ type: 'VF',
+ trackById: 'ckfqe3sb3y8',
+ vnfStoreKey: '2017-488_PASQUALE-vPE 0',
+ }
+ }
+ }
+ };
+
+
+ jest.spyOn(service, 'isAllowDrop');
+
+ service.drop(store, "serviceInstanceId", nodes, {from, to});
+
+ jest.clearAllMocks();
+
+ expect(service.isAllowDrop).not.toHaveBeenCalled();
+
+ });
+
+ test('drag shouldnt execute isAllowDrop when the from node is base module', () => {
+
+ let from = {
+ id: "04686zg11ur2",
+ index: 0,
+ data: {
+ instanceName: 'puwesovabe',
+ modelName: 'vocggrapitesting0..VocgGrapiTesting..ocgmgr..module-1'
+ },
+ parent: {
+ data: {
+ type: 'VF',
+ index: 0,
+ trackById: 'ckfqe3sb3y8',
+ vnfStoreKey: '2017-488_PASQUALE-vPE 0',
+ }
+ }
+ };
+
+ let to = {
+ parent: {
+ id: "4637423092446",
+ index: 1,
+ data: {
+ instanceName: 'bnmgtrx',
+ },
+ parent: {
+ data: {
+ type: 'VF',
+ trackById: 'ckfqe3sb3y8',
+ vnfStoreKey: '2017-488_PASQUALE-vPE 0',
+ }
+ }
+ }
+ };
+
+
+ jest.spyOn(service, 'isAllowDrop');
+
+ service.drop(store, "serviceInstanceId", nodes, {from, to});
+
+ jest.clearAllMocks();
+
+ expect(service.isAllowDrop).not.toHaveBeenCalled();
+
+ });
+
+
});
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.ts
index 2daaaaf71..2f86b0aa8 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/dragAndDrop/dragAndDrop.service.ts
@@ -9,16 +9,30 @@ export class DragAndDropService {
constructor(private store: NgRedux<AppState>) {
}
- isFlagOn(): boolean {
- return FeatureFlagsService.getFlagState(Features.FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE, this.store);
+ checkFeatureFlag(flagValue):boolean {
+ let featureFlag :boolean;
+ featureFlag = FeatureFlagsService.getFlagState(flagValue, this.store);
+ return featureFlag;
+ }
+
+ /***********************************************************************************************
+ if the dragged node is a base module instance
+ ***********************************************************************************************/
+ isBaseModule(serviceInstanceId, from): boolean {
+ try {
+ let baseModuleFlag = this.store.getState().service.serviceHierarchy[serviceInstanceId].vnfs[from.parent.data.vnfStoreKey].vfModules[from.data.modelName].properties.baseModule;
+ return (baseModuleFlag != 'undefined' ? baseModuleFlag : false);
+ }catch(e) {
+ return false;
+ }
}
/***********************************************************************************************
- if the falg is ON and nodes have same parent
+ if the flag is ON and nodes have same parent
***********************************************************************************************/
isAllowDrop(from: any, to: any): boolean {
- return this.isFlagOn() && this.isSameParent(from, to);
+ return this.checkFeatureFlag(Features.FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE) && this.isSameParent(from, to);
}
private isSameParent(from: any, to: any): boolean {
@@ -40,7 +54,11 @@ export class DragAndDropService {
drop(store, instanceId: string, nodes, {from, to}): void {
- if (!this.isFlagOn()) return;
+ if (!this.checkFeatureFlag(Features.FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE)) return;
+
+ if(this.checkFeatureFlag(Features.FLAG_2008_DISABLE_DRAG_FOR_BASE_MODULE)) {
+ if ((to.parent.index == 0 && this.isBaseModule(instanceId, to.parent)) || this.isBaseModule(instanceId, from )) return;
+ }
if (this.isAllowDrop(from, to)) {
let vfModules = nodes.find((parent) => {
@@ -101,4 +119,17 @@ export class DragAndDropService {
return arr;
};
+
+ drag(store, serviceModelId: string, fromObj): boolean {
+ if(!this.checkFeatureFlag(Features.FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE)) {
+ return;
+ } else{
+ if (this.checkFeatureFlag(Features.FLAG_2008_DISABLE_DRAG_FOR_BASE_MODULE)) {
+ if(this.isBaseModule(serviceModelId,fromObj)) {
+ return;
+ }
+ }
+ }
+
+ }
}
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts
index 837471395..7526970d3 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts
@@ -126,11 +126,14 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit {
nodes = [];
serviceModelId: string;
options = {
- allowDrag: this._dragAndDropService.isFlagOn(),
+ allowDrag: this._dragAndDropService.checkFeatureFlag(Features.FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE),
actionMapping: {
mouse: {
drop: (tree:TreeModel, node:TreeNode, $event:any, {from, to}) => {
this._dragAndDropService.drop(this.store, this.serviceModelId, this.nodes, {from, to});
+ },
+ drag:(tree: TreeModel, node:TreeNode, $event:any) => {
+ this._dragAndDropService.drag(this.store,this.serviceModelId, node);
}
}
},
@@ -256,6 +259,10 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit {
}
return optionLabel;
}
+
+ isAddPositionFlagTrue() {
+ return this._sharedTreeService.isAddPositionFlagTrue();
+ }
}
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html
index 59905bd75..a1ef96a62 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html
@@ -36,7 +36,7 @@
<div class="failed-msg" [attr.data-tests-id]="'failed-error-message'" *ngIf="node?.data?.isFailed">Failed
</div>
</custom-popover>
- <div *ngIf= "node?.data?.type == 'VFmodule'" class="instance-type" style="position: relative;border: 1px solid #D2D2CD;">
+ <div *ngIf= "node?.data?.type == 'VFmodule' && isAddPositionFlagTrue()" class="instance-type" style="position: relative;border: 1px solid #D2D2CD;">
<div *ngIf="node?.data?.action == 'Create' && node?.data?.type == 'VFmodule'" class="notShowOnViewMode notShowOnCreateMode newIcon"></div>
<div><span title="{{node.data.position}}"
[attr.data-tests-id]="'node-position-indicator'">{{node?.data?.position}}</span></div>