From a89dd687cb727d5821451131dc05318cb75bbcc2 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 19 Jan 2023 14:51:42 +0100 Subject: [PATCH] [#24458] Published projects cannot be edited/updated --- .settings/org.eclipse.wst.common.component | 30 +++++++++++-------- CHANGELOG.md | 3 +- .../client/GeoPortalDataEntryApp.java | 22 ++++++++++++++ .../client/ui/edit/EditModeRecord.java | 4 +++ 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 10e1d7e..55c3a77 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,6 @@ - + + @@ -77,7 +78,8 @@ - + + @@ -155,7 +157,8 @@ - + + @@ -233,7 +236,8 @@ - + + @@ -311,7 +315,8 @@ - + + @@ -341,10 +346,8 @@ - - uses - - + + @@ -422,7 +425,8 @@ - + + @@ -500,7 +504,8 @@ - + + @@ -578,7 +583,8 @@ - + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 21ac642..701ee99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ 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). -## [v3.0.1] - 2022-12-21 +## [v3.0.1] - 2023-01-19 #### Fixes @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - [#23913] Integrated with GUI presentation configurations read from IS - [#23926] Integrated a Post Creation Action in the UCD and manage it - [#24136] Integrated the temporal dimension on the front-end side +- [#24458] Published projects cannot be edited/updated ## [v2.2.1] - 2022-06-29 diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java index 1ce6b21..bd7d6f6 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java @@ -15,6 +15,7 @@ import org.gcube.application.geoportalcommon.shared.config.RoleRights; import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV; +import org.gcube.application.geoportalcommon.shared.geoportal.WORKFLOW_PHASE; import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; @@ -1522,9 +1523,30 @@ public class GeoPortalDataEntryApp implements EntryPoint { modal3.setCloseVisible(true); ((Element) modal3.getElement().getChildNodes().getItem(1)) .addClassName("modal-body-custom"); + + boolean isPublishedProject = false; + + if(resultDocumentDV.getLifecycleInfo()!=null) { + String phase = resultDocumentDV.getLifecycleInfo().getPhase(); + if(phase!=null && phase.compareToIgnoreCase(WORKFLOW_PHASE.PUBLISHED.getLabel())==0) { + + Alert alert = new Alert("Published project cannot be edited/updated."); + alert.setType(AlertType.WARNING); + alert.setClose(false); + modal3.add(alert); + + isPublishedProject = true; + } + } + EditModeRecord emr = new EditModeRecord(appManagerBus, resultDocumentDV); modal3.add(emr); modal3.show(); + + if(isPublishedProject) { + emr.noUpdateMode(); + } + break; } case CREATE_RELATION: { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.java index 0e89bf3..076f75e 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.java @@ -114,6 +114,10 @@ public class EditModeRecord extends Composite { } + public void noUpdateMode() { + buttonJSONUpdate.setVisible(false); + } + private void instanceJSONEditor() { rawUpdatePanel.clear();