gCube Release 4.15.0

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@181883 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-10-01 09:47:30 +00:00
parent b220d4d97b
commit fe6b6fd1d4
2 changed files with 60 additions and 97 deletions

View File

@ -235,15 +235,14 @@ public class DataMinerManagerController {
}); });
EventBusProvider.INSTANCE.addHandler(ServiceInfoRequestEvent.TYPE, EventBusProvider.INSTANCE.addHandler(ServiceInfoRequestEvent.TYPE,
new ServiceInfoRequestEvent.ServiceInfoRequestEventHandler() { new ServiceInfoRequestEvent.ServiceInfoRequestEventHandler() {
@Override @Override
public void onRequest(ServiceInfoRequestEvent event) { public void onRequest(ServiceInfoRequestEvent event) {
Log.debug("Catch EnvironmentRequestEvent: " + event); Log.debug("Catch EnvironmentRequestEvent: " + event);
retrieveEnvironment(event); retrieveEnvironment(event);
} }
}); });
@ -423,7 +422,7 @@ public class DataMinerManagerController {
getOperatorsClassifications(event); getOperatorsClassifications(event);
} else { } else {
if (event.isRefresh()) { if (event.isRefresh()) {
RemoveSelectedOperatorEvent rEvent=new RemoveSelectedOperatorEvent(); RemoveSelectedOperatorEvent rEvent = new RemoveSelectedOperatorEvent();
EventBusProvider.INSTANCE.fireEvent(rEvent); EventBusProvider.INSTANCE.fireEvent(rEvent);
getOperatorsClassifications(event); getOperatorsClassifications(event);
} else { } else {
@ -468,7 +467,9 @@ public class DataMinerManagerController {
} else { } else {
UtilsGXT3.alert("Error", UtilsGXT3.alert("Error",
"The VRE currently has problems loading all required operators. We apologize for this inconvenience."); "The VRE currently has problems loading all required operators. We apologize for this inconvenience.");
Log.error("The VRE currently has problems loading all required operators. We apologize for this inconvenience: " + caught.getLocalizedMessage()); Log.error(
"The VRE currently has problems loading all required operators. We apologize for this inconvenience: "
+ caught.getLocalizedMessage());
caught.printStackTrace(); caught.printStackTrace();
} }
} }
@ -547,7 +548,7 @@ public class DataMinerManagerController {
}); });
} }
private void retrieveEnvironment(final ServiceInfoRequestEvent event) { private void retrieveEnvironment(final ServiceInfoRequestEvent event) {
DataMinerPortletServiceAsync.INSTANCE.getServiceInfo(new AsyncCallback<ServiceInfo>() { DataMinerPortletServiceAsync.INSTANCE.getServiceInfo(new AsyncCallback<ServiceInfo>() {
@ -565,7 +566,7 @@ public class DataMinerManagerController {
@Override @Override
public void onSuccess(ServiceInfo serviceInfo) { public void onSuccess(ServiceInfo serviceInfo) {
Log.debug("DataMiner Service Info: " + serviceInfo); Log.debug("DataMiner Service Info: " + serviceInfo);
ServiceInfoEvent serviceInfoEvent = new ServiceInfoEvent(serviceInfo); ServiceInfoEvent serviceInfoEvent = new ServiceInfoEvent(serviceInfo);
EventBusProvider.INSTANCE.fireEvent(serviceInfoEvent); EventBusProvider.INSTANCE.fireEvent(serviceInfoEvent);
@ -574,7 +575,6 @@ public class DataMinerManagerController {
}); });
} }
private void fireDataMinerWorkAreaEventRetrieved(DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) { private void fireDataMinerWorkAreaEventRetrieved(DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) {
dataMinerWorkArea = result; dataMinerWorkArea = result;

View File

@ -50,7 +50,8 @@ public class ComputationStatusPanel extends SimpleContainer {
/** /**
* *
* @param operatorName operator name * @param operatorName
* operator name
*/ */
public ComputationStatusPanel(String operatorName) { public ComputationStatusPanel(String operatorName) {
super(); super();
@ -66,8 +67,7 @@ public class ComputationStatusPanel extends SimpleContainer {
private void create() { private void create() {
vert = new VerticalLayoutContainer(); vert = new VerticalLayoutContainer();
HtmlLayoutContainer title = new HtmlLayoutContainer( HtmlLayoutContainer title = new HtmlLayoutContainer(
"<div class='computationStatusTitle'><p>Computation of <b>" "<div class='computationStatusTitle'><p>Computation of <b>" + operatorName + "</b></p></div>");
+ operatorName + "</b></p></div>");
vert.add(title, new VerticalLayoutData(-1, -1, new Margins(0))); vert.add(title, new VerticalLayoutData(-1, -1, new Margins(0)));
add(vert); add(vert);
forceLayout(); forceLayout();
@ -86,8 +86,8 @@ public class ComputationStatusPanel extends SimpleContainer {
*/ */
// vert.add(date, new VerticalLayoutData(-1, -1, new Margins(0))); // vert.add(date, new VerticalLayoutData(-1, -1, new Margins(0)));
vert.add(new HtmlLayoutContainer("<p><span style='margin-right:165px;'>Id:</span> " vert.add(new HtmlLayoutContainer(
+ computationId.getId() + "</p>")); "<p><span style='margin-right:165px;'>Id:</span> " + computationId.getId() + "</p>"));
TextButton equivalentRequestBtn = new TextButton(); TextButton equivalentRequestBtn = new TextButton();
equivalentRequestBtn.setText("Show"); equivalentRequestBtn.setText("Show");
@ -100,11 +100,9 @@ public class ComputationStatusPanel extends SimpleContainer {
} }
}); });
FieldLabel equivalentRequestLabel = new FieldLabel( FieldLabel equivalentRequestLabel = new FieldLabel(equivalentRequestBtn, "WPS Request");
equivalentRequestBtn, "WPS Request");
equivalentRequestLabel.setLabelWidth(180); equivalentRequestLabel.setLabelWidth(180);
vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1, vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1, new Margins(0)));
new Margins(0)));
TextButton monitorComputationBtn = new TextButton(); TextButton monitorComputationBtn = new TextButton();
monitorComputationBtn.setText("Show"); monitorComputationBtn.setText("Show");
@ -112,18 +110,16 @@ public class ComputationStatusPanel extends SimpleContainer {
@Override @Override
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
showLinkToMonitorComputationDialog();; showLinkToMonitorComputationDialog();
} }
}); });
FieldLabel monitorComputationLabel = new FieldLabel( FieldLabel monitorComputationLabel = new FieldLabel(monitorComputationBtn, "Link to monitor the computation");
monitorComputationBtn, "Link to monitor the computation");
monitorComputationLabel.setLabelWidth(180); monitorComputationLabel.setLabelWidth(180);
vert.add(monitorComputationLabel, new VerticalLayoutData(-1, -1, vert.add(monitorComputationLabel, new VerticalLayoutData(-1, -1, new Margins(0)));
new Margins(0)));
progressBar = new ProgressBar(); progressBar = new ProgressBar();
progressBar.updateProgress(0, "Starting..."); progressBar.updateProgress(0, "Starting...");
vert.add(progressBar, new VerticalLayoutData(1, -1, new Margins(20))); vert.add(progressBar, new VerticalLayoutData(1, -1, new Margins(20)));
@ -140,21 +136,18 @@ public class ComputationStatusPanel extends SimpleContainer {
} }
}); });
cancelComputationBtn.getElement().getStyle() cancelComputationBtn.getElement().getStyle().setMarginBottom(36, Unit.PX);
.setMarginBottom(36, Unit.PX);
vert.add(cancelComputationBtn, new VerticalLayoutData(-1, -1, vert.add(cancelComputationBtn, new VerticalLayoutData(-1, -1, new Margins(0)));
new Margins(0)));
forceLayout(); forceLayout();
timer.scheduleRepeating(Constants.TIME_UPDATE_COMPUTATION_STATUS_PANEL); timer.scheduleRepeating(Constants.TIME_UPDATE_COMPUTATION_STATUS_PANEL);
} }
private void showEquivalentRequestDialog() { private void showEquivalentRequestDialog() {
EquivalentRequestDialog equivalentRequestDialog = new EquivalentRequestDialog( EquivalentRequestDialog equivalentRequestDialog = new EquivalentRequestDialog(computationId);
computationId);
equivalentRequestDialog.show(); equivalentRequestDialog.show();
} }
private void showLinkToMonitorComputationDialog() { private void showLinkToMonitorComputationDialog() {
LinkToMonitorComputationDialog linkToMonitorComputDialogDialog = new LinkToMonitorComputationDialog( LinkToMonitorComputationDialog linkToMonitorComputDialogDialog = new LinkToMonitorComputationDialog(
computationId); computationId);
@ -162,8 +155,7 @@ public class ComputationStatusPanel extends SimpleContainer {
} }
private void cancelComputation() { private void cancelComputation() {
CancelComputationExecutionRequestEvent event = new CancelComputationExecutionRequestEvent( CancelComputationExecutionRequestEvent event = new CancelComputationExecutionRequestEvent(computationId);
computationId);
EventBusProvider.INSTANCE.fireEvent(event); EventBusProvider.INSTANCE.fireEvent(event);
} }
@ -172,8 +164,7 @@ public class ComputationStatusPanel extends SimpleContainer {
* @param operator * @param operator
* *
*/ */
private void computationTerminated(ComputationId computationId, private void computationTerminated(ComputationId computationId, ComputationStatus computationStatus) {
ComputationStatus computationStatus) {
Log.debug("Computation Terminated"); Log.debug("Computation Terminated");
Log.debug("Computation Status:" + computationStatus); Log.debug("Computation Status:" + computationStatus);
if (terminated == false) { if (terminated == false) {
@ -181,17 +172,14 @@ public class ComputationStatusPanel extends SimpleContainer {
cancelComputationBtn.setVisible(false); cancelComputationBtn.setVisible(false);
if (computationStatus.isComplete()) { if (computationStatus.isComplete()) {
Log.debug("Computation is Complete"); Log.debug("Computation is Complete");
Info.display("Terminated", Info.display("Terminated", "The computation " + computationId.getId() + " of "
"The computation " + computationId.getId() + " of " + computationId.getOperatorName() + " is terminated correctly.");
+ computationId.getOperatorName()
+ " is terminated correctly.");
int index = vert.getWidgetIndex(progressBar); int index = vert.getWidgetIndex(progressBar);
vert.remove(index); vert.remove(index);
// TODO // TODO
progressBar = new GreenProgressBar(); progressBar = new GreenProgressBar();
progressBar.updateProgress(1, "Computation Complete"); progressBar.updateProgress(1, "Computation Complete");
vert.insert(progressBar, index, new VerticalLayoutData(1, -1, vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
new Margins(20)));
showComputationCompletedOutput(); showComputationCompletedOutput();
} else if (computationStatus.isFailed()) { } else if (computationStatus.isFailed()) {
Log.debug("Computation is Failed"); Log.debug("Computation is Failed");
@ -199,49 +187,37 @@ public class ComputationStatusPanel extends SimpleContainer {
if (computationStatus.getError() == null) { if (computationStatus.getError() == null) {
errorMessage = new String("Computation Failed!"); errorMessage = new String("Computation Failed!");
} else { } else {
errorMessage = computationStatus.getError() errorMessage = computationStatus.getError().getLocalizedMessage();
.getLocalizedMessage(); ElementsHighlights el = new ElementsHighlights();
ElementsHighlights el=new ElementsHighlights(); errorMessage = el.createLinkFromText(errorMessage);
errorMessage=el.createLinkFromText(errorMessage);
} }
Info.display("Failed", Info.display("Failed", "The computation " + computationId.getId() + " of "
"The computation " + computationId.getId() + " of " + computationId.getOperatorName() + " is failed.");
+ computationId.getOperatorName() UtilsGXT3.alert("Failed", "The computation " + computationId.getId() + " of "
+ " is failed."); + computationId.getOperatorName() + " has failed.</br>" + errorMessage);
UtilsGXT3.alert("Failed",
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " has failed.</br>" + errorMessage);
int index = vert.getWidgetIndex(progressBar); int index = vert.getWidgetIndex(progressBar);
vert.remove(index); vert.remove(index);
// TODO // TODO
progressBar = new RedProgressBar(); progressBar = new RedProgressBar();
progressBar.updateProgress(1, "Computation Failed"); progressBar.updateProgress(1, "Computation Failed");
progressBar.getElement().getStyle() progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
.setMarginBottom(36, Unit.PX); vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
new Margins(20)));
} else if (computationStatus.isCancelled()) { } else if (computationStatus.isCancelled()) {
Log.debug("Computation Cancelled"); Log.debug("Computation Cancelled");
String errorMessage; String errorMessage;
errorMessage = new String("Computation Cancelled!"); errorMessage = new String("Computation Cancelled!");
Info.display("Info", "The computation " + computationId.getId() Info.display("Info", "The computation " + computationId.getId() + " of "
+ " of " + computationId.getOperatorName() + computationId.getOperatorName() + " has been cancelled.");
+ " has been cancelled."); UtilsGXT3.info("Info", "The computation " + computationId.getId() + " of "
UtilsGXT3.info("Info", + computationId.getOperatorName() + " has been cancelled.</br>" + errorMessage);
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " has been cancelled.</br>" + errorMessage);
int index = vert.getWidgetIndex(progressBar); int index = vert.getWidgetIndex(progressBar);
vert.remove(index); vert.remove(index);
// TODO // TODO
progressBar = new OrangeProgressBar(); progressBar = new OrangeProgressBar();
progressBar.updateProgress(1, "Computation Cancelled"); progressBar.updateProgress(1, "Computation Cancelled");
progressBar.getElement().getStyle() progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
.setMarginBottom(36, Unit.PX); vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
new Margins(20)));
} }
} }
@ -254,16 +230,11 @@ public class ComputationStatusPanel extends SimpleContainer {
*/ */
private void showComputationCompletedOutput() { private void showComputationCompletedOutput() {
HtmlLayoutContainer computationEndMessage = new HtmlLayoutContainer( HtmlLayoutContainer computationEndMessage = new HtmlLayoutContainer(
"<p>The computation <b>" + computationId.getOperatorName() "<p>The computation <b>" + computationId.getOperatorName() + "</b> finished.</p>");
+ "</b> finished.</p>"); vert.add(computationEndMessage, new VerticalLayoutData(-1, -1, new Margins(0)));
vert.add(computationEndMessage, new VerticalLayoutData(-1, -1, ComputationOutputPanel computationOutputPanel = new ComputationOutputPanel(computationId);
new Margins(0))); computationOutputPanel.getElement().getStyle().setMarginBottom(36, Unit.PX);
ComputationOutputPanel computationOutputPanel = new ComputationOutputPanel( vert.add(computationOutputPanel, new VerticalLayoutData(1, -1, new Margins(0)));
computationId);
computationOutputPanel.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.add(computationOutputPanel, new VerticalLayoutData(1, -1,
new Margins(0)));
} }
@ -271,8 +242,7 @@ public class ComputationStatusPanel extends SimpleContainer {
* @param computationStatus * @param computationStatus
*/ */
private void updateStatus(ComputationStatus computationStatus) { private void updateStatus(ComputationStatus computationStatus) {
Log.debug("Conputation Status Panel ::Update Status " Log.debug("Conputation Status Panel ::Update Status " + computationStatus);
+ computationStatus);
if (computationStatus.getStatus().compareTo(Status.ACCEPTED) == 0) if (computationStatus.getStatus().compareTo(Status.ACCEPTED) == 0)
progressBar.updateText("Accepted..."); progressBar.updateText("Accepted...");
else { else {
@ -280,8 +250,7 @@ public class ComputationStatusPanel extends SimpleContainer {
if (percentage == 0) { if (percentage == 0) {
progressBar.updateText("Running, 0% Complete"); progressBar.updateText("Running, 0% Complete");
} else { } else {
progressBar.updateProgress(percentage / 100, "Running, " progressBar.updateProgress(percentage / 100, "Running, " + percentage + "% Complete");
+ percentage + "% Complete");
} }
} }
forceLayout(); forceLayout();
@ -292,8 +261,8 @@ public class ComputationStatusPanel extends SimpleContainer {
@Override @Override
public void run() { public void run() {
Log.debug("Timer run ....."); Log.debug("Timer run .....");
DataMinerPortletServiceAsync.INSTANCE.getComputationStatus( DataMinerPortletServiceAsync.INSTANCE.getComputationStatus(computationId,
computationId, new AsyncCallback<ComputationStatus>() { new AsyncCallback<ComputationStatus>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -301,25 +270,19 @@ public class ComputationStatusPanel extends SimpleContainer {
vert.remove(index); vert.remove(index);
// TODO // TODO
progressBar = new RedProgressBar(); progressBar = new RedProgressBar();
progressBar.updateProgress(1, progressBar.updateProgress(1, "Failed to get the status");
"Failed to get the status"); progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
progressBar.getElement().getStyle() vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
.setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index,
new VerticalLayoutData(1, -1, new Margins(
20)));
} }
@Override @Override
public void onSuccess( public void onSuccess(ComputationStatus computationStatus) {
ComputationStatus computationStatus) { Log.debug("ComputationStatus: " + computationStatus);
Log.debug("ComputationStatus: "+computationStatus);
if (computationStatus != null) { if (computationStatus != null) {
if (computationStatus.isTerminated()) { if (computationStatus.isTerminated()) {
ComputationTimer.this.cancel(); ComputationTimer.this.cancel();
computationTerminated(computationId, computationTerminated(computationId, computationStatus);
computationStatus);
} else } else
updateStatus(computationStatus); updateStatus(computationStatus);
} }