diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu')
3 files changed, 25 insertions, 3 deletions
diff --git a/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.html b/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.html index 18c6949b46..02d2683c9d 100644 --- a/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.html +++ b/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.html @@ -25,8 +25,8 @@ </div> <div class="i-sdc-designer-sidebar-section-content-item" [ngClass]="{'selected': isSelected(menuItem)}" - *ngFor="let menuItem of leftBarTabs.menuItems"> - <div class="expand-collapse-menu-box-item-text" ng-class="{'disabled': menuItem.isDisabled }"> + *ngFor="let menuItem of $scope.leftBarTabs.menuItems"> + <div class="expand-collapse-menu-box-item-text" [ngClass]="{ 'disabled': menuItem.isDisabled }"> <button [attr.data-tests-id]="menuItem.text + 'LeftSideMenu'" type="button" class="i-sdc-designer-sidebar-section-content-item-service-cat" (click)="menuItem.callback()" [disabled]="menuItem.disabledCategory">{{menuItem.text}}</button> </div> diff --git a/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.spec.ts b/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.spec.ts index a91258c00e..d9bb8833cd 100644 --- a/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.spec.ts +++ b/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.spec.ts @@ -26,6 +26,8 @@ import {CacheService} from "../../../services/cache.service"; import {States} from "../../../../utils/constants"; import {IAppMenu} from "../../../../models/app-config"; import {SdcMenuToken} from "../../../config/sdc-menu.config"; +import {IScope} from "../../../../../typings/angularjs/angular"; +import {IWorkspaceViewModelScope} from "../../../../view-models/workspace/workspace-view-model"; describe('WorkspaceMenuComponent', () => { let component: WorkspaceMenuComponent; @@ -59,6 +61,20 @@ describe('WorkspaceMenuComponent', () => { } }) }; + let importedFileMock: File = null; + let stateParamsMock: Partial<ng.ui.IStateParamsService> = { + 'importedFile': importedFileMock + }; + let resolveMock = {"$stateParams": stateParamsMock}; + let parentScopeMock: Partial<IScope> = { + '$resolve': resolveMock + }; + let scopeMock_: Partial<IWorkspaceViewModelScope> = { + '$parent': parentScopeMock, + 'current': { + 'name': States.TYPE_WORKSPACE + } + } beforeEach(async(() => { TestBed.configureTestingModule({ @@ -66,6 +82,7 @@ describe('WorkspaceMenuComponent', () => { providers: [ {provide: CacheService, useValue: cacheService}, {provide: '$injector', useValue: injectorMock}, + {provide: "$scope", useValue: scopeMock_ }, {provide: SdcMenuToken, useValue: sdcMenuMock} ] }) diff --git a/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.ts b/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.ts index c5e49d4d7d..ee4f3a84bd 100644 --- a/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.ts +++ b/catalog-ui/src/app/ng2/pages/type-workspace/workspace-menu/workspace-menu.component.ts @@ -25,6 +25,7 @@ import {CacheService} from "../../../services/cache.service"; import {IAppMenu} from "../../../../models/app-config"; import {IUserProperties} from "../../../../models/user"; import {SdcMenuToken} from "../../../config/sdc-menu.config"; +import {IWorkspaceViewModelScope} from "../../../../view-models/workspace/workspace-view-model"; @Component({ selector: 'app-workspace-menu', @@ -44,7 +45,10 @@ export class WorkspaceMenuComponent implements OnInit { leftBarTabs: MenuItemGroup = new MenuItemGroup(); - constructor(private cacheService: CacheService, @Inject(SdcMenuToken) private sdcMenu: IAppMenu, @Inject('$injector') $injector) { + constructor(private cacheService: CacheService, + @Inject('$scope') private $scope: IWorkspaceViewModelScope, + @Inject(SdcMenuToken) private sdcMenu: IAppMenu, + @Inject('$injector') $injector) { this.$state = $injector.get('$state'); this.$q = $injector.get('$q'); } @@ -70,6 +74,7 @@ export class WorkspaceMenuComponent implements OnInit { return menuItem; }); this.updateSelectedMenuItem(); + this.$scope.leftBarTabs = this.leftBarTabs; this.onMenuUpdate.emit(this.leftBarTabs); } |