aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/plugins/plugin-tab-view/plugin-tab-view.page.component.ts
blob: 7ba84745698ae9c954b8896d192ac6abd7837854 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import {Component, Inject} from "@angular/core";
import {IUserProperties, Plugin} from "app/models";
import {CacheService, PluginsService} from "app/services-ng2";

@Component({
    selector: 'plugin-tab-view',
    templateUrl: './plugin-tab-view.page.component.html',
    styleUrls: ['./plugin-tab-view.page.component.less']
})

export class PluginTabViewPageComponent {
    plugin: Plugin;
    user: IUserProperties;
    version: string;
    queryParams: Object;
    isLoading: boolean;

    constructor(@Inject("$stateParams") private _stateParams,
                private cacheService: CacheService,
                private pluginsService: PluginsService) {

        this.plugin = this.pluginsService.getPluginByStateUrl(_stateParams.path);
        this.version = this.cacheService.get('version');
        this.user = this.cacheService.get('user');
    }

    ngOnInit() {
        this.isLoading = true;

        this.queryParams = {
            userId: this.user.userId,
            userRole: this.user.role,
            displayType: "tab",
            parentUrl: window.location.origin,
            eventsClientId: this.plugin.pluginId
        };

    }

    onLoadingDone(plugin: Plugin) {
        if (plugin.pluginId == this.plugin.pluginId) {
            this.isLoading = false;
        }
    }
}