SEBSERV-160 added template column
This commit is contained in:
parent
55baa2d518
commit
93db8a4d9d
4 changed files with 48 additions and 2 deletions
|
@ -57,6 +57,8 @@ public class SEBExamConfigList implements TemplateComposer {
|
|||
new LocTextKey("sebserver.examconfig.list.column.description");
|
||||
private static final LocTextKey STATUS_TEXT_KEY =
|
||||
new LocTextKey("sebserver.examconfig.list.column.status");
|
||||
private static final LocTextKey TEMPLATE_TEXT_KEY =
|
||||
new LocTextKey("sebserver.examconfig.list.column.template");
|
||||
private static final LocTextKey EMPTY_SELECTION_TEXT_KEY =
|
||||
new LocTextKey("sebserver.examconfig.info.pleaseSelect");
|
||||
|
||||
|
@ -66,6 +68,7 @@ public class SEBExamConfigList implements TemplateComposer {
|
|||
private final TableFilterAttribute descFilter =
|
||||
new TableFilterAttribute(CriteriaType.TEXT, ConfigurationNode.FILTER_ATTR_DESCRIPTION);
|
||||
private final TableFilterAttribute statusFilter;
|
||||
private final TableFilterAttribute templateFilter;
|
||||
|
||||
private final PageService pageService;
|
||||
private final SEBExamConfigImportPopup sebExamConfigImportPopup;
|
||||
|
@ -102,6 +105,11 @@ public class SEBExamConfigList implements TemplateComposer {
|
|||
CriteriaType.SINGLE_SELECTION,
|
||||
ConfigurationNode.FILTER_ATTR_STATUS,
|
||||
this.resourceService::examConfigStatusFilterResources);
|
||||
|
||||
this.templateFilter = new TableFilterAttribute(
|
||||
CriteriaType.SINGLE_SELECTION,
|
||||
ConfigurationNode.FILTER_ATTR_TEMPLATE_ID,
|
||||
this.resourceService::getExamConfigTemplateResourcesSelection);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -153,6 +161,13 @@ public class SEBExamConfigList implements TemplateComposer {
|
|||
this.resourceService::localizedExamConfigStatusName)
|
||||
.withFilter(this.statusFilter)
|
||||
.sortable())
|
||||
|
||||
.withColumn(new ColumnDefinition<>(
|
||||
Domain.CONFIGURATION_NODE.ATTR_TEMPLATE_ID,
|
||||
TEMPLATE_TEXT_KEY,
|
||||
this.resourceService.examConfigTemplateNameFunction())
|
||||
.withFilter(this.templateFilter))
|
||||
|
||||
.withDefaultAction(pageActionBuilder
|
||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_VIEW_PROP_FROM_LIST)
|
||||
.create())
|
||||
|
|
|
@ -725,6 +725,14 @@ public class ResourceService {
|
|||
}
|
||||
|
||||
public List<Tuple<String>> getExamConfigTemplateResources() {
|
||||
return getExamConfigTemplateResourcesSelection(true);
|
||||
}
|
||||
|
||||
public List<Tuple<String>> getExamConfigTemplateResourcesSelection() {
|
||||
return getExamConfigTemplateResourcesSelection(false);
|
||||
}
|
||||
|
||||
public List<Tuple<String>> getExamConfigTemplateResourcesSelection(final boolean withEmpty) {
|
||||
final UserInfo userInfo = this.currentUser.get();
|
||||
final List<Tuple<String>> collect = this.restService.getBuilder(GetExamConfigNodes.class)
|
||||
.withQueryParam(Entity.FILTER_ATTR_INSTITUTION, String.valueOf(userInfo.getInstitutionId()))
|
||||
|
@ -735,10 +743,27 @@ public class ResourceService {
|
|||
.map(node -> new Tuple<>(node.getModelId(), node.name))
|
||||
.sorted(RESOURCE_COMPARATOR)
|
||||
.collect(Collectors.toList());
|
||||
collect.add(0, new Tuple<>(null, StringUtils.EMPTY));
|
||||
if (withEmpty) {
|
||||
collect.add(0, new Tuple<>(null, StringUtils.EMPTY));
|
||||
}
|
||||
return collect;
|
||||
}
|
||||
|
||||
public final Function<ConfigurationNode, String> examConfigTemplateNameFunction() {
|
||||
final List<Tuple<String>> examTemplateResources = getExamConfigTemplateResourcesSelection();
|
||||
return node -> {
|
||||
if (node.templateId == null) {
|
||||
return Constants.EMPTY_NOTE;
|
||||
}
|
||||
return examTemplateResources
|
||||
.stream()
|
||||
.filter(tuple -> node.templateId.toString().equals(tuple._1))
|
||||
.map(tuple -> tuple._2)
|
||||
.findAny()
|
||||
.orElse(Constants.EMPTY_NOTE);
|
||||
};
|
||||
}
|
||||
|
||||
public List<Tuple<String>> sebRestrictionWhiteListResources() {
|
||||
return Arrays.stream(WhiteListPath.values())
|
||||
.map(type -> new Tuple3<>(
|
||||
|
|
|
@ -315,6 +315,10 @@ public class PaginationServiceImpl implements PaginationService {
|
|||
configurationNodeTableMap.put(
|
||||
Domain.CONFIGURATION_NODE.ATTR_STATUS,
|
||||
ConfigurationNodeRecordDynamicSqlSupport.status.name());
|
||||
configurationNodeTableMap.put(
|
||||
Domain.CONFIGURATION_NODE.ATTR_TEMPLATE_ID,
|
||||
ConfigurationNodeRecordDynamicSqlSupport.templateId.name());
|
||||
|
||||
this.sortColumnMapping.put(
|
||||
ConfigurationNodeRecordDynamicSqlSupport.configurationNodeRecord.name(),
|
||||
configurationNodeTableMap);
|
||||
|
|
|
@ -807,6 +807,8 @@ sebserver.examconfig.list.column.description=Description
|
|||
sebserver.examconfig.list.column.description.tooltip=The description of the SEB exam configuration<br/><br/>Use the filter above to find configurations that contain specific words or phrases within the description.<br/>{0}
|
||||
sebserver.examconfig.list.column.status=Status
|
||||
sebserver.examconfig.list.column.status.tooltip=The status of the SEB exam configuration<br/><br/>Use the filter above to specify a status<br/>{0}
|
||||
sebserver.examconfig.list.column.template=Template
|
||||
sebserver.examconfig.list.column.template.tooltip=The origin template of the SEB exam configuration<br/><br/>Use the filter above to specify a template<br/>{0}
|
||||
|
||||
sebserver.examconfig.list.actions=
|
||||
|
||||
|
@ -861,7 +863,7 @@ sebserver.examconfig.message.confirm.delete=This will completely delete the exam
|
|||
sebserver.examconfig.message.consistency.error=The exam configuration cannot be deleted since it is used by at least one running or upcoming exam.<br/>Please remove the exam configuration from running and upcoming exams first.
|
||||
sebserver.examconfig.message.delete.confirm=The exam configuration ({0}) was successfully deleted.
|
||||
sebserver.examconfig.message.delete.partialerror=The exam configuration ({0}) was deleted but there where some dependency errors:<br/><br/>{1}
|
||||
sebserver.examconfig.action.restore.template.settings=Restore Template Settings
|
||||
sebserver.examconfig.action.restore.template.settings=Reset To Template Settings
|
||||
sebserver.examconfig.action.restore.template.settings.success=Configuration settings successfully restored to template defaults
|
||||
sebserver.examconfig.action.restore.template.settings.confirm=Are you sure to reset this configuration setting to the templates settings?
|
||||
|
||||
|
|
Loading…
Reference in a new issue