diff --git a/src/main/webapp/app/config/app-properties.ts b/src/main/webapp/app/config/app-properties.ts deleted file mode 100644 index 9996df9..0000000 --- a/src/main/webapp/app/config/app-properties.ts +++ /dev/null @@ -1,5 +0,0 @@ -export class appProperties { - public static BASEURL_API = "http://localhost:8081/api/"; - //public static BASEURL_API = "http://localhost:8080/api/"; - -} \ No newline at end of file diff --git a/src/main/webapp/app/home/home.component.html b/src/main/webapp/app/home/home.component.html index ef66aff..fc64a01 100644 --- a/src/main/webapp/app/home/home.component.html +++ b/src/main/webapp/app/home/home.component.html @@ -2,8 +2,7 @@
-

You are logged in as user "{{account.login}}"

+

You are logged in as user "{{account.login}}"

diff --git a/src/main/webapp/app/services/contexts-loader.service.ts b/src/main/webapp/app/services/contexts-loader.service.ts index dac1576..4089dde 100644 --- a/src/main/webapp/app/services/contexts-loader.service.ts +++ b/src/main/webapp/app/services/contexts-loader.service.ts @@ -3,8 +3,8 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs'; -import { appProperties } from 'app/config/app-properties'; import { IContextNode } from './i-context-node'; +import { ApplicationConfigService } from 'app/core/config/application-config.service'; @Injectable({ providedIn: 'root', @@ -15,11 +15,13 @@ export class ContextsLoaderService { headers: new HttpHeaders({ 'Content-Type': 'application/json' }), }; - constructor(private http: HttpClient) {} + constructor(private http: HttpClient, private applicationConfigService: ApplicationConfigService) {} fetchAll(): Observable { - return this.http.get(appProperties.BASEURL_API + 'is/allcontexts'); + //return this.http.get(appProperties.BASEURL_API + 'is/allcontexts'); + const resourceUrl = this.applicationConfigService.getEndpointFor('api/is/allcontexts'); + return this.http.get(resourceUrl); } diff --git a/src/main/webapp/app/services/resources-impl.service.ts b/src/main/webapp/app/services/resources-impl.service.ts index 9bda1dc..22da579 100644 --- a/src/main/webapp/app/services/resources-impl.service.ts +++ b/src/main/webapp/app/services/resources-impl.service.ts @@ -1,10 +1,10 @@ /* eslint-disable no-console */ import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable, Subject } from 'rxjs'; -import { appProperties } from 'app/config/app-properties'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { IHostingNode } from './i-hosting-node'; import { IEService } from './i-e-service'; +import { ApplicationConfigService } from 'app/core/config/application-config.service'; @Injectable({ providedIn: 'root' @@ -12,33 +12,30 @@ import { IEService } from './i-e-service'; export class ResourcesImplService { //public isLoading: BehaviorSubject = new BehaviorSubject(false); - httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }), }; private loading: BehaviorSubject = new BehaviorSubject(false); - constructor(private http: HttpClient) { } + constructor(private http: HttpClient, private applicationConfigService: ApplicationConfigService) { } public isLoading():Observable{ return this.loading; } - //TODO: qui va messo parametro per paginazione + //TODO: paginate when APIs are ready fetchResourceImpls(ctx:string, type:string): Observable { - const SERVICE_URL = appProperties.BASEURL_API+'is/resourceinstances'; - //console.debug("******SIAMO NEL SERVIZIO:"); - //console.debug(SERVICE_URL); + const resourceUrl = this.applicationConfigService.getEndpointFor('api/is/resourceinstances'); let queryParams = new HttpParams(); queryParams = queryParams.append("currentContext",ctx).append("resourceType",type); // eslint-disable-next-line @typescript-eslint/no-unsafe-return if(type==='HostingNode'){ //console.debug("******GETTING HOSTING NODE*****"); - return this.http.get(SERVICE_URL,{params:queryParams}); + return this.http.get(resourceUrl,{params:queryParams}); } if(type==='EService'){ - return this.http.get(SERVICE_URL,{params:queryParams}); + return this.http.get(resourceUrl,{params:queryParams}); } return new Observable(); } @@ -46,10 +43,11 @@ export class ResourcesImplService { getJsonDetails(ctx:string, type:string, uid: string): Observable { - const SERVICE_URL = appProperties.BASEURL_API+'is/resourcejson'; + const resourceUrl = this.applicationConfigService.getEndpointFor('api/is/resourcejson'); + // const SERVICE_URL = appProperties.BASEURL_API+'is/resourcejson'; let queryParams = new HttpParams(); queryParams = queryParams.append("currentContext",ctx).append("resourceType",type).append("uid",uid); - return this.http.get(SERVICE_URL,{params:queryParams}); + return this.http.get(resourceUrl,{params:queryParams}); } } diff --git a/src/main/webapp/app/services/restypes.service.ts b/src/main/webapp/app/services/restypes.service.ts index a486f34..b5aafea 100644 --- a/src/main/webapp/app/services/restypes.service.ts +++ b/src/main/webapp/app/services/restypes.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs'; import { IResource} from './i-resource'; -import { appProperties } from 'app/config/app-properties'; +import { ApplicationConfigService } from 'app/core/config/application-config.service'; @Injectable({ providedIn: 'root', @@ -13,12 +13,14 @@ export class RestypesService { headers: new HttpHeaders({ 'Content-Type': 'application/json' }), }; - constructor(private http: HttpClient) {} + constructor(private http: HttpClient, private applicationConfigService: ApplicationConfigService){} //TODO: pipe per gestione errori fetchAll(): Observable { - return this.http.get(appProperties.BASEURL_API+'is/resourcetypes'); + //return this.http.get(appProperties.BASEURL_API+'is/resourcetypes'); + const resourceUrl = this.applicationConfigService.getEndpointFor('api/is/resourcetypes'); + return this.http.get(resourceUrl); }