Shows the loader during the publication on zenodo
This commit is contained in:
parent
6fd20c127d
commit
58e7f3e8aa
|
@ -33,6 +33,8 @@ public class CkanToZendoPublisherWidget {
|
|||
|
||||
private Button buttonPublish = new Button("Publish on Zenodo");
|
||||
private Ckan2ZenodoViewManager manager = null;
|
||||
private BasicTabPanel basicTabPanel;
|
||||
private ModalFooter modalFooter;
|
||||
|
||||
|
||||
public CkanToZendoPublisherWidget() {
|
||||
|
@ -77,7 +79,7 @@ public class CkanToZendoPublisherWidget {
|
|||
loader.setVisible(false);
|
||||
modal.remove(loader);
|
||||
manager = new Ckan2ZenodoViewManager();
|
||||
BasicTabPanel basicTabPanel = manager.viewForPublishing(result);
|
||||
basicTabPanel = manager.viewForPublishing(result);
|
||||
modal.add(basicTabPanel);
|
||||
buttonPublish.setEnabled(true);
|
||||
}
|
||||
|
@ -100,6 +102,10 @@ public class CkanToZendoPublisherWidget {
|
|||
}
|
||||
|
||||
if(allFormsAreValid) {
|
||||
buttonPublish.setEnabled(false);
|
||||
basicTabPanel.getElement().getStyle().setOpacity(0.5);
|
||||
final LoaderIcon loaderPublishing = new LoaderIcon("Trying to publish on Zenodo...");
|
||||
modalFooter.add(loaderPublishing);
|
||||
//Submit publish on zenodo.
|
||||
ZenodoItem zenodoItem = manager.getZenodoItemFromFieldsForm();
|
||||
GWT.log("Publishing file: "+zenodoItem.getFiles());
|
||||
|
@ -107,6 +113,9 @@ public class CkanToZendoPublisherWidget {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
buttonPublish.setEnabled(true);
|
||||
basicTabPanel.getElement().getStyle().setOpacity(1.0);
|
||||
modalFooter.remove(loaderPublishing);
|
||||
//modal.clear();
|
||||
Alert erroLabel = new Alert();
|
||||
erroLabel.setClose(false);
|
||||
|
@ -126,6 +135,9 @@ public class CkanToZendoPublisherWidget {
|
|||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
buttonPublish.setEnabled(true);
|
||||
basicTabPanel.getElement().getStyle().setOpacity(1.0);
|
||||
modalFooter.remove(loaderPublishing);
|
||||
String msg = "Publishing: \n\n"+result+"\n\nIs it right?";
|
||||
Window.alert(msg);
|
||||
}
|
||||
|
@ -134,7 +146,7 @@ public class CkanToZendoPublisherWidget {
|
|||
}
|
||||
});
|
||||
|
||||
ModalFooter modalFooter = new ModalFooter(buttonPublish);
|
||||
modalFooter = new ModalFooter(buttonPublish);
|
||||
modal.add(modalFooter);
|
||||
modal.show();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue