aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratif husain <atif.husain@team.telstra.com>2019-10-02 18:03:57 +1000
committerOfir Sonsino <ofir.sonsino@intl.att.com>2019-10-16 10:46:17 +0000
commitd289108897f3baf5bc51092c4f55309bdd90f8d9 (patch)
tree95bd25ec828807e5e4b8f75c8f8ee1d614d1913c
parentce2eae1de729f7c66f753857643a6464fbb4013e (diff)
Changes for new service category
Introduced new service category, Partner Domain Service Added logic to disable composition for Partner Domain Service category Issue-ID: SDC-2382 Change-Id: I6ed135733c6f05914e102c037ebe9057ad731e75 Signed-off-by: Atif Husain <atif.husain@team.telstra.com>
-rw-r--r--catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml3
-rw-r--r--catalog-ui/configurations/menu.js2
-rw-r--r--catalog-ui/src/app/utils/menu-handler.ts4
-rw-r--r--catalog-ui/src/app/view-models/workspace/workspace-view-model.ts31
-rw-r--r--catalog-ui/src/app/view-models/workspace/workspace-view.html2
-rw-r--r--catalog-ui/src/app/view-models/workspace/workspace.less6
6 files changed, 42 insertions, 6 deletions
diff --git a/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml b/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml
index e3851a3539..f0aeb128cf 100644
--- a/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml
+++ b/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml
@@ -17,6 +17,9 @@ services:
Network_Service:
name: "Network Service"
icons: ['network_l_1-3']
+ Partner_Domain_Service:
+ name: "Partner Domain Service"
+ icons: ['partner_domain_service']
resources:
NetworkLayer23:
name: "Network L2-3"
diff --git a/catalog-ui/configurations/menu.js b/catalog-ui/configurations/menu.js
index d9138ae4c5..c1c6d10710 100644
--- a/catalog-ui/configurations/menu.js
+++ b/catalog-ui/configurations/menu.js
@@ -500,7 +500,7 @@ const SDC_MENU_CONFIG = {
"SERVICE": [
{"text": "General", "action": "onMenuItemPressed", "state": "workspace.general"},
{"text": "TOSCA Artifacts", "action": "onMenuItemPressed", "state": "workspace.tosca_artifacts"},
- {"text": "Composition", "action": "onMenuItemPressed", "state": "workspace.composition.details"},
+ {"text": "Composition", "action": "onMenuItemPressed", "state": "workspace.composition.details", "disabledCategories":["Partner Domain Service"]},
{"text": "Operation", "action":"onMenuItemPressed", "state": "workspace.interface_operation"},
{"text": "Activity Log", "action": "onMenuItemPressed", "state": "workspace.activity_log"},
{"text": "Management Workflow", "action": "onMenuItemPressed", "state": "workspace.management_workflow"},
diff --git a/catalog-ui/src/app/utils/menu-handler.ts b/catalog-ui/src/app/utils/menu-handler.ts
index 4c25a025da..eaef63fcc7 100644
--- a/catalog-ui/src/app/utils/menu-handler.ts
+++ b/catalog-ui/src/app/utils/menu-handler.ts
@@ -32,6 +32,7 @@ export class MenuItem {
action:string;
params:any;
isDisabled:boolean;
+ disabledCategory:boolean;
disabledRoles:Array<string>;
blockedForTypes:Array<string>; // This item will not be shown for specific components types.
@@ -43,13 +44,14 @@ export class MenuItem {
url:string; // Data added to menu item, in case the function need to use it, example: for function "changeLifecycleState", I need to pass also the state "CHECKOUT" that I want the state to change to.
- constructor(text:string, callback:(...args:Array<any>) => ng.IPromise<boolean>, state:string, action:string, params?:any, blockedForTypes?:Array<string>) {
+ constructor(text:string, callback:(...args:Array<any>) => ng.IPromise<boolean>, state:string, action:string, params?:any, blockedForTypes?:Array<string>, disabledCategory?:boolean) {
this.text = text;
this.callback = callback;
this.state = state;
this.action = action;
this.params = params;
this.blockedForTypes = blockedForTypes;
+ this.disabledCategory = disabledCategory;
}
}
diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts
index 9429022b48..f4bbed2c96 100644
--- a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts
@@ -177,6 +177,7 @@ export class WorkspaceViewModel {
}
private role:string;
+ private category:string;
private components:Array<Component>;
private initViewMode = ():WorkspaceMode => {
@@ -216,6 +217,7 @@ export class WorkspaceViewModel {
this.$scope.version = this.cacheService.get('version');
this.$scope.user = this.cacheService.get("user");
this.role = this.$scope.user.role;
+ this.category = this.$scope.component.selectedCategory;
this.$scope.mode = this.initViewMode();
this.$scope.isValidForm = true;
this.initChangeLifecycleStateButtons();
@@ -870,6 +872,21 @@ export class WorkspaceViewModel {
return tempMenuItems;
};
+ private updateMenuItemByCategory = (menuItems:Array<any>, category:string) => {
+ let tempMenuItems:Array<any> = new Array<any>();
+ menuItems.forEach((item:any) => {
+ //update flag disabledCategory to true if category is disabled
+ item.disabledCategory = false;
+ if ((item.disabledCategories && item.disabledCategories.indexOf(category) > -1))
+ {
+ item.disabledCategory = true;
+ }
+ tempMenuItems.push(item);
+ });
+ return tempMenuItems;
+ };
+
+
private deleteArchiveCache = () => {
this.cacheService.remove("archiveComponents"); //delete the cache to ensure the archive is reloaded from server
};
@@ -894,7 +911,13 @@ export class WorkspaceViewModel {
let inCreateMode = this.$scope.isCreateMode();
this.$scope.leftBarTabs = new MenuItemGroup();
- const menuItemsObjects:Array<any> = this.updateMenuItemByRole(this.sdcMenu.component_workspace_menu_option[this.$scope.component.getComponentSubType()], this.role);
+ //const menuItemsObjects:Array<any> = this.updateMenuItemByRole(this.sdcMenu.component_workspace_menu_option[this.$scope.component.getComponentSubType()], this.role);
+ let menuItemsObjects:Array<any> = this.updateMenuItemByRole(this.sdcMenu.component_workspace_menu_option[this.$scope.component.getComponentSubType()], this.role);
+ if(this.$scope.component.getComponentSubType()==="SERVICE")
+ {
+ let menuItemsObjectsCategory:Array<any> = this.updateMenuItemByCategory(menuItemsObjects, this.category);
+ menuItemsObjects = menuItemsObjectsCategory;
+ }
// Only adding plugins to the workspace if they can be displayed for the current user role
_.each(PluginsConfiguration.plugins, (plugin: Plugin) => {
@@ -909,7 +932,7 @@ export class WorkspaceViewModel {
});
this.$scope.leftBarTabs.menuItems = menuItemsObjects.map((item:MenuItem) => {
- const menuItem = new MenuItem(item.text, item.callback, item.state, item.action, item.params, item.blockedForTypes);
+ const menuItem = new MenuItem(item.text, item.callback, item.state, item.action, item.params, item.blockedForTypes, item.disabledCategory);
if (menuItem.params) {
menuItem.params.state = menuItem.state;
}
@@ -918,7 +941,9 @@ export class WorkspaceViewModel {
}
menuItem.callback = () => this.$scope[menuItem.action](menuItem.state, menuItem.params);
menuItem.isDisabled = (inCreateMode && States.WORKSPACE_GENERAL != menuItem.state) ||
- (States.WORKSPACE_DEPLOYMENT === menuItem.state && this.$scope.component.modules && this.$scope.component.modules.length === 0 && this.$scope.component.isResource());
+ (States.WORKSPACE_DEPLOYMENT === menuItem.state && this.$scope.component.modules
+ && this.$scope.component.modules.length === 0 && this.$scope.component.isResource()) ||
+ (menuItem.disabledCategory === true);
return menuItem;
});
diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view.html b/catalog-ui/src/app/view-models/workspace/workspace-view.html
index 5ae3e28f2a..d22262c94a 100644
--- a/catalog-ui/src/app/view-models/workspace/workspace-view.html
+++ b/catalog-ui/src/app/view-models/workspace/workspace-view.html
@@ -22,7 +22,7 @@
{{menuComponentTitle}}
</div>
<div class="i-sdc-designer-sidebar-section-content-item" ng-class="{'selected': isSelected(menuItem)}" ng-repeat="menuItem in leftBarTabs.menuItems track by $index">
- <div class="expand-collapse-menu-box-item-text" ng-click="menuItem.callback()" ng-class="{'disabled': menuItem.isDisabled }" data-tests-id="{{menuItem.text}}LeftSideMenu">{{menuItem.text}}</div>
+ <div class="expand-collapse-menu-box-item-text" ng-class="{'disabled': menuItem.isDisabled }" data-tests-id="{{menuItem.text}}LeftSideMenu" ><button type="button" class="i-sdc-designer-sidebar-section-content-item-service-cat" ng-click="menuItem.callback()" ng-disabled={{menuItem.disabledCategory}}>{{menuItem.text}}</button></div>
</div>
</div>
diff --git a/catalog-ui/src/app/view-models/workspace/workspace.less b/catalog-ui/src/app/view-models/workspace/workspace.less
index b9956c655b..11c0976c03 100644
--- a/catalog-ui/src/app/view-models/workspace/workspace.less
+++ b/catalog-ui/src/app/view-models/workspace/workspace.less
@@ -67,6 +67,12 @@
}
}
+ .i-sdc-designer-sidebar-section-content-item-service-cat {
+ border: none;
+ background: transparent;
+ text-align: left;
+ padding: 0;
+ }
}
.sdc-asset-creation-info {