mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
move the searching to the proper collection
so everything get filtered, not just the visible
This commit is contained in:
@@ -284,7 +284,7 @@ var FolderListView = Backbone.View.extend({
|
||||
const trimmed_term = $.trim(search_term);
|
||||
if (trimmed_term !== "") {
|
||||
let result_collection = null;
|
||||
result_collection = this.collection.search(search_term);
|
||||
result_collection = this.folder_container.search(search_term);
|
||||
this.options.result_models = result_collection.models;
|
||||
this.collection.reset(result_collection);
|
||||
} else {
|
||||
|
||||
@@ -81,22 +81,7 @@ var Folder = Backbone.Collection.extend({
|
||||
sortFolder: function(sort_key, sort_order) {
|
||||
this.comparator = mod_util.generateFolderComparator(sort_key, sort_order);
|
||||
this.sort();
|
||||
},
|
||||
|
||||
/**
|
||||
* Search the collection and return only the models that have
|
||||
* the search term in their names.
|
||||
* [the term to search]
|
||||
* @type {string}
|
||||
*/
|
||||
search: function(search_term) {
|
||||
if (search_term == "") return this;
|
||||
const lowercase_term = search_term.toLowerCase();
|
||||
return this.filter(data => {
|
||||
const lowercase_name = data.get("name").toLowerCase();
|
||||
return lowercase_name.indexOf(lowercase_term) !== -1;
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
var FolderContainer = Backbone.Model.extend({
|
||||
@@ -105,6 +90,22 @@ var FolderContainer = Backbone.Model.extend({
|
||||
urlRoot: `${getAppRoot()}api/folders/`,
|
||||
id: "unknown"
|
||||
},
|
||||
|
||||
/**
|
||||
* Search the folder and return only the models that have
|
||||
* the search term in their names.
|
||||
* [the term to search]
|
||||
* @type {string}
|
||||
*/
|
||||
search: function(search_term) {
|
||||
if (search_term == "") return this;
|
||||
const lowercase_term = search_term.toLowerCase();
|
||||
return this.get("folder").filter(data => {
|
||||
const lowercase_name = data.get("name").toLowerCase();
|
||||
return lowercase_name.indexOf(lowercase_term) !== -1;
|
||||
});
|
||||
},
|
||||
|
||||
parse: function(obj) {
|
||||
const Galaxy = getGalaxyInstance();
|
||||
// empty the collection
|
||||
|
||||
Reference in New Issue
Block a user