diff options
author | Idan Amit <ia096e@intl.att.com> | 2018-01-15 14:31:42 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-01-16 16:58:47 +0000 |
commit | 5197c8b7b3cf7576f1198e4b59a7d6484e793107 (patch) | |
tree | 55e938e420d863fac9f1c92901f4e7c2e34787c4 /catalog-ui/src/app/view-models/designers/designers-view-model.ts | |
parent | fd19ae43d9f057f9ce51d48f95ef3f5f60173f22 (diff) |
Designer-view component for top-nav
Create a designer-view component for opening a designer view from the top-nav
Updated the API to return the designers as a list and not as an object
Created a designer-frame component that will get a designer url to open in the dedicated position
Change-Id: Ic42f7695277e88aacdeaa74d4d0f95b49ce44999
Issue-ID: SDC-884
Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/view-models/designers/designers-view-model.ts')
-rw-r--r-- | catalog-ui/src/app/view-models/designers/designers-view-model.ts | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/catalog-ui/src/app/view-models/designers/designers-view-model.ts b/catalog-ui/src/app/view-models/designers/designers-view-model.ts new file mode 100644 index 0000000000..42c1194258 --- /dev/null +++ b/catalog-ui/src/app/view-models/designers/designers-view-model.ts @@ -0,0 +1,42 @@ +import {Designer, IUserProperties, DesignersConfiguration} from "app/models"; +import {CacheService} from "app/services"; +import {MenuItemGroup} from "app/utils"; + + +interface IDesignerViewModelScope extends ng.IScope { + designer: Designer + topNavMenuModel:Array<MenuItemGroup>; + user:IUserProperties; + version:string; +} + +export class DesignersViewModel { + static '$inject' = [ + '$scope', + '$stateParams', + '$sce', + 'Sdc.Services.CacheService' + ]; + + constructor(private $scope:IDesignerViewModelScope, + private $stateParams:any, + private $sce:any, + private cacheService:CacheService) { + + this.initScope(); + } + + private initScope = ():void => { + // get the designer object by using the path parameter + let designerKey: any = _.findKey(DesignersConfiguration.designers, (designerConfig: Designer) =>{ + return designerConfig.designerStateUrl === this.$stateParams.path; + }); + + this.$scope.designer = DesignersConfiguration.designers[designerKey]; + + this.$scope.version = this.cacheService.get('version'); + this.$scope.topNavMenuModel = []; + + this.$scope.user = this.cacheService.get('user'); + } +} |