This is an automated email from the ASF dual-hosted git repository.

sardell pushed a commit to branch feature/METRON-1856-parser-aggregation
in repository https://gitbox.apache.org/repos/asf/metron.git


The following commit(s) were added to 
refs/heads/feature/METRON-1856-parser-aggregation by this push:
     new 15c4a5e  METRON-2122 [UI] Fixing early app config access issue (tiborm 
via sardell) closes apache/metron#1415
15c4a5e is described below

commit 15c4a5ee68a76292524f3ef3c85100ff645aa6f6
Author: tiborm <[email protected]>
AuthorDate: Tue Jul 16 14:01:38 2019 +0200

    METRON-2122 [UI] Fixing early app config access issue (tiborm via sardell) 
closes apache/metron#1415
---
 .../metron-config/src/app/service/storm.service.ts | 43 ++++++++++++----------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/metron-interface/metron-config/src/app/service/storm.service.ts 
b/metron-interface/metron-config/src/app/service/storm.service.ts
index a45f7d1..86b08a9 100644
--- a/metron-interface/metron-config/src/app/service/storm.service.ts
+++ b/metron-interface/metron-config/src/app/service/storm.service.ts
@@ -15,28 +15,31 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import { Injectable, Inject } from '@angular/core';
+import { Injectable } from '@angular/core';
 import { HttpClient } from '@angular/common/http';
 import { HttpUtil } from '../util/httpUtil';
 import { TopologyStatus } from '../model/topology-status';
 import { TopologyResponse } from '../model/topology-response';
 import { Observable, interval } from 'rxjs';
 import { map, catchError, switchMap, onErrorResumeNext } from 'rxjs/operators';
-import {AppConfigService} from './app-config.service';
+import { AppConfigService } from './app-config.service';
 
 @Injectable()
 export class StormService {
-  url = this.appConfigService.getApiRoot() + '/storm';
 
   constructor(
     private http: HttpClient,
     private appConfigService: AppConfigService
   ) {}
 
+  private getStormApiURL() {
+    return this.appConfigService.getApiRoot() + '/storm';
+  }
+
   public pollGetAll(): Observable<TopologyStatus[]> {
     return interval(8000).pipe(
       switchMap(() => {
-        return this.http.get(this.url).pipe(
+        return this.http.get(this.getStormApiURL()).pipe(
           map(HttpUtil.extractData),
           catchError(HttpUtil.handleError),
           onErrorResumeNext()
@@ -46,112 +49,112 @@ export class StormService {
   }
 
   public getAll(): Observable<TopologyStatus[]> {
-    return this.http.get(this.url).pipe(
+    return this.http.get(this.getStormApiURL()).pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public getEnrichmentStatus(): Observable<TopologyStatus> {
-    return this.http.get(this.url + '/enrichment').pipe(
+    return this.http.get(this.getStormApiURL() + '/enrichment').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public activateEnrichment(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/enrichment/activate').pipe(
+    return this.http.get(this.getStormApiURL() + '/enrichment/activate').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public deactivateEnrichment(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/enrichment/deactivate').pipe(
+    return this.http.get(this.getStormApiURL() + 
'/enrichment/deactivate').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public startEnrichment(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/enrichment/start').pipe(
+    return this.http.get(this.getStormApiURL() + '/enrichment/start').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public stopEnrichment(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/enrichment/stop').pipe(
+    return this.http.get(this.getStormApiURL() + '/enrichment/stop').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public getIndexingStatus(): Observable<TopologyStatus> {
-    return this.http.get(this.url + '/indexing').pipe(
+    return this.http.get(this.getStormApiURL() + '/indexing').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public activateIndexing(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/indexing/activate').pipe(
+    return this.http.get(this.getStormApiURL() + '/indexing/activate').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public deactivateIndexing(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/indexing/deactivate').pipe(
+    return this.http.get(this.getStormApiURL() + '/indexing/deactivate').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public startIndexing(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/indexing/start').pipe(
+    return this.http.get(this.getStormApiURL() + '/indexing/start').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public stopIndexing(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/indexing/stop').pipe(
+    return this.http.get(this.getStormApiURL() + '/indexing/stop').pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public getStatus(name: string): Observable<TopologyStatus> {
-    return this.http.get(this.url + '/' + name).pipe(
+    return this.http.get(this.getStormApiURL() + '/' + name).pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public activateParser(name: string): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/parser/activate/' + name).pipe(
+    return this.http.get(this.getStormApiURL() + '/parser/activate/' + 
name).pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public deactivateParser(name: string): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/parser/deactivate/' + name).pipe(
+    return this.http.get(this.getStormApiURL() + '/parser/deactivate/' + 
name).pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public startParser(name: string): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/parser/start/' + name).pipe(
+    return this.http.get(this.getStormApiURL() + '/parser/start/' + name).pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );
   }
 
   public stopParser(name: string): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/parser/stop/' + name).pipe(
+    return this.http.get(this.getStormApiURL() + '/parser/stop/' + name).pipe(
       map(HttpUtil.extractData),
       catchError(HttpUtil.handleError)
     );

Reply via email to