From d289108897f3baf5bc51092c4f55309bdd90f8d9 Mon Sep 17 00:00:00 2001 From: atif husain Date: Wed, 2 Oct 2019 18:03:57 +1000 Subject: 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 --- .../view-models/workspace/workspace-view-model.ts | 31 +++++++++++++++++++--- .../app/view-models/workspace/workspace-view.html | 2 +- .../src/app/view-models/workspace/workspace.less | 6 +++++ 3 files changed, 35 insertions(+), 4 deletions(-) (limited to 'catalog-ui/src/app/view-models') 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; 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, category:string) => { + let tempMenuItems:Array = new Array(); + 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 = this.updateMenuItemByRole(this.sdcMenu.component_workspace_menu_option[this.$scope.component.getComponentSubType()], this.role); + //const menuItemsObjects:Array = this.updateMenuItemByRole(this.sdcMenu.component_workspace_menu_option[this.$scope.component.getComponentSubType()], this.role); + let menuItemsObjects:Array = this.updateMenuItemByRole(this.sdcMenu.component_workspace_menu_option[this.$scope.component.getComponentSubType()], this.role); + if(this.$scope.component.getComponentSubType()==="SERVICE") + { + let menuItemsObjectsCategory:Array = 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}}
-
{{menuItem.text}}
+
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 { -- cgit 1.2.3-korg