wrongly setting version
[sdc.git] / catalog-ui / src / app / view-models / workspace / tabs / designers / designers-tab-view-model.ts
1 import {Designer, IUserProperties} from "app/models";
2 import {CacheService} from "app/services";
3 import {DesignersService} from "../../../../ng2/services/designers.service";
4 import {IWorkspaceViewModelScope} from "../../workspace-view-model";
5
6
7 interface IDesignerTabViewModelScope extends IWorkspaceViewModelScope {
8     designer: Designer;
9     user:IUserProperties;
10     queryParams: Object;
11 }
12
13 export class DesignersTabViewModel {
14     static '$inject' = [
15         '$scope',
16         '$stateParams',
17         'Sdc.Services.CacheService',
18         'DesignersService'
19     ];
20
21     constructor(private $scope:IDesignerTabViewModelScope,
22                 private $stateParams:any,
23                 private cacheService:CacheService,
24                 private designersService:DesignersService) {
25
26         this.initScope();
27     }
28
29     private initScope = ():void => {
30         this.$scope.designer = this.designersService.getDesignerByStateUrl(this.$stateParams.path);
31
32         this.$scope.user = this.cacheService.get('user');
33
34         this.$scope.queryParams = {
35             userId: this.$scope.user.userId,
36             contextType: this.$scope.component.componentType,
37             uuid: this.$scope.component.uuid,
38             lifecycleState: this.$scope.component.lifecycleState,
39             isOwner: this.$scope.component.lastUpdaterUserId === this.$scope.user.userId
40         };
41
42     }
43 }