diff options
author | Idan Amit <ia096e@intl.att.com> | 2018-05-21 16:09:35 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-05-21 17:21:15 +0000 |
commit | f1039ca450c906389099e22b37febf0a73044490 (patch) | |
tree | c87dbb0dd603b959846208c58125f9ee97b147be /catalog-ui/src/app/ng2 | |
parent | 06681f9451fd5d834b9e0b96ca000c8e2078de25 (diff) |
fixed SDC UI loading issues
Fixed the API loading issues in slow network environments
Change-Id: I1b8cb779d769c80d41a2303595a0b78dab46f192
Issue-ID: SDC-1347
Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/ng2')
-rw-r--r-- | catalog-ui/src/app/ng2/app.module.ts | 6 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/services/config.service.ts | 16 |
2 files changed, 14 insertions, 8 deletions
diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts index 194d2e0095..c3cd06043b 100644 --- a/catalog-ui/src/app/ng2/app.module.ts +++ b/catalog-ui/src/app/ng2/app.module.ts @@ -64,8 +64,10 @@ export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); export function configServiceFactory(config:ConfigService) { return () => { - config.loadValidationConfiguration(); - config.loadPluginsConfiguration(); + return Promise.all([ + config.loadValidationConfiguration(), + config.loadPluginsConfiguration() + ]); } } diff --git a/catalog-ui/src/app/ng2/services/config.service.ts b/catalog-ui/src/app/ng2/services/config.service.ts index 3e6e667285..a9a4e86a55 100644 --- a/catalog-ui/src/app/ng2/services/config.service.ts +++ b/catalog-ui/src/app/ng2/services/config.service.ts @@ -72,15 +72,19 @@ export class ConfigService { loadPluginsConfiguration(): Promise<PluginsConfiguration> { let url:string = this.api.no_proxy_root + this.api.GET_plugins_configuration; let promise: Promise<any> = this.http.get(url).map((res: Response) => res.json()).toPromise(); - promise.then((pluginsData: Plugins) => { - PluginsConfiguration.plugins = pluginsData; - }).catch((ex) => { - console.error("Error loading plugins configuration from BE", ex); + return new Promise<PluginsConfiguration>((resolve) => { + promise.then((pluginsData: Plugins) => { + PluginsConfiguration.plugins = pluginsData; + console.log('RESOLVED PLUGINS!!!'); + resolve(); + }).catch((ex) => { + console.error("Error loading plugins configuration from BE", ex); - PluginsConfiguration.plugins = [] as Plugins; + PluginsConfiguration.plugins = [] as Plugins; + }); }); - return promise; + // return promise; } } |