1 import {Component, Inject} from "@angular/core";
2 import {Component as ComponentData, IUserProperties, Plugin} from "app/models";
3 import {CacheService, PluginsService} from "app/services-ng2";
7 selector: 'plugin-context-view',
8 templateUrl: './plugin-context-view.page.component.html',
9 styleUrls: ['./plugin-context-view.page.component.less']
12 export class PluginContextViewPageComponent {
14 user: IUserProperties;
18 component: ComponentData;
20 constructor(@Inject("$stateParams") private _stateParams,
21 private cacheService: CacheService,
22 private pluginsService: PluginsService) {
25 this.component = this._stateParams.component;
26 this.plugin = this.pluginsService.getPluginByStateUrl(_stateParams.path);
27 this.user = this.cacheService.get('user');
31 this.isLoading = true;
34 userId: this.user.userId,
35 userRole: this.user.role,
36 displayType: "context",
37 contextType: this.component.getComponentSubType(),
38 uuid: this.component.uuid,
39 lifecycleState: this.component.lifecycleState,
40 isOwner: this.component.lastUpdaterUserId === this.user.userId,
41 version: this.component.version,
42 parentUrl: window.location.origin,
43 eventsClientId: this.plugin.pluginId
46 if (this._stateParams.queryParams) {
47 _.assign(this.queryParams, this._stateParams.queryParams);
51 onLoadingDone(plugin: Plugin) {
52 if (plugin.pluginId == this.plugin.pluginId) {
53 this.isLoading = false;