Skip to content

Commit

Permalink
fix: prevent changing search when results are loading (#2025)
Browse files Browse the repository at this point in the history
  • Loading branch information
replicantSocks authored Oct 4, 2023
1 parent d4c439a commit c479178
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/client/src/components/GrantsTableNext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<section class="container-fluid grants-table-container">
<b-row class="my-3" v-if="showSearchControls">
<div class="ml-3">
<SavedSearchPanel />
<SavedSearchPanel :isDisabled="loading" />
</div>
<div class="ml-2">
<SearchPanel ref="searchPanel" :search-id="Number(editingSearchId)" @filters-applied="paginateGrants" />
<SearchPanel :isDisabled="loading" ref="searchPanel" :search-id="Number(editingSearchId)" @filters-applied="paginateGrants" />
</div>
</b-row>
<b-row class="grants-table-title-control">
<b-col v-if="showSearchControls" >
<SearchFilter :filterKeys="searchFilters" @filter-removed="clearSearch" />
<SearchFilter :isDisabled="loading" :filterKeys="searchFilters" @filter-removed="clearSearch" />
</b-col>
<b-col align-self="end" v-if="!showSearchControls">
<h4 class="mb-0">{{ searchTitle }}</h4>
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/components/Modals/SavedSearchPanel.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="saved-search-panel">
<b-button @click="initManageSearches" variant="primary" size="sm">
<b-button @click="initManageSearches" variant="primary" size="sm" :disabled="isDisabled">
My Saved Searches
</b-button>
<b-sidebar
Expand Down Expand Up @@ -89,6 +89,7 @@ import { formatFilterDisplay } from '@/helpers/filters';
export default {
props: {
showModal: Boolean,
isDisabled: Boolean,
},
directives: {
'v-b-toggle': VBToggle,
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/components/Modals/SearchPanel.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="search-panel">
<b-button @click="initNewSearch" variant="outline-primary" size="sm">
<b-button @click="initNewSearch" variant="outline-primary" size="sm" :disabled="isDisabled">
New Search
</b-button>

Expand Down Expand Up @@ -241,6 +241,7 @@ export default {
SearchType: String,
showModal: Boolean,
searchId: Number,
isDisabled: Boolean,
},
directives: {
'v-b-toggle': VBToggle,
Expand Down
16 changes: 15 additions & 1 deletion packages/client/src/components/SearchFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<div class="align-self-end">
<h4 class="mb-0">{{ selectedSearch === null ? "All Grants" : searchName }} </h4>
<span v-if="selectedSearch !== null">
<a href="#" v-on:click.prevent="editFilter">Edit</a> | <a href="#" v-on:click.prevent="clearAll" >Clear</a>
<a href="#" :class="{ inactiveLink: isDisabled }" v-on:click.prevent="editFilter">Edit</a> |
<a href="#" :class="{ inactiveLink: isDisabled }" v-on:click.prevent="clearAll" >Clear</a>
</span>
</div>
<span class="filter-item" v-for="(item, idx) in $props.filterKeys" :key="idx">
Expand All @@ -18,6 +19,7 @@ import { mapActions, mapGetters } from 'vuex';
export default {
props: {
isDisabled: Boolean,
filterKeys: {
type: Array,
required: true,
Expand All @@ -41,9 +43,15 @@ export default {
return value;
},
editFilter() {
if (!this.isDisabled) {
return;
}
this.initEditSearch(this.selectedSearch.id);
},
clearAll() {
if (!this.isDisabled) {
return;
}
this.clearSelectedSearch();
this.$emit('filter-removed');
},
Expand All @@ -63,3 +71,9 @@ export default {
};
</script>
<style>
.inactiveLink {
pointer-events: none;
color: grey;
}
</style>

0 comments on commit c479178

Please sign in to comment.