Updated: Edit and Create New Config
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-task-executor-widget@167750 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
47bdcacedd
commit
e0caeb63d8
|
@ -174,7 +174,7 @@ public class WsTaskExecutorWidget {
|
|||
|
||||
try {
|
||||
if(result){
|
||||
String msg = "Task configuration for Algorithm Id: "+dcEvent.getTaskConf().getTaskId() +"<br/>removed correctly";
|
||||
String msg = "Task configuration for Algorithm: "+dcEvent.getTaskConf().getTaskName() +"<br/><br/>removed correctly";
|
||||
new DialogResult(null, "Delete performed!",msg).center();
|
||||
}
|
||||
showTaskConfigurations(dcEvent.getWsItem());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.client.dialog;
|
||||
|
||||
|
@ -20,13 +20,13 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
* Jan 19, 2018
|
||||
*/
|
||||
public class DialogResult extends DialogBox implements ClickHandler {
|
||||
|
||||
|
||||
/** The dock. */
|
||||
private DockPanel dock = new DockPanel();
|
||||
|
||||
|
||||
/** The close button. */
|
||||
private Button closeButton;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new dialog result.
|
||||
*
|
||||
|
@ -41,15 +41,42 @@ public class DialogResult extends DialogBox implements ClickHandler {
|
|||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
dock.add(new HTML(msg), DockPanel.CENTER);
|
||||
|
||||
|
||||
dock.add(closeButton, DockPanel.SOUTH);
|
||||
if(img!=null)
|
||||
dock.add(img, DockPanel.WEST);
|
||||
|
||||
|
||||
dock.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_RIGHT);
|
||||
setWidget(dock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new dialog result.
|
||||
*
|
||||
* @param img the img
|
||||
* @param title the title
|
||||
* @param widget the widget
|
||||
* @param closeable the closeable
|
||||
*/
|
||||
public DialogResult(Image img, String title, Widget widget, boolean closeable) {
|
||||
getElement().setClassName("gwt-DialogBoxNew");
|
||||
setText(title);
|
||||
closeButton = new Button("Close", this);
|
||||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
dock.add(widget, DockPanel.CENTER);
|
||||
|
||||
dock.add(closeButton, DockPanel.SOUTH);
|
||||
if(img!=null)
|
||||
dock.add(img, DockPanel.WEST);
|
||||
|
||||
dock.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_RIGHT);
|
||||
setWidget(dock);
|
||||
|
||||
closeButton.setVisible(closeable);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the close button.
|
||||
|
@ -67,9 +94,9 @@ public class DialogResult extends DialogBox implements ClickHandler {
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
hide();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the to center panel.
|
||||
*
|
||||
|
|
|
@ -145,7 +145,7 @@ public interface WsTaskExecutorWidgetServiceAsync {
|
|||
* @return the list operators per scope
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
void getListOperatorsPerScope(String scope, AsyncCallback<List<TaskOperator>> asyncCallback) throws Exception;
|
||||
void getListOperatorsPerScope(String scope, AsyncCallback<List<TaskOperator>> asyncCallback);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -351,6 +351,7 @@ public class WsTaskExecutorWidgetViewManager {
|
|||
TaskConfiguration conf = new TaskConfiguration();
|
||||
conf.setScope(getSelectedScope().getScopeName());
|
||||
conf.setTaskId(getTaskId());
|
||||
conf.setTaskName(getTaskName());
|
||||
conf.setTaskDescription(getDescription());
|
||||
conf.setWorkspaceItemId(wsItem.getItemId());
|
||||
conf.setListParameters(getParameters());
|
||||
|
|
|
@ -6,13 +6,16 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOperator;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskParameter;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.dialog.DialogResult;
|
||||
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.event.ShowListOfTaskConfigurationsEvent;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.LoaderIcon;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem;
|
||||
|
||||
|
@ -23,10 +26,11 @@ 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.TextArea;
|
||||
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.dom.client.Document;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.DomEvent;
|
||||
|
@ -34,6 +38,7 @@ 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.HTMLPanel;
|
||||
|
@ -70,20 +75,21 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
|||
ListBox field_select_scope;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_input_task_id;
|
||||
ListBox field_select_task_id;
|
||||
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_select_vre;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_select_task_id;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_parameters_control;
|
||||
|
||||
@UiField
|
||||
Fieldset form_unit_fields;
|
||||
|
||||
@UiField
|
||||
TextBox field_task_id;
|
||||
|
||||
@UiField
|
||||
Controls task_parameters_control;
|
||||
|
||||
|
@ -100,6 +106,8 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
|||
/** The map VR es. */
|
||||
private Map<String, GcubeScope> mapScopes = new HashMap<String, GcubeScope>();
|
||||
|
||||
private Map<String, List<TaskOperator>> mapOperators = new HashMap<String, List<TaskOperator>>();
|
||||
|
||||
private String currentScope;
|
||||
|
||||
public final static HandlerManager eventBus = new HandlerManager(null);
|
||||
|
@ -166,6 +174,185 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
|||
|
||||
bindEvents();
|
||||
|
||||
if(isEditConfiguration){
|
||||
|
||||
String vreName = editConfiguration.getScope().substring(editConfiguration.getScope().lastIndexOf("/")+1, editConfiguration.getScope().length());
|
||||
field_select_scope.addItem(vreName, editConfiguration.getScope());
|
||||
field_select_scope.setSelectedValue(editConfiguration.getScope());
|
||||
|
||||
field_select_task_id.addItem(editConfiguration.getTaskName(), editConfiguration.getTaskId());
|
||||
field_select_task_id.setSelectedValue(editConfiguration.getTaskId());
|
||||
//field_task_id.setValue(editConfiguration.getTaskId());
|
||||
field_task_description.setValue(editConfiguration.getTaskDescription());
|
||||
|
||||
List<TaskParameter> params = editConfiguration.getListParameters();
|
||||
for (TaskParameter taskParameter : params) {
|
||||
appendCustomField(taskParameter.getKey(), taskParameter.getValue(), taskParameter.getType().getType(), false);
|
||||
}
|
||||
|
||||
pager.getRight().setText("Update Configuration");
|
||||
}
|
||||
else{
|
||||
|
||||
WsTaskExecutorWidget.wsTaskService.getListOfScopesForLoggedUser(new AsyncCallback<List<GcubeScope>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<GcubeScope> result) {
|
||||
|
||||
|
||||
for (GcubeScope gcubeScope : result) {
|
||||
String toValue = gcubeScope.getScopeTitle();
|
||||
mapScopes.put(gcubeScope.getScopeName(), gcubeScope);
|
||||
field_select_scope.addItem(toValue, gcubeScope.getScopeName());
|
||||
|
||||
}
|
||||
|
||||
if(result.size()>0){
|
||||
|
||||
// if(isEditConfiguration){
|
||||
// //String vreName = FormatUtil.toVREName(editConfiguration.getScope());
|
||||
// field_select_scope.setSelectedValue(editConfiguration.getScope());
|
||||
// }
|
||||
// else
|
||||
field_select_scope.setSelectedValue(result.get(0).getScopeName());
|
||||
|
||||
//field_select_vre.setSelectedIndex(0);
|
||||
//field_select_vre.fireEvent(DomEvent.fireNativeEvent(nativeEvent, handlerSource););
|
||||
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), field_select_scope);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
addEmptyCustomFieldEvent(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the empty custom field event.
|
||||
*
|
||||
* @param e the e
|
||||
*/
|
||||
@UiHandler("addCustomFieldButton")
|
||||
void addEmptyCustomFieldEvent(ClickEvent e){
|
||||
|
||||
appendCustomField(null, null, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append custom field.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @param parameterType the parameter type
|
||||
* @param removable the removable
|
||||
*/
|
||||
private void appendCustomField(String key, String value, String parameterType, boolean removable){
|
||||
|
||||
CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, key, value, parameterType, removable);
|
||||
customFieldEntriesList.add(toAdd);
|
||||
cg_parameters_control.add(toAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param taskOperator
|
||||
*/
|
||||
private void fillParametersToOperator(TaskOperator taskOperator) {
|
||||
|
||||
customFieldEntriesList.clear();
|
||||
cg_parameters_control.clear();
|
||||
|
||||
for (TaskParameter operator : taskOperator.getInputOperators()) {
|
||||
appendCustomField(operator.getKey(), operator.getValue(), operator.getType().getType(), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void loadAlgorithmsForSelectedScope(){
|
||||
|
||||
final GcubeScope selScope = getSelectedScope();
|
||||
|
||||
if(selScope==null)
|
||||
return;
|
||||
|
||||
List<TaskOperator> operators = mapOperators.get(selScope.getScopeName());
|
||||
|
||||
if(operators!=null){
|
||||
fillSelectOperator(operators);
|
||||
return;
|
||||
}
|
||||
|
||||
LoaderIcon loader = new LoaderIcon("Please wait, loading Algorithms...");
|
||||
final DialogResult loaderBox = new DialogResult(null, "Please wait", loader, false);
|
||||
loaderBox.getElement().getStyle().setZIndex(Integer.MAX_VALUE-5000);
|
||||
pager.getRight().setVisible(false);
|
||||
|
||||
WsTaskExecutorWidget.wsTaskService.getListOperatorsPerScope(selScope.getScopeName(), new AsyncCallback<List<TaskOperator>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
loaderBox.hide();
|
||||
field_select_task_id.setEnabled(false);
|
||||
Window.alert("Error: "+caught.getMessage());
|
||||
pager.getRight().setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<TaskOperator> result) {
|
||||
loaderBox.hide();
|
||||
field_select_task_id.setEnabled(true);
|
||||
if(result==null || result.size()==0){
|
||||
new DialogResult(null, "Warning", "No operator available in the scope: "+selScope.getScopeName()).center();
|
||||
return;
|
||||
}
|
||||
|
||||
pager.getRight().setVisible(true);
|
||||
mapOperators.put(selScope.getScopeName(), result);
|
||||
fillSelectOperator(result);
|
||||
}
|
||||
});
|
||||
|
||||
loaderBox.center();
|
||||
|
||||
}
|
||||
|
||||
private void fillSelectOperator(List<TaskOperator> operators){
|
||||
field_select_task_id.clear();
|
||||
for (TaskOperator taskOperator : operators) {
|
||||
field_select_task_id.addItem(taskOperator.getName(), taskOperator.getId());
|
||||
}
|
||||
|
||||
if(isEditConfiguration){
|
||||
//String vreName = FormatUtil.toVREName(editConfiguration.getScope());
|
||||
field_select_task_id.setSelectedValue(editConfiguration.getTaskId());
|
||||
}
|
||||
|
||||
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), field_select_task_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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());
|
||||
cg_parameters_control.remove(event.getRemovedEntry());
|
||||
}
|
||||
});
|
||||
|
||||
pager.getLeft().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -187,110 +374,54 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
WsTaskExecutorWidget.wsTaskService.getListOfScopesForLoggedUser(new AsyncCallback<List<GcubeScope>>() {
|
||||
field_select_scope.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<GcubeScope> result) {
|
||||
public void onChange(ChangeEvent event) {
|
||||
|
||||
loadAlgorithmsForSelectedScope();
|
||||
}
|
||||
});
|
||||
|
||||
for (GcubeScope gcubeScope : result) {
|
||||
String toValue = gcubeScope.getScopeTitle();
|
||||
mapScopes.put(gcubeScope.getScopeName(), gcubeScope);
|
||||
field_select_scope.addItem(toValue, gcubeScope.getScopeName());
|
||||
field_select_task_id.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
|
||||
if(result.size()>0){
|
||||
|
||||
if(isEditConfiguration){
|
||||
//String vreName = FormatUtil.toVREName(editConfiguration.getScope());
|
||||
field_select_scope.setSelectedValue(editConfiguration.getScope());
|
||||
setValueDescription("");
|
||||
String taskId = getTaskId();
|
||||
GWT.log("Task Id: "+taskId);
|
||||
GcubeScope selScope = getSelectedScope();
|
||||
List<TaskOperator> operators = mapOperators.get(selScope.getScopeName());
|
||||
GWT.log("Operatos for scope '"+selScope.getScopeName() +"' are: "+operators);
|
||||
for (TaskOperator taskOperator : operators) {
|
||||
if(taskId.compareTo(taskOperator.getId())==0){
|
||||
setValueDescription(taskOperator.getBriefDescription());
|
||||
fillParametersToOperator(taskOperator);
|
||||
}
|
||||
else
|
||||
field_select_scope.setSelectedValue(result.get(0).getScopeName());
|
||||
|
||||
//field_select_vre.setSelectedIndex(0);
|
||||
//field_select_vre.fireEvent(DomEvent.fireNativeEvent(nativeEvent, handlerSource););
|
||||
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), field_select_scope);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if(isEditConfiguration){
|
||||
|
||||
field_task_id.setValue(editConfiguration.getTaskId());
|
||||
field_task_description.setValue(editConfiguration.getTaskDescription());
|
||||
|
||||
List<TaskParameter> params = editConfiguration.getListParameters();
|
||||
for (TaskParameter taskParameter : params) {
|
||||
appendCustomField(taskParameter.getKey(), taskParameter.getValue(), taskParameter.getType().getType());
|
||||
}
|
||||
|
||||
pager.getRight().setText("Update Configuration");
|
||||
}
|
||||
else
|
||||
addEmptyCustomFieldEvent(null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the empty custom field event.
|
||||
*
|
||||
* @param e the e
|
||||
*/
|
||||
@UiHandler("addCustomFieldButton")
|
||||
void addEmptyCustomFieldEvent(ClickEvent e){
|
||||
private void setValueDescription(String value) {
|
||||
|
||||
appendCustomField(null, null, null);
|
||||
field_task_description.setValue(value);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Append custom field.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @param parameterType the parameter type
|
||||
*/
|
||||
private void appendCustomField(String key, String value, String parameterType){
|
||||
|
||||
CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, key, value, parameterType);
|
||||
customFieldEntriesList.add(toAdd);
|
||||
cg_parameters_control.add(toAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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());
|
||||
cg_parameters_control.remove(event.getRemovedEntry());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate submit.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
protected boolean validateSubmit() {
|
||||
cg_input_task_id.setType(ControlGroupType.NONE);
|
||||
cg_select_task_id.setType(ControlGroupType.NONE);
|
||||
//cg_parameters_control.setType(ControlGroupType.NONE);
|
||||
//cg_remote_path.setType(ControlGroupType.NONE);
|
||||
|
||||
|
@ -300,9 +431,9 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
|||
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!");
|
||||
if(field_select_scope.getSelectedItemText() == null || field_select_scope.getSelectedItemText().isEmpty()){
|
||||
cg_select_task_id.setType(ControlGroupType.ERROR);
|
||||
setError(true, "You must select an Algorithm!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -338,10 +469,22 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
|||
* @return the task id
|
||||
*/
|
||||
public String getTaskId(){
|
||||
return field_task_id.getValue();
|
||||
String taskId = field_select_task_id.getSelectedValue();
|
||||
GWT.log("Selected task Id: "+taskId);
|
||||
return taskId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the task name.
|
||||
*
|
||||
* @return the task name
|
||||
*/
|
||||
public String getTaskName(){
|
||||
return field_select_task_id.getSelectedItemText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parameters.
|
||||
*
|
||||
|
@ -369,7 +512,6 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the isEditConfiguration
|
||||
*/
|
||||
|
@ -386,4 +528,5 @@ public abstract class CreateTaskConfigurationView extends Composite {
|
|||
|
||||
return editConfiguration;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,14 +20,24 @@
|
|||
</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:ControlGroup ui:field="cg_select_task_id">
|
||||
<b:ControlLabel for="cl_select_task_id">The Algorithm</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox placeholder="The Operator ID indexed in the DataMiner service provided by e-Infrastructure"
|
||||
title="This is the Operator ID that will be executed" b:id="field_task_id"
|
||||
ui:field="field_task_id" addStyleNames="my-external-input-width"></b:TextBox>
|
||||
<b:ListBox name="Select the Algorithm..." b:id="field_select_task_id"
|
||||
ui:field="field_select_task_id" addStyleNames="my-external-select-width">
|
||||
</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="The Operator ID indexed in the DataMiner service provided by e-Infrastructure" -->
|
||||
<!-- title="This is the Operator ID that will be executed" b:id="field_task_id" -->
|
||||
<!-- ui:field="field_task_id" addStyleNames="my-external-input-width"></b:TextBox> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
<b:ControlGroup ui:field="cg_input_task_descritption">
|
||||
<b:ControlLabel for="cl_input_task_descritption">Description</b:ControlLabel>
|
||||
<b:Controls>
|
||||
|
|
|
@ -72,7 +72,7 @@ public class CustomFieldEntry extends Composite {
|
|||
* @param value the value
|
||||
* @param parameterType the parameter type
|
||||
*/
|
||||
public CustomFieldEntry(HandlerManager eventBus, String key, String value, final String parameterType) {
|
||||
public CustomFieldEntry(HandlerManager eventBus, String key, String value, final String parameterType, boolean removable) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||
this.getElement().getStyle().setMarginBottom(20, Unit.PX);
|
||||
|
@ -127,6 +127,8 @@ public class CustomFieldEntry extends Composite {
|
|||
|
||||
field_select_parameter.setEnabled(false);
|
||||
|
||||
removeCustomField.setVisible(removable);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.workspacetaskexecutor.dataminer.WorkspaceDataMinerTaskExecutor;
|
||||
|
@ -322,21 +323,25 @@ public class WsTaskExecutorWidgetServiceImpl extends RemoteServiceServlet implem
|
|||
|
||||
WorkspaceDataMinerTaskExecutor exec = getTaskExecutor();
|
||||
String originalScope = ScopeProvider.instance.get();
|
||||
String originalToken = SecurityTokenProvider.instance.get();
|
||||
|
||||
try{
|
||||
|
||||
GCubeUser user = PortalContextUtil.getUserLogged(this.getThreadLocalRequest());
|
||||
String token = PortalContextUtil.getTokenFor(scope, user.getUsername());
|
||||
ScopeProvider.instance.set(scope);
|
||||
SecurityTokenProvider.instance.set(token);
|
||||
return exec.getListOperators();
|
||||
|
||||
}catch(Exception e){
|
||||
|
||||
logger.error("Error on getting list of Operators for scope: "+scope,e);
|
||||
throw new Exception("It is not possible to get list of Operators in the scope: "+scope +". Please, check if a DataMiner is available for this scope");
|
||||
}finally{
|
||||
if(originalScope!=null)
|
||||
ScopeProvider.instance.set(originalScope);
|
||||
|
||||
if(originalToken!=null)
|
||||
SecurityTokenProvider.instance.set(originalToken);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue