Enhancement on Task #10070

Task Configurations View


git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-task-executor-widget@167384 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-05-09 16:00:33 +00:00
parent 57f4f0fbb3
commit ed03b304ae
15 changed files with 341 additions and 306 deletions

View File

@ -8,8 +8,12 @@ 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.dialog.DialogConfirm;
import org.gcube.portlets.widgets.wstaskexecutor.client.dialog.DialogResult;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreateTaskConfigurationEvent;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreateTaskConfigurationEventHandler;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteConfigurationEvent;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteConfigurationEventHandler;
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.event.ShowCreateTaskConfigurationEvent;
@ -88,14 +92,65 @@ public class WsTaskExecutorWidget {
}
});
eventBus.addHandler(DeleteConfigurationEvent.TYPE, new DeleteConfigurationEventHandler() {
@Override
public void onRemoveConfiguration(final DeleteConfigurationEvent dcEvent) {
GWT.log("qui remove");
if(dcEvent.getTaskConf()!=null){
DialogConfirm confirm = new DialogConfirm(null, "Delete Confirm?", "Deleting the configuration: "+dcEvent.getTaskConf().getTaskId()+". Confirm?");
confirm.getYesButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
WsTaskExecutorWidget.wsTaskService.removeTaskConfiguration(dcEvent.getTaskConf(), new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
new DialogResult(null, "Alert!!!", caught.getMessage()).center();
}
@Override
public void onSuccess(Boolean result) {
DialogResult dg = new DialogResult(null, "Configuration removed", "The configuration "+dcEvent.getTaskConf().getConfigurationKey() +" has been removed correctly");
dg.center();
try {
viewManager.showCreateTaskConfigurationForFolder(dcEvent.getWsItem(), null);
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
});
confirm.getElement().getStyle().setZIndex(Integer.MAX_VALUE-1000);
confirm.center();
}
}
});
eventBus.addHandler(ShowCreateTaskConfigurationEvent.TYPE, new ShowCreateTaskConfigurationEventHandler() {
@Override
public void onShowCreateConfiguration(
ShowCreateTaskConfigurationEvent showCreateTaskConfigurationEvent) {
if(showCreateTaskConfigurationEvent.getFolder()!=null)
viewManager.showCreateTaskConfigurationForFolder(showCreateTaskConfigurationEvent.getFolder(), null);
if(showCreateTaskConfigurationEvent.getWsItem()!=null)
viewManager.showCreateTaskConfigurationForFolder(showCreateTaskConfigurationEvent.getWsItem(), null);
}
});

View File

