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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
import {Component, Inject} from "@angular/core";
import {Component as ComponentData, IUserProperties, Plugin} from "app/models";
import {CacheService, PluginsService} from "app/services-ng2";
@Component({
selector: 'plugin-context-view',
templateUrl: './plugin-context-view.page.component.html',
styleUrls: ['./plugin-context-view.page.component.less']
})
export class PluginContextViewPageComponent {
plugin: Plugin;
user: IUserProperties;
queryParams: Object;
isLoading: boolean;
show: boolean;
component: ComponentData;
constructor(@Inject("$stateParams") private _stateParams,
private cacheService: CacheService,
private pluginsService: PluginsService) {
this.show = false;
this.component = this._stateParams.component;
this.plugin = this.pluginsService.getPluginByStateUrl(_stateParams.path);
this.user = this.cacheService.get('user');
}
ngOnInit() {
this.isLoading = true;
this.queryParams = {
userId: this.user.userId,
userRole: this.user.role,
displayType: "context",
contextType: this.component.getComponentSubType(),
uuid: this.component.uuid,
componentId: this.component.uniqueId,
lifecycleState: this.component.lifecycleState,
isOwner: this.component.lastUpdaterUserId === this.user.userId,
version: this.component.version,
parentUrl: window.location.origin,
eventsClientId: this.plugin.pluginId
};
if (this._stateParams.queryParams) {
_.assign(this.queryParams, this._stateParams.queryParams);
}
}
onLoadingDone(plugin: Plugin) {
if (plugin.pluginId == this.plugin.pluginId) {
this.isLoading = false;
}
}
}
|