SEBSLI-4 institution feature and full feature message mockup

This commit is contained in:
anhefti 2024-01-29 15:07:05 +01:00
parent 52192619fd
commit 12f67149f0
11 changed files with 77 additions and 6 deletions

View file

@ -181,6 +181,8 @@ public class ActivitiesPane implements TemplateComposer {
sebAdmin.dispose();
}
// ---- SEB ADMIN ----------------------------------------------------------------------
//--------------------------------------------------------------------------------------
@ -445,6 +447,9 @@ public class ActivitiesPane implements TemplateComposer {
private TreeItem getDefaultSelectionFor(final Tree navigation, final CurrentUser currentUser2) {
try {
if (this.currentUser.get().hasAnyRole(UserRole.SEB_SERVER_ADMIN, UserRole.INSTITUTIONAL_ADMIN)) {
if (pageService.isSEBServerLightSetup()) {
return navigation.getItem(0).getItem(1);
}
return navigation.getItem(0);
} else if (this.currentUser.get().hasAnyRole(UserRole.EXAM_ADMIN)) {
return findItemByActionDefinition(

View file

@ -94,6 +94,12 @@ public class InstitutionList implements TemplateComposer {
pageContext.getParent(),
TITLE_TEXT_KEY);
if (pageService.isSEBServerLightSetup()) {
pageService.applyFullVersionNote(content, pageContext);
return;
}
final PageActionBuilder pageActionBuilder =
this.pageService.pageActionBuilder(pageContext.clearEntityKeys());

View file

@ -27,6 +27,7 @@ public interface PageContext {
Logger log = LoggerFactory.getLogger(PageContext.class);
/** Defines attribute keys that can be used to store attribute values within the page context state */
interface AttributeKeys {

View file

@ -127,6 +127,13 @@ public interface PageService {
* @return the configured tooltip mode for input forms */
FormTooltipMode getFormTooltipMode();
/** Indicates if SEB Server runs with SEB Server light setup
*
* @return true if this is a SEB Server light setup*/
boolean isSEBServerLightSetup();
void applyFullVersionNote(Composite content, PageContext pageContext);
/** Get a PageAction function to go back to the current state.
*
* @return a PageAction function to go back to the current state. */

View file

@ -20,7 +20,9 @@ import java.util.function.Supplier;
import javax.servlet.http.HttpSession;
import ch.ethz.seb.sebserver.gui.GuiServiceInfo;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TreeItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -88,6 +90,7 @@ public class PageServiceImpl implements PageService {
private final ResourceService resourceService;
private final CurrentUser currentUser;
private final ServerPushService serverPushService;
private final GuiServiceInfo guiServiceInfo;
public PageServiceImpl(
final Cryptor cryptor,
@ -96,7 +99,8 @@ public class PageServiceImpl implements PageService {
final PolyglotPageService polyglotPageService,
final ResourceService resourceService,
final CurrentUser currentUser,
final ServerPushService serverPushService) {
final ServerPushService serverPushService,
final GuiServiceInfo guiServiceInfo) {
this.cryptor = cryptor;
this.jsonMapper = jsonMapper;
@ -105,6 +109,7 @@ public class PageServiceImpl implements PageService {
this.resourceService = resourceService;
this.currentUser = currentUser;
this.serverPushService = serverPushService;
this.guiServiceInfo = guiServiceInfo;
}
@Override
@ -182,6 +187,19 @@ public class PageServiceImpl implements PageService {
return FormTooltipMode.INPUT;
}
@Override
public boolean isSEBServerLightSetup() {
return this.guiServiceInfo.isLightSetup();
}
private static final LocTextKey FULL_VERSION_NOTE = new LocTextKey("sebserver.features.lightsetup.fullversion.message");
@Override
public void applyFullVersionNote(final Composite content, final PageContext pageContext) {
final Composite warningPanel = this.widgetFactory.createWarningPanel(content);
warningPanel.setData(RWT.CUSTOM_VARIANT, WidgetFactory.CustomVariant.NOTE.key);
this.widgetFactory.labelLocalizedNote(warningPanel, FULL_VERSION_NOTE);
}
@SuppressWarnings("unchecked")
@Override
public <T extends PageEvent> void firePageEvent(final T event, final PageContext pageContext) {

View file

@ -220,6 +220,7 @@ public class WidgetFactory {
MESSAGE("message"),
ERROR("error"),
WARNING("warning"),
NOTE("note"),
DISABLED("disabled"),
CONFIG_INPUT_READONLY("inputreadonly"),
@ -507,6 +508,14 @@ public class WidgetFactory {
labelLocalized.setLayoutData(gridData);
return labelLocalized;
}
public Label labelLocalizedNote(final Composite content, final LocTextKey locTextKey) {
final Label labelLocalized = labelLocalized(content, CustomVariant.NOTE, locTextKey);
labelLocalized.setData(RWT.MARKUP_ENABLED, true);
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
labelLocalized.setLayoutData(gridData);
return labelLocalized;
}
public Text textInput(final Composite content, final LocTextKey ariaLabel) {
return textInput(content, false, false, ariaLabel.name, ariaLabel);

View file

@ -114,11 +114,19 @@ public class WebserviceInit implements ApplicationListener<ApplicationReadyEvent
SEBServerInit.INIT_LOGGER.info("----> JDBC connection pool max size: {}",
this.environment.getProperty("spring.datasource.hikari.maximumPoolSize"));
if (this.webserviceInfo.isDistributed()) {
if (this.webserviceInfo.isLightSetup()) {
throw new IllegalStateException("Illegal invalid setup configuration detected, SEB Serer light and distributed setup cannot be applied within the same setup.");
}
SEBServerInit.INIT_LOGGER.info("----> ");
SEBServerInit.INIT_LOGGER.info("----> Distributed Setup: {}", this.webserviceInfo.getWebserviceUUID());
SEBServerInit.INIT_LOGGER.info("----> Connection update time: {}",
this.environment.getProperty("sebserver.webservice.distributed.connectionUpdate", "2000"));
} else if (this.webserviceInfo.isLightSetup()) {
SEBServerInit.INIT_LOGGER.info("----> ");
SEBServerInit.INIT_LOGGER.info("----> SEB Server light setup enabled!");
}
SEBServerInit.INIT_LOGGER.info("----> ");

View file

@ -25,7 +25,8 @@ sebserver.webservice.clean-db-on-startup=false
# webservice setup configuration
sebserver.init.adminaccount.gen-on-init=false
sebserver.webservice.distributed=true
sebserver.webservice.light.setup=true
sebserver.webservice.distributed=false
#sebserver.webservice.master.delay.threshold=10000
sebserver.webservice.http.external.scheme=http
sebserver.webservice.http.external.servername=localhost
@ -75,5 +76,5 @@ sebserver.feature.seb.screenProctoring.bundled.url=http://localhost:8090
sebserver.feature.seb.screenProctoring.bundled.clientId=sebserverClient
sebserver.feature.seb.screenProctoring.bundled.sebserveraccount.username=SEBServerAPIAccount
sebserver.feature.admin.institution.enabled=false
sebserver.feature.admin.institution.enabled=true

View file

@ -20,8 +20,6 @@ server.tomcat.socket.soKeepAlive=true
server.tomcat.socket.performanceConnectionTime=1
server.tomcat.socket.performanceLatency=2
server.tomcat.socket.performanceBandwidth=0
server.tomcat.keepAliveTimeout(3000);
server.tomcat.maxKeepAliveRequests(3000);
server.tomcat.uri-encoding=UTF-8
### encoding

View file

@ -2572,4 +2572,4 @@ sebserver.seblogs.delete.action.delete=Delete All Logs
sebserver.seblogs.delete.confirm.title=Deletion Successful
sebserver.seblogs.delete.confirm.message={0} SEB client logs where successfully deleted.<br/><br/>And there where {1} errors.
sebserver.features.lightsetup.fullversion.message=MOCKUP_TEXT: This feature is not available within this SEB Server (light) setup. To use this feature you need a full version SEB Server setup. Please read more about SEB Server setups in the <a href="..." target="blank">SEB Server installation guide</a>
sebserver.features.lightsetup.fullversion.message=MOCKUP-TEXT:<br/><br/>[Specific feature description here!?]<br/><br/>Note that this feature is not available within the SEB Server Light setup.<br/>To use this feature you will need a full version SEB Server setup.<br/><br/>Please read more about SEB Server setups in the <a href="https://seb-server-setup.readthedocs.io/en/latest/overview.html" target="blank">SEB Server installation guide</a>

View file

@ -80,6 +80,8 @@ Label.h2 {
color: #1f407a;
}
Label.h3 {
font: bold 14px Arial, Helvetica, sans-serif;
height: 20px;
@ -93,6 +95,13 @@ Label.subtitle {
color: #4a4a4a;
}
Label.note {
font: 18px Arial, Helvetica, sans-serif;
height: 22px;
padding: 0 0 6px 0;
color: #4a4a4a;
}
Label.error {
font: 10px Arial, Helvetica, sans-serif;
color: #aa0000;
@ -252,6 +261,15 @@ Composite.warning {
opacity: 1;
}
Composite.note {
background-gradient-color: rgba( 31, 64, 122, 0.2 );
background-image: gradient( linear, left top, left bottom, from(rgba( 31, 64, 122, 0.2 ) ), to( rgba( 31, 64, 122, 0.2 ) ) );
background-repeat: repeat;
background-position: left top;
font: bold 18px Arial, Helvetica, sans-serif;
opacity: 1;
}
*.header {
font: bold 12px Arial, Helvetica, sans-serif;
color: #FFFFFF;