@ -0,0 +1,64 @@
package org.gcube.portlets.widgets.wstaskexecutor.client.event;
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class DeleteCustomFieldEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 8, 2018
*/
public class DeleteConfigurationEvent extends GwtEvent<DeleteConfigurationEventHandler> {
public static Type<DeleteConfigurationEventHandler> TYPE = new Type<DeleteConfigurationEventHandler>();
private WSItem wsItem;
private TaskConfiguration taskConf;
/**
* Instantiates a new delete custom field event.
*
* @param removedEntry the removed entry
*/
public DeleteConfigurationEvent(WSItem wsItem, TaskConfiguration taskConf) {
this.wsItem = wsItem;
this.taskConf = taskConf;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<DeleteConfigurationEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(DeleteConfigurationEventHandler handler) {
handler.onRemoveConfiguration(this);
}
/**
* @return the wsItem
*/
public WSItem getWsItem() {
return wsItem;
}
/**
* @return the taskConf
*/
public TaskConfiguration getTaskConf() {
return taskConf;
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.widgets.wstaskexecutor.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface DeleteConfigurationEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* May 9, 2018
*/
public interface DeleteConfigurationEventHandler extends EventHandler {
/**
* On remove configuration.
*
* @param deleteConfigurationEvent
* the delete configuration event
*/
void onRemoveConfiguration(DeleteConfigurationEvent deleteConfigurationEvent);
}

View File

@ -19,15 +19,15 @@ public class ShowCreateTaskConfigurationEvent extends GwtEvent<ShowCreateTaskCon
/** The type. */
public static Type<ShowCreateTaskConfigurationEventHandler> TYPE = new Type<ShowCreateTaskConfigurationEventHandler>();
private WSItem folder;
private WSItem wsItem;
/**
* Instantiates a new creates the task configuration event.
*
* @param folder the folder
*/
public ShowCreateTaskConfigurationEvent(WSItem folder) {
this.folder = folder;
public ShowCreateTaskConfigurationEvent(WSItem wsItem) {
this.wsItem = wsItem;
}
@ -56,8 +56,8 @@ public class ShowCreateTaskConfigurationEvent extends GwtEvent<ShowCreateTaskCon
*
* @return the folder
*/
public WSItem getFolder() {
return folder;
public WSItem getWsItem() {
return wsItem;
}
}

View File

@ -7,6 +7,7 @@ import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus;
import org.gcube.common.workspacetaskexecutor.shared.exception.ItemNotConfiguredException;
import org.gcube.common.workspacetaskexecutor.shared.exception.ItemNotExecutableException;
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
import com.google.gwt.user.client.rpc.RemoteService;
@ -79,4 +80,13 @@ public interface WsTaskExecutorWidgetService extends RemoteService {
*/
List<TaskConfiguration> getItemTaskConfigurations(String itemId)
throws Exception;
/**
* @param taskConfiguration
* @return
* @throws ItemNotExecutableException
* @throws Exception
*/
Boolean removeTaskConfiguration(TaskConfiguration taskConfiguration)
throws ItemNotExecutableException, Exception;
}

View File

@ -116,4 +116,14 @@ public interface WsTaskExecutorWidgetServiceAsync {
* @return the item task configurations
*/
void getItemTaskConfigurations(String itemId, AsyncCallback<List<TaskConfiguration>> asyncCallback);
/**
* Removes the task configuration.
*
* @param taskConfiguration the task configuration
* @param asyncCallback the async callback
*/
void removeTaskConfiguration(TaskConfiguration taskConfiguration, AsyncCallback<Boolean> asyncCallback);
}

View File

@ -11,6 +11,7 @@ import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStat
import org.gcube.portlets.widgets.wstaskexecutor.client.TaskCompletedNotification.TaskCompletedNotificationListner;
import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreateTaskConfigurationEvent;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteConfigurationEvent;
import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.AbstractViewDialogBox;
import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.CreateTaskConfigurationView;
import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.MonitorFolderTaskExecutionStatusView;
@ -134,7 +135,7 @@ public class WsTaskExecutorWidgetViewManager {
}
@Override
public void confirmHanlder(CONFIRM_VALUE confirm, Command command) {
public void confirmHandler(CONFIRM_VALUE confirm, Command command) {
// TODO Auto-generated method stub
@ -239,8 +240,65 @@ public class WsTaskExecutorWidgetViewManager {
box.setTitle("Task Configuration created for: "+FormatUtil.getFolderTitle(wsItem.getItemName(), 20));
box.addStyleName("ws-task-modal-body");
box.setWidth(AbstractViewDialogBox.DEFAULT_WIDTH+50);
ShowTaskConfigurationsView panelConfigs = new ShowTaskConfigurationsView(wsItem, listTaskConfigurations);
box.add(panelConfigs);
final AbstractViewDialogBox panelView = new AbstractViewDialogBox() {
@Override
public void closeHandler() {
box.hide();
}
@Override
public void confirmHandler(CONFIRM_VALUE confirm, Command command) {
if(confirm.equals(CONFIRM_VALUE.YES)){
box.hide();
}
if(command!=null)
command.execute();
}
};
ShowTaskConfigurationsView panelConfigs = new ShowTaskConfigurationsView(wsItem, listTaskConfigurations){
@Override
public void submitHandler() {
WsTaskExecutorWidget.eventBus.fireEvent(new DeleteConfigurationEvent(getWsItem(), getSelectedConfiguration()));
}
public void setConfirm(boolean visible, String msg) {
Command yes = new Command() {
@Override
public void execute() {
submitHandler();
}
};
Command no = new Command() {
@Override
public void execute() {
panelView.setConfirm(false, "", null, null);
}
};
panelView.setConfirm(visible, msg, yes, no);
}
};
panelView.addViewAsWidget(panelConfigs);
box.add(panelView);
box.show();
}
@ -270,7 +328,7 @@ public class WsTaskExecutorWidgetViewManager {
}
@Override
public void confirmHanlder(CONFIRM_VALUE confirm, Command command) {
public void confirmHandler(CONFIRM_VALUE confirm, Command command) {
if(confirm.equals(CONFIRM_VALUE.YES)){
box.hide();

View File

@ -90,12 +90,14 @@ public abstract class AbstractViewDialogBox extends Composite {
public abstract void closeHandler();
/**
* Confirm hanlder.
* Confirm handler.
*
* @param confirm the confirm
* @param command the command
*/
public abstract void confirmHanlder(CONFIRM_VALUE confirm, Command command);
public abstract void confirmHandler(CONFIRM_VALUE confirm, Command command);
/**
* Because this class has a default constructor, it can
@ -225,6 +227,8 @@ public abstract class AbstractViewDialogBox extends Composite {
*
* @param visible the visible
* @param msg the msg
* @param yes the yes
* @param no the no
*/
public void setConfirm(boolean visible, String msg, final Command yes, final Command no){
@ -241,13 +245,13 @@ public abstract class AbstractViewDialogBox extends Composite {
@Override
public void onClickYesButton() {
confirmHanlder(CONFIRM_VALUE.YES, yes);
confirmHandler(CONFIRM_VALUE.YES, yes);
}
@Override
public void onClickNoButton() {
confirmHanlder(CONFIRM_VALUE.NO, no);
confirmHandler(CONFIRM_VALUE.NO, no);
}
};

View File

@ -25,7 +25,7 @@
</b:Controls>
<b:Controls>
<b:Button icon="REMOVE_SIGN" title="Remove Parameter" text="Remove Parameter"
ui:field="removeCustomField"></b:Button>
ui:field="removeCustomField" type="LINK"></b:Button>
</b:Controls>
</b:ControlGroup>
</g:HTMLPanel>

View File

@ -1,210 +0,0 @@
package org.gcube.portlets.widgets.wstaskexecutor.client.view.binder;
import java.util.HashMap;
import java.util.Map;
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.Pager;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
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.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class CreateTaskConfigurationView.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 4, 2018
*/
public abstract class ShowTaskConfigurationView extends Composite {
/** The ui binder. */
private static ShowTaskConfigurationViewUiBinder uiBinder =
GWT.create(ShowTaskConfigurationViewUiBinder.class);
/**
* The Interface CreateTaskConfigurationViewUiBinder.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 4, 2018
*/
interface ShowTaskConfigurationViewUiBinder
extends UiBinder<Widget, ShowTaskConfigurationView> {
}
/** The pager. */
@UiField
Pager pager;
@UiField
ListBox field_select_scope;
@UiField
TextBox field_key_param;
@UiField
TextBox field_value_param;
@UiField
ControlGroup cg_input_task_id;
@UiField
ControlGroup cg_select_vre;
@UiField
ControlGroup cg_input_key_param;
@UiField
ControlGroup cg_input_value_param;
@UiField
TextBox field_task_id;
/** The folder id. */
private String folderId;
/** The map VR es. */
private Map<String, GcubeScope> mapScopes = new HashMap<String, GcubeScope>();
private String currentScope;
/**
* Submit handler.
*/
public abstract void submitHandler();
/**
* Sets the error.
*
* @param visible the visible
* @param error the error
*/
public abstract void setError(boolean visible, String error);
/**
* Sets the confirm.
*
* @param visible the visible
* @param msg the msg
*/
public abstract void setConfirm(boolean visible, String msg);
/**
* Because this class has a default constructor, it can
* be used as a binder template. In other words, it can be used in other
* *.ui.xml files as follows:
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
* xmlns:g="urn:import:**user's package**">
* <g:**UserClassName**>Hello!</g:**UserClassName>
* </ui:UiBinder>
* Note that depending on the widget that is used, it may be necessary to
* implement HasHTML instead of HasText.
*
* @param folderId the folder id
*/
public ShowTaskConfigurationView(String folderId) {
this.folderId = folderId;
initWidget(uiBinder.createAndBindUi(this));
pager.getLeft().setVisible(false);
pager.getRight().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
setError(false, "");
boolean isValid = validateSubmit();
if(isValid)
submitHandler();
}
});
}
/**
* Inits the field catalogue name.
*/
private void initFields() {
field_task_id.setText("");
field_key_param.setText("");
field_value_param.setText("");
}
/**
* Validate submit.
*
* @return true, if successful
*/
protected boolean validateSubmit() {
cg_input_task_id.setType(ControlGroupType.NONE);
cg_input_key_param.setType(ControlGroupType.NONE);
cg_input_value_param.setType(ControlGroupType.NONE);
//cg_remote_path.setType(ControlGroupType.NONE);
if(field_select_scope.getSelectedItemText()==null){
cg_select_vre.setType(ControlGroupType.ERROR);
setError(true, "You must select a Scope!");
return false;
}
if(field_task_id.getValue() == null || field_task_id.getValue().isEmpty()){
cg_input_task_id.setType(ControlGroupType.ERROR);
setError(true, "You must type an Algorithm Identifier!");
return false;
}
if(field_key_param.getValue() == null || field_key_param.getValue().isEmpty()){
cg_input_key_param.setType(ControlGroupType.WARNING);
setConfirm(true, "The key of input parameter is empty. Do you want continue anyway?");
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;
}
/**
* Gets the selected scope.
*
* @return the selected scope
*/
public GcubeScope getSelectedScope(){
//String item = field_select_scope.getSelectedItemText();
String text = field_select_scope.getSelectedValue();
return mapScopes.get(text);
}
}

View File

@ -1,57 +0,0 @@
<!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">
<ui:style>
.noBorder {
border: 0px;
}
</ui:style>
<g:HTMLPanel>
<g:HTMLPanel ui:field="form_unit_fields">
<b:Form type="HORIZONTAL">
<b:Fieldset styleName="{style.noBorder}">
<b:ControlGroup ui:field="cg_select_vre">
<b:ControlLabel for="cl_select_vre">Executed in the Scope</b:ControlLabel>
<b:Controls>
<b:ListBox name="Select a VRE..." b:id="field_select_scope"
ui:field="field_select_scope" readOnly="true">
</b:ListBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="cg_input_task_id">
<b:ControlLabel for="cl_input_task_id">The Algorithm Id</b:ControlLabel>
<b:Controls>
<b:TextBox placeholder="Type the Algorithm Identifier..."
title="This is the Algorithm Identifier..." b:id="field_task_id"
ui:field="field_task_id" readOnly="true"></b:TextBox>
</b:Controls>
</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" readOnly="true"></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" readOnly="true"></b:TextBox>
</b:Controls>
</b:ControlGroup>
</b:WellForm>
</b:Fieldset>
</b:Form>
</g:HTMLPanel>
<b:Pager left="Older" right="Create Configuration and Do Sync"
aligned="true" ui:field="pager" />
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -30,7 +30,7 @@ import com.google.gwt.user.client.ui.Widget;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 9, 2018
*/
public class ShowTaskConfigurationsView extends Composite {
public abstract class ShowTaskConfigurationsView extends Composite {
private static ShowTaskConfigurationViewUiBinder uiBinder =
GWT.create(ShowTaskConfigurationViewUiBinder.class);
@ -45,7 +45,22 @@ public class ShowTaskConfigurationsView extends Composite {
@UiField
FlexTable flex_table_configurations;
private WSItem folder;
private WSItem wsItem;
private TaskConfiguration selectedConfiguration;
/**
* Submit handler.
*/
public abstract void submitHandler();
/**
* Sets the confirm.
*
* @param visible the visible
* @param msg the msg
*/
public abstract void setConfirm(boolean visible, String msg);
/**
@ -59,34 +74,62 @@ public class ShowTaskConfigurationsView extends Composite {
* Note that depending on the widget that is used, it may be necessary to
* implement HasHTML instead of HasText.
*/
public ShowTaskConfigurationsView(WSItem folder, List<TaskConfiguration> listTaskConfigurations) {
this.folder = folder;
public ShowTaskConfigurationsView(final WSItem wsItem, List<TaskConfiguration> listTaskConfigurations) {
this.wsItem = wsItem;
initWidget(uiBinder.createAndBindUi(this));
butt_CreateNewConfiguration.getElement().getStyle().setMarginTop(20, Unit.PX);
flex_table_configurations.setCellSpacing(4);
flex_table_configurations.getElement().getStyle().setMarginTop(10, Unit.PX);
flex_table_configurations.addStyleName("table-fixed");
//flex_table_configurations.setWidget(0, 0, new HTML("<b>Config Id<b>"));
flex_table_configurations.setWidget(0, 0, new HTML("<b>Algorithm Id<b>"));
flex_table_configurations.setWidget(0, 1, new HTML("<b>VRE<b>"));
flex_table_configurations.setWidget(0, 2, new HTML("<b>Owner<b>"));
flex_table_configurations.setWidget(0, 3, new HTML("<b>Oper.<b>"));
flex_table_configurations.setWidget(0, 1, new HTML("<b>N.Par.<b>"));
flex_table_configurations.setWidget(0, 2, new HTML("<b>VRE<b>"));
flex_table_configurations.setWidget(0, 3, new HTML("<b>Owner<b>"));
flex_table_configurations.setWidget(0, 4, new HTML("<b>Oper.<b>"));
flex_table_configurations.setWidget(0, 5, new HTML("<b>Oper.<b>"));
flex_table_configurations.setWidget(0, 6, new HTML("<b>Oper.<b>"));
//flex_table_configurations.getColumnFormatter().setWidth(0, "10%");
flex_table_configurations.getColumnFormatter().setWidth(0, "35%");
flex_table_configurations.getColumnFormatter().setWidth(1, "30%");
flex_table_configurations.getColumnFormatter().setWidth(2, "20%");
flex_table_configurations.getColumnFormatter().setWidth(3, "7%");
flex_table_configurations.getColumnFormatter().setWidth(4, "7%");
flex_table_configurations.getColumnFormatter().setWidth(0, "31%");
flex_table_configurations.getColumnFormatter().setWidth(1, "6%");
flex_table_configurations.getColumnFormatter().setWidth(2, "25%");
flex_table_configurations.getColumnFormatter().setWidth(3, "20%");
flex_table_configurations.getColumnFormatter().setWidth(4, "6%");
flex_table_configurations.getColumnFormatter().setWidth(5, "6%");
flex_table_configurations.getColumnFormatter().setWidth(6, "6%");
//flex_table_configurations.getColumnFormatter().setWidth(5, "7%");
// flt.setWidget(0, 1, new HTML("<b>Description<b>"));
for (int i = 0; i<listTaskConfigurations.size(); i++) {
final TaskConfiguration taskConfiguration = listTaskConfigurations.get(i);
//flex_table_configurations.setWidget(i+1, 0, new HTML(taskConfiguration.getConfigurationKey()));
flex_table_configurations.setWidget(i+1, 0, new HTML(taskConfiguration.getTaskId()));
flex_table_configurations.setWidget(i+1, 1, new HTML(taskConfiguration.getScope().substring(taskConfiguration.getScope().lastIndexOf("/")+1, taskConfiguration.getScope().length())));
flex_table_configurations.setWidget(i+1, 2, new HTML(taskConfiguration.getOwner()));
HTML aId=new HTML(taskConfiguration.getTaskId());
aId.setTitle(taskConfiguration.getTaskId());
flex_table_configurations.setWidget(i+1, 0,aId);
String countParameters = taskConfiguration.getListParameters()!=null?taskConfiguration.getListParameters().size()+"":"0";
HTML params = new HTML(countParameters);
params.setTitle(countParameters + " Parameter/s used by this configuration");
flex_table_configurations.setWidget(i+1, 1, params);
HTML VREName = new HTML(taskConfiguration.getScope().substring(taskConfiguration.getScope().lastIndexOf("/")+1, taskConfiguration.getScope().length()));
VREName.setTitle(taskConfiguration.getScope());
flex_table_configurations.setWidget(i+1, 2, VREName);
flex_table_configurations.setWidget(i+1, 3, new HTML(taskConfiguration.getOwner()));
Button buttRunTask = new Button();
buttRunTask.setIcon(IconType.PLAY_SIGN);
//buttEdit.setType(ButtonType.LINK);
buttRunTask.setTitle("Run this Task Configuration");
buttRunTask.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
}
});
flex_table_configurations.setWidget(i+1, 4, buttRunTask);
Button buttEdit = new Button();
buttEdit.setIcon(IconType.EDIT_SIGN);
//buttEdit.setType(ButtonType.LINK);
@ -99,7 +142,7 @@ public class ShowTaskConfigurationsView extends Composite {
}
});
flex_table_configurations.setWidget(i+1, 3, buttEdit);
flex_table_configurations.setWidget(i+1, 5, buttEdit);
Button buttRemove = new Button();
buttRemove.setIcon(IconType.REMOVE_SIGN);
@ -109,15 +152,26 @@ public class ShowTaskConfigurationsView extends Composite {
@Override
public void onClick(ClickEvent event) {
selectedConfiguration = taskConfiguration;
setConfirm(true, "Deleting che configuration: <br/>"+taskConfiguration+". <br/>Confirm?");
}
});
flex_table_configurations.setWidget(i+1, 4, buttRemove);
flex_table_configurations.setWidget(i+1, 6, buttRemove);
}
}
/**
* Gets the selected configuration.
*
* @return the selected configuration
*/
public TaskConfiguration getSelectedConfiguration(){
return selectedConfiguration;
}
/**
* Adds the custom field event.
*
@ -126,8 +180,17 @@ public class ShowTaskConfigurationsView extends Composite {
@UiHandler("butt_CreateNewConfiguration")
void addCustomFieldEvent(ClickEvent e){
WsTaskExecutorWidget.eventBus.fireEvent(new ShowCreateTaskConfigurationEvent(folder));
WsTaskExecutorWidget.eventBus.fireEvent(new ShowCreateTaskConfigurationEvent(wsItem));
}
/**
* @return the wsItem
*/
public WSItem getWsItem() {
return wsItem;
}
}

View File

@ -8,6 +8,6 @@
<g:FlexTable ui:field="flex_table_configurations">
</g:FlexTable>
<b:Button icon="PLUS_SIGN" title="Create New Configuration"
ui:field="butt_CreateNewConfiguration">Create New Configuration</b:Button>
ui:field="butt_CreateNewConfiguration" type="LINK">Create New Configuration</b:Button>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -47,7 +47,7 @@
}
.my-external-input-width {
width: 430px !important;
width: 425px !important;
}
table.table-fixed {
@ -56,18 +56,18 @@ table.table-fixed {
text-align: center;
padding-top: 12px;
padding-bottom: 12px;
overflow: hidden;
overflow-y: scroll;
}
table.table-fixed tr {
border-bottom: 1px solid #ccc;
text-align: center;
}
table.table-fixed td {
text-overflow: ellipsis;
white-space: nowrap;
border: 1px solid #ddd;
padding: 2px;
text-align: center;
overflow: hidden;
}

View File

@ -12,6 +12,7 @@ import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus;
import org.gcube.common.workspacetaskexecutor.shared.exception.ItemNotConfiguredException;
import org.gcube.common.workspacetaskexecutor.shared.exception.ItemNotExecutableException;
import org.gcube.common.workspacetaskexecutor.shared.exception.WorkspaceFolderLocked;
import org.gcube.common.workspacetaskexecutor.util.EncrypterUtil;
import org.gcube.portlets.widgets.wstaskexecutor.client.rpc.WsTaskExecutorWidgetService;
@ -246,6 +247,22 @@ public class WsTaskExecutorWidgetServiceImpl extends RemoteServiceServlet implem
}
}
/* (non-Javadoc)
* @see org.gcube.common.workspacetaskexecutor.ConfigurableTask#removeTaskConfig(java.lang.Object)
*/
@Override
public Boolean removeTaskConfiguration(TaskConfiguration taskConfiguration) throws ItemNotExecutableException, Exception {
logger.debug("Remove task configuration "+taskConfiguration+ "starts...");
GCubeUser user = PortalContextUtil.getUserLogged(this.getThreadLocalRequest());
if(user.getUsername()!=taskConfiguration.getOwner())
throw new Exception("You has not authorized to delete this configuration. You must be the owner of");
WorkspaceDataMinerTaskExecutor exec = getTaskExecutor();
return exec.removeTaskConfiguration(taskConfiguration);
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wstaskexecutor.client.rpc.WsTaskExecutorWidgetService#getItemTaskConfigurations(java.lang.String)