Change designer to plugin in code
[sdc.git] / catalog-ui / src / app / view-models / plugins / plugins-tab-view-model.ts
1 import {Plugin, IUserProperties} from "app/models";
2 import {CacheService} from "app/services";
3 import {PluginsService} from "../../ng2/services/plugins.service";
4
5
6 interface IPluginsTabViewModelScope extends ng.IScope {
7     plugin: Plugin
8     user: IUserProperties;
9     version: string;
10     queryParams: Object;
11 }
12
13 export class PluginsTabViewModel {
14     static '$inject' = [
15         '$scope',
16         '$stateParams',
17         'Sdc.Services.CacheService',
18         'PluginsService'
19     ];
20
21     constructor(private $scope:IPluginsTabViewModelScope,
22                 private $stateParams:any,
23                 private cacheService:CacheService,
24                 private pluginsService:PluginsService) {
25
26         this.initScope();
27     }
28
29     private initScope = ():void => {
30         this.$scope.plugin = this.pluginsService.getPluginByStateUrl(this.$stateParams.path);
31
32         this.$scope.version = this.cacheService.get('version');
33
34         this.$scope.user = this.cacheService.get('user');
35
36         this.$scope.queryParams = {
37             userId: this.$scope.user.userId
38         };
39     }
40 }