diff options
author | Alexey Sandler <alexey.sandler@intl.att.com> | 2020-05-06 18:58:14 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2020-05-17 02:37:48 +0000 |
commit | c8a3cfffe97ec18a54f43e82c3d4f65a65d7eefb (patch) | |
tree | d1c7b25f925609b9457c015465f5f281ad7400de /vid-webpack-master/src | |
parent | 4ac68cef7eac5c56d61626000f43d4e8f686c33d (diff) |
Add to VFM context menu action "Add pause upon completion".
Issue-ID: VID-821
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Change-Id: I8b0ef7021fb7b74e8ad12ae92e581510491d9605
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src')
10 files changed, 60 insertions, 8 deletions
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 18c3f72de..837471395 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 @@ -213,6 +213,11 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit { return this.isLabeledAsAction(node, "Delete"); } + isPaused(node: ITreeNode): boolean { + let isPaused = node.data.pauseInstantiation; + return !_.isNil(isPaused); + } + private isLabeledAsAction(node: ITreeNode, action) { let nodeAction = node.data.action.split('_').pop(); if (!_.isNil(nodeAction)) { 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 610986279..0ebee903c 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 @@ -66,7 +66,14 @@ <div class="scaling invalid" *ngIf="node?.data?.errors?.scalingError" [attr.data-tests-id]="'scaling-policy'"> <span>Limit</span><span>{{node?.data?.limitMembers}}</span> </div> - <div class="model-actions notShowOnViewMode "> + <div class="model-actions notShowOnViewMode" *ngIf="isPaused(node)" style="border-right: none;"> + <custom-icon + [size]="'large'" + [name]="'pause-upon-completion'" + [testId]="'pause-upon-completion'"> + </custom-icon> + </div> + <div class="model-actions notShowOnViewMode"> <span class="icon-browse" [ngClass]="{'isLinked' : isLinkedInstance(node?.data)}" [attr.data-tests-id]="'node-'+node.data.modelId +'-' +node.data.modelName+'-menu-btn'" diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.scss b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.scss index b774e03b6..95e7ba9ff 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.scss +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.scss @@ -408,7 +408,7 @@ drawing-board-tree { } } - .model-actions { + .model-actions{ :hover { background: transparent !important; } @@ -496,7 +496,7 @@ drawing-board-tree { .cdk-overlay-pane.ngx-contextmenu { ul.dropdown-menu { - width: 200px; + width: 250px; box-shadow: none; padding: 0; padding-top: 10px; diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts index e5979f7ed..90ecb8565 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts @@ -74,9 +74,10 @@ describe('Drawing board tree Service', () => { new TreeNodeContextMenuModel('upgrade', 'context-menu-upgrade', 'Upgrade', 'upgrade'), new TreeNodeContextMenuModel('undoDelete', 'context-menu-undoDelete', 'Undo Delete', 'undo-delete'), new TreeNodeContextMenuModel('undoUpgrade', 'context-menu-undoUpgrade', 'Undo Upgrade', 'undo-delete'), - new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o') + new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o'), + new TreeNodeContextMenuModel('pauseInstantiation', 'context-menu-pause', 'Add pause upon completion', 'pause-upon-completion') ]; - expect(options.length).toEqual(10); + expect(options.length).toEqual(11); expect(options).toEqual(expected); }); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts index dfd89ca79..3fc5c531c 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts @@ -35,6 +35,10 @@ export class DrawingBoardTreeService { return FeatureFlagsService.getFlagState(Features.FLAG_1902_NEW_VIEW_EDIT, this.store); } + isPauseVFMInstantiationCreationFlagTrue() { + return FeatureFlagsService.getFlagState(Features.FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION, this.store); + } + /********************************************** return all drawing board context menu options ***********************************************/ @@ -49,7 +53,8 @@ export class DrawingBoardTreeService { new TreeNodeContextMenuModel('upgrade', 'context-menu-upgrade', 'Upgrade', 'upgrade'), new TreeNodeContextMenuModel('undoDelete', 'context-menu-undoDelete', 'Undo Delete', 'undo-delete'), new TreeNodeContextMenuModel('undoUpgrade', 'context-menu-undoUpgrade', 'Undo Upgrade', 'undo-delete'), - new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o') + new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o'), + new TreeNodeContextMenuModel('pauseInstantiation', 'context-menu-pause', 'Add pause upon completion', 'pause-upon-completion') ]; } diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts index c225687ea..42ee238d0 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts @@ -20,6 +20,7 @@ import {VfModuleUpgradePopupService} from "../../../../../shared/components/gene import {instance, mock, when} from "ts-mockito"; import each from "jest-each"; import {VfModule} from "../../../../../shared/models/vfModule"; +import {VfModuleTreeNode} from "../../../../../shared/models/vfModuleTreeNode"; class MockAppStore<T> { getState() { @@ -127,6 +128,26 @@ describe('VFModule Model Info', () => { expect(nextLevel).toBeNull(); }); + each([ + ['afterCompletion', 'afterCompletion'], + ['undefined', undefined] + ]). + test('createNode should return pauseInstantiation status %s', (description, pauseInstantiationStatus) => { + const modelName: string = "vfModuleModelName"; + const vfModuleInstance = { + "vfModuleInstanceName": { + "pauseInstantiation": pauseInstantiationStatus, + } + }; + const currentModel = {}; + const parentModel = {}; + const serviceModelId = "serviceModelId"; + + let actual: VfModuleTreeNode = vfModuleModel.createNode(<any>vfModuleInstance, <any>currentModel, <any>parentModel, modelName, 0, serviceModelId); + let expected: string = pauseInstantiationStatus; + expect(actual.pauseInstantiation).toEqual(expected); + }); + test('getModel should return Module model', () => { let model = vfModuleModel.getModel({ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5", diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts index c7c4d3a56..607519ab3 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts @@ -22,6 +22,7 @@ import {IframeService} from "../../../../../shared/utils/iframe.service"; import { deleteActionVfModuleInstance, deleteVFModuleField, + pauseActionVFModuleInstance, removeVfModuleInstance, undoDeleteVfModuleInstance, undoUgradeVFModule, @@ -97,6 +98,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo { newVfModule.menuActions = this.getMenuAction(<any>newVfModule, serviceModelId); newVfModule.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed; newVfModule.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : ""; + newVfModule.pauseInstantiation = instance.pauseInstantiation; newVfModule = this._sharedTreeService.addingStatusProperty(newVfModule); return newVfModule; @@ -387,6 +389,13 @@ export class VFModuleModelInfo implements ILevelNodeInfo { return this._sharedTreeService.shouldShowUndoUpgrade(node); } }, + pauseInstantiation: { + method: (node, serviceModelId) => { + this._store.dispatch(pauseActionVFModuleInstance(node.data.dynamicModelName, node.parent.data.vnfStoreKey, serviceModelId, node.data.modelName)); + }, + visible: () => this._sharedTreeService.shouldShowPauseInstantiation(), + enable: () => true, + } }; } diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts index 249f9ec85..98edb4161 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts @@ -222,6 +222,9 @@ export class SharedTreeService { } } + shouldShowPauseInstantiation(): boolean { + return (FeatureFlagsService.getFlagState(Features.FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION, this._store)); + } /**************************************************** * should return true if customer can upgrade a VFM * ****************************************************/ diff --git a/vid-webpack-master/src/app/shared/models/treeNodeModel.ts b/vid-webpack-master/src/app/shared/models/treeNodeModel.ts index d25850dbb..a6c933ac0 100644 --- a/vid-webpack-master/src/app/shared/models/treeNodeModel.ts +++ b/vid-webpack-master/src/app/shared/models/treeNodeModel.ts @@ -2,7 +2,7 @@ import {ChildNodeInstance} from "./nodeInstance"; import {NodeModel} from "./nodeModel"; import {ServiceNodeTypes} from "./ServiceNodeTypes"; import * as _ from 'lodash'; -import {ServiceInstanceActions} from "./serviceInstanceActions"; +import {PauseStatus, ServiceInstanceActions} from "./serviceInstanceActions"; import {ModelInfo} from "./modelInfo"; export enum TreeLevel { @@ -34,6 +34,7 @@ export class TreeNodeModel { instanceId?: string; instanceType?: string; instanceName?: string; + pauseInstantiation?: PauseStatus; constructor(instance: ChildNodeInstance, nodeModel: NodeModel){ diff --git a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts index 0ab175808..50840d194 100644 --- a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts +++ b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts @@ -22,7 +22,7 @@ export enum Features { FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF = 'FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF', FLAG_2006_VNF_LOB_MULTI_SELECT= 'FLAG_2006_VNF_LOB_MULTI_SELECT', FLAG_2006_NEW_VIEW_EDIT_BUTTON_IN_INSTANTIATION_STATUS= 'FLAG_2006_NEW_VIEW_EDIT_BUTTON_IN_INSTANTIATION_STATUS', - FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION= 'FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION', + FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION = 'FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION', } @Injectable() |