mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 10:24:38 +08:00
Merge pull request #12087 from OlegZharkov/fix_filter_on_search
[21.05] fix library search filter
This commit is contained in:
@@ -271,7 +271,11 @@ export default {
|
||||
async getSelected() {
|
||||
if (this.isAllSelectedMode) {
|
||||
this.$emit("setBusy", true);
|
||||
const selected = await this.services.getFilteredFolderContents(this.folder_id, this.unselected);
|
||||
const selected = await this.services.getFilteredFolderContents(
|
||||
this.folder_id,
|
||||
this.unselected,
|
||||
this.$parent.search_text
|
||||
);
|
||||
this.$emit("setBusy", false);
|
||||
return selected;
|
||||
} else {
|
||||
|
||||
@@ -8,8 +8,11 @@ export class Services {
|
||||
}
|
||||
|
||||
async getFolderContents(id, include_deleted, limit, offset, search_text = false) {
|
||||
search_text = search_text ? `&search_text=${encodeURI(search_text.trim())}` : "";
|
||||
const url = `${this.root}api/folders/${id}/contents?include_deleted=${include_deleted}&limit=${limit}&offset=${offset}${search_text}`;
|
||||
const url = `${
|
||||
this.root
|
||||
}api/folders/${id}/contents?include_deleted=${include_deleted}&limit=${limit}&offset=${offset}${this.getSearchQuery(
|
||||
search_text
|
||||
)}`;
|
||||
try {
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
@@ -18,13 +21,17 @@ export class Services {
|
||||
}
|
||||
}
|
||||
|
||||
async getFilteredFolderContents(id, excluded) {
|
||||
const contents = await axios.get(`${this.root}api/folders/${id}/contents`);
|
||||
async getFilteredFolderContents(id, excluded, search_text) {
|
||||
const contents = await axios.get(`${this.root}api/folders/${id}/contents?${this.getSearchQuery(search_text)}`);
|
||||
return contents.data.folder_contents.filter((item) => {
|
||||
return !excluded.some((exc) => exc.id === item.id);
|
||||
});
|
||||
}
|
||||
|
||||
getSearchQuery(search_text) {
|
||||
return search_text ? `&search_text=${encodeURI(search_text.trim())}` : "";
|
||||
}
|
||||
|
||||
updateFolder(item, onSucess, onError) {
|
||||
const url = `${this.root}api/folders/${item.id}`;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user