From d5cefc93d7db0acbf9e3b44ef6adf5307615ffda Mon Sep 17 00:00:00 2001 From: Arved Solth Date: Mon, 30 Sep 2024 15:15:58 +0200 Subject: [PATCH] Add dialog informing user about result of setting import configurations --- .../kitodo/production/forms/ProcessForm.java | 28 ++++++++- .../resources/messages/messages_de.properties | 3 + .../resources/messages/messages_en.properties | 3 + .../importConfigurationsSelectedDialog.xhtml | 57 +++++++++++++++++++ Kitodo/src/main/webapp/pages/processes.xhtml | 1 + 5 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 Kitodo/src/main/webapp/WEB-INF/templates/includes/processes/importConfigurationsSelectedDialog.xhtml diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java index feb8193ac94..5527b93a524 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java @@ -102,6 +102,8 @@ public class ProcessForm extends TemplateBaseForm { private static final String PROCESS_TABLE_VIEW_ID = "/pages/processes.xhtml"; private static final String PROCESS_TABLE_ID = "processesTabView:processesForm:processesTable"; private final Map assignedProcesses = new HashMap<>(); + private String settingImportConfigurationResultMessage; + private boolean importConfigurationsSetSuccessfully = false; @Inject private CustomListColumnInitializer initializer; @@ -1168,8 +1170,32 @@ public void startSettingImportConfigurations(int importConfigurationId) { try { ServiceManager.getProcessService().setImportConfigurationForMultipleProcesses(getSelectedProcesses(), importConfigurationId); + settingImportConfigurationResultMessage = Helper.getTranslation("setImportConfigurationSuccessfulDescription", + String.valueOf(importConfigurationId), String.valueOf(selectedProcessesOrProcessDTOs.size())); + importConfigurationsSetSuccessfully = true; } catch (DAOException e) { - Helper.setErrorMessage(e); + settingImportConfigurationResultMessage = e.getLocalizedMessage(); + importConfigurationsSetSuccessfully = false; } + Ajax.update("importConfigurationsSelectedDialog"); + PrimeFaces.current().executeScript("PF('importConfigurationsSelectedDialog').show();"); + } + + /** + * Get value of 'settingImportConfigurationResultMessage'. + * + * @return value of 'settingImportConfigurationResultMessage' + */ + public String getSettingImportConfigurationResultMessage() { + return settingImportConfigurationResultMessage; + } + + /** + * Get value of 'importConfigurationsSetSuccessfully'. + * + * @return value of 'importConfigurationsSetSuccessfully' + */ + public boolean isImportConfigurationsSetSuccessfully() { + return importConfigurationsSetSuccessfully; } } diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index 0b0001dc611..73c8263bafa 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -1037,6 +1037,9 @@ sendSolutionMessageForSingle=Meldung \u00FCber Probleml\u00F6sung f\u00FCr den a separateStructure=Erweiterter Strukturbaum separateStructureCheckboxTooltip=Logische und physische Strukturdaten im Metadaten-Editor getrennt bearbeiten setImportConfiguration=Importkonfiguration setzen +setImportConfigurationSuccessful=Importkonfigurationen erfolgreich gesetzt +setImportConfigurationSuccessfulDescription=Die Importkonfiguration {0} wurde erfolgreich f\u00FCr {1} ausgew\u00E4hlte Vorg\u00E4nge gesetzt. +setImportConfigurationFailed=Fehler beim Setzen der Importkonfigurationen setImportConfigurationConfirmMessage=Die Importconfiguration wird f\u00FCr alle ausgew\u00E4hlten Vorg\u00E4nge gesetzt. Dies Aktion kann nicht r\u00FCckg\u00E4ngig gemacht werden. M\u00F6chten Sie fortfahren? setImportConfigurationForSelectedProcessesText=Bitte w\u00E4hlen Sie die Importkonfiguration f\u00FCr die selektierten Vorg\u00E4nge aus. Der Re-Import von Katalogmetadaten ist nur f\u00FCr Vorg\u00E4nge mit Importkonfiguration vom Typ 'OPAC-Suche' m\u00F6glich. setRepresentative=Repr\u00E4sentant setzen\: diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index 0ae7f7d86e2..9d33994943f 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -1037,6 +1037,9 @@ sendSolutionMessageForSingle=send troubleshooting message to the current step separateStructure=Extended structure separateStructureCheckboxTooltip=edit logical and physical structures separately setImportConfiguration=Set import configuration +setImportConfigurationSuccessful=Import configuration set successfully +setImportConfigurationSuccessfulDescription=Import configuration {0} set successfully for {1} selected processes +setImportConfigurationFailed=Error setting import configurations setImportConfigurationConfirmMessage=You are about the change the import configuration of all selected processes. This process cannot be reverted. Do you want to continue? setImportConfigurationForSelectedProcessesText=Please select the import configuration for the selected processes. Re-importing metadata from remote catalog interfaces is only supported for processes with import configurations of type 'OPAC search'. setRepresentative=Set representative\: diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/processes/importConfigurationsSelectedDialog.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/processes/importConfigurationsSelectedDialog.xhtml new file mode 100644 index 00000000000..4b9e3b66ae8 --- /dev/null +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/processes/importConfigurationsSelectedDialog.xhtml @@ -0,0 +1,57 @@ + + + + + + + + + +

#{ProcessForm.importConfigurationsSetSuccessfully ? msgs['setImportConfigurationSuccessful'] : msgs['setImportConfigurationFailed']}

+ +
+ +
+
+ + + + + +
+
+
+ +
+ +
diff --git a/Kitodo/src/main/webapp/pages/processes.xhtml b/Kitodo/src/main/webapp/pages/processes.xhtml index 64ec4e8ff92..fb84abda08d 100644 --- a/Kitodo/src/main/webapp/pages/processes.xhtml +++ b/Kitodo/src/main/webapp/pages/processes.xhtml @@ -99,6 +99,7 @@ +