Enhancement on Task #10070
Added checkConfigurations git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-task-executor-widget@167329 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d051be62b9
commit
dad0e274ee
|
@ -6,17 +6,27 @@ import java.util.List;
|
|||
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.exception.ItemNotConfiguredException;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.exception.WorkspaceFolderLocked;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.TaskCompletedNotification.TaskCompletedNotificationListner;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.PerformRunTaskEvent;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.PerformRunTaskEventHandler;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.rpc.WsTaskExecutorWidgetServiceAsync;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.LoaderIcon;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.WsTaskExecutorWidgetViewManager;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.MonitorFolderTaskExecutionStatusView;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.WsFolder;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -60,11 +70,42 @@ public class WsTaskExecutorWidget {
|
|||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
eventBus.addHandler(PerformRunTaskEvent.TYPE, new PerformRunTaskEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onPerformRunTask(PerformRunTaskEvent perforRunTaskEvent) {
|
||||
|
||||
try {
|
||||
performRunTask(perforRunTaskEvent.getFolder(), perforRunTaskEvent.getConf());
|
||||
}
|
||||
catch (Exception e) {
|
||||
Window.alert(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param folder
|
||||
* @param conf
|
||||
* @throws Exception
|
||||
*/
|
||||
public void performRunTask(WsFolder folder, TaskConfiguration conf) throws Exception {
|
||||
|
||||
if(folder==null || folder.getFolderId()==null)
|
||||
throw new Exception("Invalid parameter folder null");
|
||||
|
||||
if(conf==null)
|
||||
throw new Exception("Invalid parameter the configuration is null");
|
||||
|
||||
|
||||
//WsTaskExecutorWidget.wsTaskService.runTask()
|
||||
}
|
||||
|
||||
/**
|
||||
* Show task configurations folder info.
|
||||
*
|
||||
|
@ -105,9 +146,31 @@ public class WsTaskExecutorWidget {
|
|||
public void onFailure(Throwable caught) {
|
||||
|
||||
if(caught instanceof ItemNotConfiguredException){
|
||||
|
||||
viewManager.showCreateConfigurationFolder(folder, null);
|
||||
|
||||
}else if(caught instanceof WorkspaceFolderLocked){
|
||||
VerticalPanel v = new VerticalPanel();
|
||||
Alert alert = new Alert("Current Folder is locked by another proccess. Do you want see Task status?");
|
||||
alert.setClose(true);
|
||||
alert.setType(AlertType.INFO);
|
||||
|
||||
Button butt = new Button("Show Status");
|
||||
butt.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
//WsThreddsWidget.eventBus.fireEvent(new ShowMonitorSyncStatusEvent(folder));
|
||||
}
|
||||
});
|
||||
|
||||
v.add(alert);
|
||||
v.add(butt);
|
||||
box.add(v);
|
||||
}
|
||||
|
||||
Window.alert(caught.getMessage());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.client.event;
|
||||
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
||||
|
@ -6,12 +9,11 @@ import org.gcube.portlets.widgets.wstaskexecutor.shared.WsFolder;
|
|||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PerformDoSyncEvent.
|
||||
* The Class PerformRunTaskEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
* May 4, 2018
|
||||
*/
|
||||
public class PerformRunTaskEvent extends GwtEvent<PerformRunTaskEventHandler> {
|
||||
|
||||
|
@ -60,6 +62,11 @@ public class PerformRunTaskEvent extends GwtEvent<PerformRunTaskEventHandler> {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the folder.
|
||||
*
|
||||
* @return the folder
|
||||
*/
|
||||
public WsFolder getFolder() {
|
||||
return folder;
|
||||
}
|
||||
|
|
|
@ -3,20 +3,18 @@ package org.gcube.portlets.widgets.wstaskexecutor.client.event;
|
|||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface PerformDoSyncEventHandler.
|
||||
* The Interface PerformRunTaskEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
* May 4, 2018
|
||||
*/
|
||||
public interface PerformRunTaskEventHandler extends EventHandler {
|
||||
|
||||
|
||||
/**
|
||||
* On change status.
|
||||
* On perform run task.
|
||||
*
|
||||
* @param courseChangeStatusEvent the course change status event
|
||||
* @param perforRunTaskEvent the perfor run task event
|
||||
*/
|
||||
void onPerformRunTask(PerformRunTaskEvent courseChangeStatusEvent);
|
||||
void onPerformRunTask(PerformRunTaskEvent perforRunTaskEvent);
|
||||
}
|
|
@ -236,8 +236,7 @@ public class WsTaskExecutorWidgetViewManager {
|
|||
* @param result the result
|
||||
* @param taskEventsListeners the task events listeners
|
||||
*/
|
||||
public void showTaskConfigurationsFolderInfo(
|
||||
WsFolder folder, final List<TaskConfiguration> result, final List<TaskCompletedNotificationListner> taskEventsListeners) {
|
||||
public void showTaskConfigurationsFolderInfo(WsFolder folder, final List<TaskConfiguration> result, final List<TaskCompletedNotificationListner> taskEventsListeners) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,7 +248,7 @@ public class WsTaskExecutorWidgetViewManager {
|
|||
public void showCreateConfigurationFolder(final WsFolder folder, TaskConfiguration conf){
|
||||
|
||||
final Modal box = new Modal(true);
|
||||
box.setTitle("Create Thredds Sync Configuration for: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20));
|
||||
box.setTitle("Create Task Configuration for: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20));
|
||||
//box.getElement().getStyle().setZIndex(10000);
|
||||
|
||||
final AbstractViewDialogBox panelView = new AbstractViewDialogBox() {
|
||||
|
|
Loading…
Reference in New Issue