diff options
author | ilanap <ilanap@amdocs.com> | 2019-12-17 14:57:13 +0200 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-02-05 07:46:21 +0000 |
commit | f6ddad9c6f5d5801da3e6cb8d2c12ae81c2b7582 (patch) | |
tree | e016d7c6c43faa1be8915857d0b2c4779c3695ce /catalog-ui/src/app/ng2/components/ui | |
parent | 9fb5a1e5b8ff970dd811ea7bf03ad6fcbe30fe70 (diff) |
Fix loader for unready plugins
Checks whether plugin was ready and will reset loader and ready event when moving between windows if not.
Issue-ID: SDC-2715
Signed-off-by: ilanap <ilanap@amdocs.com>
Change-Id: I9c3d637135153f0607a6588e5f588450c1708b99
Diffstat (limited to 'catalog-ui/src/app/ng2/components/ui')
-rw-r--r-- | catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts index d94f24da28..e704e3c983 100644 --- a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts +++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts @@ -18,6 +18,7 @@ export class PluginFrameComponent implements OnInit { pluginUrl: string; private urlSearchParams: URLSearchParams; private isClosed: boolean; + private isReady: boolean; private isPluginCheckDone: boolean; constructor(private eventBusService: EventBusService, @@ -44,6 +45,7 @@ export class PluginFrameComponent implements OnInit { private initPlugin() { this.pluginUrl = this.plugin.pluginSourceUrl; this.isClosed = false; + this.isReady = false; if (this.queryParams && !_.isEmpty(this.queryParams)) { _.forOwn(this.queryParams, (value, key) => { @@ -57,6 +59,7 @@ export class PluginFrameComponent implements OnInit { let readyEvent = (eventData) => { if (eventData.originId === this.plugin.pluginId) { if (eventData.type == "READY") { + this.isReady = true; this.onLoadingDone.emit(); this.eventBusService.off(readyEvent) } @@ -69,10 +72,13 @@ export class PluginFrameComponent implements OnInit { // before moving to a new state this.$scope.$on('$stateChangeStart', (event, toState, toParams, fromState, fromParams) => { if ((fromState.name !== toState.name) || (fromState.name === toState.name) && (toParams.path !== fromParams.path)) { + if (!this.isReady) { + this.onLoadingDone.emit(); + this.eventBusService.off(readyEvent) + } if (this.eventBusService.NoWindowOutEvents.indexOf(this.eventBusService.lastEventNotified) == -1) { if (!this.isClosed) { event.preventDefault(); - this.eventBusService.notify("WINDOW_OUT").subscribe(() => { this.isClosed = true; this.eventBusService.unregister(this.plugin.pluginId); |