Catalog alignment
[sdc.git] / catalog-ui / src / app / ng2 / pages / plugins / plugin-tab-view / plugin-tab-view.page.component.ts
1 import {Component, Inject} from "@angular/core";
2 import {IUserProperties, Plugin} from "app/models";
3 import {CacheService, PluginsService} from "app/services-ng2";
4
5 @Component({
6     selector: 'plugin-tab-view',
7     templateUrl: './plugin-tab-view.page.component.html',
8     styleUrls: ['./plugin-tab-view.page.component.less']
9 })
10
11 export class PluginTabViewPageComponent {
12     plugin: Plugin;
13     user: IUserProperties;
14     version: string;
15     queryParams: Object;
16     isLoading: boolean;
17
18     constructor(@Inject("$stateParams") private _stateParams,
19                 private cacheService: CacheService,
20                 private pluginsService: PluginsService) {
21
22         this.plugin = this.pluginsService.getPluginByStateUrl(_stateParams.path);
23         this.version = this.cacheService.get('version');
24         this.user = this.cacheService.get('user');
25     }
26
27     ngOnInit() {
28         this.isLoading = true;
29
30         this.queryParams = {
31             userId: this.user.userId,
32             userRole: this.user.role,
33             displayType: "tab",
34             parentUrl: window.location.origin,
35             eventsClientId: this.plugin.pluginId
36         };
37
38     }
39
40     onLoadingDone(plugin: Plugin) {
41         if (plugin.pluginId == this.plugin.pluginId) {
42             this.isLoading = false;
43         }
44     }
45 }