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>
diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts
index 194d2e0..c3cd060 100644
--- a/catalog-ui/src/app/ng2/app.module.ts
+++ b/catalog-ui/src/app/ng2/app.module.ts
@@ -64,8 +64,10 @@
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 3e6e667..a9a4e86 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 @@
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;
}
}