summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
Diffstat (limited to 'webapp')
-rw-r--r--webapp/src/app/common/xdsagent.service.ts24
-rw-r--r--webapp/src/app/config/config.component.html7
2 files changed, 15 insertions, 16 deletions
diff --git a/webapp/src/app/common/xdsagent.service.ts b/webapp/src/app/common/xdsagent.service.ts
index 4d9aadc..86f0336 100644
--- a/webapp/src/app/common/xdsagent.service.ts
+++ b/webapp/src/app/common/xdsagent.service.ts
@@ -59,20 +59,12 @@ export class XDSAgentService {
this.Status$ = this.statusSubject.asObservable();
this.apikey = DEFAULT_API_KEY; // FIXME Add dynamic allocated key
- this._status.baseURL = 'http://localhost:' + DEFAULT_PORT;
- this.baseRestUrl = this._status.baseURL + '/api/' + API_VERSION;
- let re = this._window.location.origin.match(/http[s]?:\/\/([^\/]*)[\/]?/);
- if (re === null || re.length < 2) {
- console.error('ERROR: cannot determine Websocket url');
- } else {
- this.wsUrl = 'ws://' + re[1];
- }
+ this._initURLs('http://localhost:' + DEFAULT_PORT);
}
connect(retry: number, url?: string): Observable<IAgentStatus> {
if (url) {
- this._status.baseURL = url;
- this.baseRestUrl = this._status.baseURL + '/api/' + API_VERSION;
+ this._initURLs(url);
}
//FIXME [XDS-Agent]: not implemented yet, set always as connected
//this._status.connected = false;
@@ -103,6 +95,18 @@ export class XDSAgentService {
});
}
+ private _initURLs(url: string) {
+ this._status.baseURL = url;
+ this.baseRestUrl = this._status.baseURL + '/api/' + API_VERSION;
+ let re = this._status.baseURL.match(/http[s]?:\/\/([^\/]*)[\/]?/);
+ if (re === null || re.length < 2) {
+ this.wsUrl = '';
+ console.error('ERROR: cannot determine Websocket url');
+ return;
+ }
+ this.wsUrl = 'ws://' + re[1];
+ }
+
private _WSState(sts: boolean) {
this._status.WS_connected = sts;
this.statusSubject.next(Object.assign({}, this._status));
diff --git a/webapp/src/app/config/config.component.html b/webapp/src/app/config/config.component.html
index f707bbe..8737d08 100644
--- a/webapp/src/app/config/config.component.html
+++ b/webapp/src/app/config/config.component.html
@@ -10,17 +10,12 @@
<div class="col-xs-12">
<table class="table table-condensed">
<tbody>
- <!-- FIXME [XDS-Agent]
<tr [ngClass]="{'info': (agentStatus$ | async)?.connected, 'danger': !(agentStatus$ | async)?.connected}">
- -->
- <tr [ngClass]="{'info': (localSTStatus$ | async)?.connected, 'danger': !(localSTStatus$ | async)?.connected}">
<th><label>XDS local Agent URL</label></th>
<td> <input type="text" [(ngModel)]="xdsAgentUrl"></td>
<td>
<button class="btn btn-link" (click)="xdsAgentRestartConn()"><span class="fa fa-refresh fa-size-x2"></span></button>
- <!-- FIXME [XDS-Agent]
- <button *ngIf="!(agentStatus$ | async)?.connected" -->
- <button *ngIf="!(localSTStatus$ | async)?.connected" [disabled]="xdsAgentZipUrl==''" class="btn btn-link">
+ <button [disabled]="xdsAgentZipUrl==''" class="btn btn-link">
<a *ngIf="xdsAgentZipUrl!=''" class="fa fa-download fa-size-x2" [href]="xdsAgentZipUrl" target="_blank"></a>
<a *ngIf="xdsAgentZipUrl==''" class="fa fa-download fa-size-x2" href="javascript:void(0);" target="_blank"></a>
</button>