diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java index 67dc454..d24ea76 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java @@ -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() { + + @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); } }); diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/DeleteConfigurationEvent.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/DeleteConfigurationEvent.java new file mode 100644 index 0000000..07251f4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/DeleteConfigurationEvent.java @@ -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 { + public static Type TYPE = new Type(); + + 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 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; + } +} diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/DeleteConfigurationEventHandler.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/DeleteConfigurationEventHandler.java new file mode 100644 index 0000000..b49ec8f --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/DeleteConfigurationEventHandler.java @@ -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); +} diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEvent.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEvent.java index fec1099..d8d569d 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEvent.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEvent.java @@ -19,15 +19,15 @@ public class ShowCreateTaskConfigurationEvent extends GwtEvent TYPE = new Type(); - 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 getItemTaskConfigurations(String itemId) throws Exception; + + /** + * @param taskConfiguration + * @return + * @throws ItemNotExecutableException + * @throws Exception + */ + Boolean removeTaskConfiguration(TaskConfiguration taskConfiguration) + throws ItemNotExecutableException, Exception; } diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/rpc/WsTaskExecutorWidgetServiceAsync.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/rpc/WsTaskExecutorWidgetServiceAsync.java index 36ed455..e266f77 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/rpc/WsTaskExecutorWidgetServiceAsync.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/rpc/WsTaskExecutorWidgetServiceAsync.java @@ -116,4 +116,14 @@ public interface WsTaskExecutorWidgetServiceAsync { * @return the item task configurations */ void getItemTaskConfigurations(String itemId, AsyncCallback> asyncCallback); + + + /** + * Removes the task configuration. + * + * @param taskConfiguration the task configuration + * @param asyncCallback the async callback + */ + void removeTaskConfiguration(TaskConfiguration taskConfiguration, AsyncCallback asyncCallback); + } diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/WsTaskExecutorWidgetViewManager.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/WsTaskExecutorWidgetViewManager.java index d31a196..60d1111 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/WsTaskExecutorWidgetViewManager.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/WsTaskExecutorWidgetViewManager.java @@ -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(); diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/AbstractViewDialogBox.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/AbstractViewDialogBox.java index 13c1425..769196b 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/AbstractViewDialogBox.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/AbstractViewDialogBox.java @@ -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); } }; diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CustomFieldEntry.ui.xml b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CustomFieldEntry.ui.xml index 1a8d70b..51bf193 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CustomFieldEntry.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CustomFieldEntry.ui.xml @@ -25,7 +25,7 @@ + ui:field="removeCustomField" type="LINK"> diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationView.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationView.java deleted file mode 100644 index 8355d91..0000000 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationView.java +++ /dev/null @@ -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 { - } - - /** 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 mapScopes = new HashMap(); - - - - 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: - * - * Hello! - * - * 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); - } - - - - -} diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationView.ui.xml b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationView.ui.xml deleted file mode 100644 index 0edb2ad..0000000 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationView.ui.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - .noBorder { - border: 0px; - } - - - - - - - - Executed in the Scope - - - - - - - - The Algorithm Id - - - - - - With Parameter - - - Parameter Key - - - - - - Parameter Value - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.java index 4343251..de7d4bd 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.java @@ -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 listTaskConfigurations) { - this.folder = folder; - + public ShowTaskConfigurationsView(final WSItem wsItem, List 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("Config Id")); flex_table_configurations.setWidget(0, 0, new HTML("Algorithm Id")); - flex_table_configurations.setWidget(0, 1, new HTML("VRE")); - flex_table_configurations.setWidget(0, 2, new HTML("Owner")); - flex_table_configurations.setWidget(0, 3, new HTML("Oper.")); + flex_table_configurations.setWidget(0, 1, new HTML("N.Par.")); + flex_table_configurations.setWidget(0, 2, new HTML("VRE")); + flex_table_configurations.setWidget(0, 3, new HTML("Owner")); flex_table_configurations.setWidget(0, 4, new HTML("Oper.")); + flex_table_configurations.setWidget(0, 5, new HTML("Oper.")); + flex_table_configurations.setWidget(0, 6, new HTML("Oper.")); //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("Description")); for (int i = 0; i"+taskConfiguration+".
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; + } + } diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.ui.xml b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.ui.xml index 89801ed..4159e82 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.ui.xml @@ -8,6 +8,6 @@ Create New Configuration + ui:field="butt_CreateNewConfiguration" type="LINK">Create New Configuration \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/public/WsTaskExecutorWidget.css b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/public/WsTaskExecutorWidget.css index 056821e..3fb99f3 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/public/WsTaskExecutorWidget.css +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/public/WsTaskExecutorWidget.css @@ -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; } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/server/WsTaskExecutorWidgetServiceImpl.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/server/WsTaskExecutorWidgetServiceImpl.java index 272c242..f2a2ae0 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/server/WsTaskExecutorWidgetServiceImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/server/WsTaskExecutorWidgetServiceImpl.java @@ -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)