aboutsummaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-24 14:21:37 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-24 15:25:44 +0100
commitafe1f83bdbec2c369c0840c94df1d12c8faa0eeb (patch)
treee3c3ad307fb40b85a02783832c32e62f6210b5c2 /webapp
parenta3dd155428ef5c0b9ca1ca2c866cdf6f367f6191 (diff)
Improved and fixed connection to XDS Server
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'webapp')
-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
5 files changed, 26 insertions, 28 deletions
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
}