SEBSERV-276 fixed done reload page on missing change

This commit is contained in:
anhefti 2022-02-09 14:12:55 +01:00
parent a55cc57cb5
commit d26cc8930e

View file

@ -69,6 +69,7 @@ public class ClientConnectionDetails {
private ClientConnectionData connectionData = null; private ClientConnectionData connectionData = null;
private boolean statusChanged = true; private boolean statusChanged = true;
private boolean missingChanged = true;
private long startTime = -1; private long startTime = -1;
private Consumer<ClientConnectionData> statusChangeListener = null; private Consumer<ClientConnectionData> statusChangeListener = null;
@ -143,9 +144,9 @@ public class ClientConnectionDetails {
if (this.connectionData != null && connectionData != null) { if (this.connectionData != null && connectionData != null) {
this.statusChanged = this.statusChanged =
this.connectionData.clientConnection.status != connectionData.clientConnection.status || this.connectionData.clientConnection.status != connectionData.clientConnection.status;
BooleanUtils.toBoolean(this.connectionData.missingPing) != BooleanUtils this.missingChanged = BooleanUtils.toBoolean(this.connectionData.missingPing) != BooleanUtils
.toBoolean(connectionData.missingPing); .toBoolean(connectionData.missingPing);
} }
this.connectionData = connectionData; this.connectionData = connectionData;
if (this.startTime < 0) { if (this.startTime < 0) {
@ -157,6 +158,10 @@ public class ClientConnectionDetails {
final Supplier<EntityTable<ClientNotification>> notificationTableSupplier, final Supplier<EntityTable<ClientNotification>> notificationTableSupplier,
final PageContext pageContext) { final PageContext pageContext) {
if (this.connectionData == null) {
return;
}
// Note: This is to update the whole page (by reload) only when the status has changed // Note: This is to update the whole page (by reload) only when the status has changed
// while this page was open. This prevent constant page reloads. // while this page was open. This prevent constant page reloads.
if (this.statusChanged && System.currentTimeMillis() - this.startTime > Constants.SECOND_IN_MILLIS) { if (this.statusChanged && System.currentTimeMillis() - this.startTime > Constants.SECOND_IN_MILLIS) {
@ -164,10 +169,6 @@ public class ClientConnectionDetails {
return; return;
} }
if (this.connectionData == null) {
return;
}
final Form form = this.formHandle.getForm(); final Form form = this.formHandle.getForm();
form.setFieldValue( form.setFieldValue(
Domain.CLIENT_CONNECTION.ATTR_EXAM_USER_SESSION_ID, Domain.CLIENT_CONNECTION.ATTR_EXAM_USER_SESSION_ID,
@ -177,7 +178,7 @@ public class ClientConnectionDetails {
ClientConnection.ATTR_INFO, ClientConnection.ATTR_INFO,
this.connectionData.clientConnection.info); this.connectionData.clientConnection.info);
if (this.statusChanged) { if (this.missingChanged) {
// update status // update status
form.setFieldValue( form.setFieldValue(
Domain.CLIENT_CONNECTION.ATTR_STATUS, Domain.CLIENT_CONNECTION.ATTR_STATUS,