Question: How to render a tool form with predefined parameters?
0
gravatar for Evgeny Anatskiy
9 months ago by
Evgeny Anatskiy0 wrote:

The goal is to update the form:

enter image description here

And get the following:

enter image description here


After creating a form:

var toolForm = new ToolForm.View({
    id: tool.get('id'),
    version: tool.get('version')
});

toolForm.deferred.execute(function() {
    Galaxy.app.display(toolForm);
});

I'm trying to redraw it with non-default parameters (i.e., Cut columns: c3):

var form = toolForm.form;
form.deferred.reset();
form.deferred.execute(function(process) {
    me._updateModel(form, process);
});

...

_updateModel: function(form, process) {
    var currentState = {
        tool_id: this.toolId,
        tool_version: this.toolVersion,
        inputs: $.extend(true, {}, form.data.create())
    };

    currentState.inputs.columnList = 'c3';

    Utils.request({
        url: Galaxy.root + 'api/tools/' + this.toolId + '/build',
        type: 'POST',
        data: currentState,
        success: function(newModel) {
            window.newModel = newModel;
            form.update(newModel['tool_model'] || newModel);
            form.options.update && form.options.update(newModel);
            ...
         }
    });
    ...
}

In the response from the server, I can see the changed parameter, but the field itself (Cut columns) is not refreshed.

The question is: how to refresh all the fields with new parameters so that the form after pressing the Execute button would send correct (updated) parameters?

P.S. I was looking into client/galaxy/scripts/mvc/tool/tool-form-base.js to see how forms are being updated.

tool galaxy • 239 views
ADD COMMENTlink modified 9 months ago by aysam.guerler70 • written 9 months ago by Evgeny Anatskiy0
0
gravatar for aysam.guerler
9 months ago by
United States
aysam.guerler70 wrote:

One option is to parse the value through the url e.g. https://usegalaxy.org/root?tool_id=Cut1&columnList=c3.

ADD COMMENTlink written 9 months ago by aysam.guerler70
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 82 users visited in the last hour