diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f5fb78..82c71eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,13 @@ 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.2.0-SNAPSHOT] - 2022-02-09 +## [v3.2.0-SNAPSHOT] - 2022-05-03 - Implemented the Update facility [#24166] - Integrated with the geoportal-data-mapper library [#24244] - Integrated the Geoportal Data-Viewer Widget [#25015] - Passed to Geoportal_Resolver service [#25031] +- Provided the "View Document" and "View As JSON" facilities ## [v3.1.0] - 2023-03-06 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 9cc1022..9b84190 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 @@ -56,6 +56,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaMainTabPanel; import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginatedView; import org.gcube.portlets.user.geoportaldataentry.client.ui.ModalWindow; import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel; +import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.EditModeRecord; import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.UpdateRecord; import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm; import org.gcube.portlets.user.geoportaldataentry.client.ui.report.LifecycleInformationPanel; @@ -879,13 +880,13 @@ public class GeoPortalDataEntryApp implements EntryPoint { switch (createRelationHE.getRelactionActionType()) { case DELETE: { - + GcubeUserRole myRole = myRights.getRoleRights().getUserRole(); // TODO REMOVE THIS IF AFTER ADDING ALL THE OPERATIONS IN THE IS // OPERATIONS/RIGHTS CONFIGURATION if (!myRole.equals(GcubeUserRole.DATA_MANAGER) && !myRole.equals(GcubeUserRole.DATA_EDITOR)) { - String action = RELACTION_ACTION_TYPE.DELETE +" Relation"; + String action = RELACTION_ACTION_TYPE.DELETE + " Relation"; String msg = "You are not authorized to perform the action: " + action; ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()), @@ -893,7 +894,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { modalW.show(); return; } - + if (createRelationHE.getFromProject() == null || createRelationHE.getToProject() == null) { DialogInform di = new DialogInform(null, "No selection", "You must select a Project"); di.center(); @@ -1441,7 +1442,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { switch (action) { case VIEW_ON_MAP: { - + final Modal modal = new Modal(true, true); modal.setTitle("Show on Map the Project..."); modal.setCloseVisible(true); @@ -1557,6 +1558,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { } case EDIT_PROJECT: { + final Modal modal3 = new Modal(true, true); modal3.setTitle( "Update Project with id: " @@ -1590,7 +1592,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { isNotInDRAFT = true; } } - + UpdateRecord ur = new UpdateRecord(appManagerBus, resultDocumentDV.getProfileID(), resultDocumentDV.getId(), width, height); @@ -1636,10 +1638,11 @@ public class GeoPortalDataEntryApp implements EntryPoint { break; } - - //It is the show document - case SHOW_METADATA: { - GWT.log("VIEW SHOW_METADATA fired"); + + // It is the show document + case VIEW_PROJECT_AS_DOCUMENT: { + GWT.log("VIEW VIEW_PROJECT_AS_DOCUMENT fired"); + final Modal modal = new Modal(true, true); modal.setCloseVisible(true); final int height = Window.getClientHeight() * 70 / 100; @@ -1688,6 +1691,27 @@ public class GeoPortalDataEntryApp implements EntryPoint { break; } + case VIEW_PROJECT_AS_JSON: { + GWT.log("VIEW VIEW_PROJECT_AS_JSON fired"); + + final Modal modal = new Modal(true, true); + modal.setCloseVisible(true); + final int height = Window.getClientHeight() * 70 / 100; + int width = Window.getClientWidth() * 70 / 100; + modal.setMaxHeigth("none"); + modal.setWidth(width); + modal.setHeight(height + "px"); + modal.setTitle( + "View as JSON for Project ID: " + + resultDocumentDV.getId() + ""); + + EditModeRecord editMode = new EditModeRecord(appManagerBus, resultDocumentDV, height); + modal.add(editMode); + modal.show(); + + break; + } + case DELETE_PROJECT: { String htmlMsg = "Going to delete the project with:"; diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java index 9fe49f7..56269d0 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java @@ -97,9 +97,12 @@ public class GeonaMainTabPanel extends Composite { @UiField Tab tabGetListOfProjects; - + @UiField - NavLink navView; + NavLink navViewAsDocument; + + @UiField + NavLink navViewAsJSON; @UiField NavLink navShowOnMap; @@ -246,8 +249,8 @@ public class GeonaMainTabPanel extends Composite { } }); - - navView.addClickHandler(new ClickHandler() { + + navViewAsDocument.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -256,8 +259,23 @@ public class GeonaMainTabPanel extends Composite { listDocuments = grpw.getSelectItems(); } - appManagerBus - .fireEvent(new OperationOnItemEvent(listDocuments, OPERATION_ON_ITEM.SHOW_METADATA)); + appManagerBus.fireEvent(new OperationOnItemEvent(listDocuments, + OPERATION_ON_ITEM.VIEW_PROJECT_AS_DOCUMENT)); + + } + }); + + navViewAsJSON.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + List listDocuments = null; + if (grpw != null && grpw.getSelectItems() != null) { + listDocuments = grpw.getSelectItems(); + } + + appManagerBus.fireEvent( + new OperationOnItemEvent(listDocuments, OPERATION_ON_ITEM.VIEW_PROJECT_AS_JSON)); } }); @@ -474,21 +492,7 @@ public class GeonaMainTabPanel extends Composite { GEOPORTAL_DATA_HANDLER.geoportal_data_list); if (dataListHandler != null) { - -// NavLink link = new NavLink(ucd.getName()); -// link.addClickHandler(new ClickHandler() { -// -// @Override -// public void onClick(ClickEvent event) { -// -// appManagerBus.fireEvent(new GetListOfRecordsEvent(false, ucd.getProfileID(), -// getCurrentProjectsSearchingFilter(), true)); -// } -// }); ucdProjectTypesForListingDataView.add(ucd); - -// listOfProjectTablePanel.addProjectType(link); - listOfProjectTablePanel.addProjectType(ucd); } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.ui.xml index 0b7402c..479d943 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.ui.xml @@ -74,7 +74,8 @@ Welcome - to GeoPortal Data Entry + to GeoPortal Data + Entry select "Create New Project" @@ -99,10 +100,14 @@ - View Document + View Document + View as JSON + Show on Map + Publication Report { } - public EditModeRecord(HandlerManager appManagerBus, ResultDocumentDV selectedProject) { + public EditModeRecord(HandlerManager appManagerBus, ResultDocumentDV selectedProject, int modalHeight) { initWidget(uiBinder.createAndBindUi(this)); + this.modalHeight = modalHeight; this.selectedProject = selectedProject; this.appManagerBus = appManagerBus; - this.filesUpdatePanel.setHeight("490px"); - // filesUpdatePanel.getElement().getStyle().setProperty("maxHeight", "550px"); + this.filesUpdatePanel.setHeight((modalHeight - 50) + "px"); + // filesUpdatePanel.getElement().modalHeight().setProperty("maxHeight", + // "550px"); // TODO Must be instanceUpdateFilesetEditor tabUploadFiles.asWidget().getElement().getStyle().setVisibility(Visibility.HIDDEN); @@ -121,9 +127,14 @@ public class EditModeRecord extends Composite { private void instanceJSONEditor() { rawUpdatePanel.clear(); + + final HorizontalPanel hpLoader = new HorizontalPanel(); + final LoaderIcon lc = new LoaderIcon("Loading Project... please wait"); + hpLoader.add(lc); + rawUpdatePanel.add(hpLoader); final FlowPanel fp = new FlowPanel(); fp.getElement().setId("jsoneditor" + Random.nextInt()); - fp.setHeight("410px"); + fp.setHeight((modalHeight - 160) + "px"); rawUpdatePanel.add(fp); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @@ -134,6 +145,7 @@ public class EditModeRecord extends Composite { @Override public void onSuccess(String jsonData) { + hpLoader.clear(); GWT.log("Instance JSON Editor with: " + jsonData); jsEditor = JSONEditorWrapper.init(fp.getElement().getId()); jsEditor.setName(selectedProject.getId()); @@ -152,7 +164,13 @@ public class EditModeRecord extends Composite { @Override public void onFailure(Throwable caught) { - Window.alert(caught.getMessage()); + rawUpdatePanel.clear(); + Alert alert = new Alert( + "Sorry, I cannot show the source Project with id '" + selectedProject.getId() + + "' Refresh an try again. Error: " + caught.getMessage(), + AlertType.ERROR); + alert.setClose(false); + rawUpdatePanel.add(alert); } }); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.ui.xml index 50ffd6b..776505c 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.ui.xml @@ -21,13 +21,13 @@ - - Source Project Editor - You can update the project by editing + Source Project as JSON + You can update the project by editing the model data displayed in the following editor. - +

Be careful not to change the keys (e.g. nome, introduzione, @@ -52,7 +52,7 @@ UPDATE + ui:field="buttonJSONUpdate" visible="false">UPDATE