11 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/6eccc509c109/ Changeset: 6eccc509c109 Branch: next-stable User: dannon Date: 2014-12-04 16:38:16+00:00 Summary: Sanitize all user fields in cloud/index.mako Affected #: 1 file diff -r 29b2c328b89b6634c9a3f9a21c2349105a7e485a -r 6eccc509c109c87889d80ba745d97cfa425e0ce4 templates/webapps/galaxy/cloud/index.mako --- a/templates/webapps/galaxy/cloud/index.mako +++ b/templates/webapps/galaxy/cloud/index.mako @@ -218,7 +218,7 @@ </div> %if share_string: - <input type='hidden' name='share_string' value='${share_string}'/> + <input id="dbremove_share_string" type='hidden' name='share_string' value='${share_string | h}'/> %else: <!-- DBEDIT temporary hide share string due to it being broken on the cloudman end --><div class="form-row" style="display:none;"> @@ -228,11 +228,11 @@ %endif %if ami: - <input type='hidden' name='ami' value='${ami}'/> + <input type='hidden' name='ami' value='${ami | h}'/> %endif %if bucket_default: - <input type='hidden' name='bucket_default' value='${bucket_default}'/> + <input type='hidden' name='bucket_default' value='${bucket_default | h}'/> %endif <div class="form-row"> https://bitbucket.org/galaxy/galaxy-central/commits/90d3d1205ef0/ Changeset: 90d3d1205ef0 Branch: next-stable User: dannon Date: 2014-12-04 16:51:46+00:00 Summary: Remove unused cloud/run.mako; all functionality is rolled into cloud/index. Affected #: 1 file diff -r 6eccc509c109c87889d80ba745d97cfa425e0ce4 -r 90d3d1205ef0211ce2f459e2832c6bad2737d924 templates/webapps/galaxy/cloud/run.mako --- a/templates/webapps/galaxy/cloud/run.mako +++ /dev/null @@ -1,41 +0,0 @@ -<%inherit file="/webapps/galaxy/base_panels.mako"/> - -<%def name="init()"> -<% - self.has_left_panel=False - self.has_right_panel=False - self.active_view="shared" - self.message_box_visible=False -%> -</%def> - - -<%def name="center_panel()"> - <div style="overflow: auto; height: 100%;"> - <div class="page-container" style="padding: 10px;"> - <h2>Launching a Galaxy Cloud Instance</h2> -%if error: - <p>${error}</p> -%elif instance: - %if kp_material: - <h3>Very Important Key Pair Information</h3> - <p>A new key pair named '${kp_name}' has been created in your AWS - account and will be used to access this instance via ssh. It is - <strong>very important</strong> that you save the following private key - as it is not saved on this Galaxy instance and will be permanently lost - once you leave this page. To do this, save the following key block as - a plain text file named '${kp_name}'.</p> - <pre>${kp_material}</pre> - %endif - <p>The instance '${instance.id} has been successfully launched using the - '${instance.image_id}' AMI.<br/> Access it at <a - href="http://${instance.public_dns_name}">http://${instance.public_dns_name}</a></p> - <p>SSH access is available using your private key '${kp_name}'.</p> -%else: - <p> Unknown failure, no instance. Please refer to your AWS console at <a - href="https://console.aws.amazon.com">https://console.aws.amazon.com</a></p> -%endif - </div> - </div> -</%def> - https://bitbucket.org/galaxy/galaxy-central/commits/54e5ea026a4a/ Changeset: 54e5ea026a4a Branch: next-stable User: dannon Date: 2014-12-04 17:05:07+00:00 Summary: Don't trust user email rendered into page unescaped for Raven. Affected #: 1 file diff -r 90d3d1205ef0211ce2f459e2832c6bad2737d924 -r 54e5ea026a4aaad0f4fd1228c63c77c15327afa4 templates/base/base_panels.mako --- a/templates/base/base_panels.mako +++ b/templates/base/base_panels.mako @@ -45,7 +45,7 @@ <script> Raven.config('${app.config.sentry_dsn_public}').install(); %if trans.user: - Raven.setUser( { email: "${trans.user.email}" } ); + Raven.setUser( { email: "${trans.user.email | h}" } ); %endif </script> %endif https://bitbucket.org/galaxy/galaxy-central/commits/3ecb6b58e88a/ Changeset: 3ecb6b58e88a Branch: next-stable User: dannon Date: 2014-12-04 17:05:23+00:00 Summary: Trim trailing whitespace. Affected #: 1 file diff -r 54e5ea026a4aaad0f4fd1228c63c77c15327afa4 -r 3ecb6b58e88aeac8db48253e585df2aa429f39dc templates/base/base_panels.mako --- a/templates/base/base_panels.mako +++ b/templates/base/base_panels.mako @@ -13,7 +13,7 @@ self.body_class="" self.require_javascript=False %> - + <%def name="init()"> ## Override </%def> @@ -62,7 +62,7 @@ 'libs/require', "mvc/ui" )} - + <script type="text/javascript"> ## global configuration object var galaxy_config = @@ -112,14 +112,14 @@ 'galaxy.panels' )} <script type="text/javascript"> - + ensure_dd_helper(); - + %if self.has_left_panel: var lp = new Panel( { panel: $("#left"), center: $("#center"), drag: $("#left > .unified-panel-footer > .drag" ), toggle: $("#left > .unified-panel-footer > .panel-collapse" ) } ); force_left_panel = function( x ) { lp.force_panel( x ) }; %endif - + %if self.has_right_panel: var rp = new Panel( { panel: $("#right"), center: $("#center"), drag: $("#right > .unified-panel-footer > .drag" ), toggle: $("#right > .unified-panel-footer > .panel-collapse" ), right: true } ); window.handle_minwidth_hint = function( x ) { rp.handle_minwidth_hint( x ) }; @@ -134,7 +134,7 @@ ga('create', '${app.config.ga_code}', 'auto'); ga('send', 'pageview'); %endif - + </script> ## Handle AJAX (actually hidden iframe) upload tool <script type="text/javascript"> @@ -300,7 +300,7 @@ ## Document <html><!--base_panels.mako--> - ${self.init()} + ${self.init()} <head> %if app.config.brand: <title>${self.title()} / ${app.config.brand}</title> @@ -316,7 +316,7 @@ ${self.javascripts()} ${self.javascript_app()} </head> - + <% body_class = self.body_class if self.message_box_visible: https://bitbucket.org/galaxy/galaxy-central/commits/738a4cbb6ed3/ Changeset: 738a4cbb6ed3 Branch: next-stable User: dannon Date: 2014-12-04 18:07:03+00:00 Summary: Cleanup of show_params while looking for bugs. Affected #: 1 file diff -r 3ecb6b58e88aeac8db48253e585df2aa429f39dc -r 738a4cbb6ed3189a80202f4be53726542b516239 lib/galaxy/webapps/galaxy/controllers/dataset.py --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -932,7 +932,7 @@ @web.expose def show_params( self, trans, dataset_id=None, from_noframe=None, **kwd ): """ - Show the parameters used for an HDA + Show the parameters used for the job associated with an HDA """ hda = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( dataset_id ) ) if not hda: @@ -961,19 +961,31 @@ toolbox = self.get_toolbox() tool = toolbox.get_tool( job.tool_id ) assert tool is not None, 'Requested tool has not been loaded.' - #Load parameter objects, if a parameter type has changed, it's possible for the value to no longer be valid + # Load parameter objects, if a parameter type has changed, it's possible for the value to no longer be valid try: params_objects = job.get_param_values( trans.app, ignore_errors=False ) except: params_objects = job.get_param_values( trans.app, ignore_errors=True ) - upgrade_messages = tool.check_and_update_param_values( job.get_param_values( trans.app, ignore_errors=True ), trans, update_values=False ) #use different param_objects here, since we want to display original values as much as possible + # use different param_objects in the following line, since we want to display original values as much as possible + upgrade_messages = tool.check_and_update_param_values( job.get_param_values( trans.app, + ignore_errors=True ), + trans, + update_values=False ) has_parameter_errors = True except: pass if job is None: return trans.show_error_message( "Job information is not available for this dataset." ) - #TODO: we should provide the basic values along with the objects, in order to better handle reporting of old values during upgrade - return trans.fill_template( "show_params.mako", inherit_chain=inherit_chain, history=trans.get_history(), hda=hda, job=job, tool=tool, params_objects=params_objects, upgrade_messages=upgrade_messages, has_parameter_errors=has_parameter_errors ) + # TODO: we should provide the basic values along with the objects, in order to better handle reporting of old values during upgrade + return trans.fill_template( "show_params.mako", + inherit_chain=inherit_chain, + history=trans.get_history(), + hda=hda, + job=job, + tool=tool, + params_objects=params_objects, + upgrade_messages=upgrade_messages, + has_parameter_errors=has_parameter_errors ) @web.expose def copy_datasets( self, trans, source_history=None, source_content_ids="", target_history_id=None, target_history_ids="", new_history_name="", do_copy=False, **kwd ): https://bitbucket.org/galaxy/galaxy-central/commits/84bf14a4e9de/ Changeset: 84bf14a4e9de Branch: next-stable User: dannon Date: 2014-12-04 18:10:37+00:00 Summary: Catch ValueError and actually log it instead of blowing up w/ invalid dataset_id. Raise httpexception. Affected #: 1 file diff -r 738a4cbb6ed3189a80202f4be53726542b516239 -r 84bf14a4e9de8bb7a27411933c28fdc237b75a52 lib/galaxy/webapps/galaxy/controllers/dataset.py --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -934,9 +934,12 @@ """ Show the parameters used for the job associated with an HDA """ - hda = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( dataset_id ) ) + try: + hda = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( dataset_id ) ) + except ValueError: + hda = None if not hda: - raise paste.httpexceptions.HTTPRequestRangeNotSatisfiable( "Invalid reference dataset id: %s." % str( dataset_id ) ) + raise paste.httpexceptions.HTTPRequestRangeNotSatisfiable( "Invalid reference dataset id: %s." % escape( str( dataset_id ) ) ) if not self._can_access_dataset( trans, hda ): return trans.show_error_message( "You are not allowed to access this dataset" ) @@ -967,8 +970,7 @@ except: params_objects = job.get_param_values( trans.app, ignore_errors=True ) # use different param_objects in the following line, since we want to display original values as much as possible - upgrade_messages = tool.check_and_update_param_values( job.get_param_values( trans.app, - ignore_errors=True ), + upgrade_messages = tool.check_and_update_param_values( job.get_param_values( trans.app, ignore_errors=True ), trans, update_values=False ) has_parameter_errors = True https://bitbucket.org/galaxy/galaxy-central/commits/502ee96ed98d/ Changeset: 502ee96ed98d Branch: next-stable User: dannon Date: 2014-12-04 19:04:52+00:00 Summary: Cleanup of search functionality while hunting bugs. Affected #: 3 files diff -r 84bf14a4e9de8bb7a27411933c28fdc237b75a52 -r 502ee96ed98d74e31844dc601599fd4c10006090 lib/galaxy/webapps/galaxy/controllers/search.py --- a/lib/galaxy/webapps/galaxy/controllers/search.py +++ b/lib/galaxy/webapps/galaxy/controllers/search.py @@ -1,4 +1,3 @@ - """ Contains a basic search interface for Galaxy """ @@ -8,7 +7,8 @@ log = logging.getLogger( __name__ ) + class SearchController( BaseUIController ): @web.expose def index(self, trans): - return trans.fill_template( "search/index.mako") + return trans.fill_template( "search/index.mako" ) diff -r 84bf14a4e9de8bb7a27411933c28fdc237b75a52 -r 502ee96ed98d74e31844dc601599fd4c10006090 templates/search/index.mako --- a/templates/search/index.mako +++ b/templates/search/index.mako @@ -17,9 +17,9 @@ ${parent.stylesheets()} <style> .searchResult { - border-style:dashed; - border-width:1px; - margin: 5px; + border-style:dashed; + border-width:1px; + margin: 5px; } </style> @@ -30,17 +30,17 @@ <script type="text/javascript"> var search_format_output = function(doc) { - var div_class = "historyItem"; - var a = $("<div class='" + div_class + "'>") - a.append($("<div>").append(doc['model_class'])); - b = a.append( $("<div class='historyItemTitle'><a href='/file/" + doc['id'] + "'>" + doc['name'] + "</a></div>") ); - if ('misc_blurb' in doc) { - b.append( $("<div>").append(doc["misc_blurb"]) ); - } - if ('peek' in doc) { - b.append( $("<pre class='peek'>").append( doc["peek"]) ); - } - return a; + var div_class = "historyItem"; + var a = $("<div class='" + div_class + "'>") + a.append($("<div>").append(doc['model_class'])); + b = a.append( $("<div class='historyItemTitle'><a href='/file/" + doc['id'] + "'>" + doc['name'] + "</a></div>") ); + if ('misc_blurb' in doc) { + b.append( $("<div>").append(doc["misc_blurb"]) ); + } + if ('peek' in doc) { + b.append( $("<pre class='peek'>").append( doc["peek"]) ); + } + return a; } </script> diff -r 84bf14a4e9de8bb7a27411933c28fdc237b75a52 -r 502ee96ed98d74e31844dc601599fd4c10006090 templates/search/search.mako --- a/templates/search/search.mako +++ b/templates/search/search.mako @@ -2,7 +2,7 @@ <%def name="search_init()"> ${h.js( - 'libs/jquery/jquery', + 'libs/jquery/jquery', )} </%def> @@ -12,54 +12,54 @@ <script type="text/javascript"> function doSearch(query) { - if (query.length > 1) { - var url = "/api/search"; - $.ajax({ - type : 'POST', - url: url, - data: JSON.stringify({"query" : query }), - contentType : 'application/json', - dataType : 'json', - success : function(data) { - var p = $("#output"); - p.empty(); - for(var i in data) { - var e = ${output_format}(data[i]); - p.append(e); - } - } - }); - } + if (query.length > 1) { + var url = "/api/search"; + $.ajax({ + type : 'POST', + url: url, + data: JSON.stringify({"query" : query }), + contentType : 'application/json', + dataType : 'json', + success : function(data) { + var p = $("#output"); + p.empty(); + for(var i in data) { + var e = ${output_format}(data[i]); + p.append(e); + } + } + }); + } }; $(document).ready( function() { - $("#search_button").click(function() { - doSearch($("#search_text").val()); - }); - $('#search_text').keyup(function(e){ - if(e.keyCode == 13) { - doSearch($("#search_text").val()); - } - }); - doSearch($("#search_text").val()); + $("#search_button").click(function() { + doSearch($("#search_text").val()); + }); + $('#search_text').keyup(function(e){ + if(e.keyCode == 13) { + doSearch($("#search_text").val()); + } + }); + doSearch($("#search_text").val()); }); var queryURL = function (query) { - var url = "/api/search" + encodeURIComponent(query); - url = url + "&field=" + $("#searchFields").val(); - if ($("#fileType").val() != "All") { - url = url + "&type=" + $("#fileType").val() - } - return url; + var url = "/api/search" + encodeURIComponent(query); + url = url + "&field=" + $("#searchFields").val(); + if ($("#fileType").val() != "All") { + url = url + "&type=" + $("#fileType").val() + } + return url; } </script><div id="search_box" style="margin: 20px;"> - <input type="text" id="search_text" size="90"/> + <input type="text" id="search_text" size="90"/></div><div style="margin: 20px;"> - <input type="button" id="search_button" value="Search"/> + <input type="button" id="search_button" value="Search"/></div><div id="output"></div> https://bitbucket.org/galaxy/galaxy-central/commits/02681fa23902/ Changeset: 02681fa23902 Branch: next-stable User: dannon Date: 2014-12-04 20:23:35+00:00 Summary: Fix search to work for at least datasets, hdas, etc. Affected #: 2 files diff -r 502ee96ed98d74e31844dc601599fd4c10006090 -r 02681fa23902d774892634cbbe5c9fbaf26f0846 templates/search/index.mako --- a/templates/search/index.mako +++ b/templates/search/index.mako @@ -1,52 +1,112 @@ - <%inherit file="/webapps/galaxy/base_panels.mako"/> -<%namespace file="/search/search.mako" import="search_init" /> -<%namespace file="/search/search.mako" import="search_dialog" /><%def name="init()"> -<% - self.has_left_panel=False - self.has_right_panel=False - self.message_box_visible=False - self.active_view="shared" - self.overlay_visible=False -%> + <% + self.has_left_panel=False + self.has_right_panel=False + self.message_box_visible=False + self.active_view="shared" + self.overlay_visible=False + %></%def><%def name="stylesheets()"> -${parent.stylesheets()} -<style> -.searchResult { - border-style:dashed; - border-width:1px; - margin: 5px; -} -</style> + ${parent.stylesheets()} + <style> + .searchResult { + border-style:dashed; + border-width:1px; + margin: 5px; + } + </style> +</%def> + + +<%def name="javascripts()"> + ${parent.javascripts()} + ${h.js( + "libs/jquery/jquery", + )} + <script type="text/javascript"> + + function search_format_output(doc) { + var div_class = "historyItem"; + var a = $("<div class='" + div_class + "'>") + a.append($("<div>").append(doc['model_class'])); + b = a.append( $("<div class='historyItemTitle'><a href='/file/" + doc['id'] + "'>" + doc['name'] + "</a></div>") ); + if ('misc_blurb' in doc) { + b.append( $("<div>").append(doc["misc_blurb"]) ); + } + if ('peek' in doc) { + b.append( $("<pre class='peek'>").append( doc["peek"]) ); + } + return a; + } + + function doSearch(query) { + if (query.length > 1) { + var url = "/api/search"; + $.ajax({ + type : 'POST', + url: url, + data: JSON.stringify({"query" : query }), + contentType : 'application/json', + dataType : 'json', + success : function(data) { + var p = $("#output"); + p.empty(); + _.each(data.results, function(doc){ + var div_class = "historyItem"; + var a = $("<div class='" + div_class + "'>") + a.append($("<div>").append(doc['model_class'])); + b = a.append( $("<div class='historyItemTitle'><a href='/file/" + doc['id'] + "'>" + doc['name'] + "</a></div>") ); + if ('misc_blurb' in doc) { + b.append( $("<div>").append(doc["misc_blurb"]) ); + } + if ('peek' in doc) { + b.append( $("<pre class='peek'>").append( doc["peek"]) ); + } + p.append(b); + }); + } + }); + } + }; + + + var queryURL = function (query) { + var url = "/api/search" + encodeURIComponent(query); + url = url + "&field=" + $("#searchFields").val(); + if ($("#fileType").val() != "All") { + url = url + "&type=" + $("#fileType").val() + } + return url; + } + + $(document).ready( function() { + $("#search_button").click(function() { + doSearch($("#search_text").val()); + }); + $('#search_text').keyup(function(e){ + if(e.keyCode == 13) { + doSearch($("#search_text").val()); + } + }); + doSearch($("#search_text").val()); + }); + </script></%def> + <%def name="center_panel()"> -${search_init()} -<script type="text/javascript"> -var search_format_output = function(doc) { - var div_class = "historyItem"; - var a = $("<div class='" + div_class + "'>") - a.append($("<div>").append(doc['model_class'])); - b = a.append( $("<div class='historyItemTitle'><a href='/file/" + doc['id'] + "'>" + doc['name'] + "</a></div>") ); - if ('misc_blurb' in doc) { - b.append( $("<div>").append(doc["misc_blurb"]) ); - } - if ('peek' in doc) { - b.append( $("<pre class='peek'>").append( doc["peek"]) ); - } - return a; -} + <div id="search_box" style="margin: 20px;"> + <input type="text" id="search_text" size="90"/> + </div> + <div style="margin: 20px;"> + <input type="button" id="search_button" value="Search"/> + </div> + <div id="output"></div> -</script> -<div style="overflow: auto; height: 100%"> -${search_dialog("search_format_output")} -</div></%def> - - diff -r 502ee96ed98d74e31844dc601599fd4c10006090 -r 02681fa23902d774892634cbbe5c9fbaf26f0846 templates/search/search.mako --- a/templates/search/search.mako +++ /dev/null @@ -1,68 +0,0 @@ - -<%def name="search_init()"> - - ${h.js( - 'libs/jquery/jquery', -)} - -</%def> - -<%def name="search_dialog(output_format)"> - -<script type="text/javascript"> - -function doSearch(query) { - if (query.length > 1) { - var url = "/api/search"; - $.ajax({ - type : 'POST', - url: url, - data: JSON.stringify({"query" : query }), - contentType : 'application/json', - dataType : 'json', - success : function(data) { - var p = $("#output"); - p.empty(); - for(var i in data) { - var e = ${output_format}(data[i]); - p.append(e); - } - } - }); - } -}; - -$(document).ready( function() { - $("#search_button").click(function() { - doSearch($("#search_text").val()); - }); - $('#search_text').keyup(function(e){ - if(e.keyCode == 13) { - doSearch($("#search_text").val()); - } - }); - doSearch($("#search_text").val()); -}); - -var queryURL = function (query) { - var url = "/api/search" + encodeURIComponent(query); - url = url + "&field=" + $("#searchFields").val(); - if ($("#fileType").val() != "All") { - url = url + "&type=" + $("#fileType").val() - } - return url; -} - -</script> - -<div id="search_box" style="margin: 20px;"> - <input type="text" id="search_text" size="90"/> -</div> -<div style="margin: 20px;"> - <input type="button" id="search_button" value="Search"/> -</div> - -<div id="output"></div> - - -</%def> https://bitbucket.org/galaxy/galaxy-central/commits/ead3e859dda1/ Changeset: ead3e859dda1 Branch: next-stable User: dannon Date: 2014-12-04 20:27:19+00:00 Summary: Disable search interface for right now -- I made it not broken in the previous commit, but nobody should be using this yet. Affected #: 1 file diff -r 02681fa23902d774892634cbbe5c9fbaf26f0846 -r ead3e859dda102520ea706bb3a566723af33a90f lib/galaxy/webapps/galaxy/controllers/search.py --- a/lib/galaxy/webapps/galaxy/controllers/search.py +++ b/lib/galaxy/webapps/galaxy/controllers/search.py @@ -9,6 +9,11 @@ class SearchController( BaseUIController ): + @web.expose def index(self, trans): - return trans.fill_template( "search/index.mako" ) + """ + Not ready for human consumption, yet. Power users can still use the + search API. + """ + return trans.show_message("Sorry, the search interface isn't quite ready for use, yet.") https://bitbucket.org/galaxy/galaxy-central/commits/a37ee286981b/ Changeset: a37ee286981b Branch: next-stable User: dannon Date: 2014-12-04 20:29:06+00:00 Summary: Tweak message and commentary for search controller. Affected #: 1 file diff -r ead3e859dda102520ea706bb3a566723af33a90f -r a37ee286981b363c0f8b644c3a40a7007648fffe lib/galaxy/webapps/galaxy/controllers/search.py --- a/lib/galaxy/webapps/galaxy/controllers/search.py +++ b/lib/galaxy/webapps/galaxy/controllers/search.py @@ -13,7 +13,7 @@ @web.expose def index(self, trans): """ - Not ready for human consumption, yet. Power users can still use the - search API. + Per the message, this is not ready for human consumption, yet. Power + users can still use the search API. """ - return trans.show_message("Sorry, the search interface isn't quite ready for use, yet.") + return trans.show_message("Sorry, the search interface isn't quite ready for use, yet. Watch the release notes and check back later!") https://bitbucket.org/galaxy/galaxy-central/commits/b51526d2f9b4/ Changeset: b51526d2f9b4 Branch: next-stable User: dannon Date: 2014-12-04 20:40:51+00:00 Summary: Merge. Affected #: 3 files diff -r a37ee286981b363c0f8b644c3a40a7007648fffe -r b51526d2f9b42a0bc64b55584e435ceebe7ceb31 client/galaxy/scripts/mvc/tools/tools-tree.js --- a/client/galaxy/scripts/mvc/tools/tools-tree.js +++ b/client/galaxy/scripts/mvc/tools/tools-tree.js @@ -125,6 +125,9 @@ // handle default value if (!field.skip) { + if (input.optional && field.validate && !field.validate()) { + value = 'None'; + } add (job_input_id, input.id, value); } } diff -r a37ee286981b363c0f8b644c3a40a7007648fffe -r b51526d2f9b42a0bc64b55584e435ceebe7ceb31 static/scripts/mvc/tools/tools-tree.js --- a/static/scripts/mvc/tools/tools-tree.js +++ b/static/scripts/mvc/tools/tools-tree.js @@ -125,6 +125,9 @@ // handle default value if (!field.skip) { + if (input.optional && field.validate && !field.validate()) { + value = 'None'; + } add (job_input_id, input.id, value); } } diff -r a37ee286981b363c0f8b644c3a40a7007648fffe -r b51526d2f9b42a0bc64b55584e435ceebe7ceb31 static/scripts/packed/mvc/tools/tools-tree.js --- a/static/scripts/packed/mvc/tools/tools-tree.js +++ b/static/scripts/packed/mvc/tools/tools-tree.js @@ -1,1 +1,1 @@ -define([],function(){return Backbone.Model.extend({initialize:function(a){this.app=a},refresh:function(){this.dict={};this.xml=$("<div/>");if(!this.app.section){return{}}this._iterate(this.app.section.$el,this.dict,this.xml)},finalize:function(d){d=d||{};var a=this;this.job_def={};this.job_ids={};function c(g,f,e){a.job_def[g]=e;a.job_ids[g]=f}function b(l,o){for(var j in o){var g=o[j];if(g.input){var q=g.input;var k=l;if(l!=""){k+="|"}k+=q.name;switch(q.type){case"repeat":var f="section-";var t=[];var n=null;for(var s in g){var m=s.indexOf(f);if(m!=-1){m+=f.length;t.push(parseInt(s.substr(m)));if(!n){n=s.substr(0,m)}}}t.sort(function(u,i){return u-i});var j=0;for(var h in t){b(k+"_"+j++,g[n+t[h]])}break;case"conditional":var r=a.app.field_list[q.id].value();if(d[q.test_param.type]){r=d[q.test_param.type](r)}c(k+"|"+q.test_param.name,q.id,r);var e=a.matchCase(q,r);if(e!=-1){b(k,o[q.id+"-section-"+e])}break;default:var p=a.app.field_list[q.id];var r=p.value();if(d[q.type]){r=d[q.type](r)}if(!p.skip){c(k,q.id,r)}}}}}b("",this.dict);return this.job_def},match:function(a){return this.job_ids&&this.job_ids[a]},matchCase:function(a,c){if(a.test_param.type=="boolean"){if(c=="true"){c=a.test_param.truevalue||"true"}else{c=a.test_param.falsevalue||"false"}}for(var b in a.cases){if(a.cases[b].value==c){return b}}return -1},matchModel:function(c,e){var a={};var b=this;function d(f,o){for(var l in o){var h=o[l];var m=h.name;if(f!=""){m=f+"|"+m}switch(h.type){case"repeat":for(var k in h.cache){d(m+"_"+k,h.cache[k])}break;case"conditional":var p=h.test_param&&h.test_param.value;var g=b.matchCase(h,p);if(g!=-1){d(m,h.cases[g].inputs)}break;default:var n=b.app.tree.job_ids[m];if(n){e(n,h)}}}}d("",c.inputs);return a},matchResponse:function(c){var a={};var b=this;function d(k,h){if(typeof h==="string"){var f=b.app.tree.job_ids[k];if(f){a[f]=h}}else{for(var g in h){var e=g;if(k!==""){var j="|";if(h instanceof Array){j="_"}e=k+j+e}d(e,h[g])}}}d("",c);return a},references:function(c,e){var g=[];var b=this;function d(h,j){var i=$(j).children();var l=[];var k=false;i.each(function(){var o=this;var n=$(o).attr("id");if(n!==c){var m=b.app.input_list[n];if(m){if(m.name==h){k=true;return false}if(m.data_ref==h&&m.type==e){l.push(n)}}}});if(!k){g=g.concat(l);i.each(function(){d(h,this)})}}var f=this.xml.find("#"+c);if(f.length>0){var a=this.app.input_list[c];if(a){d(a.name,f.parent())}}return g},_iterate:function(d,e,b){var a=this;var c=$(d).children();c.each(function(){var i=this;var h=$(i).attr("id");if($(i).hasClass("section-row")){e[h]={};var f=a.app.input_list[h];if(f){e[h]={input:f}}var g=$('<div id="'+h+'"/>');b.append(g);a._iterate(i,e[h],g)}else{a._iterate(i,e,b)}})}})}); \ No newline at end of file +define([],function(){return Backbone.Model.extend({initialize:function(a){this.app=a},refresh:function(){this.dict={};this.xml=$("<div/>");if(!this.app.section){return{}}this._iterate(this.app.section.$el,this.dict,this.xml)},finalize:function(d){d=d||{};var a=this;this.job_def={};this.job_ids={};function c(g,f,e){a.job_def[g]=e;a.job_ids[g]=f}function b(l,o){for(var j in o){var g=o[j];if(g.input){var q=g.input;var k=l;if(l!=""){k+="|"}k+=q.name;switch(q.type){case"repeat":var f="section-";var t=[];var n=null;for(var s in g){var m=s.indexOf(f);if(m!=-1){m+=f.length;t.push(parseInt(s.substr(m)));if(!n){n=s.substr(0,m)}}}t.sort(function(u,i){return u-i});var j=0;for(var h in t){b(k+"_"+j++,g[n+t[h]])}break;case"conditional":var r=a.app.field_list[q.id].value();if(d[q.test_param.type]){r=d[q.test_param.type](r)}c(k+"|"+q.test_param.name,q.id,r);var e=a.matchCase(q,r);if(e!=-1){b(k,o[q.id+"-section-"+e])}break;default:var p=a.app.field_list[q.id];var r=p.value();if(d[q.type]){r=d[q.type](r)}if(!p.skip){if(q.optional&&p.validate&&!p.validate()){r="None"}c(k,q.id,r)}}}}}b("",this.dict);return this.job_def},match:function(a){return this.job_ids&&this.job_ids[a]},matchCase:function(a,c){if(a.test_param.type=="boolean"){if(c=="true"){c=a.test_param.truevalue||"true"}else{c=a.test_param.falsevalue||"false"}}for(var b in a.cases){if(a.cases[b].value==c){return b}}return -1},matchModel:function(c,e){var a={};var b=this;function d(f,o){for(var l in o){var h=o[l];var m=h.name;if(f!=""){m=f+"|"+m}switch(h.type){case"repeat":for(var k in h.cache){d(m+"_"+k,h.cache[k])}break;case"conditional":var p=h.test_param&&h.test_param.value;var g=b.matchCase(h,p);if(g!=-1){d(m,h.cases[g].inputs)}break;default:var n=b.app.tree.job_ids[m];if(n){e(n,h)}}}}d("",c.inputs);return a},matchResponse:function(c){var a={};var b=this;function d(k,h){if(typeof h==="string"){var f=b.app.tree.job_ids[k];if(f){a[f]=h}}else{for(var g in h){var e=g;if(k!==""){var j="|";if(h instanceof Array){j="_"}e=k+j+e}d(e,h[g])}}}d("",c);return a},references:function(c,e){var g=[];var b=this;function d(h,j){var i=$(j).children();var l=[];var k=false;i.each(function(){var o=this;var n=$(o).attr("id");if(n!==c){var m=b.app.input_list[n];if(m){if(m.name==h){k=true;return false}if(m.data_ref==h&&m.type==e){l.push(n)}}}});if(!k){g=g.concat(l);i.each(function(){d(h,this)})}}var f=this.xml.find("#"+c);if(f.length>0){var a=this.app.input_list[c];if(a){d(a.name,f.parent())}}return g},_iterate:function(d,e,b){var a=this;var c=$(d).children();c.each(function(){var i=this;var h=$(i).attr("id");if($(i).hasClass("section-row")){e[h]={};var f=a.app.input_list[h];if(f){e[h]={input:f}}var g=$('<div id="'+h+'"/>');b.append(g);a._iterate(i,e[h],g)}else{a._iterate(i,e,b)}})}})}); \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.