X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/da3b350bf378bf40f932227b2aad5c232556fac9..13ac0cadc7b65d2ab5ba3b3919dc55d06b85c3d5:/apps/workbench/app/assets/javascripts/filterable.js diff --git a/apps/workbench/app/assets/javascripts/filterable.js b/apps/workbench/app/assets/javascripts/filterable.js index 40df5c7174..bf859c350a 100644 --- a/apps/workbench/app/assets/javascripts/filterable.js +++ b/apps/workbench/app/assets/javascripts/filterable.js @@ -41,6 +41,11 @@ // data-example-attr="foo" are shown, and all others are hidden. When // the user selects the "Show all" option, all rows are shown. // +// +// +// Merges on- or off-value with other params in query. Only works with +// infinite-scroll. +// // Notes: // // When multiple filterable-control widgets operate on the same @@ -56,12 +61,7 @@ function updateFilterableQueryNow($target) { var newquery = $target.data('filterable-query-new'); var params = $target.data('infinite-content-params-filterable') || {}; - var tsquery = to_tsquery(newquery); - if (tsquery == null) { - params.filters = []; - } else { - params.filters = [['any', '@@', tsquery]]; - } + params.filters = ilike_filters(newquery); $(".modal-dialog-preview-pane").html(""); $target.data('infinite-content-params-filterable', params); $target.data('filterable-query', newquery); @@ -92,6 +92,21 @@ $(document). updateFilterableQueryNow($(this)); }); }). + on('change', 'input[type=checkbox].filterable-control', function(e) { + if (this != e.target) return; + var $target = $($(this).attr('data-filterable-target')); + var currentquery = $target.data('filterable-query'); + if (currentquery === undefined) currentquery = ''; + if ($target.is('[data-infinite-scroller]')) { + var datakey = 'infiniteContentParamsFrom'+this.id; + var whichvalue = $(this).is(':checked') ? 'on-value' : 'off-value'; + if (JSON.stringify($target.data(datakey)) == JSON.stringify($(this).data(whichvalue))) + return; + $target.data(datakey, $(this).data(whichvalue)); + updateFilterableQueryNow($target); + $target.trigger('refresh-content'); + } + }). on('paste keyup input', 'input[type=text].filterable-control', function(e) { var regexp; if (this != e.target) return;