SEBSERV-188 added new Active connection filter
This commit is contained in:
parent
50aef06db0
commit
fc398d3ff9
6 changed files with 201 additions and 74 deletions
|
@ -757,6 +757,18 @@ public enum ActionDefinition {
|
||||||
ImageIcon.TOGGLE_ON,
|
ImageIcon.TOGGLE_ON,
|
||||||
PageStateDefinitionImpl.MONITORING_RUNNING_EXAM,
|
PageStateDefinitionImpl.MONITORING_RUNNING_EXAM,
|
||||||
ActionCategory.FILTER),
|
ActionCategory.FILTER),
|
||||||
|
|
||||||
|
MONITOR_EXAM_HIDE_ACTIVE_CONNECTION(
|
||||||
|
new LocTextKey("sebserver.monitoring.exam.connection.action.hide.active"),
|
||||||
|
ImageIcon.TOGGLE_OFF,
|
||||||
|
PageStateDefinitionImpl.MONITORING_RUNNING_EXAM,
|
||||||
|
ActionCategory.FILTER),
|
||||||
|
MONITOR_EXAM_SHOW_ACTIVE_CONNECTION(
|
||||||
|
new LocTextKey("sebserver.monitoring.exam.connection.action.show.active"),
|
||||||
|
ImageIcon.TOGGLE_ON,
|
||||||
|
PageStateDefinitionImpl.MONITORING_RUNNING_EXAM,
|
||||||
|
ActionCategory.FILTER),
|
||||||
|
|
||||||
MONITOR_EXAM_HIDE_CLOSED_CONNECTION(
|
MONITOR_EXAM_HIDE_CLOSED_CONNECTION(
|
||||||
new LocTextKey("sebserver.monitoring.exam.connection.action.hide.closed"),
|
new LocTextKey("sebserver.monitoring.exam.connection.action.hide.closed"),
|
||||||
ImageIcon.TOGGLE_OFF,
|
ImageIcon.TOGGLE_OFF,
|
||||||
|
|
|
@ -338,93 +338,180 @@ public class MonitoringRunningExam implements TemplateComposer {
|
||||||
final ClientConnectionTable clientTable,
|
final ClientConnectionTable clientTable,
|
||||||
final BooleanSupplier isExamSupporter) {
|
final BooleanSupplier isExamSupporter) {
|
||||||
|
|
||||||
addClosedFilterAction(actionBuilder, clientTable);
|
addFilterAction(
|
||||||
addRequestedFilterAction(actionBuilder, clientTable);
|
actionBuilder,
|
||||||
addDisabledFilterAction(actionBuilder, clientTable);
|
clientTable,
|
||||||
|
ConnectionStatus.CONNECTION_REQUESTED,
|
||||||
|
ActionDefinition.MONITOR_EXAM_SHOW_REQUESTED_CONNECTION,
|
||||||
|
ActionDefinition.MONITOR_EXAM_HIDE_REQUESTED_CONNECTION);
|
||||||
|
addFilterAction(
|
||||||
|
actionBuilder,
|
||||||
|
clientTable,
|
||||||
|
ConnectionStatus.ACTIVE,
|
||||||
|
ActionDefinition.MONITOR_EXAM_SHOW_ACTIVE_CONNECTION,
|
||||||
|
ActionDefinition.MONITOR_EXAM_HIDE_ACTIVE_CONNECTION);
|
||||||
|
addFilterAction(
|
||||||
|
actionBuilder,
|
||||||
|
clientTable,
|
||||||
|
ConnectionStatus.CLOSED,
|
||||||
|
ActionDefinition.MONITOR_EXAM_SHOW_CLOSED_CONNECTION,
|
||||||
|
ActionDefinition.MONITOR_EXAM_HIDE_CLOSED_CONNECTION);
|
||||||
|
addFilterAction(
|
||||||
|
actionBuilder,
|
||||||
|
clientTable,
|
||||||
|
ConnectionStatus.DISABLED,
|
||||||
|
ActionDefinition.MONITOR_EXAM_SHOW_DISABLED_CONNECTION,
|
||||||
|
ActionDefinition.MONITOR_EXAM_HIDE_DISABLED_CONNECTION);
|
||||||
|
|
||||||
|
// addRequestedFilterAction(actionBuilder, clientTable);
|
||||||
|
// addActiveFilterAction(actionBuilder, clientTable);
|
||||||
|
// addClosedFilterAction(actionBuilder, clientTable);
|
||||||
|
// addDisabledFilterAction(actionBuilder, clientTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDisabledFilterAction(
|
// private void addRequestedFilterAction(
|
||||||
|
// final PageActionBuilder actionBuilder,
|
||||||
|
// final ClientConnectionTable clientTable) {
|
||||||
|
//
|
||||||
|
// if (clientTable.isStatusHidden(ConnectionStatus.CONNECTION_REQUESTED)) {
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_REQUESTED_CONNECTION)
|
||||||
|
// .withExec(showStateViewAction(clientTable, ConnectionStatus.CONNECTION_REQUESTED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .withSwitchAction(
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_REQUESTED_CONNECTION)
|
||||||
|
// .withExec(
|
||||||
|
// hideStateViewAction(clientTable, ConnectionStatus.CONNECTION_REQUESTED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .create())
|
||||||
|
// .publish();
|
||||||
|
// } else {
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_REQUESTED_CONNECTION)
|
||||||
|
// .withExec(hideStateViewAction(clientTable, ConnectionStatus.CONNECTION_REQUESTED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .withSwitchAction(
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_REQUESTED_CONNECTION)
|
||||||
|
// .withExec(
|
||||||
|
// showStateViewAction(clientTable, ConnectionStatus.CONNECTION_REQUESTED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .create())
|
||||||
|
// .publish();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
private void addFilterAction(
|
||||||
final PageActionBuilder actionBuilder,
|
final PageActionBuilder actionBuilder,
|
||||||
final ClientConnectionTable clientTable) {
|
final ClientConnectionTable clientTable,
|
||||||
|
final ConnectionStatus status,
|
||||||
|
final ActionDefinition showAction,
|
||||||
|
final ActionDefinition hideAction) {
|
||||||
|
|
||||||
if (clientTable.isStatusHidden(ConnectionStatus.DISABLED)) {
|
if (clientTable.isStatusHidden(status)) {
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_DISABLED_CONNECTION)
|
actionBuilder.newAction(showAction)
|
||||||
.withExec(showStateViewAction(clientTable, ConnectionStatus.DISABLED))
|
.withExec(showStateViewAction(clientTable, status))
|
||||||
.noEventPropagation()
|
.noEventPropagation()
|
||||||
.withSwitchAction(
|
.withSwitchAction(
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_DISABLED_CONNECTION)
|
actionBuilder.newAction(hideAction)
|
||||||
.withExec(hideStateViewAction(clientTable, ConnectionStatus.DISABLED))
|
|
||||||
.noEventPropagation()
|
|
||||||
.create())
|
|
||||||
.publish();
|
|
||||||
} else {
|
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_DISABLED_CONNECTION)
|
|
||||||
.withExec(hideStateViewAction(clientTable, ConnectionStatus.DISABLED))
|
|
||||||
.noEventPropagation()
|
|
||||||
.withSwitchAction(
|
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_DISABLED_CONNECTION)
|
|
||||||
.withExec(showStateViewAction(clientTable, ConnectionStatus.DISABLED))
|
|
||||||
.noEventPropagation()
|
|
||||||
.create())
|
|
||||||
.publish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addRequestedFilterAction(
|
|
||||||
final PageActionBuilder actionBuilder,
|
|
||||||
final ClientConnectionTable clientTable) {
|
|
||||||
|
|
||||||
if (clientTable.isStatusHidden(ConnectionStatus.CONNECTION_REQUESTED)) {
|
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_REQUESTED_CONNECTION)
|
|
||||||
.withExec(showStateViewAction(clientTable, ConnectionStatus.CONNECTION_REQUESTED))
|
|
||||||
.noEventPropagation()
|
|
||||||
.withSwitchAction(
|
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_REQUESTED_CONNECTION)
|
|
||||||
.withExec(
|
.withExec(
|
||||||
hideStateViewAction(clientTable, ConnectionStatus.CONNECTION_REQUESTED))
|
hideStateViewAction(clientTable, status))
|
||||||
.noEventPropagation()
|
.noEventPropagation()
|
||||||
.create())
|
.create())
|
||||||
.publish();
|
.publish();
|
||||||
} else {
|
} else {
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_REQUESTED_CONNECTION)
|
actionBuilder.newAction(hideAction)
|
||||||
.withExec(hideStateViewAction(clientTable, ConnectionStatus.CONNECTION_REQUESTED))
|
.withExec(hideStateViewAction(clientTable, status))
|
||||||
.noEventPropagation()
|
.noEventPropagation()
|
||||||
.withSwitchAction(
|
.withSwitchAction(
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_REQUESTED_CONNECTION)
|
actionBuilder.newAction(showAction)
|
||||||
.withExec(
|
.withExec(
|
||||||
showStateViewAction(clientTable, ConnectionStatus.CONNECTION_REQUESTED))
|
showStateViewAction(clientTable, status))
|
||||||
.noEventPropagation()
|
.noEventPropagation()
|
||||||
.create())
|
.create())
|
||||||
.publish();
|
.publish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addClosedFilterAction(
|
// private void addActiveFilterAction(
|
||||||
final PageActionBuilder actionBuilder,
|
// final PageActionBuilder actionBuilder,
|
||||||
final ClientConnectionTable clientTable) {
|
// final ClientConnectionTable clientTable) {
|
||||||
|
//
|
||||||
if (clientTable.isStatusHidden(ConnectionStatus.CLOSED)) {
|
// if (clientTable.isStatusHidden(ConnectionStatus.ACTIVE)) {
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_CLOSED_CONNECTION)
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_ACTIVE_CONNECTION)
|
||||||
.withExec(showStateViewAction(clientTable, ConnectionStatus.CLOSED))
|
// .withExec(showStateViewAction(clientTable, ConnectionStatus.ACTIVE))
|
||||||
.noEventPropagation()
|
// .noEventPropagation()
|
||||||
.withSwitchAction(
|
// .withSwitchAction(
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_CLOSED_CONNECTION)
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_ACTIVE_CONNECTION)
|
||||||
.withExec(hideStateViewAction(clientTable, ConnectionStatus.CLOSED))
|
// .withExec(
|
||||||
.noEventPropagation()
|
// hideStateViewAction(clientTable, ConnectionStatus.ACTIVE))
|
||||||
.create())
|
// .noEventPropagation()
|
||||||
.publish();
|
// .create())
|
||||||
} else {
|
// .publish();
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_CLOSED_CONNECTION)
|
// } else {
|
||||||
.withExec(hideStateViewAction(clientTable, ConnectionStatus.CLOSED))
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_ACTIVE_CONNECTION)
|
||||||
.noEventPropagation()
|
// .withExec(hideStateViewAction(clientTable, ConnectionStatus.ACTIVE))
|
||||||
.withSwitchAction(
|
// .noEventPropagation()
|
||||||
actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_CLOSED_CONNECTION)
|
// .withSwitchAction(
|
||||||
.withExec(showStateViewAction(clientTable, ConnectionStatus.CLOSED))
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_ACTIVE_CONNECTION)
|
||||||
.noEventPropagation()
|
// .withExec(
|
||||||
.create())
|
// showStateViewAction(clientTable, ConnectionStatus.ACTIVE))
|
||||||
.publish();
|
// .noEventPropagation()
|
||||||
}
|
// .create())
|
||||||
}
|
// .publish();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void addDisabledFilterAction(
|
||||||
|
// final PageActionBuilder actionBuilder,
|
||||||
|
// final ClientConnectionTable clientTable) {
|
||||||
|
//
|
||||||
|
// if (clientTable.isStatusHidden(ConnectionStatus.DISABLED)) {
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_DISABLED_CONNECTION)
|
||||||
|
// .withExec(showStateViewAction(clientTable, ConnectionStatus.DISABLED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .withSwitchAction(
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_DISABLED_CONNECTION)
|
||||||
|
// .withExec(hideStateViewAction(clientTable, ConnectionStatus.DISABLED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .create())
|
||||||
|
// .publish();
|
||||||
|
// } else {
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_DISABLED_CONNECTION)
|
||||||
|
// .withExec(hideStateViewAction(clientTable, ConnectionStatus.DISABLED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .withSwitchAction(
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_DISABLED_CONNECTION)
|
||||||
|
// .withExec(showStateViewAction(clientTable, ConnectionStatus.DISABLED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .create())
|
||||||
|
// .publish();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void addClosedFilterAction(
|
||||||
|
// final PageActionBuilder actionBuilder,
|
||||||
|
// final ClientConnectionTable clientTable) {
|
||||||
|
//
|
||||||
|
// if (clientTable.isStatusHidden(ConnectionStatus.CLOSED)) {
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_CLOSED_CONNECTION)
|
||||||
|
// .withExec(showStateViewAction(clientTable, ConnectionStatus.CLOSED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .withSwitchAction(
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_CLOSED_CONNECTION)
|
||||||
|
// .withExec(hideStateViewAction(clientTable, ConnectionStatus.CLOSED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .create())
|
||||||
|
// .publish();
|
||||||
|
// } else {
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_HIDE_CLOSED_CONNECTION)
|
||||||
|
// .withExec(hideStateViewAction(clientTable, ConnectionStatus.CLOSED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .withSwitchAction(
|
||||||
|
// actionBuilder.newAction(ActionDefinition.MONITOR_EXAM_SHOW_CLOSED_CONNECTION)
|
||||||
|
// .withExec(showStateViewAction(clientTable, ConnectionStatus.CLOSED))
|
||||||
|
// .noEventPropagation()
|
||||||
|
// .create())
|
||||||
|
// .publish();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
private PageAction openSearchPopup(final PageAction action) {
|
private PageAction openSearchPopup(final PageAction action) {
|
||||||
this.monitoringExamSearchPopup.show(action.pageContext());
|
this.monitoringExamSearchPopup.show(action.pageContext());
|
||||||
|
|
|
@ -524,10 +524,6 @@ public final class ClientConnectionTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update(final TableItem tableItem) {
|
private void update(final TableItem tableItem) {
|
||||||
if (ClientConnectionTable.this.statusFilter.contains(this.connectionData.clientConnection.status)) {
|
|
||||||
tableItem.dispose();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
updateData(tableItem);
|
updateData(tableItem);
|
||||||
if (this.connectionData != null) {
|
if (this.connectionData != null) {
|
||||||
updateConnectionStatusColor(tableItem);
|
updateConnectionStatusColor(tableItem);
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class ClientConnectionDataInternal extends ClientConnectionData {
|
||||||
@Override
|
@Override
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public final boolean hasAnyIncident() {
|
public final boolean hasAnyIncident() {
|
||||||
return pendingNotification() || hasIncident();
|
return getMissingPing() || pendingNotification() || hasIncident();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasIncident() {
|
private boolean hasIncident() {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Collection;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
@ -180,19 +181,48 @@ public class ExamMonitoringController {
|
||||||
if (StringUtils.isNoneBlank(hiddenStates)) {
|
if (StringUtils.isNoneBlank(hiddenStates)) {
|
||||||
final String[] split = StringUtils.split(hiddenStates, Constants.LIST_SEPARATOR);
|
final String[] split = StringUtils.split(hiddenStates, Constants.LIST_SEPARATOR);
|
||||||
for (int i = 0; i < split.length; i++) {
|
for (int i = 0; i < split.length; i++) {
|
||||||
filterStates.add(ConnectionStatus.valueOf(split[0]));
|
filterStates.add(ConnectionStatus.valueOf(split[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final boolean active = filterStates.contains(ConnectionStatus.ACTIVE);
|
||||||
|
if (active) {
|
||||||
|
filterStates.remove(ConnectionStatus.ACTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
return this.examSessionService
|
return this.examSessionService
|
||||||
.getConnectionData(
|
.getConnectionData(
|
||||||
examId,
|
examId,
|
||||||
filterStates.isEmpty()
|
filterStates.isEmpty()
|
||||||
? Objects::nonNull
|
? Objects::nonNull
|
||||||
: conn -> conn != null && !filterStates.contains(conn.clientConnection.status))
|
: active
|
||||||
|
? withActiveFilter(filterStates)
|
||||||
|
: noneActiveFilter(filterStates))
|
||||||
.getOrThrow();
|
.getOrThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Predicate<ClientConnectionData> noneActiveFilter(final EnumSet<ConnectionStatus> filterStates) {
|
||||||
|
return conn -> conn != null && !filterStates.contains(conn.clientConnection.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** If we have a filter criteria for ACTIVE connection, we shall filter only the active connections
|
||||||
|
* that has no incident. */
|
||||||
|
private Predicate<ClientConnectionData> withActiveFilter(final EnumSet<ConnectionStatus> filterStates) {
|
||||||
|
return conn -> {
|
||||||
|
if (conn == null) {
|
||||||
|
return false;
|
||||||
|
} else if (conn.clientConnection.status == ConnectionStatus.ACTIVE) {
|
||||||
|
return conn.hasAnyIncident();
|
||||||
|
} else {
|
||||||
|
return !filterStates.contains(conn.clientConnection.status);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// return conn -> conn != null
|
||||||
|
// && ((conn.clientConnection.status == ConnectionStatus.ACTIVE && !conn.hasAnyIncident()) ||
|
||||||
|
// (conn.clientConnection.status != ConnectionStatus.ACTIVE
|
||||||
|
// && !filterStates.contains(conn.clientConnection.status)));
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(
|
@RequestMapping(
|
||||||
path = API.PARENT_MODEL_ID_VAR_PATH_SEGMENT +
|
path = API.PARENT_MODEL_ID_VAR_PATH_SEGMENT +
|
||||||
API.EXAM_MONITORING_SEB_CONNECTION_TOKEN_PATH_SEGMENT,
|
API.EXAM_MONITORING_SEB_CONNECTION_TOKEN_PATH_SEGMENT,
|
||||||
|
|
|
@ -1799,6 +1799,8 @@ sebserver.monitoring.exam.connection.action.instruction.disable.all.confirm=Are
|
||||||
sebserver.monitoring.exam.connection.action.disable=Mark As Canceled
|
sebserver.monitoring.exam.connection.action.disable=Mark As Canceled
|
||||||
sebserver.monitoring.exam.connection.action.hide.requested=Hide Requested
|
sebserver.monitoring.exam.connection.action.hide.requested=Hide Requested
|
||||||
sebserver.monitoring.exam.connection.action.show.requested=Show Requested
|
sebserver.monitoring.exam.connection.action.show.requested=Show Requested
|
||||||
|
sebserver.monitoring.exam.connection.action.hide.active=Hide Active
|
||||||
|
sebserver.monitoring.exam.connection.action.show.active=Show Active
|
||||||
sebserver.monitoring.exam.connection.action.hide.closed=Hide Closed
|
sebserver.monitoring.exam.connection.action.hide.closed=Hide Closed
|
||||||
sebserver.monitoring.exam.connection.action.show.closed=Show Closed
|
sebserver.monitoring.exam.connection.action.show.closed=Show Closed
|
||||||
sebserver.monitoring.exam.connection.action.hide.disabled=Hide Canceled
|
sebserver.monitoring.exam.connection.action.hide.disabled=Hide Canceled
|
||||||
|
|
Loading…
Reference in a new issue