Continue monitoring with last connection if respective board is reconnected

Signed-off-by: jbicker <jan.bicker@typefox.io>
This commit is contained in:
jbicker 2019-08-20 13:30:40 +02:00
parent 3eebd580d8
commit 2046c0bdee

View File

@ -131,6 +131,8 @@ export class MonitorWidget extends ReactWidget implements StatefulWidget {
protected widgetHeight: number; protected widgetHeight: number;
protected continuePreviousConnection: boolean;
constructor( constructor(
@inject(MonitorServiceClientImpl) protected readonly serviceClient: MonitorServiceClientImpl, @inject(MonitorServiceClientImpl) protected readonly serviceClient: MonitorServiceClientImpl,
@inject(MonitorConnection) protected readonly connection: MonitorConnection, @inject(MonitorConnection) protected readonly connection: MonitorConnection,
@ -204,13 +206,18 @@ export class MonitorWidget extends ReactWidget implements StatefulWidget {
} }
return false; return false;
}); });
if (!connectedBoard) { if (connectedBoard && currentConnectionConfig) {
this.close(); this.continuePreviousConnection = true;
this.connection.connect(currentConnectionConfig);
} }
})); }));
this.toDisposeOnDetach.push(this.connection.onConnectionChanged(() => { this.toDisposeOnDetach.push(this.connection.onConnectionChanged(() => {
if (!this.continuePreviousConnection) {
this.clear(); this.clear();
} else {
this.continuePreviousConnection = false;
}
})); }));
} }