From 16a9fce0e104a38371a9e5a567ec611ae3fc7f33 Mon Sep 17 00:00:00 2001 From: ys9693 Date: Sun, 19 Jan 2020 13:50:02 +0200 Subject: Catalog alignment Issue-ID: SDC-2724 Signed-off-by: ys9693 Change-Id: I52b4aacb58cbd432ca0e1ff7ff1f7dd52099c6fe --- .../plugin-context-view.page.component.ts | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 catalog-ui/src/app/ng2/pages/plugins/plugin-context-view/plugin-context-view.page.component.ts (limited to 'catalog-ui/src/app/ng2/pages/plugins/plugin-context-view/plugin-context-view.page.component.ts') diff --git a/catalog-ui/src/app/ng2/pages/plugins/plugin-context-view/plugin-context-view.page.component.ts b/catalog-ui/src/app/ng2/pages/plugins/plugin-context-view/plugin-context-view.page.component.ts new file mode 100644 index 0000000000..21aa8584d5 --- /dev/null +++ b/catalog-ui/src/app/ng2/pages/plugins/plugin-context-view/plugin-context-view.page.component.ts @@ -0,0 +1,58 @@ +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, + 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; + } + } + + +} -- cgit 1.2.3-korg