Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: APPS-2300_remove-donor-filter #714

Merged
merged 9 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"prettier-eslint": "^12.0.0",
"sass": "^1.45.2",
"sass-loader": "^10.1.1",
"ucla-library-design-tokens": "^5.4.1",
"ucla-library-design-tokens": "^5.5.0",
"ucla-library-website-components": "^2.38.2",
"vue-svg-loader": "^0.16.0",
"vue-template-compiler": "^2.6.12"
Expand Down
113 changes: 56 additions & 57 deletions pages/give/endowments/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<masthead-secondary :title="page.title" :text="page.text" />
<search-generic
search-type="about"
:filters="searchFilters"
class="generic-search"
:search-generic-query="searchGenericQuery"
:placeholder="parsedPlaceholder"
Expand Down Expand Up @@ -126,7 +125,7 @@
</template>

<script>
import getListingFilters from "~/utils/getListingFilters"
// import getListingFilters from "~/utils/getListingFilters"
import config from "~/utils/searchConfig"

// HELPERS
Expand All @@ -152,22 +151,21 @@ export default {
hits: [],
title: "",
noResultsFound: false,
searchFilters: [],
// searchFilters: [],
searchGenericQuery: {
queryText: this.$route.query.q || "",
queryFilters:
(this.$route.query.filters &&
JSON.parse(this.$route.query.filters)) ||
{},
// queryFilters:
// (this.$route.query.filters &&
// JSON.parse(this.$route.query.filters)) ||
// {},
},
}
},
async fetch() {
this.endowments = []
this.hits = []
if (
(this.$route.query.q && this.$route.query.q !== "") ||
this.$route.query.filters
(this.$route.query.q && this.$route.query.q !== "")
) {
if (!this.page.title) {
const data = await this.$graphql.default.request(
Expand All @@ -182,13 +180,14 @@ export default {
query_text,
config.endowmentsList.searchFields,
"sectionHandle:endowment",
JSON.parse(this.$route.query.filters) || {},
JSON.parse(this.$route.query.q) || "*",
config.endowmentsList.sortField,
config.endowmentsList.orderBy,
config.endowmentsList.resultFields,
config.endowmentsList.filters
// config.endowmentsList.filters
jendiamond marked this conversation as resolved.
Show resolved Hide resolved
[]
)
//console.log("getsearchdata method:" + JSON.stringify(results))
// console.log("getsearchdata method:" + JSON.stringify(results))
this.endowments = []
this.hits = []
if (results && results.hits && results.hits.total.value > 0) {
Expand All @@ -202,10 +201,10 @@ export default {
}
this.searchGenericQuery = {
queryText: this.$route.query.q || "",
queryFilters:
(this.$route.query.filters &&
JSON.parse(this.$route.query.filters)) ||
{},
// queryFilters:
// (this.$route.query.filters &&
// JSON.parse(this.$route.query.filters)) ||
// {},
}
} else {
this.hits = []
Expand Down Expand Up @@ -288,51 +287,51 @@ export default {
"$route.query.q"(newValue) {
//console.log("watching queryText:" + newValue)
},
"$route.query.filters"(newValue) {
//console.log("watching filters:" + newValue)
},
// "$route.query.filters"(newValue) {
// //console.log("watching filters:" + newValue)
// },
},
async mounted() {
//console.log("In mounted")
this.setFilters()
// this.setFilters()
},
methods: {
queryFilterHasValues() {
if (!this.$route.query.filters) return false
let routeQueryFilters = JSON.parse(this.$route.query.filters)
// //console.log(
// "is route query exixts:" + JSON.stringify(routeQueryFilters)
// )
let configFilters = config.endowmentsList.filters
for (const filter of configFilters) {
if (
Array.isArray(routeQueryFilters[filter.esFieldName]) &&
routeQueryFilters[filter.esFieldName].length > 0
) {
return true
} else if (
routeQueryFilters[filter.esFieldName] &&
!Array.isArray(routeQueryFilters[filter.esFieldName]) &&
routeQueryFilters[filter.esFieldName] != ""
) {
return true
}
}
return false
},
async setFilters() {
const searchAggsResponse = await this.$dataApi.getAggregations(
config.endowmentsList.filters,
"endowment"
)
/*console.log(
"Search Aggs Response: " + JSON.stringify(searchAggsResponse)
)*/
this.searchFilters = getListingFilters(
searchAggsResponse,
config.endowmentsList.filters
)
},
// queryFilterHasValues() {
// if (!this.$route.query.filters) return false
// let routeQueryFilters = JSON.parse(this.$route.query.filters)
// // //console.log(
// // "is route query exixts:" + JSON.stringify(routeQueryFilters)
// // )
// let configFilters = config.endowmentsList.filters
// for (const filter of configFilters) {
// if (
// Array.isArray(routeQueryFilters[filter.esFieldName]) &&
// routeQueryFilters[filter.esFieldName].length > 0
// ) {
// return true
// } else if (
// routeQueryFilters[filter.esFieldName] &&
// !Array.isArray(routeQueryFilters[filter.esFieldName]) &&
// routeQueryFilters[filter.esFieldName] != ""
// ) {
// return true
// }
// }
// return false
// },
// async setFilters() {
// const searchAggsResponse = await this.$dataApi.getAggregations(
// config.endowmentsList.filters,
// "endowment"
// )
// /*console.log(
// "Search Aggs Response: " + JSON.stringify(searchAggsResponse)
// )*/
// this.searchFilters = getListingFilters(
// searchAggsResponse,
// config.endowmentsList.filters
// )
// },
parseHits(hits = []) {
return hits.map((obj) => {
return {
Expand Down Expand Up @@ -366,7 +365,7 @@ export default {
path: "/give/endowments",
query: {
q: data.text,
filters: JSON.stringify(data.filters),
// filters: JSON.stringify(data.filters),
},
})
},
Expand Down
Loading