SEBSERV-151 finished up

This commit is contained in:
anhefti 2022-06-15 09:53:03 +02:00
parent 3cbfd80206
commit a979d4c13b
4 changed files with 76 additions and 46 deletions

View file

@ -775,6 +775,12 @@ public enum ActionDefinition {
ImageIcon.SEND_QUIT,
PageStateDefinitionImpl.MONITORING_CLIENT_CONNECTION,
ActionCategory.FORM),
MONITOR_EXAM_CLIENT_CONNECTION_LOCK(
new LocTextKey("sebserver.monitoring.exam.connection.action.instruction.lock"),
ImageIcon.LOCK,
PageStateDefinitionImpl.MONITORING_CLIENT_CONNECTION,
ActionCategory.FORM),
MONITOR_EXAM_CLIENT_CONNECTION_PROCTORING(
new LocTextKey("sebserver.monitoring.exam.connection.action.proctoring"),
ImageIcon.PROCTOR_SINGLE,

View file

@ -8,7 +8,9 @@
package ch.ethz.seb.sebserver.gui.content.monitoring;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
@ -119,6 +121,7 @@ public class MonitoringClientConnection implements TemplateComposer {
private final I18nSupport i18nSupport;
private final InstructionProcessor instructionProcessor;
private final SEBClientEventDetailsPopup sebClientLogDetailsPopup;
private final SEBSendLockPopup sebSendLockPopup;
private final MonitoringProctoringService monitoringProctoringService;
private final long pollInterval;
private final int pageSize;
@ -133,6 +136,7 @@ public class MonitoringClientConnection implements TemplateComposer {
final InstructionProcessor instructionProcessor,
final SEBClientEventDetailsPopup sebClientLogDetailsPopup,
final MonitoringProctoringService monitoringProctoringService,
final SEBSendLockPopup sebSendLockPopup,
@Value("${sebserver.gui.webservice.poll-interval:500}") final long pollInterval,
@Value("${sebserver.gui.list.page.size:20}") final Integer pageSize) {
@ -144,6 +148,7 @@ public class MonitoringClientConnection implements TemplateComposer {
this.monitoringProctoringService = monitoringProctoringService;
this.pollInterval = pollInterval;
this.sebClientLogDetailsPopup = sebClientLogDetailsPopup;
this.sebSendLockPopup = sebSendLockPopup;
this.pageSize = pageSize;
this.typeFilter = new TableFilterAttribute(
@ -371,6 +376,14 @@ public class MonitoringClientConnection implements TemplateComposer {
return action;
})
.noEventPropagation()
.publishIf(() -> isExamSupporter.getAsBoolean() &&
connectionData.clientConnection.status.clientActiveStatus)
.newAction(ActionDefinition.MONITOR_EXAM_CLIENT_CONNECTION_LOCK)
.withEntityKey(parentEntityKey)
.withExec(action -> this.sebSendLockPopup.show(action,
some -> new HashSet<>(Arrays.asList(connectionToken))))
.noEventPropagation()
.publishIf(() -> isExamSupporter.getAsBoolean() &&
connectionData.clientConnection.status.clientActiveStatus);

View file

@ -76,6 +76,8 @@ public class SEBSendLockPopup {
final PageAction action,
final Function<Predicate<ClientConnection>, Set<String>> selectionFunction) {
try {
final PageContext pageContext = action.pageContext();
final Set<String> selection = selectionFunction.apply(ClientConnection.getStatusPredicate(
ConnectionStatus.CONNECTION_REQUESTED,
@ -113,7 +115,9 @@ public class SEBSendLockPopup {
doLock,
Utils.EMPTY_EXECUTION,
popupComposer);
} catch (final Exception e) {
action.pageContext().notifyUnexpectedError(e);
}
return action;
}
@ -195,6 +199,8 @@ public class SEBSendLockPopup {
final PageContext pageContext,
final FormHandle<?> formHandle) {
try {
final EntityKey examKey = pageContext.getEntityKey();
final String lockMessage = formHandle
.getForm()
@ -207,6 +213,10 @@ public class SEBSendLockPopup {
connectionTokens,
pageContext);
} catch (final Exception e) {
pageContext.notifyUnexpectedError(e);
}
return true;
}

View file

@ -1873,6 +1873,7 @@ sebserver.monitoring.exam.connection.action.instruction.quit.all=Quit All SEB Cl
sebserver.monitoring.exam.connection.action.instruction.quit.confirm=Are you sure to quit this SEB client connection?
sebserver.monitoring.exam.connection.action.instruction.quit.selected.confirm=Are you sure to quit all selected, active SEB client connections?
sebserver.monitoring.exam.connection.action.instruction.quit.all.confirm=Are you sure to quit all active SEB client connections?
sebserver.monitoring.exam.connection.action.instruction.lock=Lock SEB Client
sebserver.monitoring.exam.connection.action.instruction.lock.selected=Lock Selected SEB Clients
sebserver.monitoring.exam.connection.action.instruction.lock.confirm=Are you sure to lock this SEB client connection?
sebserver.monitoring.exam.connection.action.instruction.disable.selected.confirm=Are you sure to disable all selected SEB client connections?