From 30237beecdd8a766a454b5bf2a71d06cdf1b9f8f Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 11 Jul 2024 10:35:36 +0200 Subject: [PATCH] Bug fixing [#27826] --- CHANGELOG.md | 10 ++++ pom.xml | 2 +- .../client/ui/form/UpdateDatasetForm.java | 59 ++++++------------- 3 files changed, 28 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b6a833..b5b8137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v2.3.0-SNAPSHOT] - 2024-05-17 + +**Enhancement** + +- In edit mode, is allowed to delete fields according to data type [#27455] + +**Bug fixes** + +- Edit facility when Catalogue Profiles mixing fields with namespaces and fields without namespaces [#27826] + ## [v2.2.2] - 2024-05-14 **Bug fixes** diff --git a/pom.xml b/pom.xml index 40b7b2b..1231402 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.gcube.portlets.widgets ckan-metadata-publisher-widget - 2.2.2 + 2.3.0-SNAPSHOT gCube Ckan metadata publisher widget diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/UpdateDatasetForm.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/UpdateDatasetForm.java index c3854fd..8d4e0c7 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/UpdateDatasetForm.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/UpdateDatasetForm.java @@ -310,7 +310,7 @@ public class UpdateDatasetForm extends Composite { private DatasetBean theDatasetBean; // resource table - //private SelectResourceByWEMainPanel resourcesSelectByWEMainPanel; + // private SelectResourceByWEMainPanel resourcesSelectByWEMainPanel; // List of opened popup'ids private List popupOpenedIds = new ArrayList(); @@ -394,7 +394,8 @@ public class UpdateDatasetForm extends Composite { infoBlock.add(alertPanel); - List listOfSteps = Arrays.asList("Edit Common Metadata", "Edit Item Specific Metadata & Update", "Manage Resources"); + List listOfSteps = Arrays.asList("Edit Common Metadata", "Edit Item Specific Metadata & Update", + "Manage Resources"); this.wizCreator = new WizardCreator(listOfSteps); wizardCreatorPanel.add(wizCreator); @@ -407,7 +408,7 @@ public class UpdateDatasetForm extends Composite { continueButton.setEnabled(false); resetButton.setEnabled(false); addResourcesButtonStep1.setEnabled(false); - + // hide reset button resetButton.setVisible(false); @@ -567,8 +568,8 @@ public class UpdateDatasetForm extends Composite { public void onSuccess( final MetadataProfileBeanForUpdate metadataProfileForUpdate) { setAlertBlock("", null, AlertType.ERROR, false); - - GWT.log("MetadataProfileBeanForUpdate: "+metadataProfileForUpdate); + + GWT.log("MetadataProfileBeanForUpdate: " + metadataProfileForUpdate); List profiles = metadataProfileForUpdate .getListProfileBean(); @@ -820,7 +821,7 @@ public class UpdateDatasetForm extends Composite { GWT.log("There are " + categories.size() + " categories for profile " + bean.getTitle()); - //Adding fields without categories + // Adding fields without categories if (categories == null || categories.isEmpty()) { for (MetadataFieldWrapper field : fields) { @@ -834,15 +835,18 @@ public class UpdateDatasetForm extends Composite { } } } else { - + // create the categories, then parse the fields. Fields do not belonging to a // category are put at the end - - //Collecting and showing the fields for categories + + // Collecting and showing the fields for categories for (CategoryWrapper categoryWrapper : categories) { - - List fieldsForThisCategory = fields.stream().filter(f -> f.getOwnerCategory().getId()==categoryWrapper.getId()).collect(Collectors.toList()); - + + List fieldsForThisCategory = fields.stream() + .filter(f -> f.getOwnerCategory() != null + && f.getOwnerCategory().getId() == categoryWrapper.getId()) + .collect(Collectors.toList()); + CategoryPanel cp = new CategoryPanel(categoryWrapper.getTitle(), categoryWrapper.getDescription()); fields.removeAll(fieldsForThisCategory); @@ -861,35 +865,6 @@ public class UpdateDatasetForm extends Composite { } metadataFieldsPanel.add(cp); } - - - // create the categories, then parse the fields. Fields do not belonging to a - // category are put at the end - /*for (CategoryWrapper categoryWrapper : categories) { - if (categoryWrapper.getFieldsForThisCategory() != null - && categoryWrapper.getFieldsForThisCategory().size() > 0) { - - CategoryPanel cp = new CategoryPanel(categoryWrapper.getTitle(), - categoryWrapper.getDescription()); - List fieldsForThisCategory = categoryWrapper - .getFieldsForThisCategory(); - fields.removeAll(fieldsForThisCategory); - - for (MetadataFieldWrapper metadataFieldWrapper : fieldsForThisCategory) { - - MetaDataField fieldWidget; - try { - fieldWidget = new MetaDataField(metadataFieldWrapper, eventBusPublisherWidget, - operation); - cp.addField(fieldWidget); - listOfMetadataFields.add(fieldWidget); - } catch (Exception e) { - GWT.log("Unable to build such widget", e); - } - } - metadataFieldsPanel.add(cp); - } - }*/ // add the remaining one at the end of the categories CategoryPanel extrasCategory = new CategoryPanel("Other", null); @@ -978,7 +953,7 @@ public class UpdateDatasetForm extends Composite { // add the resources to the container panel if (workspaceResourcesContainer.getWidget() == null) { workspaceResourcesContainer.getElement().getStyle().setMarginLeft(20, Unit.PX); - //workspaceResourcesContainer.add(resourcesSelectByWEMainPanel); + // workspaceResourcesContainer.add(resourcesSelectByWEMainPanel); } } else { -- 2.17.1