- Added optional message when performing lifecycle step [#27192]

This commit is contained in:
Francesco Mangiacrapa 2024-04-08 17:18:29 +02:00
parent c8c500c736
commit 140856db03
11 changed files with 265 additions and 48 deletions

View File

@ -118,6 +118,7 @@
@ -259,6 +260,7 @@
@ -400,6 +402,7 @@
@ -541,6 +544,7 @@
@ -634,6 +638,7 @@
@ -662,6 +667,10 @@
<dependent-module archiveName="uri-resolver-manager-1.8.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="geoportal-common-1.0.14-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-common/geoportal-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -922,6 +931,7 @@
@ -1063,6 +1073,7 @@
@ -1204,6 +1215,7 @@

View File

@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Implemented the init facility to resolve a public link on an item [#27120]
- Integrated new Uri-Resolver-Manager [#27160]
- Added Get Shareable Link facility [#27120]
- Added optional message when performing lifecycle step [#27192]
## [v3.2.2] - 2024-01-11

View File

@ -56,13 +56,14 @@ import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
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.action.DeleteViewPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.action.StepViewPanel;
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.projects.ListOfProjectTablePanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.LifecycleInformationPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.NodeItem;
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.TreeItemPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
@ -1338,21 +1339,11 @@ public class GeoPortalDataEntryApp implements EntryPoint {
final ResultDocumentDV resultDocumentDV = (ResultDocumentDV) item;
String htmlMsg = "Going to perform the step/s <i><b>" + wActionOnItem.getAction().getCallSteps()
+ "</b></i> on the project with:";
htmlMsg += "<ul>";
htmlMsg += "<li>id: " + resultDocumentDV.getId() + "</li>";
htmlMsg += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
htmlMsg += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
htmlMsg += "</ul>";
htmlMsg += "<br>";
htmlMsg += "Would you like to proceed?";
final ModalConfirm dialog = new ModalConfirm(null,
"Step/s " + wActionOnItem.getAction().getTitle() + ", Confirm?", htmlMsg);
dialog.addToCenterPanel(
new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false));
"Step/s " + wActionOnItem.getAction().getTitle() + ", Confirm?", null);
final StepViewPanel stvp = new StepViewPanel(resultDocumentDV, wActionOnItem.getAction());
dialog.addToCenterPanel(stvp);
dialog.getYesButton().addClickHandler(new ClickHandler() {
@ -1374,7 +1365,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal.add(modalContainerPanel);
GeoportalDataEntryServiceAsync.Util.getInstance().performActionSteps(
resultDocumentDV.getProfileID(), resultDocumentDV.getId(),
resultDocumentDV.getProfileID(), resultDocumentDV.getId(),stvp.getOptionalMessage(),
wActionOnItem.getAction(), new AsyncCallback<ProjectDV>() {
@Override
@ -1945,19 +1936,10 @@ public class GeoPortalDataEntryApp implements EntryPoint {
case DELETE_PROJECT: {
String htmlMsg = "Going to delete the project with:";
htmlMsg += "<ul>";
htmlMsg += "<li>id: " + resultDocumentDV.getId() + "</li>";
htmlMsg += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
htmlMsg += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
htmlMsg += "</ul>";
htmlMsg += "<br>";
htmlMsg += "This operation cannot be undone. Would you like to proceed?";
DeleteViewPanel dvp = new DeleteViewPanel(resultDocumentDV);
final ModalConfirm dialog = new ModalConfirm(null, "Delete Confirm?", htmlMsg);
dialog.addToCenterPanel(
new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false));
final ModalConfirm dialog = new ModalConfirm(null, "Delete Confirm?", null);
dialog.addToCenterPanel(dvp);
dialog.show();
dialog.getYesButton().addClickHandler(new ClickHandler() {

View File

@ -142,11 +142,11 @@ public interface GeoportalDataEntryService extends RemoteService {
*
* @param profileID the profile ID
* @param projectID the project ID
* @param optionalMessage the optional message
* @param action the action
* @return the project DV
* @throws Exception the exception
*/
ProjectDV performActionSteps(String profileID, String projectID, ActionDefinitionDV action) throws Exception;
ProjectDV performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action) throws Exception;
/**
* Gets the relationships definition.
@ -237,8 +237,14 @@ public interface GeoportalDataEntryService extends RemoteService {
CommitReport updateGeportalDataForm(String profileID, String projectID, GeoNaFormDataObject section,
String sectionPath, List<FilePathDV> listFilePaths) throws Exception;
/**
* Gets the project view.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project view
* @throws Exception the exception
*/
ProjectView getProjectView(String profileID, String projectID) throws Exception;
}

View File

@ -79,7 +79,7 @@ public interface GeoportalDataEntryServiceAsync {
void getLifecycleInfoForProjectId(String profileID, String projectID,
AsyncCallback<LifecycleInformationDV> callback);
void performActionSteps(String profileID, String projectID, ActionDefinitionDV action,
void performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action,
AsyncCallback<ProjectDV> callback);
void getRelationshipsDefinition(String profileID, AsyncCallback<List<RelationshipDefinitionDV>> callback);

View File

@ -0,0 +1,60 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class DeleteViewPanel extends Composite {
private static DeleteViewPanelUiBinder uiBinder = GWT.create(DeleteViewPanelUiBinder.class);
interface DeleteViewPanelUiBinder extends UiBinder<Widget, DeleteViewPanel> {
}
@UiField
FlowPanel principalPanel;
@UiField
AccordionGroup accordionProjectDetails;
@UiField
FlowPanel confirmProceedPanel;
private ResultDocumentDV resultDocumentDV;
public DeleteViewPanel(ResultDocumentDV resultDocumentDV) {
initWidget(uiBinder.createAndBindUi(this));
this.resultDocumentDV = resultDocumentDV;
builtUI();
}
private void builtUI() {
String htmlMsg = "<p style='font-size: 18px'>Going to permanently delete the:</p>";
// TODO Auto-generated method stub
principalPanel.add(new HTML(htmlMsg));
ReportTemplateToHTML rt = new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false);
rt.showAsJSON(false);
principalPanel.add(rt);
String projectDetails = "<ul>";
projectDetails += "<li>id: " + resultDocumentDV.getId() + "</li>";
projectDetails += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
projectDetails += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
projectDetails += "</ul>";
accordionProjectDetails.add(new HTML(projectDetails));
String confirmMessage = "<b>This operation cannot be undone. Would you like to proceed?</b>";
confirmProceedPanel.add(new HTML(confirmMessage));
}
}

View File

@ -0,0 +1,33 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.accordion-no-border {
border: 0px !important;
}
.text-are-size {
width: 80%;
height: 50px;
}
</ui:style>
<g:HTMLPanel>
<g:FlowPanel ui:field="principalPanel">
</g:FlowPanel>
<g:HTMLPanel>
<b:Accordion>
<b:AccordionGroup icon="GEAR"
heading="Project details" ui:field="accordionProjectDetails"
addStyleNames="{style.accordion-no-border}">
</b:AccordionGroup>
</b:Accordion>
</g:HTMLPanel>
<g:FlowPanel ui:field="confirmProceedPanel">
</g:FlowPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,72 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.github.gwtbootstrap.client.ui.TextArea;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class StepViewPanel extends Composite {
private static StepViewPanelUiBinder uiBinder = GWT.create(StepViewPanelUiBinder.class);
interface StepViewPanelUiBinder extends UiBinder<Widget, StepViewPanel> {
}
@UiField
FlowPanel principalPanel;
@UiField
AccordionGroup accordionProjectDetails;
@UiField
FlowPanel confirmProceedPanel;
@UiField
TextArea txtOptionalMessage;
private ResultDocumentDV resultDocumentDV;
private ActionDefinitionDV actionDefinitionDV;
public StepViewPanel(ResultDocumentDV resultDocumentDV, ActionDefinitionDV actionDefinitionDV) {
initWidget(uiBinder.createAndBindUi(this));
this.resultDocumentDV = resultDocumentDV;
this.actionDefinitionDV = actionDefinitionDV;
builtUI();
}
private void builtUI() {
String htmlMsg = "<p style='font-size: 18px'>Going to perform the step/s <i><b>" + actionDefinitionDV.getCallSteps() + "</b></i> on the: </p>";
// TODO Auto-generated method stub
principalPanel.add(new HTML(htmlMsg));
ReportTemplateToHTML rt = new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false);
rt.showAsJSON(false);
principalPanel.add(rt);
String projectDetails = "<ul>";
projectDetails += "<li>id: " + resultDocumentDV.getId() + "</li>";
projectDetails += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
projectDetails += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
projectDetails += "</ul>";
accordionProjectDetails.add(new HTML(projectDetails));
String confirmMessage = "<b>Would you like to proceed?</b>";
confirmProceedPanel.add(new HTML(confirmMessage));
}
public String getOptionalMessage() {
return txtOptionalMessage.getText();
}
}

View File

@ -0,0 +1,46 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.accordion-no-border {
border: 0px !important;
}
.text-are-size {
width: 80%;
height: 70px;
}
</ui:style>
<g:HTMLPanel>
<g:FlowPanel ui:field="principalPanel">
</g:FlowPanel>
<g:HTMLPanel>
<b:Accordion>
<b:AccordionGroup icon="GEAR"
heading="Project details" ui:field="accordionProjectDetails"
addStyleNames="{style.accordion-no-border}">
</b:AccordionGroup>
</b:Accordion>
</g:HTMLPanel>
<g:FlowPanel ui:field="confirmProceedPanel">
<b:Form type="HORIZONTAL">
<b:Fieldset>
<b:ControlGroup>
<b:ControlLabel>Message</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextArea addStyleNames="{style.text-are-size}"
ui:field="txtOptionalMessage"></b:TextArea>
<b:HelpBlock>You can add an optional message...</b:HelpBlock>
</b:Controls>
</b:ControlGroup>
</b:Fieldset>
</b:Form>
</g:FlowPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -29,6 +29,7 @@ import com.google.gwt.user.client.ui.Widget;
*/
public class ModalConfirm extends Modal implements ClickHandler {
private static final int modal_width = 800;
private DockPanel dock = new DockPanel();
private Button yesButton;
private VerticalPanel vpContainer;
@ -44,7 +45,7 @@ public class ModalConfirm extends Modal implements ClickHandler {
* @param text the text
*/
public ModalConfirm(Image img, String caption, String text) {
setWidth(800);
setWidth(modal_width);
setAnimation(true);
// getElement().setClassName("gwt-DialogBoxNew");
dock.setSpacing(4);
@ -65,6 +66,8 @@ public class ModalConfirm extends Modal implements ClickHandler {
vpContainer = new VerticalPanel();
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
vpContainer.setWidth((modal_width - 70) + "px");
if (text != null)
vpContainer.add(new HTML(text));
hpButtons = new HorizontalPanel();
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

View File

@ -136,6 +136,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
* Save geona data forms.
*
* @param profileID the profile ID
* @param optionalMessage the optional message
* @param tree_Node the tree node
* @param stepsOnPostCreation the steps on post creation
* @return the commit report
@ -195,7 +196,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.info("stepsOnPostCreation are {}", stepsOnPostCreation);
for (String stepID : stepsOnPostCreation) {
LOG.info("calling step OnPostCreation are {}", stepID);
theProject = client.performStep(theProject.getProfileID(), theProject.getId(), stepID, null);
theProject = client.performStep(theProject.getProfileID(), theProject.getId(), stepID, null, null);
}
} catch (Exception e) {
@ -1265,12 +1266,13 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
*
* @param profileID the profile ID
* @param projectID the project ID
* @param optionalMessage the optional message
* @param action the action
* @return the project DV
* @throws Exception the exception
*/
@Override
public ProjectDV performActionSteps(String profileID, String projectID, ActionDefinitionDV action)
public ProjectDV performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action)
throws Exception {
LOG.info("performActionSteps called for profileID {}, projectID {}, action: " + action, profileID, projectID);
@ -1285,7 +1287,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
Project project = null;
for (String stepID : action.getCallSteps()) {
LOG.info("calling stepID {} on projectID {}", stepID, projectID);
project = client.performStep(profileID, projectID, stepID, null);
project = client.performStep(profileID, projectID, stepID, optionalMessage, null);
}
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);