aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/agent/apiv1-version.go8
-rw-r--r--webapp/src/app/@core-xds/services/xds-config.service.ts3
-rw-r--r--webapp/src/app/pages/config/config-xds/config-xds.component.html24
-rw-r--r--webapp/src/app/pages/config/config-xds/config-xds.component.scss2
-rw-r--r--webapp/src/app/pages/config/config-xds/config-xds.component.ts23
-rw-r--r--webapp/tslint.json2
6 files changed, 31 insertions, 31 deletions
diff --git a/lib/agent/apiv1-version.go b/lib/agent/apiv1-version.go
index c75e7f5..c73010e 100644
--- a/lib/agent/apiv1-version.go
+++ b/lib/agent/apiv1-version.go
@@ -1,11 +1,11 @@
package agent
import (
+ "fmt"
"net/http"
"github.com/gin-gonic/gin"
"github.com/iotbzh/xds-agent/lib/apiv1"
- common "github.com/iotbzh/xds-common/golib"
)
// getInfo : return various information about server
@@ -23,8 +23,10 @@ func (s *APIService) getVersion(c *gin.Context) {
for _, svr := range s.xdsServers {
res := apiv1.VersionData{}
if err := svr.GetVersion(&res); err != nil {
- common.APIError(c, "Cannot retrieve version of XDS server ID %s : %v", svr.ID, err.Error())
- return
+ errMsg := fmt.Sprintf("Cannot retrieve version of XDS server ID %s : %v", svr.ID, err.Error())
+ s.Log.Warning(errMsg)
+ res.ID = svr.ID
+ res.Version = errMsg
}
svrVer = append(svrVer, res)
}
diff --git a/webapp/src/app/@core-xds/services/xds-config.service.ts b/webapp/src/app/@core-xds/services/xds-config.service.ts
index 2f751a7..2a43f2b 100644
--- a/webapp/src/app/@core-xds/services/xds-config.service.ts
+++ b/webapp/src/app/@core-xds/services/xds-config.service.ts
@@ -74,9 +74,10 @@ export class XDSConfigService {
return Observable.of(curSvr);
}
- private _updateCurServer() {
+ private _updateCurServer(): IXDServerCfg {
this._curServer = this._getCurServer();
this.curServer$.next(this._curServer);
+ return this._curServer;
}
private _getCurServer(url?: string): IXDServerCfg {
diff --git a/webapp/src/app/pages/config/config-xds/config-xds.component.html b/webapp/src/app/pages/config/config-xds/config-xds.component.html
index 31559e2..ebfaa36 100644
--- a/webapp/src/app/pages/config/config-xds/config-xds.component.html
+++ b/webapp/src/app/pages/config/config-xds/config-xds.component.html
@@ -7,28 +7,30 @@
<div class="form-group row">
<label class="col-sm-3 col-form-label">XDS Server URL</label>
<div class="col-sm-8">
- <input type="url" class="form-control" [ngClass]="{ 'form-control-danger': !server.connected }" id="inputServerUrl" [(ngModel)]="xdsServerUrl" name="serverUrl" (ngModelChange)="configFormChanged=true" [disabled]="connecting">
+ <input type="url" class="form-control" [ngClass]="{ 'form-control-danger': !server?.connected }" id="inputServerUrl" [(ngModel)]="xdsServerUrl" name="serverUrl" (ngModelChange)="configFormChanged=true" [disabled]="applying">
</div>
<div class="col-sm-1">
- <span *ngIf="!connecting" class="fa fa-fw fa-exchange fa-size-x2 vcenter" [style.color]="server.connected?'green':'red'"></span>
- <span *ngIf="connecting" class="fa fa-gear faa-spin animated fa-size-x2 vcenter"></span>
+ <span class="fa fa-fw fa-exchange faa-burst fa-size-x2 vcenter" [ngClass]="{'animated': applying}" [style.color]="(server?.connected && !animated)?'green':'red'" ></span>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label">XDS Server connection retry</label>
- <div class="col-sm-8">
+ <div class="col-sm-8" *ngIf="server">
<input type="number" class="form-control" id="inputServerConnRetry" [(ngModel)]="server.connRetry" name="serverRetry" (ngModelChange)="configFormChanged=true">
</div>
</div>
-
- <div class="form-group row">
- <div class="offset-sm-3 col-sm-9">
- <button type="submit" class="btn btn-primary" [disabled]="
- connecting || (server.connected && !configFormChanged)">Apply</button>
- </div>
- </div>
</form>
</nb-card-body>
+ <nb-card-footer>
+ <div class="col-12">
+ <div class="offset-sm-5 col-sm-2">
+ <button class="btn btn-primary" (click)="onSubmit()" [disabled]="
+ applying || (server?.connected && !configFormChanged)">{{ applying ?"Applying... ":"Apply" }}
+ <span *ngIf="applying" class="fa fa-gear faa-spin animated fa-size-x2"></span>
+ </button>
+ </div>
+ </div>
+ </nb-card-footer>
</nb-card>
</div>
</div>
diff --git a/webapp/src/app/pages/config/config-xds/config-xds.component.scss b/webapp/src/app/pages/config/config-xds/config-xds.component.scss
index d7571b9..027f0fc 100644
--- a/webapp/src/app/pages/config/config-xds/config-xds.component.scss
+++ b/webapp/src/app/pages/config/config-xds/config-xds.component.scss
@@ -16,7 +16,7 @@ nb-card.inline-form-card nb-card-body {
}
.fa-size-x2 {
- font-size: 20px;
+ font-size: 22px;
}
.vcenter {
diff --git a/webapp/src/app/pages/config/config-xds/config-xds.component.ts b/webapp/src/app/pages/config/config-xds/config-xds.component.ts
index ffd236d..396115b 100644
--- a/webapp/src/app/pages/config/config-xds/config-xds.component.ts
+++ b/webapp/src/app/pages/config/config-xds/config-xds.component.ts
@@ -15,10 +15,10 @@ import 'rxjs/add/operator/catch';
styleUrls: ['./config-xds.component.scss'],
templateUrl: './config-xds.component.html',
})
-export class ConfigXdsComponent implements OnInit {
+export class ConfigXdsComponent {
// TODO: cleanup agentStatus$: Observable<IAgentStatus>;
- connecting = false;
+ applying = false;
xdsServerUrl = '';
server: IXDServerCfg;
@@ -28,17 +28,10 @@ export class ConfigXdsComponent implements OnInit {
private XdsConfigSvr: XDSConfigService,
private alert: AlertService,
) {
- }
-
- ngOnInit() {
// FIXME support multiple servers
-
- this.server = this.XdsConfigSvr.getCurServer();
- this.xdsServerUrl = this.server.url;
-
this.XdsConfigSvr.onCurServer().subscribe(svr => {
this.xdsServerUrl = svr.url;
- this.server = svr;
+ this.server = Object.assign({}, svr);
});
}
@@ -47,14 +40,16 @@ export class ConfigXdsComponent implements OnInit {
return;
}
this.configFormChanged = false;
- this.connecting = true;
+ this.applying = true;
this.server.url = this.xdsServerUrl;
this.XdsConfigSvr.setCurServer(this.server)
.subscribe(cfg => {
- this.connecting = false;
- },
+ this.alert.info('XDS Server successfully connected (' + cfg.url + ')');
+ this.server = Object.assign({}, cfg);
+ this.applying = false;
+ },
err => {
- this.connecting = false;
+ this.applying = false;
this.alert.error(err);
});
}
diff --git a/webapp/tslint.json b/webapp/tslint.json
index 6cd34e9..9bfdcb2 100644
--- a/webapp/tslint.json
+++ b/webapp/tslint.json
@@ -131,7 +131,7 @@
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
- "no-access-missing-member": true,
+ "no-access-missing-member": false,
"templates-use-public": true,
"invoke-injectable": true
}