aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2020-01-29 15:11:47 +0200
committerEylon Malin <eylon.malin@intl.att.com>2020-01-30 23:23:36 +0200
commitaefc6a0e43b8ce36134dbbed71cf2b4cb9745a9f (patch)
tree82e6a44cdb477657796d3280aa0a9ef91aea1fe3 /vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
parent714c28d14b53b91eac1a5ffa3ebdf63650028918 (diff)
don't show delete in menu action while edit a macro service
Issue-ID: VID-760 Change-Id: Ieed2b7430cc1584681b1143d8b7244801dd8a1c4 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts22
1 files changed, 16 insertions, 6 deletions
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 6c985ec6a..669f9b675 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
@@ -139,8 +139,8 @@ export class SharedTreeService {
/**********************************************
* should return true if can delete
**********************************************/
- shouldShowDelete(node): boolean {
- return this.shouldShowButtonGeneric(node, "delete")
+ shouldShowDelete(node, serviceModelId): boolean {
+ return this.shouldShowButtonGeneric(node, "delete", serviceModelId)
}
/**********************************************
@@ -193,7 +193,7 @@ export class SharedTreeService {
shouldShowUpgrade(node, serviceModelId): boolean {
if (FeatureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE, this._store) &&
this.isThereAnUpdatedLatestVersion(serviceModelId)) {
- return this.shouldShowButtonGeneric(node, VNFMethods.UPGRADE);
+ return this.shouldShowButtonGeneric(node, VNFMethods.UPGRADE, serviceModelId);
}
else {
return false
@@ -201,12 +201,22 @@ export class SharedTreeService {
}
private isThereAnUpdatedLatestVersion(serviceModelId) : boolean{
- let serviceInstance = this._store.getState().service.serviceInstance[serviceModelId];
+ let serviceInstance = this.getServiceInstance(serviceModelId);
return !_.isNil(serviceInstance.latestAvailableVersion) && (Number(serviceInstance.modelInfo.modelVersion) < serviceInstance.latestAvailableVersion);
}
- private shouldShowButtonGeneric(node, method) {
+ private getServiceInstance(serviceModelId): any {
+ return this._store.getState().service.serviceInstance[serviceModelId];
+ }
+
+ shouldShowButtonGeneric(node, method, serviceModelId) {
const mode = this._store.getState().global.drawingBoardStatus;
+ const isMacro = !(this.getServiceInstance(serviceModelId).isALaCarte);
+
+ if (isMacro) { //if macro action allowed only for service level
+ return false;
+ }
+
if (!_.isNil(node) && !_.isNil(node.data) && !_.isNil(node.data.action) && !_.isNil(node.data.menuActions[method])) {
if (mode !== DrawingBoardModes.EDIT || node.data.action === ServiceInstanceActions.Create) {
return false;
@@ -288,7 +298,7 @@ export class SharedTreeService {
************************************************/
getExistingInstancesWithDeleteMode(node, serviceModelId: string, type: string): number {
let counter = 0;
- const existingInstances = this._store.getState().service.serviceInstance[serviceModelId][type];
+ const existingInstances = this.getServiceInstance(serviceModelId)[type];
const modelUniqueId = node.data.modelUniqueId;
if (!_.isNil(existingInstances)) {
for (let instanceKey in existingInstances) {