diff options
Diffstat (limited to 'catalog-ui/src/app/view-models/workspace')
3 files changed, 35 insertions, 4 deletions
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 { |