added toggle action buttons for active/inactive on institutions
This commit is contained in:
parent
412ed6fd7b
commit
daafb7a64b
10 changed files with 66 additions and 14 deletions
|
@ -53,12 +53,12 @@ public enum ActionDefinition {
|
|||
ActionCategory.FORM),
|
||||
INSTITUTION_ACTIVATE(
|
||||
new LocTextKey("sebserver.institution.action.activate"),
|
||||
ImageIcon.INACTIVE,
|
||||
ImageIcon.TOGGLE_OFF,
|
||||
PageStateDefinition.INSTITUTION_VIEW,
|
||||
ActionCategory.FORM),
|
||||
INSTITUTION_DEACTIVATE(
|
||||
new LocTextKey("sebserver.institution.action.deactivate"),
|
||||
ImageIcon.ACTIVE,
|
||||
ImageIcon.TOGGLE_ON,
|
||||
PageStateDefinition.INSTITUTION_VIEW,
|
||||
ActionCategory.FORM),
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType;
|
|||
import ch.ethz.seb.sebserver.gbl.model.Entity;
|
||||
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall.CallType;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestService;
|
||||
|
||||
|
@ -44,13 +45,21 @@ public final class PageUtils {
|
|||
|
||||
return () -> {
|
||||
try {
|
||||
final RestCall<Set<EntityKey>>.RestCallBuilder builder =
|
||||
restService.<Set<EntityKey>> getBuilder(
|
||||
entity.entityType(),
|
||||
CallType.GET_DEPENDENCIES);
|
||||
|
||||
final Set<EntityKey> dependencies =
|
||||
restService.<Set<EntityKey>> getBuilder(entity.entityType(), CallType.GET_DEPENDENCIES)
|
||||
.withURIVariable(API.PARAM_MODEL_ID, String.valueOf(entity.getModelId()))
|
||||
.withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.DEACTIVATE.name())
|
||||
.call()
|
||||
.getOrThrow();
|
||||
if (builder == null) {
|
||||
log.error("No RestCall builder found for entity type: {}", entity.entityType());
|
||||
return null;
|
||||
}
|
||||
|
||||
final Set<EntityKey> dependencies = builder
|
||||
.withURIVariable(API.PARAM_MODEL_ID, String.valueOf(entity.getModelId()))
|
||||
.withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.DEACTIVATE.name())
|
||||
.call()
|
||||
.getOrThrow();
|
||||
final int size = dependencies.size();
|
||||
if (size > 0) {
|
||||
return new LocTextKey("sebserver.dialog.confirm.deactivation", String.valueOf(size));
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package ch.ethz.seb.sebserver.gui.service.remote.webservice.api.useraccount;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
@GuiProfile
|
||||
public class GetUserDependency extends RestCall<Set<EntityKey>> {
|
||||
|
||||
public GetUserDependency() {
|
||||
super(new TypeKey<>(
|
||||
CallType.GET_DEPENDENCIES,
|
||||
EntityType.USER,
|
||||
new TypeReference<Set<EntityKey>>() {
|
||||
}),
|
||||
HttpMethod.GET,
|
||||
MediaType.APPLICATION_FORM_URLENCODED,
|
||||
API.USER_ACCOUNT_ENDPOINT + API.MODEL_ID_VAR_PATH_SEGMENT + API.DEPENDENCY_PATH_SEGMENT);
|
||||
}
|
||||
|
||||
}
|
|
@ -72,6 +72,8 @@ public class WidgetFactory {
|
|||
SHOW("show.png"),
|
||||
ACTIVE("active.png"),
|
||||
INACTIVE("inactive.png"),
|
||||
TOGGLE_ON("toggle_on.png"),
|
||||
TOGGLE_OFF("toggle_off.png"),
|
||||
YES("yes.png"),
|
||||
NO("no.png"),
|
||||
SAVE("save.png"),
|
||||
|
|
|
@ -5,6 +5,6 @@ spring.mandatory-file-encoding=UTF-8
|
|||
spring.http.encoding.charset=UTF-8
|
||||
spring.http.encoding.enabled=true
|
||||
|
||||
sebserver.version=0.3.0 pre-beta
|
||||
sebserver.version=0.3.1 pre-beta
|
||||
sebserver.supported.languages=en,de
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ sebserver.institution.action.list.view=View Institution
|
|||
sebserver.institution.action.list.modify=Edit Institution
|
||||
sebserver.institution.action.modify=Edit
|
||||
sebserver.institution.action.save=Save Institution
|
||||
sebserver.institution.action.activate=Activate
|
||||
sebserver.institution.action.deactivate=Deactivate
|
||||
sebserver.institution.action.activate=Toggle Activity
|
||||
sebserver.institution.action.deactivate=Toggle Activity
|
||||
sebserver.institution.action.delete=Delete Institution
|
||||
|
||||
sebserver.institution.info.pleaseSelect=Please Select an Institution first.
|
||||
|
|
|
@ -84,8 +84,8 @@ sebserver.institution.action.list.view=View Institution
|
|||
sebserver.institution.action.list.modify=Edit Institution
|
||||
sebserver.institution.action.modify=Edit
|
||||
sebserver.institution.action.save=Save Institution
|
||||
sebserver.institution.action.activate=Activate
|
||||
sebserver.institution.action.deactivate=Deactivate
|
||||
sebserver.institution.action.activate=Toggle Activity
|
||||
sebserver.institution.action.deactivate=Toggle Activity
|
||||
sebserver.institution.action.delete=Delete Institution
|
||||
sebserver.institution.action.export.sebconfig=SEB Client Config
|
||||
|
||||
|
|
BIN
src/main/resources/static/images/toggle_off.png
Normal file
BIN
src/main/resources/static/images/toggle_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 171 B |
BIN
src/main/resources/static/images/toggle_on.png
Normal file
BIN
src/main/resources/static/images/toggle_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 172 B |
|
@ -249,7 +249,6 @@ public class SebExamConfigurationRequestTest extends ExamAPIIntegrationTester {
|
|||
assertEquals(
|
||||
"{\"messageCode\":\"0\",\"systemMessage\":\"Generic error message\",\"details\":\"Missing exam identider or requested exam is not running\",\"attributes\":[]}",
|
||||
contentAsString);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue