summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2025-02-09 13:18:28 +0100
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2025-02-10 09:04:41 +0100
commitc1667e6060e078b31d7b64ce509d58e853df3a3b (patch)
tree1ff01c3a0c27cbb7e4b1171e5c824c0433e7c2e9
parent9410a0b6eb80fda6dd652424e8c80ffa46d43077 (diff)
Backend url is environment specific in some locations
- use `window.location.origin` to make the backend url working for both local (localhost) and remote (uui.example.com) deployments Issue-ID: USECASEUI-865 Change-Id: Idf5b6fe8a04ce744fc4cb9986c10977e60548820 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
-rw-r--r--usecaseui-portal/src/app/core/models/dataInterface.ts7
-rw-r--r--usecaseui-portal/src/app/core/services/homes.service.ts7
-rw-r--r--usecaseui-portal/src/app/core/services/intentBase.service.ts16
-rw-r--r--usecaseui-portal/src/app/core/services/managemencs.service.ts7
-rw-r--r--usecaseui-portal/src/app/core/services/networkHttpservice.service.ts6
-rw-r--r--usecaseui-portal/src/app/core/services/onboard.service.ts7
-rw-r--r--usecaseui-portal/src/app/core/services/serviceList.service.ts11
-rw-r--r--usecaseui-portal/src/app/datainterface.ts6
-rw-r--r--usecaseui-portal/src/app/views/services/sotn-management/manage-service/manage-service.component.ts16
-rw-r--r--usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.ts26
-rw-r--r--usecaseui-portal/src/app/views/services/sotn-management/order-service/order-service.component.ts16
-rw-r--r--usecaseui-portal/src/environments/environment.prod.ts1
-rw-r--r--usecaseui-portal/src/environments/environment.ts1
13 files changed, 57 insertions, 70 deletions
diff --git a/usecaseui-portal/src/app/core/models/dataInterface.ts b/usecaseui-portal/src/app/core/models/dataInterface.ts
index d367fe14..578096ea 100644
--- a/usecaseui-portal/src/app/core/models/dataInterface.ts
+++ b/usecaseui-portal/src/app/core/models/dataInterface.ts
@@ -1,11 +1,6 @@
-enum baseUrl{
- baseUrl = '/api/usecaseui-server/v1' //online
- // baseUrl = 'https://192.168.235.25:30283/api/usecaseui-server/v1' //local two
-}
-
interface servicesTableData {
total:number,
tableList:string[]
}
-export {servicesTableData , baseUrl}
+export {servicesTableData}
diff --git a/usecaseui-portal/src/app/core/services/homes.service.ts b/usecaseui-portal/src/app/core/services/homes.service.ts
index 98d60b52..322bbd0a 100644
--- a/usecaseui-portal/src/app/core/services/homes.service.ts
+++ b/usecaseui-portal/src/app/core/services/homes.service.ts
@@ -14,15 +14,14 @@
limitations under the License.
*/
import { Injectable } from '@angular/core';
-import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
-import { Observable } from 'rxjs/Observable';
-import { baseUrl } from '../models/dataInterface';
+import { HttpClient, HttpParams } from '@angular/common/http';
+import { environment } from '@src/environments/environment';
@Injectable()
export class HomesService {
constructor(private http: HttpClient) { }
- baseUrl = baseUrl.baseUrl;
+ baseUrl = environment.backendUrl;
url = {
home_serviceData: this.baseUrl + "/uui-lcm/serviceNumByCustomer",
home_alarmData: this.baseUrl + "/alarm/statusCount",
diff --git a/usecaseui-portal/src/app/core/services/intentBase.service.ts b/usecaseui-portal/src/app/core/services/intentBase.service.ts
index a9c4187b..f5702544 100644
--- a/usecaseui-portal/src/app/core/services/intentBase.service.ts
+++ b/usecaseui-portal/src/app/core/services/intentBase.service.ts
@@ -15,13 +15,13 @@
*/
import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
-import { baseUrl } from '../models/dataInterface';
+import { environment } from '@src/environments/environment';
@Injectable()
export class intentBaseService {
constructor(private http: HttpClient) { }
- baseUrl = baseUrl.baseUrl;
+ baseUrl = environment.backendUrl;
url = {
getInstanceId: this.baseUrl + "/intent/getInstanceId",
createIntentInstance: this.baseUrl + "/intent/createIntentInstance",
@@ -47,7 +47,7 @@ export class intentBaseService {
getInstanceId() {
return this.http.get<any>(this.url["getInstanceId"]);
}
-
+
createIntentInstance(requestBody) {
return this.http.post<any>(this.url["createIntentInstance"], requestBody);
}
@@ -55,7 +55,7 @@ export class intentBaseService {
getInstanceList(requestBody) {
return this.http.post<any>(this.url["getInstanceList"], requestBody);
}
-
+
getInstanceStatus(requestBody) {
return this.http.post<any>(this.url["getInstanceStatus"], requestBody);
}
@@ -63,16 +63,16 @@ export class intentBaseService {
queryInstancePerformanceData(requestBody) {
return this.http.post<any>(this.url["queryInstancePerformanceData"], requestBody);
}
-
+
getFinishedInstanceInfo() {
return this.http.get<any>(this.url["getFinishedInstanceInfo"]);
}
-
+
deleteIntentInstance(instanceId) {
let params = new HttpParams({ fromObject: { "instanceId": instanceId } });
return this.http.delete<any>(this.url.deleteIntentInstance, { params });
}
-
+
activeIntentInstance(requestBody) {
return this.http.post<any>(this.url["activeIntentInstance"], requestBody);
}
@@ -84,7 +84,7 @@ export class intentBaseService {
updateIntentInstance(requestBody) {
return this.http.post<any>(this.url["updateIntentInstance"], requestBody);
}
-
+
queryAccessNodeInfo() {
return this.http.get<any>(this.url["queryAccessNodeInfo"]);
}
diff --git a/usecaseui-portal/src/app/core/services/managemencs.service.ts b/usecaseui-portal/src/app/core/services/managemencs.service.ts
index c8eed218..7dd9d94d 100644
--- a/usecaseui-portal/src/app/core/services/managemencs.service.ts
+++ b/usecaseui-portal/src/app/core/services/managemencs.service.ts
@@ -1,14 +1,13 @@
import { Injectable } from '@angular/core';
-import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
-import { Observable } from 'rxjs/Observable';
-import { baseUrl } from '../models/dataInterface';
+import { HttpClient, HttpParams } from '@angular/common/http';
+import { environment } from '@src/environments/environment';
@Injectable()
export class ManagemencsService {
constructor(private http: HttpClient) { }
- baseUrl = baseUrl.baseUrl;
+ baseUrl = environment.backendUrl;
/* line up */
url = {
diff --git a/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts b/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts
index d558d489..73d6211c 100644
--- a/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts
+++ b/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts
@@ -15,8 +15,8 @@
limitations under the License.
*/
import { Injectable } from '@angular/core';
-import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
-import { baseUrl } from '../models/dataInterface';
+import { HttpClient, HttpParams } from '@angular/common/http';
+import { environment } from '@src/environments/environment';
@Injectable()
@@ -24,7 +24,7 @@ export class networkHttpservice {
constructor(private http: HttpClient) { }
- baseUrl = baseUrl.baseUrl;//Online environment
+ baseUrl = environment.backendUrl;
url = {
"getNetworkD3Data": this.baseUrl+"/uui-sotn/getNetWorkResources",
"getLogicalLinksData": this.baseUrl+"/uui-sotn/getLogicalLinks",
diff --git a/usecaseui-portal/src/app/core/services/onboard.service.ts b/usecaseui-portal/src/app/core/services/onboard.service.ts
index 20d9c244..472fcf63 100644
--- a/usecaseui-portal/src/app/core/services/onboard.service.ts
+++ b/usecaseui-portal/src/app/core/services/onboard.service.ts
@@ -14,15 +14,14 @@
limitations under the License.
*/
import { Injectable } from '@angular/core';
-import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
-import { Observable } from 'rxjs/Observable';
-import { baseUrl } from '../models/dataInterface';
+import { HttpClient, HttpParams } from '@angular/common/http';
+import { environment } from '@src/environments/environment';
@Injectable()
export class onboardService {
constructor(private http: HttpClient) { }
- baseUrl = baseUrl.baseUrl;
+ baseUrl =environment.backendUrl;
url = {
onboardTableData: this.baseUrl + "/uui-lcm/ns-packages",
onboardDataVNF: this.baseUrl + "/uui-lcm/vnf-packages",
diff --git a/usecaseui-portal/src/app/core/services/serviceList.service.ts b/usecaseui-portal/src/app/core/services/serviceList.service.ts
index 945d60c2..1492d0db 100644
--- a/usecaseui-portal/src/app/core/services/serviceList.service.ts
+++ b/usecaseui-portal/src/app/core/services/serviceList.service.ts
@@ -16,15 +16,16 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
-import { servicesTableData,baseUrl } from '../models/dataInterface';
-import { retry, catchError } from 'rxjs/operators';
+import { servicesTableData } from '../models/dataInterface';
+import { catchError } from 'rxjs/operators';
+import { environment } from '@src/environments/environment';
@Injectable()
export class ServiceListService {
constructor(private http: HttpClient) { }
- baseUrl = baseUrl.baseUrl;
-
+ baseUrl = environment.backendUrl;
+
url = {
customers: this.baseUrl + "/uui-lcm/customers",
serviceType: this.baseUrl + "/uui-lcm/customers/" + "*_*" + "/service-subscriptions",
@@ -219,7 +220,7 @@ export class ServiceListService {
return this.http.get<any>(url);
}
-
+
handleError(error) {
let errorMessage = '';
if (error.error instanceof ErrorEvent) {
diff --git a/usecaseui-portal/src/app/datainterface.ts b/usecaseui-portal/src/app/datainterface.ts
deleted file mode 100644
index 2ba1af97..00000000
--- a/usecaseui-portal/src/app/datainterface.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-enum baseUrl{
- baseUrl = 'http://localhost:8082/api/usecaseui/server/v1' //online
- //baseUrl = 'http://172.19.44.223/api/usecaseui-server/v1' //local one
- //baseUrl = 'http://localhost:8082/api/usecaseui/server/v1' //local two
-}
-export {baseUrl}; \ No newline at end of file
diff --git a/usecaseui-portal/src/app/views/services/sotn-management/manage-service/manage-service.component.ts b/usecaseui-portal/src/app/views/services/sotn-management/manage-service/manage-service.component.ts
index 16aee4e7..fa11985c 100644
--- a/usecaseui-portal/src/app/views/services/sotn-management/manage-service/manage-service.component.ts
+++ b/usecaseui-portal/src/app/views/services/sotn-management/manage-service/manage-service.component.ts
@@ -1,6 +1,6 @@
-import { Component, OnInit, SimpleChanges } from '@angular/core';
-import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
-import { baseUrl } from '../../../../datainterface';
+import { Component, OnInit } from '@angular/core';
+import { HttpClient, HttpHeaders } from '@angular/common/http';
+import { environment } from '@src/environments/environment';
@Component({
selector: 'app-manage-service',
templateUrl: './manage-service.component.html',
@@ -25,7 +25,7 @@ export class ManageServiceComponent implements OnInit {
uniInfo = [];
mapped: any;
myKeys = [] as Array<any>;
- baseUrl = baseUrl.baseUrl
+ baseUrl = environment.backendUrl;
constructor(private http: HttpClient) { }
ngOnInit() {
@@ -58,10 +58,10 @@ export class ManageServiceComponent implements OnInit {
this.selectedServiceInstance="";
let url = this.baseUrl + "/uui-lcm/Sotnservices/ServiceInstances/"+subscriptionType;
this.http.get<any>(url,httpOptions).subscribe((data) => {
- this.serviceInstanceList = data.serviceInstanceList;
+ this.serviceInstanceList = data.serviceInstanceList;
}, (err) => {
console.log(err);
- });
+ });
}
deleteSelectedService() {
@@ -81,8 +81,8 @@ export class ManageServiceComponent implements OnInit {
}
-
- getSubscribedSites() {
+
+ getSubscribedSites() {
console.log("on change");
let httpOptions = {
headers: new HttpHeaders({
diff --git a/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.ts b/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.ts
index 6ad98216..95254886 100644
--- a/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.ts
+++ b/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.ts
@@ -1,9 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Network, Node, Edge } from 'vis';
import { HttpClient, HttpHeaders } from '@angular/common/http';
-import { Observable } from 'rxjs/Observable';
-import { baseUrl } from '../../../../datainterface';
-import { getLocaleDateFormat } from '@angular/common';
+import { environment } from '@src/environments/environment';
@Component({
selector: 'app-monitor-service',
templateUrl: './monitor-service.component.html',
@@ -17,7 +15,7 @@ export class MonitorServiceComponent implements OnInit {
serviceInstanceList = [] as Array<any>;
selectedTopology:string = 'i18nTextDefine_serviceTopology';
- baseUrl = baseUrl.baseUrl
+ baseUrl = environment.backendUrl;
title = 'Network';
public nodes: Node;
@@ -41,10 +39,10 @@ export class MonitorServiceComponent implements OnInit {
topologyType:"i18nTextDefine_resourceTopology",
}
];
-
-
+
+
networkOptions = {
- layout: {
+ layout: {
randomSeed: 15
},
nodes: {
@@ -115,10 +113,10 @@ export class MonitorServiceComponent implements OnInit {
};
let url = this.baseUrl + "/uui-lcm/Sotnservices/ServiceInstances/" + subscriptionType;
this.http.get<any>(url,httpOptions).subscribe((data) => {
- this.serviceInstanceList = data.serviceInstanceList;
+ this.serviceInstanceList = data.serviceInstanceList;
}, (err) => {
console.log(err);
- });
+ });
}
getTopologyInfo (topo) {
@@ -158,7 +156,7 @@ export class MonitorServiceComponent implements OnInit {
</thead>\
<tbody>\
';
- Object.entries(filteredNode[0].dataNode).forEach(entry => {
+ Object.entries(filteredNode[0].dataNode).forEach(entry => {
if( entry[1] !== "null")
{
t1 += '<tr class="popup-table-row">\
@@ -166,7 +164,7 @@ export class MonitorServiceComponent implements OnInit {
<td class="monitor-table-td-th ">'+ entry[1] + '</td>\
</tr>\
';
- }
+ }
});
t1 += '</tbody>\
</table>\
@@ -214,14 +212,14 @@ export class MonitorServiceComponent implements OnInit {
}
// Getting sitedata Based On Type and ID
- getSelectedsubscriptionInfo() {
+ getSelectedsubscriptionInfo() {
this.getData("");
if (this.intervalData) {
clearInterval(this.intervalData);
- }
+ }
}
-
+
ngOnDestroy() {
console.log('clear interval');
if (this.intervalData) {
diff --git a/usecaseui-portal/src/app/views/services/sotn-management/order-service/order-service.component.ts b/usecaseui-portal/src/app/views/services/sotn-management/order-service/order-service.component.ts
index 1cfd00fd..473681c2 100644
--- a/usecaseui-portal/src/app/views/services/sotn-management/order-service/order-service.component.ts
+++ b/usecaseui-portal/src/app/views/services/sotn-management/order-service/order-service.component.ts
@@ -1,12 +1,12 @@
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import {
- FormBuilder,
+ FormBuilder,
FormGroup,
Validators
} from '@angular/forms';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { NzMessageService } from 'ng-zorro-antd';
-import { baseUrl } from '../../../../datainterface';
+import { environment } from '@src/environments/environment';
@Component({
selector: 'app-order-service',
@@ -20,7 +20,7 @@ export class OrderServiceComponent implements OnInit {
siteData:object = {};
buttonDisabled:boolean = false;
intervalData:any;
- baseUrl = baseUrl.baseUrl
+ baseUrl = environment.backendUrl;
expandDataSet = [
{ rowIdx: 1, name: 'i18nTextDefine_serviceInformation', expand: true },
{ rowIdx: 2, name: 'i18nTextDefine_vpnInformation', expand: true },
@@ -28,7 +28,7 @@ export class OrderServiceComponent implements OnInit {
];
uni = {};
sotnUni = [];
-
+
@Output() childEvent = new EventEmitter<string>();
constructor(private fb: FormBuilder, private http: HttpClient, private message: NzMessageService) { }
@@ -58,7 +58,7 @@ export class OrderServiceComponent implements OnInit {
});
}
-
+
numberOnly(event): boolean {
const charCode = (event.which) ? event.which : event.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
@@ -78,7 +78,7 @@ export class OrderServiceComponent implements OnInit {
deletesotnUni(data) {
for(let i = 0; i < this.sotnUni.length; i++) {
if(data.sotnuni_tpId == this.sotnUni[i].sotnuni_tpId) {
- this.sotnUni.splice(i, 1);
+ this.sotnUni.splice(i, 1);
}
}
}
@@ -139,9 +139,9 @@ export class OrderServiceComponent implements OnInit {
'Content-Type': 'application/json',
})
};
-
+
let url1 = this.baseUrl + '/uui-lcm/Sotnservices_unni';
- this.http.post<any>(url1, body, httpOptions).subscribe((data) => {
+ this.http.post<any>(url1, body, httpOptions).subscribe((data) => {
let comp = this;
this.message.info('Instantiation In Progress');
this.intervalData = setInterval(() => {
diff --git a/usecaseui-portal/src/environments/environment.prod.ts b/usecaseui-portal/src/environments/environment.prod.ts
index c9669790..c0aa6727 100644
--- a/usecaseui-portal/src/environments/environment.prod.ts
+++ b/usecaseui-portal/src/environments/environment.prod.ts
@@ -1,3 +1,4 @@
export const environment = {
production: true,
+ backendUrl: window.location.origin + '/api/usecaseui-server/v1',
};
diff --git a/usecaseui-portal/src/environments/environment.ts b/usecaseui-portal/src/environments/environment.ts
index cf6bba0d..c423f686 100644
--- a/usecaseui-portal/src/environments/environment.ts
+++ b/usecaseui-portal/src/environments/environment.ts
@@ -5,4 +5,5 @@
export const environment = {
production: false,
+ backendUrl: window.location.origin + '/api/usecaseui-server/v1',
};