Enhancement on Task #10070
GUI enhancement git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-task-executor-widget@167361 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
dad0e274ee
commit
1d3de9f423
|
@ -84,8 +84,6 @@ public class WsTaskExecutorWidget {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,7 +145,7 @@ public class WsTaskExecutorWidget {
|
||||||
|
|
||||||
if(caught instanceof ItemNotConfiguredException){
|
if(caught instanceof ItemNotConfiguredException){
|
||||||
|
|
||||||
viewManager.showCreateConfigurationFolder(folder, null);
|
viewManager.showCreateTaskConfigurationForFolder(folder, null);
|
||||||
|
|
||||||
}else if(caught instanceof WorkspaceFolderLocked){
|
}else if(caught instanceof WorkspaceFolderLocked){
|
||||||
VerticalPanel v = new VerticalPanel();
|
VerticalPanel v = new VerticalPanel();
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package org.gcube.portlets.widgets.wstaskexecutor.client.event;
|
||||||
|
import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.CustomFieldEntry;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class DeleteCustomFieldEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* May 8, 2018
|
||||||
|
*/
|
||||||
|
public class DeleteCustomFieldEvent extends GwtEvent<DeleteCustomFieldEventHandler> {
|
||||||
|
public static Type<DeleteCustomFieldEventHandler> TYPE = new Type<DeleteCustomFieldEventHandler>();
|
||||||
|
|
||||||
|
private CustomFieldEntry removedEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new delete custom field event.
|
||||||
|
*
|
||||||
|
* @param removedEntry the removed entry
|
||||||
|
*/
|
||||||
|
public DeleteCustomFieldEvent(CustomFieldEntry removedEntry) {
|
||||||
|
this.removedEntry = removedEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the removed entry.
|
||||||
|
*
|
||||||
|
* @return the removed entry
|
||||||
|
*/
|
||||||
|
public CustomFieldEntry getRemovedEntry() {
|
||||||
|
return removedEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<DeleteCustomFieldEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(DeleteCustomFieldEventHandler handler) {
|
||||||
|
handler.onRemoveEntry(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.gcube.portlets.widgets.wstaskexecutor.client.event;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface DeleteCustomFieldEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* May 8, 2018
|
||||||
|
*/
|
||||||
|
public interface DeleteCustomFieldEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On remove entry.
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
*/
|
||||||
|
void onRemoveEntry(DeleteCustomFieldEvent event);
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.widgets.wstaskexecutor.client.rpc;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
||||||
import org.gcube.common.workspacetaskexecutor.shared.exception.ItemNotConfiguredException;
|
import org.gcube.common.workspacetaskexecutor.shared.exception.ItemNotConfiguredException;
|
||||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
||||||
|
@ -35,4 +36,13 @@ public interface WsTaskExecutorWidgetService extends RemoteService {
|
||||||
* @throws ItemNotConfiguredException, Exception
|
* @throws ItemNotConfiguredException, Exception
|
||||||
*/
|
*/
|
||||||
List<TaskConfiguration> checkItemTaskConfigurations(String itemId) throws ItemNotConfiguredException, Exception;
|
List<TaskConfiguration> checkItemTaskConfigurations(String itemId) throws ItemNotConfiguredException, Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the availables parameter types.
|
||||||
|
*
|
||||||
|
* @return the availables parameter types
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
List<TaskParameterType> getAvailableParameterTypes() throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ package org.gcube.portlets.widgets.wstaskexecutor.client.rpc;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
|
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
|
||||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
||||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus;
|
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus;
|
||||||
|
@ -84,4 +85,14 @@ public interface WsTaskExecutorWidgetServiceAsync {
|
||||||
void monitorTaskExecutionStatus(
|
void monitorTaskExecutionStatus(
|
||||||
TaskConfiguration configuration, TaskComputation taskComputation,
|
TaskConfiguration configuration, TaskComputation taskComputation,
|
||||||
AsyncCallback<TaskExecutionStatus> asyncCallback);
|
AsyncCallback<TaskExecutionStatus> asyncCallback);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the available parameter types.
|
||||||
|
*
|
||||||
|
* @param asyncCallback the async callback
|
||||||
|
* @return the available parameter types
|
||||||
|
*/
|
||||||
|
void getAvailableParameterTypes(AsyncCallback<List<TaskParameterType>> asyncCallback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,12 +35,6 @@ public class WsTaskExecutorWidgetViewManager {
|
||||||
private Map<String, MonitorFolderTaskExecutionStatusView> mapMonitor = new HashMap<String, MonitorFolderTaskExecutionStatusView>();
|
private Map<String, MonitorFolderTaskExecutionStatusView> mapMonitor = new HashMap<String, MonitorFolderTaskExecutionStatusView>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new ws thredds widget view manager.
|
|
||||||
*/
|
|
||||||
public WsTaskExecutorWidgetViewManager() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel scheduler.
|
* Cancel scheduler.
|
||||||
*
|
*
|
||||||
|
@ -239,13 +233,15 @@ public class WsTaskExecutorWidgetViewManager {
|
||||||
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) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show create configuration folder.
|
* Show create task configuration for folder.
|
||||||
*
|
*
|
||||||
* @param folder the folder
|
* @param folder the folder
|
||||||
* @param conf the conf
|
* @param conf the conf
|
||||||
*/
|
*/
|
||||||
public void showCreateConfigurationFolder(final WsFolder folder, TaskConfiguration conf){
|
public void showCreateTaskConfigurationForFolder(final WsFolder folder, TaskConfiguration conf){
|
||||||
|
|
||||||
final Modal box = new Modal(true);
|
final Modal box = new Modal(true);
|
||||||
box.setTitle("Create Task Configuration for: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20));
|
box.setTitle("Create Task Configuration for: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20));
|
||||||
|
@ -272,7 +268,7 @@ public class WsTaskExecutorWidgetViewManager {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CreateTaskConfigurationView createThreddsConfiguration = new CreateTaskConfigurationView(folder.getFolderId()) {
|
CreateTaskConfigurationView createTaskConfiguration = new CreateTaskConfigurationView(folder) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void submitHandler() {
|
public void submitHandler() {
|
||||||
|
@ -282,7 +278,7 @@ public class WsTaskExecutorWidgetViewManager {
|
||||||
conf.setTaskId(getTaskId());
|
conf.setTaskId(getTaskId());
|
||||||
conf.setTaskDescription("");
|
conf.setTaskDescription("");
|
||||||
conf.setWorkspaceItemId(folder.getFolderId());
|
conf.setWorkspaceItemId(folder.getFolderId());
|
||||||
conf.setMapParameters(getParameters());
|
conf.setListParameters(getParameters());
|
||||||
|
|
||||||
WsTaskExecutorWidget.eventBus.fireEvent(new PerformRunTaskEvent(folder, conf));
|
WsTaskExecutorWidget.eventBus.fireEvent(new PerformRunTaskEvent(folder, conf));
|
||||||
}
|
}
|
||||||
|
@ -319,7 +315,7 @@ public class WsTaskExecutorWidgetViewManager {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
panelView.addViewAsWidget(createThreddsConfiguration);
|
panelView.addViewAsWidget(createTaskConfiguration);
|
||||||
box.add(panelView);
|
box.add(panelView);
|
||||||
box.show();
|
box.show();
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
package org.gcube.portlets.widgets.wstaskexecutor.client.view.binder;
|
package org.gcube.portlets.widgets.wstaskexecutor.client.view.binder;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.common.workspacetaskexecutor.shared.TaskParameter;
|
||||||
|
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||||
import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget;
|
import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget;
|
||||||
|
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldEvent;
|
||||||
|
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldEventHandler;
|
||||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.FormatUtil;
|
import org.gcube.portlets.widgets.wstaskexecutor.client.view.FormatUtil;
|
||||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
||||||
|
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.ControlGroup;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Controls;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Form;
|
||||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
import com.github.gwtbootstrap.client.ui.Pager;
|
import com.github.gwtbootstrap.client.ui.Pager;
|
||||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
|
@ -19,8 +28,10 @@ import com.google.gwt.dom.client.Document;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.dom.client.DomEvent;
|
import com.google.gwt.event.dom.client.DomEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.uibinder.client.UiHandler;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
@ -56,12 +67,6 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
ListBox field_select_scope;
|
ListBox field_select_scope;
|
||||||
|
|
||||||
@UiField
|
|
||||||
TextBox field_key_param;
|
|
||||||
|
|
||||||
@UiField
|
|
||||||
TextBox field_value_param;
|
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ControlGroup cg_input_task_id;
|
ControlGroup cg_input_task_id;
|
||||||
|
|
||||||
|
@ -69,27 +74,33 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
||||||
ControlGroup cg_select_vre;
|
ControlGroup cg_select_vre;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ControlGroup cg_input_key_param;
|
ControlGroup cg_parameters_control;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ControlGroup cg_input_value_param;
|
Form form_unit_fields;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
TextBox field_task_id;
|
TextBox field_task_id;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Controls task_parameters_control;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button addCustomFieldButton;
|
||||||
|
|
||||||
/** The folder id. */
|
|
||||||
private String folderId;
|
|
||||||
|
|
||||||
/** The map VR es. */
|
/** The map VR es. */
|
||||||
private Map<String, GcubeScope> mapScopes = new HashMap<String, GcubeScope>();
|
private Map<String, GcubeScope> mapScopes = new HashMap<String, GcubeScope>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String currentScope;
|
private String currentScope;
|
||||||
|
|
||||||
|
public final static HandlerManager eventBus = new HandlerManager(null);
|
||||||
|
|
||||||
|
// added custom field entries (by the user)
|
||||||
|
private List<CustomFieldEntry> customFieldEntriesList = new ArrayList<CustomFieldEntry>();
|
||||||
|
|
||||||
|
|
||||||
|
private WsFolder folder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit handler.
|
* Submit handler.
|
||||||
|
@ -126,13 +137,15 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
||||||
* Note that depending on the widget that is used, it may be necessary to
|
* Note that depending on the widget that is used, it may be necessary to
|
||||||
* implement HasHTML instead of HasText.
|
* implement HasHTML instead of HasText.
|
||||||
*
|
*
|
||||||
* @param folderId the folder id
|
* @param folder the folder
|
||||||
*/
|
*/
|
||||||
public CreateTaskConfigurationView(String folderId) {
|
public CreateTaskConfigurationView(WsFolder folder) {
|
||||||
this.folderId = folderId;
|
this.folder = folder;
|
||||||
|
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
|
bindEvents();
|
||||||
|
|
||||||
pager.getLeft().setVisible(false);
|
pager.getLeft().setVisible(false);
|
||||||
|
|
||||||
pager.getRight().addClickHandler(new ClickHandler() {
|
pager.getRight().addClickHandler(new ClickHandler() {
|
||||||
|
@ -176,20 +189,48 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CustomFieldEntry customFieldEntry;
|
||||||
|
if(folder.getPublicLink()!=null){
|
||||||
|
customFieldEntry = new CustomFieldEntry(eventBus, "publicLink", folder.getPublicLink(), false);
|
||||||
|
customFieldEntriesList.add(customFieldEntry);
|
||||||
|
task_parameters_control.add(customFieldEntry);
|
||||||
|
}else
|
||||||
|
addCustomFieldEvent(null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the field catalogue name.
|
* Adds the custom field event.
|
||||||
|
*
|
||||||
|
* @param e the e
|
||||||
*/
|
*/
|
||||||
private void initFields() {
|
@UiHandler("addCustomFieldButton")
|
||||||
|
void addCustomFieldEvent(ClickEvent e){
|
||||||
|
|
||||||
|
CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, "", "", true);
|
||||||
|
customFieldEntriesList.add(toAdd);
|
||||||
|
task_parameters_control.add(toAdd);
|
||||||
|
|
||||||
field_task_id.setText("");
|
|
||||||
field_key_param.setText("");
|
|
||||||
field_value_param.setText("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind events.
|
||||||
|
*/
|
||||||
|
private void bindEvents() {
|
||||||
|
|
||||||
|
// when a custom field is removed, remove it from the list
|
||||||
|
eventBus.addHandler(DeleteCustomFieldEvent.TYPE, new DeleteCustomFieldEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoveEntry(DeleteCustomFieldEvent event) {
|
||||||
|
customFieldEntriesList.remove(event.getRemovedEntry());
|
||||||
|
task_parameters_control.remove(event.getRemovedEntry());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate submit.
|
* Validate submit.
|
||||||
*
|
*
|
||||||
|
@ -197,8 +238,7 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
||||||
*/
|
*/
|
||||||
protected boolean validateSubmit() {
|
protected boolean validateSubmit() {
|
||||||
cg_input_task_id.setType(ControlGroupType.NONE);
|
cg_input_task_id.setType(ControlGroupType.NONE);
|
||||||
cg_input_key_param.setType(ControlGroupType.NONE);
|
cg_parameters_control.setType(ControlGroupType.NONE);
|
||||||
cg_input_value_param.setType(ControlGroupType.NONE);
|
|
||||||
//cg_remote_path.setType(ControlGroupType.NONE);
|
//cg_remote_path.setType(ControlGroupType.NONE);
|
||||||
|
|
||||||
if(field_select_scope.getSelectedItemText()==null){
|
if(field_select_scope.getSelectedItemText()==null){
|
||||||
|
@ -213,16 +253,12 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(field_key_param.getValue() == null || field_key_param.getValue().isEmpty()){
|
for (CustomFieldEntry cFE : customFieldEntriesList) {
|
||||||
cg_input_key_param.setType(ControlGroupType.WARNING);
|
if(cFE.getKey()==null || cFE.getKey().isEmpty()){
|
||||||
setConfirm(true, "The key of input parameter is empty. Do you want continue anyway?");
|
cg_parameters_control.setType(ControlGroupType.ERROR);
|
||||||
return false;
|
setError(true, "You must type a valid key paramter!");
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
if(field_value_param.getValue() == null || field_value_param.getValue().isEmpty()){
|
|
||||||
cg_input_key_param.setType(ControlGroupType.WARNING);
|
|
||||||
setConfirm(true, "The value of input parameter is empty. Do you want continue anyway?");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -251,20 +287,19 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the parameters.
|
* Gets the parameters.
|
||||||
*
|
*
|
||||||
* @return the parameters
|
* @return the parameters
|
||||||
*/
|
*/
|
||||||
public Map<String,String> getParameters(){
|
public List<TaskParameter> getParameters(){
|
||||||
|
|
||||||
Map<String, String> map = new HashMap<String, String>(1);
|
List<TaskParameter> listParameters = new ArrayList<TaskParameter>();
|
||||||
map.put(field_key_param.getValue(), field_value_param.getValue());
|
for (CustomFieldEntry cFE : customFieldEntriesList) {
|
||||||
return map;
|
TaskParameter tp = new TaskParameter(cFE.getKey(), cFE.getValue(), null, new TaskParameterType(cFE.getType()));
|
||||||
|
listParameters.add(tp);
|
||||||
|
}
|
||||||
|
return listParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
}
|
}
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
<g:HTMLPanel ui:field="form_unit_fields">
|
<g:HTMLPanel>
|
||||||
<b:Form type="HORIZONTAL">
|
<b:Form type="HORIZONTAL" ui:field="form_unit_fields">
|
||||||
<b:Fieldset styleName="{style.noBorder}">
|
<b:Fieldset styleName="{style.noBorder}">
|
||||||
|
|
||||||
<b:ControlGroup ui:field="cg_select_vre">
|
<b:ControlGroup ui:field="cg_select_vre">
|
||||||
|
@ -29,27 +29,15 @@
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
|
||||||
<b:Label>With Parameter</b:Label>
|
|
||||||
<b:WellForm type="INLINE">
|
|
||||||
<b:ControlGroup ui:field="cg_input_key_param">
|
|
||||||
<b:ControlLabel for="cl_input_key_param">Parameter Key</b:ControlLabel>
|
|
||||||
<b:Controls>
|
|
||||||
<b:TextBox placeholder="Type the Key Entry..." title="This is the key of Parameter"
|
|
||||||
b:id="field_key_param" ui:field="field_key_param"></b:TextBox>
|
|
||||||
</b:Controls>
|
|
||||||
</b:ControlGroup>
|
|
||||||
<b:ControlGroup ui:field="cg_input_value_param">
|
|
||||||
<b:ControlLabel for="cl_input_value_param">Parameter Value</b:ControlLabel>
|
|
||||||
<b:Controls>
|
|
||||||
<b:TextBox placeholder="Type the Value Entry..."
|
|
||||||
title="This is the value of parameter" b:id="field_value_param"
|
|
||||||
ui:field="field_value_param"></b:TextBox>
|
|
||||||
</b:Controls>
|
|
||||||
</b:ControlGroup>
|
|
||||||
</b:WellForm>
|
|
||||||
|
|
||||||
</b:Fieldset>
|
</b:Fieldset>
|
||||||
</b:Form>
|
</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>
|
</g:HTMLPanel>
|
||||||
<b:Pager left="Older" right="Create Configuration and Do Sync"
|
<b:Pager left="Older" right="Create Configuration and Do Sync"
|
||||||
aligned="true" ui:field="pager" />
|
aligned="true" ui:field="pager" />
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
package org.gcube.portlets.widgets.wstaskexecutor.client.view.binder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||||
|
import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget;
|
||||||
|
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldEvent;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.InputAddOn;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.uibinder.client.UiHandler;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class CustomFieldEntry.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* May 8, 2018
|
||||||
|
*/
|
||||||
|
public class CustomFieldEntry extends Composite {
|
||||||
|
|
||||||
|
private static CustomFieldEntryUiBinder uiBinder = GWT
|
||||||
|
.create(CustomFieldEntryUiBinder.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface CustomFieldEntryUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* May 8, 2018
|
||||||
|
*/
|
||||||
|
interface CustomFieldEntryUiBinder extends
|
||||||
|
UiBinder<Widget, CustomFieldEntry> {
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField InputAddOn keyFieldPrepend;
|
||||||
|
@UiField InputAddOn valueFieldPrepend;
|
||||||
|
@UiField Button removeCustomField;
|
||||||
|
@UiField ListBox field_select_parameter;
|
||||||
|
|
||||||
|
private List<TaskParameterType> parameterTypes;
|
||||||
|
|
||||||
|
//inserted values
|
||||||
|
private String value;
|
||||||
|
private String key;
|
||||||
|
private boolean isCustomCreatedByUser;
|
||||||
|
|
||||||
|
// event bus
|
||||||
|
private HandlerManager eventBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new custom field entry.
|
||||||
|
*
|
||||||
|
* @param eventBus the event bus
|
||||||
|
* @param key the key
|
||||||
|
* @param value the value
|
||||||
|
* @param isCustomCreatedByUser the is custom created by user
|
||||||
|
*/
|
||||||
|
public CustomFieldEntry(HandlerManager eventBus, String key, String value, boolean isCustomCreatedByUser) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
|
keyFieldPrepend.setTitle("This is the key of the parameter");
|
||||||
|
valueFieldPrepend.setTitle("This is the value of the parameter");
|
||||||
|
|
||||||
|
// save information
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
this.value = value;
|
||||||
|
this.key = key;
|
||||||
|
this.isCustomCreatedByUser = isCustomCreatedByUser;
|
||||||
|
|
||||||
|
// remove the first appendbox
|
||||||
|
if(!isCustomCreatedByUser){
|
||||||
|
this.valueFieldPrepend.removeFromParent();
|
||||||
|
this.keyFieldPrepend.setPrependText(key + ":");
|
||||||
|
((TextBox)this.keyFieldPrepend.getWidget(1)).setText(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
WsTaskExecutorWidget.wsTaskService.getAvailableParameterTypes(new AsyncCallback<List<TaskParameterType>>() {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Window.alert(caught.getMessage());
|
||||||
|
field_select_parameter.setEnabled(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<TaskParameterType> result) {
|
||||||
|
|
||||||
|
parameterTypes = result;
|
||||||
|
|
||||||
|
for (TaskParameterType taskParameterType : result) {
|
||||||
|
field_select_parameter.addItem(taskParameterType.getType(), taskParameterType.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
field_select_parameter.setEnabled(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
field_select_parameter.setEnabled(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the key value.
|
||||||
|
*
|
||||||
|
* @return the key
|
||||||
|
*/
|
||||||
|
public String getKey(){
|
||||||
|
|
||||||
|
if(isCustomCreatedByUser){
|
||||||
|
|
||||||
|
return ((TextBox)this.keyFieldPrepend.getWidget(1)).getText();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return key;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the value.
|
||||||
|
*
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public String getValue(){
|
||||||
|
|
||||||
|
if(isCustomCreatedByUser){
|
||||||
|
|
||||||
|
return ((TextBox)this.valueFieldPrepend.getWidget(1)).getText();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On remove custom field.
|
||||||
|
*
|
||||||
|
* @param e the e
|
||||||
|
*/
|
||||||
|
@UiHandler("removeCustomField")
|
||||||
|
void onRemoveCustomField(ClickEvent e){
|
||||||
|
|
||||||
|
// fire event
|
||||||
|
eventBus.fireEvent(new DeleteCustomFieldEvent(this));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove delete button.
|
||||||
|
*/
|
||||||
|
public void freeze() {
|
||||||
|
|
||||||
|
removeCustomField.setEnabled(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type.
|
||||||
|
*
|
||||||
|
* @return the type
|
||||||
|
*/
|
||||||
|
public String getType(){
|
||||||
|
return field_select_parameter.getSelectedValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<!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:Controls>
|
||||||
|
<b:ListBox name="Select the Type of Parameter..." b:id="field_select_parameter"
|
||||||
|
ui:field="field_select_parameter">
|
||||||
|
</b:ListBox>
|
||||||
|
</b:Controls>
|
||||||
|
<b:Controls>
|
||||||
|
<b:InputAddOn prependText="Key:" ui:field="keyFieldPrepend">
|
||||||
|
<b:TextBox />
|
||||||
|
</b:InputAddOn>
|
||||||
|
<b:InputAddOn prependText="Value:" ui:field="valueFieldPrepend">
|
||||||
|
<b:TextBox />
|
||||||
|
</b:InputAddOn>
|
||||||
|
<b:Button icon="REMOVE_SIGN" title="Remove field" ui:field="removeCustomField"></b:Button>
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
</ui:UiBinder>
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.workspacetaskexecutor.dataminer.WorkspaceDataMinerTaskExecutor;
|
import org.gcube.common.workspacetaskexecutor.dataminer.WorkspaceDataMinerTaskExecutor;
|
||||||
|
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
||||||
import org.gcube.common.workspacetaskexecutor.shared.exception.ItemNotConfiguredException;
|
import org.gcube.common.workspacetaskexecutor.shared.exception.ItemNotConfiguredException;
|
||||||
import org.gcube.common.workspacetaskexecutor.shared.exception.WorkspaceFolderLocked;
|
import org.gcube.common.workspacetaskexecutor.shared.exception.WorkspaceFolderLocked;
|
||||||
|
@ -208,8 +209,15 @@ public class WsTaskExecutorWidgetServiceImpl extends RemoteServiceServlet implem
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.widgets.wstaskexecutor.client.rpc.WsTaskExecutorWidgetService#getAvailablesParameterTypes()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TaskParameterType> getAvailableParameterTypes()
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
WorkspaceDataMinerTaskExecutor exec = WorkspaceDataMinerTaskExecutor.getInstance();
|
||||||
|
return exec.getParameterTypes();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,14 @@ import java.io.Serializable;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class WsFolder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
* May 8, 2018
|
||||||
|
*/
|
||||||
public class WsFolder implements Serializable, IsSerializable{
|
public class WsFolder implements Serializable, IsSerializable{
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,52 +21,99 @@ public class WsFolder implements Serializable, IsSerializable{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private String folderId;
|
private String folderId;
|
||||||
private String foderName;
|
private String foderName;
|
||||||
|
private String publicLink;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new ws folder.
|
||||||
|
*/
|
||||||
public WsFolder() {
|
public WsFolder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
public WsFolder(String folderId, String foderName) {
|
* Instantiates a new ws folder.
|
||||||
|
*
|
||||||
|
* @param folderId the folder id
|
||||||
|
* @param foderName the foder name
|
||||||
|
* @param publicLink the public link
|
||||||
|
*/
|
||||||
|
public WsFolder(String folderId, String foderName, String publicLink) {
|
||||||
this.folderId = folderId;
|
this.folderId = folderId;
|
||||||
this.foderName = foderName;
|
this.foderName = foderName;
|
||||||
|
this.publicLink = publicLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the folder id.
|
||||||
|
*
|
||||||
|
* @return the folder id
|
||||||
|
*/
|
||||||
public String getFolderId() {
|
public String getFolderId() {
|
||||||
return folderId;
|
return folderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the folder id.
|
||||||
|
*
|
||||||
|
* @param folderId the new folder id
|
||||||
|
*/
|
||||||
public void setFolderId(String folderId) {
|
public void setFolderId(String folderId) {
|
||||||
this.folderId = folderId;
|
this.folderId = folderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the foder name.
|
||||||
|
*
|
||||||
|
* @return the foder name
|
||||||
|
*/
|
||||||
public String getFoderName() {
|
public String getFoderName() {
|
||||||
return foderName;
|
return foderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the public link.
|
||||||
|
*
|
||||||
|
* @return the public link
|
||||||
|
*/
|
||||||
|
public String getPublicLink() {
|
||||||
|
|
||||||
|
return publicLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the foder name.
|
||||||
|
*
|
||||||
|
* @param foderName the new foder name
|
||||||
|
*/
|
||||||
public void setFoderName(String foderName) {
|
public void setFoderName(String foderName) {
|
||||||
this.foderName = foderName;
|
this.foderName = foderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("WsFolder [folderId=");
|
builder.append("WsFolder [folderId=");
|
||||||
builder.append(folderId);
|
builder.append(folderId);
|
||||||
builder.append(", foderName=");
|
builder.append(", foderName=");
|
||||||
builder.append(foderName);
|
builder.append(foderName);
|
||||||
|
builder.append(", publicLink=");
|
||||||
|
builder.append(publicLink);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue