diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/TemplateForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/TemplateForm.java index 253ed375ec8..6d110431756 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/TemplateForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/TemplateForm.java @@ -15,9 +15,11 @@ import java.io.InputStream; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import java.util.Objects; +import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.inject.Named; @@ -54,6 +56,9 @@ public class TemplateForm extends TemplateBaseForm { private static final String TITLE_USED = "templateTitleAlreadyInUse"; private final String templateListPath = MessageFormat.format(REDIRECT_PATH, "projects"); private final String templateEditPath = MessageFormat.format(REDIRECT_PATH, "templateEdit"); + private List templateFilters; + private List selectedTemplateFilters; + private static final String DEACTIVATED_TEMPLATES_FILTER = "deactivatedTemplates"; /** * Constructor. @@ -62,6 +67,16 @@ public TemplateForm() { super.setLazyDTOModel(new LazyDTOModel(ServiceManager.getTemplateService())); } + /** + * Initialize list of template filters (currently only 'deactivated templates'). + */ + @PostConstruct + public void init() { + templateFilters = new LinkedList<>(); + templateFilters.add(DEACTIVATED_TEMPLATES_FILTER); + selectedTemplateFilters = new LinkedList<>(); + } + /** * Check if inactive templates should be shown. * @@ -430,4 +445,47 @@ public boolean isCurrentTemplateInUse() { return false; } } + + /** + * Get templateFilters. + * + * @return value of templateFilters + */ + public List getTemplateFilters() { + return templateFilters; + } + + /** + * Set templateFilters. + * + * @param templateFilters as java.util.List + */ + public void setTemplateFilters(List templateFilters) { + this.templateFilters = templateFilters; + } + + /** + * Get selectedTemplateFilters. + * + * @return value of selectedTemplateFilters + */ + public List getSelectedTemplateFilters() { + return selectedTemplateFilters; + } + + /** + * Set selectedTemplateFilters. + * + * @param selectedTemplateFilters as java.util.List + */ + public void setSelectedTemplateFilters(List selectedTemplateFilters) { + this.selectedTemplateFilters = selectedTemplateFilters; + } + + /** + * Event listener for template filter changed event. + */ + public void templateFiltersChanged() { + setShowInactiveTemplates(selectedTemplateFilters.contains(DEACTIVATED_TEMPLATES_FILTER)); + } } diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index 8980a10ef04..3baceec6fc6 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -342,6 +342,7 @@ dataPrivacyDefaultText=Datenschutzinformationen f\u00FCr dieses System wurden no databaseStatistic=Datenbankstatistik day=Tag days=Tage +deactivatedTemplates=Deaktivierte Produktionsvorlagen defaults=Vorgaben delete=L\u00F6schen deleteAfterMove=Nach dem Export l\u00F6schen @@ -1025,7 +1026,6 @@ showDataForProcess=Zeige Daten des Vorgangs showHierarchyLevel=Zeige Hierarchielevel showInSelectList=In Auswahlliste anzeigen showInactiveProjects=Deaktivierte Projekte zeigen -showInactiveTemplates=Deaktivierte Produktionsvorlagen zeigen showOnlyStructureElements=Zeige nur Strukturelemente showProjectProcesses=Vorg\u00E4nge dieses Projektes anzeigen showProjectTasks=Aktuelle Aufgaben dieses Projektes anzeigen diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index 34503a47b56..74e5cc062e0 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -342,6 +342,7 @@ dataPrivacyDefaultText=Data privacy information have not been configured for thi databaseStatistic=Database statistics day=day days=days +deactivatedTemplates=Deactivated templates defaults=Defaults delete=Delete deleteAfterMove=Delete after export @@ -1025,7 +1026,6 @@ showDataForProcess=show process data showHierarchyLevel=Show hierarchy level showInSelectList=Show in selection list showInactiveProjects=show deactivated projects -showInactiveTemplates=show deactivated templates showOnlyStructureElements=Show only structure elements showProjectProcesses=Show processes of this project showProjectTasks=Show current tasks of this project diff --git a/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css b/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css index 340f6098a2b..b9b42decae6 100644 --- a/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css +++ b/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css @@ -1325,21 +1325,6 @@ main i.fa { text-overflow: clip; } -#showInactiveTemplatesForm { - height: 100%; -} - -#showInactiveTemplatesForm .ui-outputlabel { - display: inline-block; - height: 100%; - margin-right: var(--default-half-size); - vertical-align: middle; -} - -#showInactiveTemplatesForm .switch { - display: inline; -} - .hierarchy-info { width: calc(var(--default-double-size) + var(--default-full-size)); } @@ -1800,7 +1785,7 @@ Mass import color: var(--medium-gray); } -.task-filter-panel.ui-selectcheckboxmenu-panel .ui-selectcheckboxmenu-items-wrapper { +.filter-panel.ui-selectcheckboxmenu-panel .ui-selectcheckboxmenu-items-wrapper { overflow-y: hidden; } @@ -1808,7 +1793,7 @@ Mass import margin-right: var(--default-full-size); } -#tasksTabView\:filterForm .ui-selectcheckboxmenu-label, +.filter-form .ui-selectcheckboxmenu .ui-selectcheckboxmenu-label, #tasksTabView\:statusForm .ui-selectcheckboxmenu-label { padding-right: var(--input-height); } diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/projects/templateList.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/projects/templateList.xhtml index 4bd17feb500..3e937d0e775 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/projects/templateList.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/projects/templateList.xhtml @@ -19,6 +19,7 @@ xmlns:p="http://primefaces.org/ui"> + + + diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/tasks/taskList.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/tasks/taskList.xhtml index fce0c5182cc..699b8225247 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/tasks/taskList.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/tasks/taskList.xhtml @@ -278,4 +278,40 @@ + + diff --git a/Kitodo/src/test/java/org/kitodo/selenium/ListingST.java b/Kitodo/src/test/java/org/kitodo/selenium/ListingST.java index 8c6e7e0859e..63c804e3999 100644 --- a/Kitodo/src/test/java/org/kitodo/selenium/ListingST.java +++ b/Kitodo/src/test/java/org/kitodo/selenium/ListingST.java @@ -253,7 +253,6 @@ public void listTemplatesTest() throws Exception { assertEquals("Wrong number of templates after hiding first template", 1, projectsPage.getTemplateTitles().size()); projectsPage.goToTemplateTab(); - Thread.sleep(500); projectsPage.toggleHiddenTemplates(); assertEquals("Wrong number of templates after toggling hidden templates", 2, projectsPage.getTemplateTitles().size()); diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/Page.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/Page.java index 7baada38b16..b3fc4580c90 100644 --- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/Page.java +++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/Page.java @@ -36,6 +36,7 @@ public abstract class Page { private static final Logger logger = LogManager.getLogger(Page.class); static final String DATA = "_data"; static final String CSS_SELECTOR_DROPDOWN_TRIGGER = ".ui-selectonemenu-trigger"; + static final String WAIT_FOR_FILTER_FORM_MENU = "Wait for filter form menu to open"; @SuppressWarnings("unused") @FindBy(id = "user-menu") diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java index 47cb2ca8883..be7ecb989bd 100644 --- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java +++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java @@ -175,7 +175,13 @@ public class ProjectsPage extends Page { @FindBy(id = RULESET_TABLE + ":0:actionForm:deleteRuleset") private WebElement deleteFirstRulesetButton; - @FindBy(id = "showInactiveTemplateWrapper") + @FindBy(id = "filterForm:templateFilters") + private WebElement filterMenu; + + @FindBy(id = "filterForm:templateFilters_panel") + private WebElement checkBoxPanel; + + @FindBy(css = ".filter-panel li:last-child .ui-chkbox") private WebElement toggleHiddenTemplatesWrapper; public ProjectsPage() { @@ -638,7 +644,14 @@ public Long getNumberOfMappingFiles() { * Toggle switch to hide/show inactive templates. */ public void toggleHiddenTemplates() { - toggleHiddenTemplatesWrapper.findElement(By.className("ui-chkbox-box")).click(); - + filterMenu.click(); + await(WAIT_FOR_FILTER_FORM_MENU).pollDelay(700, TimeUnit.MILLISECONDS) + .atMost(3, TimeUnit.SECONDS) + .until(() -> checkBoxPanel.isDisplayed()); + toggleHiddenTemplatesWrapper.click(); + + await("Wait for template filter list to be updated").pollDelay(700, TimeUnit.MILLISECONDS) + .atMost(3, TimeUnit.SECONDS) + .until(() -> filterMenu.isEnabled()); } }