Enhancement on Task #10070

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-task-executor-widget@167376 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-05-08 16:11:29 +00:00
parent 12dad5edba
commit 52678a65b9
8 changed files with 64 additions and 50 deletions

View File

@ -118,9 +118,6 @@ public class WsTaskExecutorWidget {
if(folder==null || folder.getFolderId()==null)
throw new Exception("Invalid parameter folder null");
GWT.log("Qui");
MonitorFolderTaskExecutionStatusView monitor = viewManager.getMonitor(folder);
//SHOWING CURRENT ACTIVE MONITOR
@ -141,12 +138,14 @@ public class WsTaskExecutorWidget {
@Override
public void onSuccess(List<TaskConfiguration> result) {
box.hide();
viewManager.showTaskConfigurationsFolderInfo(folder, result, taskEventsListeners);
}
@Override
public void onFailure(Throwable caught) {
box.hide();
if(caught instanceof ItemNotConfiguredException){
@ -172,8 +171,6 @@ public class WsTaskExecutorWidget {
box.add(v);
}
Window.alert(caught.getMessage());
}
});

View File

@ -244,6 +244,7 @@ public class WsTaskExecutorWidgetViewManager {
public void showCreateTaskConfigurationForFolder(final WsFolder folder, TaskConfiguration conf){
final Modal box = new Modal(true);
box.setWidth(AbstractViewDialogBox.DEFAULT_WIDTH+20+"px");
box.setTitle("Create Task Configuration for: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20));
//box.getElement().getStyle().setZIndex(10000);

View File

@ -34,7 +34,7 @@ public abstract class AbstractViewDialogBox extends Composite {
GWT.create(AbstractViewDialogBoxUiBinder.class);
/** The default width. */
public static int DEFAULT_WIDTH = 500;
public static int DEFAULT_WIDTH = 800;
/**
@ -111,6 +111,7 @@ public abstract class AbstractViewDialogBox extends Composite {
public AbstractViewDialogBox() {
initWidget(uiBinder.createAndBindUi(this));
setWidth(DEFAULT_WIDTH+"px");
//setWidth(DEFAULT_WIDTH+"px");
alertError.setType(AlertType.ERROR);

View File

@ -18,7 +18,7 @@ import org.gcube.portlets.widgets.wstaskexecutor.shared.WsFolder;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.Controls;
import com.github.gwtbootstrap.client.ui.Form;
import com.github.gwtbootstrap.client.ui.Fieldset;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.Pager;
import com.github.gwtbootstrap.client.ui.TextBox;
@ -77,7 +77,7 @@ public abstract class CreateTaskConfigurationView extends Composite {
ControlGroup cg_parameters_control;
@UiField
Form form_unit_fields;
Fieldset form_unit_fields;
@UiField
TextBox field_task_id;
@ -191,7 +191,7 @@ public abstract class CreateTaskConfigurationView extends Composite {
CustomFieldEntry customFieldEntry;
if(folder.getPublicLink()!=null){
customFieldEntry = new CustomFieldEntry(eventBus, "publicLink", folder.getPublicLink(), false);
customFieldEntry = new CustomFieldEntry(eventBus, "publicLink", folder.getPublicLink(), "FILE");
customFieldEntriesList.add(customFieldEntry);
task_parameters_control.add(customFieldEntry);
}else
@ -207,7 +207,7 @@ public abstract class CreateTaskConfigurationView extends Composite {
@UiHandler("addCustomFieldButton")
void addCustomFieldEvent(ClickEvent e){
CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, "", "", true);
CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, null, null, null);
customFieldEntriesList.add(toAdd);
task_parameters_control.add(toAdd);

View File

@ -8,8 +8,8 @@
</ui:style>
<g:HTMLPanel>
<g:HTMLPanel>
<b:Form type="HORIZONTAL" ui:field="form_unit_fields">
<b:Fieldset styleName="{style.noBorder}">
<b:Form type="HORIZONTAL">
<b:Fieldset styleName="{style.noBorder}" ui:field="form_unit_fields">
<b:ControlGroup ui:field="cg_select_vre">
<b:ControlLabel for="cl_select_vre">Execute in the Scope</b:ControlLabel>
@ -28,16 +28,17 @@
ui:field="field_task_id"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="cg_parameters_control">
<b:Controls ui:field="task_parameters_control">
</b:Controls>
</b:ControlGroup>
<b:ControlLabel for="cl_parameters_control">Add Parameter</b:ControlLabel>
<b:Controls>
<b:Button icon="PLUS_SIGN" title="Add Parameter"
ui:field="addCustomFieldButton"></b:Button>
</b:Controls>
</b:Fieldset>
</b:Form>
<b:ControlGroup ui:field="cg_parameters_control">
<b:ControlLabel for="cg_parameters_control">With Parameters</b:ControlLabel>
<b:Button icon="PLUS_SIGN" title="Add Parameter"
ui:field="addCustomFieldButton"></b:Button>
<b:Controls ui:field="task_parameters_control">
</b:Controls>
</b:ControlGroup>
</g:HTMLPanel>
<b:Pager left="Older" right="Create Configuration and Do Sync"
aligned="true" ui:field="pager" />

View File

@ -53,10 +53,11 @@ public class CustomFieldEntry extends Composite {
//inserted values
private String value;
private String key;
private boolean isCustomCreatedByUser;
//private boolean isCustomCreatedByUser;
// event bus
private HandlerManager eventBus;
private String parameterType;
/**
* Instantiates a new custom field entry.
@ -66,7 +67,7 @@ public class CustomFieldEntry extends Composite {
* @param value the value
* @param isCustomCreatedByUser the is custom created by user
*/
public CustomFieldEntry(HandlerManager eventBus, String key, String value, boolean isCustomCreatedByUser) {
public CustomFieldEntry(HandlerManager eventBus, String key, String value, final String parameterType) {
initWidget(uiBinder.createAndBindUi(this));
keyFieldPrepend.setTitle("This is the key of the parameter");
@ -74,16 +75,27 @@ public class CustomFieldEntry extends Composite {
// save information
this.eventBus = eventBus;
this.value = value;
this.key = key;
this.isCustomCreatedByUser = isCustomCreatedByUser;
this.value = value;
this.parameterType = parameterType;
if(key!=null && !key.isEmpty()){
((TextBox)this.keyFieldPrepend.getWidget(1)).setText(key);
}
if(value!=null && !value.isEmpty()){
((TextBox)this.valueFieldPrepend.getWidget(1)).setText(value);
}
//this.isCustomCreatedByUser = isCustomCreatedByUser;
// remove the first appendbox
if(!isCustomCreatedByUser){
this.valueFieldPrepend.removeFromParent();
this.keyFieldPrepend.setPrependText(key + ":");
((TextBox)this.keyFieldPrepend.getWidget(1)).setText(value);
}
// if(!isCustomCreatedByUser){
// this.valueFieldPrepend.removeFromParent();
// this.keyFieldPrepend.setPrependText(key + ":");
// ((TextBox)this.keyFieldPrepend.getWidget(1)).setText(value);
// }
WsTaskExecutorWidget.wsTaskService.getAvailableParameterTypes(new AsyncCallback<List<TaskParameterType>>() {
@ -105,6 +117,12 @@ public class CustomFieldEntry extends Composite {
}
field_select_parameter.setEnabled(true);
if(parameterType!=null && !parameterType.isEmpty()){
field_select_parameter.setSelectedValue(parameterType);
field_select_parameter.setEnabled(false);
}
}
});
@ -119,14 +137,7 @@ public class CustomFieldEntry extends Composite {
*/
public String getKey(){
if(isCustomCreatedByUser){
return ((TextBox)this.keyFieldPrepend.getWidget(1)).getText();
}
return key;
return ((TextBox)this.keyFieldPrepend.getWidget(1)).getText();
}
/**
@ -136,13 +147,8 @@ public class CustomFieldEntry extends Composite {
*/
public String getValue(){
if(isCustomCreatedByUser){
return ((TextBox)this.valueFieldPrepend.getWidget(1)).getText();
return ((TextBox)this.valueFieldPrepend.getWidget(1)).getText();
}
return value;
}
/**

View File

@ -1,12 +1,14 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<b:ControlGroup ui:field="cg_select_vre">
<b:ControlLabel for="cl_select_vre">Type of Parameter</b:ControlLabel>
<b:ControlGroup>
<b:ControlLabel>Parameter</b:ControlLabel>
<b:Controls>
<b:ListBox name="Select the Type of Parameter..." b:id="field_select_parameter"
ui:field="field_select_parameter">
</b:ListBox>
<b:InputAddOn prependText="Type:">
<b:ListBox name="Select the Type of Parameter..." b:id="field_select_parameter"
ui:field="field_select_parameter">
</b:ListBox>
</b:InputAddOn>
</b:Controls>
<b:Controls>
<b:InputAddOn prependText="Key:" ui:field="keyFieldPrepend">

View File

@ -5,6 +5,7 @@ import java.util.Collections;
import java.util.List;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.workspacetaskexecutor.dataminer.WorkspaceDataMinerTaskExecutor;
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
@ -66,7 +67,12 @@ public class WsTaskExecutorWidgetServiceImpl extends RemoteServiceServlet implem
private WorkspaceDataMinerTaskExecutor getTaskExecutor(){
GCubeUser user = PortalContextUtil.getUserLogged(this.getThreadLocalRequest());
logger.trace("Found user "+user+ "in portal context util");
String scope = PortalContextUtil.getCurrentScope(this.getThreadLocalRequest());
logger.debug("Found user "+user+ ", scope: "+scope+" into PortalContext, using them...");
//String userToken = PortalContextUtil.getTokenFor(scope, user.getUsername());
//SecurityTokenProvider.instance.set(userToken);
ScopeProvider.instance.set(scope);
logger.info("Using user "+user.getUsername()+ "and scope: "+scope+" to intancing the "+WorkspaceDataMinerTaskExecutor.class.getSimpleName());
WorkspaceDataMinerTaskExecutor exec = WorkspaceDataMinerTaskExecutor.getInstance();
exec.withOwner(user.getUsername());
return exec;
@ -166,7 +172,7 @@ public class WsTaskExecutorWidgetServiceImpl extends RemoteServiceServlet implem
*/
@Override
public List<TaskConfiguration> checkItemTaskConfigurations(String itemId) throws Exception {
logger.debug("Checking Task Configurations for item: "+itemId);
WorkspaceDataMinerTaskExecutor exec = getTaskExecutor();
List<TaskConfiguration> confs = null;
try {