Integrated in the report UI the link of project just saved

This commit is contained in:
Francesco Mangiacrapa 2024-10-16 14:29:50 +02:00
parent b829f0b818
commit a0d7501da2
2 changed files with 54 additions and 0 deletions

View File

@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Added optional message when performing lifecycle step [#27192]
- Enforced deleteProject method/UX
- The save operation is now monitored asynchronously [#28268]
- Integrated in the report UI the link of project just saved
## [v3.2.2] - 2024-01-11

View File

@ -9,6 +9,7 @@ import java.util.TreeMap;
import java.util.stream.Collectors;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences.SHARE_LINK_TO;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
@ -953,6 +954,58 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal.setCloseVisible(true);
modal.setTitle("Project Saved!");
// Getting the linnk
HorizontalPanel hLink = new HorizontalPanel();
hLink.getElement().getStyle().setMarginBottom(5, Unit.PX);
Label linkLabel = new Label("Link");
linkLabel.getElement().getStyle().setMarginRight(5, Unit.PX);
linkLabel.setType(LabelType.INFO);
hLink.add(linkLabel);
final LoaderIcon loaderIcon = new LoaderIcon("Getting link...");
hLink.add(loaderIcon);
modalContainerPanel.add(hLink);
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(
commitReport.getProjectID(), commitReport.getProfileID(),
SHARE_LINK_TO.DATA_ENTRY,
new AsyncCallback<GeoportalItemReferences>() {
@Override
public void onFailure(Throwable caught) {
hLink.remove(loaderIcon);
Alert alert = new Alert(caught.getMessage());
alert.setType(AlertType.ERROR);
alert.setClose(false);
hLink.add(alert);
}
@Override
public void onSuccess(
GeoportalItemReferences itemReferences) {
hLink.remove(loaderIcon);
if (itemReferences.getRestrictedLink() != null) {
String theURL = itemReferences.getRestrictedLink()
.getShortURL() != null
? itemReferences.getRestrictedLink()
.getShortURL()
: itemReferences.getRestrictedLink()
.getCompleteURL();
String htmlLink = "<a href=" + theURL
+ " target=\"_blank\">" + theURL + "</a>";
hLink.add(new HTML(htmlLink));
} else {
Alert alert = new Alert(
"Error occurred on getting the link to the project");
alert.setType(AlertType.ERROR);
alert.setClose(false);
hLink.add(alert);
}
}
});
LifecycleInformationDV lcDV = commitReport.getLifecycleInformation();
switch (lcDV.getLastOperationStatus()) {