#19988 Integrated with `checkEnvironment` for Zenodo. Moved to

2.1.0-SNAPSHOT
This commit is contained in:
Francesco Mangiacrapa 2021-10-05 11:10:13 +02:00
parent 219a4c3b4e
commit cefe1f43d8
5 changed files with 101 additions and 61 deletions

View File

@ -1,6 +1,5 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
jarsExcludedFromWebInfLib= jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francescomangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-2.0.0-SNAPSHOT lastWarOutDir=/home/francescomangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-2.0.1
>>>>>>> refs/heads/task_20699
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,37 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="gcube-ckan-datacatalog-2.0.0-SNAPSHOT">
<wb-module deploy-name="gcube-ckan-datacatalog-2.0.1">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="ckan2zenodo-publisher-widget-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan2zenodo-publisher-widget/ckan2zenodo-publisher-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="gcube-ckan-datacatalog"/> <property name="context-root" value="gcube-ckan-datacatalog"/>
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module> </wb-module>
</project-modules> </project-modules>

View File

@ -5,6 +5,12 @@ 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). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.1.0-SNAPSHOT] - 2021-10-05
#### Enhancements
[#19988] Integrated with `checkEnvironment` to show or not the "Upload to Zenodo" facility
## [v2.0.1] - 2021-05-04 ## [v2.0.1] - 2021-05-04
#### Enhancements #### Enhancements

View File

@ -29,15 +29,13 @@ import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.InlineHTML; import com.google.gwt.user.client.ui.InlineHTML;
/** /**
* The Class CkanMetadataManagementPanel. * The Class CkanMetadataManagementPanel.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @author Costantino Perciante costantino.perciante@isti.cnr.it * @author Costantino Perciante costantino.perciante@isti.cnr.it Jun 9, 2016
* Jun 9, 2016
*/ */
public class CkanMetadataManagementPanel extends FlowPanel{ public class CkanMetadataManagementPanel extends FlowPanel {
/** /**
* *
@ -79,10 +77,10 @@ public class CkanMetadataManagementPanel extends FlowPanel{
* *
* @param eventBus the event bus * @param eventBus the event bus
*/ */
public CkanMetadataManagementPanel(HandlerManager eventBus){ public CkanMetadataManagementPanel(HandlerManager eventBus) {
this.eventBus = eventBus; this.eventBus = eventBus;
// this.getElement().getStyle().setPaddingTop(H_OFFSET, Unit.PX); // this.getElement().getStyle().setPaddingTop(H_OFFSET, Unit.PX);
// this.getElement().getStyle().setPaddingBottom(H_OFFSET, Unit.PX); // this.getElement().getStyle().setPaddingBottom(H_OFFSET, Unit.PX);
// set link style buttons // set link style buttons
home.setType(ButtonType.LINK); home.setType(ButtonType.LINK);
@ -254,7 +252,6 @@ public class CkanMetadataManagementPanel extends FlowPanel{
} }
}); });
myGroups.addClickHandler(new ClickHandler() { myGroups.addClickHandler(new ClickHandler() {
@Override @Override
@ -280,7 +277,8 @@ public class CkanMetadataManagementPanel extends FlowPanel{
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
eventBus.fireEvent(new ShowManageProductWidgetEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier())); eventBus.fireEvent(new ShowManageProductWidgetEvent(
GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
} }
}); });
@ -294,13 +292,14 @@ public class CkanMetadataManagementPanel extends FlowPanel{
} }
}); });
uploadToZenodo.addClickHandler(new ClickHandler() { uploadToZenodo.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
eventBus.fireEvent(new PublishOnZenodoEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier())); eventBus.fireEvent(
new PublishOnZenodoEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
} }
}); });
} }
@ -310,19 +309,20 @@ public class CkanMetadataManagementPanel extends FlowPanel{
* *
* @return the current height * @return the current height
*/ */
public int getCurrentHeight(){ public int getCurrentHeight() {
return this.getOffsetHeight(); return this.getOffsetHeight();
} }
/** /**
* Those buttons can be only visible when the logged user has role edit/admin/sysadmin. * Those buttons can be only visible when the logged user has role
* edit/admin/sysadmin.
* *
* @param show the show * @param show the show
*/ */
public void showInsertAndEditProductButtons(boolean show){ public void showInsertAndEditProductButtons(boolean show) {
//editMeta.setVisible(show); TODO // editMeta.setVisible(show); TODO
//separatorAdminButtons.setVisible(show); // separatorAdminButtons.setVisible(show);
insertMeta.setVisible(show); insertMeta.setVisible(show);
} }
@ -332,7 +332,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
* *
* @param value true or false * @param value true or false
*/ */
public void showManageProductButton(boolean value){ public void showManageProductButton(boolean value) {
manageProduct.setVisible(value); manageProduct.setVisible(value);
} }
@ -341,7 +341,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
* *
* @param value the value * @param value the value
*/ */
public void enableManageProductButton(boolean value){ public void enableManageProductButton(boolean value) {
manageProduct.setEnabled(value); manageProduct.setEnabled(value);
} }
@ -350,7 +350,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
* *
* @param value the value * @param value the value
*/ */
public void enableShareItemButton(boolean value){ public void enableShareItemButton(boolean value) {
shareLink.setEnabled(value); shareLink.setEnabled(value);
} }
@ -359,15 +359,23 @@ public class CkanMetadataManagementPanel extends FlowPanel{
* *
* @param value the value * @param value the value
*/ */
public void enablePublishOnZenodoButton(boolean value){ public void enablePublishOnZenodoButton(boolean value) {
uploadToZenodo.setEnabled(value); uploadToZenodo.setEnabled(value);
} }
/**
* Visibility publish on zenodo button.
*
* @param value the value
*/
public void visibilityPublishOnZenodoButton(boolean value) {
uploadToZenodo.setVisible(value);
}
/** /**
* Show only home/statistics buttons. * Show only home/statistics buttons.
*/ */
public void doNotShowUserRelatedInfo(){ public void doNotShowUserRelatedInfo() {
separatorMyInfo.setVisible(false); separatorMyInfo.setVisible(false);
separatorAdminButtons.setVisible(false); separatorAdminButtons.setVisible(false);
@ -402,63 +410,60 @@ public class CkanMetadataManagementPanel extends FlowPanel{
} }
/** /**
* Customize label according translate. * Customize label according translate.
* *
* @param labelName the label name * @param labelName the label name
* @param translateValue the translate value * @param translateValue the translate value
*/ */
public void customizeLabelAccordingTranslate(String labelName, String translateValue){ public void customizeLabelAccordingTranslate(String labelName, String translateValue) {
if (labelName == null || labelName.isEmpty() || translateValue == null || translateValue.isEmpty())
if(labelName==null || labelName.isEmpty() || translateValue==null || translateValue.isEmpty())
return; return;
// GWT.log("labelName "+labelName); // GWT.log("labelName "+labelName);
// GWT.log("translateValue "+translateValue); // GWT.log("translateValue "+translateValue);
// GWT.log("organizations "+organizations.getText()); // GWT.log("organizations "+organizations.getText());
if(labelName.compareToIgnoreCase(organizations.getText().trim())==0){ if (labelName.compareToIgnoreCase(organizations.getText().trim()) == 0) {
organizations.setText(translateValue); organizations.setText(translateValue);
//return; // return;
}else if(labelName.compareToIgnoreCase(groups.getText().trim())==0){ } else if (labelName.compareToIgnoreCase(groups.getText().trim()) == 0) {
groups.setText(translateValue); groups.setText(translateValue);
//return; // return;
}else if(labelName.compareToIgnoreCase(items.getText().trim())==0){ } else if (labelName.compareToIgnoreCase(items.getText().trim()) == 0) {
items.setText(translateValue); items.setText(translateValue);
//return; // return;
}else if(labelName.compareToIgnoreCase(types.getText().trim())==0){ } else if (labelName.compareToIgnoreCase(types.getText().trim()) == 0) {
types.setText(translateValue); types.setText(translateValue);
//return; // return;
} }
String mylabelName = MY_PREFIX+labelName; String mylabelName = MY_PREFIX + labelName;
// GWT.log("mylabelName "+mylabelName); // GWT.log("mylabelName "+mylabelName);
// GWT.log("myDatasets.getText() "+myDatasets.getText()); // GWT.log("myDatasets.getText() "+myDatasets.getText());
if(mylabelName.compareToIgnoreCase(myDatasets.getText().trim())==0){ if (mylabelName.compareToIgnoreCase(myDatasets.getText().trim()) == 0) {
myDatasets.setText(MY_PREFIX+translateValue); myDatasets.setText(MY_PREFIX + translateValue);
//return; // return;
}else if(mylabelName.compareToIgnoreCase(myOrganizations.getText().trim())==0){ } else if (mylabelName.compareToIgnoreCase(myOrganizations.getText().trim()) == 0) {
myOrganizations.setText(MY_PREFIX+translateValue); myOrganizations.setText(MY_PREFIX + translateValue);
//return; // return;
}else if(mylabelName.compareToIgnoreCase(myGroups.getText().trim())==0){ } else if (mylabelName.compareToIgnoreCase(myGroups.getText().trim()) == 0) {
myGroups.setText(MY_PREFIX+translateValue); myGroups.setText(MY_PREFIX + translateValue);
//return; // return;
} }
} }
/** /**
* Capitalize. * Capitalize.
* *
* @param stringValue the translate value * @param stringValue the translate value
* @return the string * @return the string
*/ */
public static String capitalize(String stringValue){ public static String capitalize(String stringValue) {
return stringValue.substring(0,1).toUpperCase()+stringValue.substring(1, stringValue.length()); return stringValue.substring(0, 1).toUpperCase() + stringValue.substring(1, stringValue.length());
} }
} }

View File

@ -14,6 +14,7 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowRevert
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.resource.CkanPortletResources; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.resource.CkanPortletResources;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherServiceAsync;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ResizeEvent; import com.google.gwt.event.logical.shared.ResizeEvent;
@ -268,6 +269,23 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
// listen for DOM messages // listen for DOM messages
listenForPostMessage(); listenForPostMessage();
CkanToZenodoPublisherServiceAsync.Util.getInstance().checkZenodoEnvironment(new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
managementPanel.visibilityPublishOnZenodoButton(false);
}
@Override
public void onSuccess(Boolean result) {
GWT.log("checkZenodoEnvironment result: "+result);
managementPanel.visibilityPublishOnZenodoButton(result);
}
});
} }