mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 06:35:56 +08:00
Merge pull request #7864 from aignatov-bio/ai-sci-11067-fix-search-and-filter
Fix search and filter on storage locations [SCI-11067][SCI-11068]
This commit is contained in:
commit
b9fd5148cf
|
@ -517,7 +517,7 @@ export default {
|
|||
this.totalPage = response.data.meta.total_pages;
|
||||
this.totalEntries = response.data.meta.total_count;
|
||||
}
|
||||
this.$emit('tableReloaded', this.rowData);
|
||||
this.$emit('tableReloaded', this.rowData, { filtered: this.searchValue.length > 0 });
|
||||
this.dataLoading = false;
|
||||
this.restoreSelection();
|
||||
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
:selectedPosition="assignToPosition"
|
||||
:selectedRow="rowIdToMove"
|
||||
:cellId="cellIdToUnassign"
|
||||
@close="openAssignModal = false; this.reloadingTable = true"
|
||||
@close="openAssignModal = false; resetTableSearch(); this.reloadingTable = true"
|
||||
></AssignModal>
|
||||
<ImportModal
|
||||
v-if="openImportModal"
|
||||
:containerId="containerId"
|
||||
@close="openImportModal = false"
|
||||
@reloadTable="reloadingTable = true"
|
||||
@reloadTable="resetTableSearch(); reloadingTable = true"
|
||||
></ImportModal>
|
||||
<ConfirmationModal
|
||||
:title="i18n.t('storage_locations.show.unassign_modal.title')"
|
||||
|
@ -187,9 +187,14 @@ export default {
|
|||
updateTable() {
|
||||
this.reloadingTable = true;
|
||||
},
|
||||
handleTableReload(items) {
|
||||
handleTableReload(items, params) {
|
||||
this.reloadingTable = false;
|
||||
this.assignedItems = items;
|
||||
if (!params.filtered) {
|
||||
this.assignedItems = items;
|
||||
}
|
||||
},
|
||||
resetTableSearch() {
|
||||
this.$refs.table.searchValue = '';
|
||||
},
|
||||
selectRow(row) {
|
||||
if (this.$refs.table.selectedRows.includes(row)) {
|
||||
|
@ -231,7 +236,9 @@ export default {
|
|||
const ok = await this.$refs.unassignStorageLocationModal.show();
|
||||
if (ok) {
|
||||
axios.post(event.path).then(() => {
|
||||
this.resetTableSearch();
|
||||
this.reloadingTable = true;
|
||||
|
||||
}).catch((error) => {
|
||||
HelperModule.flashAlertMsg(error.response.data.error, 'danger');
|
||||
});
|
||||
|
|
|
@ -12,7 +12,9 @@ module Lists
|
|||
@records = StorageLocationRepositoryRow.includes(:repository_row).where(storage_location_id: @storage_location_id)
|
||||
end
|
||||
|
||||
def filter_records; end
|
||||
def filter_records
|
||||
@records = @records.joins(:repository_row).where('LOWER(repository_rows.name) ILIKE ?', "%#{@params[:search].downcase}%") if @params[:search].present?
|
||||
end
|
||||
|
||||
def sort_records
|
||||
return unless @params[:order]
|
||||
|
|
|
@ -36,8 +36,8 @@ module Lists
|
|||
@records = @records.where(parent_id: @parent_id)
|
||||
end
|
||||
|
||||
@records = @records.where('LOWER(name) ILIKE ?', "%#{@filters[:query].downcase}%") if @filters[:query].present?
|
||||
@records = @records.where('LOWER(name) ILIKE ?', "%#{@params[:search].downcase}%") if @params[:search].present?
|
||||
@records = @records.where('LOWER(storage_locations.name) ILIKE ?', "%#{@filters[:query].downcase}%") if @filters[:query].present?
|
||||
@records = @records.where('LOWER(storage_locations.name) ILIKE ?', "%#{@params[:search].downcase}%") if @params[:search].present?
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue