added join URL for Zoom collecting rooms

This commit is contained in:
anhefti 2021-09-06 10:16:02 +02:00
parent a081a38f84
commit 446bb15a9c
2 changed files with 71 additions and 8 deletions

View file

@ -11,6 +11,14 @@ package ch.ethz.seb.sebserver.gui.content.monitoring;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
@ -30,6 +38,8 @@ import ch.ethz.seb.sebserver.gui.service.page.impl.PageAction;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.session.GetCollectingRoomConnections;
import ch.ethz.seb.sebserver.gui.table.ColumnDefinition;
import ch.ethz.seb.sebserver.gui.table.EntityTable;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
@Lazy
@Component
@ -43,6 +53,8 @@ public class ProctorRoomConnectionsPopup {
private static final LocTextKey TABLE_COLUMN_NAME =
new LocTextKey("sebserver.monitoring.search.list.name");
public static final String PAGE_ATTR_JOIN_LINK = "PAGE_ATTR_JOIN_LINK";
private final PageService pageService;
protected ProctorRoomConnectionsPopup(final PageService pageService) {
@ -64,6 +76,28 @@ public class ProctorRoomConnectionsPopup {
private void compose(final PageContext pageContext, final ModalInputDialog<Void> dialog) {
final EntityKey entityKey = pageContext.getEntityKey();
final EntityKey parentEntityKey = pageContext.getParentEntityKey();
final String joinLink = pageContext.getAttribute(PAGE_ATTR_JOIN_LINK);
if (StringUtils.isNotBlank(joinLink)) {
final WidgetFactory widgetFactory = this.pageService.getWidgetFactory();
final Composite titleComp = widgetFactory.voidComposite(pageContext.getParent());
final GridLayout layout = (GridLayout) titleComp.getLayout();
layout.numColumns = 2;
layout.makeColumnsEqualWidth = false;
final Label label = widgetFactory.label(titleComp, "Join URL: ");
label.setLayoutData(new GridData());
label.setData(RWT.CUSTOM_VARIANT, CustomVariant.TITLE_LABEL.key);
final Text textInput = widgetFactory.textInput(titleComp, joinLink);
final GridData gridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
textInput.setLayoutData(gridData);
textInput.setText(joinLink);
textInput.setEditable(false);
titleComp.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
}
final PageActionBuilder actionBuilder = this.pageService
.pageActionBuilder(pageContext.clearEntityKeys());

View file

@ -10,6 +10,7 @@ package ch.ethz.seb.sebserver.gui.service.session.proctoring;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import org.apache.commons.lang3.BooleanUtils;
import org.eclipse.rap.rwt.RWT;
@ -24,9 +25,12 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.type.TypeReference;
import ch.ethz.seb.sebserver.gbl.Constants;
import ch.ethz.seb.sebserver.gbl.api.API;
import ch.ethz.seb.sebserver.gbl.api.EntityType;
import ch.ethz.seb.sebserver.gbl.api.JSONMapper;
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
import ch.ethz.seb.sebserver.gbl.model.exam.ProctoringRoomConnection;
import ch.ethz.seb.sebserver.gbl.model.exam.ProctoringServiceSettings;
@ -95,17 +99,20 @@ public class MonitoringProctoringService {
private final PageService pageService;
private final GuiServiceInfo guiServiceInfo;
private final ProctorRoomConnectionsPopup proctorRoomConnectionsPopup;
private final JSONMapper jsonMapper;
private final String remoteProctoringEndpoint;
public MonitoringProctoringService(
final PageService pageService,
final GuiServiceInfo guiServiceInfo,
final ProctorRoomConnectionsPopup proctorRoomConnectionsPopup,
final JSONMapper jsonMapper,
@Value("${sebserver.gui.remote.proctoring.entrypoint:/remote-proctoring}") final String remoteProctoringEndpoint) {
this.pageService = pageService;
this.guiServiceInfo = guiServiceInfo;
this.proctorRoomConnectionsPopup = proctorRoomConnectionsPopup;
this.jsonMapper = jsonMapper;
this.remoteProctoringEndpoint = remoteProctoringEndpoint;
}
@ -218,14 +225,8 @@ public class MonitoringProctoringService {
_treeItem -> proctoringGUIService.registerCollectingRoomAction(
room,
_treeItem,
collectingRoom -> {
final PageContext pc = pageContext.copy()
.clearAttributes()
.withEntityKey(new EntityKey(collectingRoom.name,
EntityType.REMOTE_PROCTORING_ROOM))
.withParentEntityKey(entityKey);
this.proctorRoomConnectionsPopup.show(pc, collectingRoom.subject);
}));
collectingRoom -> showCollectingRoomPopup(pageContext, entityKey,
collectingRoom)));
processProctorRoomActionActivation(
proctoringGUIService.getCollectingRoomActionItem(room.name),
@ -236,6 +237,34 @@ public class MonitoringProctoringService {
updateTownhallButton(proctoringGUIService, pageContext);
}
private void showCollectingRoomPopup(
final PageContext pageContext,
final EntityKey entityKey,
final RemoteProctoringRoom collectingRoom) {
final String additionalRoomData = collectingRoom.getAdditionalRoomData();
String joinURL = null;
try {
final Map<String, String> roomData = this.jsonMapper.readValue(
additionalRoomData,
new TypeReference<Map<String, String>>() {
});
joinURL = roomData.get("start_url");
} catch (final Exception e) {
}
final PageContext pc = pageContext.copy()
.clearAttributes()
.withEntityKey(
new EntityKey(collectingRoom.name,
EntityType.REMOTE_PROCTORING_ROOM))
.withParentEntityKey(entityKey)
.withAttribute(
ProctorRoomConnectionsPopup.PAGE_ATTR_JOIN_LINK,
joinURL);
this.proctorRoomConnectionsPopup.show(pc, collectingRoom.subject);
}
private PageAction openExamProctoringRoom(
final ProctoringGUIService proctoringGUIService,
final ProctoringServiceSettings proctoringSettings,