From 731d0bf975bc493390a195fbf9bd76e4626da36c Mon Sep 17 00:00:00 2001
From: Ignacio Pascual <4764217+ignapas@users.noreply.github.com>
Date: Wed, 26 Jun 2024 16:48:23 +0200
Subject: [PATCH 1/7] removed immediate watch to avoid overlapping fetching
---
pages/about/projects/index.vue | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/pages/about/projects/index.vue b/pages/about/projects/index.vue
index 1beb03d9..940e9a7f 100644
--- a/pages/about/projects/index.vue
+++ b/pages/about/projects/index.vue
@@ -272,7 +272,7 @@ export default {
// Added route name check bc clicking on Data & Models header link was causing this to still fire after navigating to the data page
if (!this.$route.query.consortiaType && this.$route.name == 'about-projects') {
this.$router.push({
- query: {consortiaType: this.consortiaType['id'] }
+ query: {consortiaType: this.consortiaType.id }
})
} else {
this.searchData = {
@@ -291,20 +291,17 @@ export default {
handler: function () {
this.searchQuery = this.$route.query.search
this.fetchResults()
- },
- immediate: true
+ }
},
'$route.query.projectsSort': {
handler: function (option) {
this.fetchResults()
- },
- immediate: true
+ }
},
'$route.query.selectedProjectsAnatomicalFocusIds': {
handler: function (option) {
this.fetchResults()
- },
- immediate: true
+ }
},
},
@@ -321,7 +318,6 @@ export default {
limit: Number(this.$route.query.limit || this.searchData.limit),
search: this.$route.query.search || ''
}
-
this.searchData = { ...this.searchData, ...queryParams }
}
if (window.innerWidth <= 768) this.titleColumnWidth = 150
From 323d46fca815f7380afafd5756af7a9417f9d1e2 Mon Sep 17 00:00:00 2001
From: Ignacio Pascual <4764217+ignapas@users.noreply.github.com>
Date: Tue, 2 Jul 2024 11:22:42 +0200
Subject: [PATCH 2/7] url building
---
components/FilesTable/FilesTable.vue | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/components/FilesTable/FilesTable.vue b/components/FilesTable/FilesTable.vue
index 1cc533af..7236d977 100644
--- a/components/FilesTable/FilesTable.vue
+++ b/components/FilesTable/FilesTable.vue
@@ -680,7 +680,10 @@ export default {
const fileType = scope.row.fileType.toLowerCase()
const contentType = contentTypes[fileType]
- const requestUrl = `${this.$config.public.portal_api}/download?s3BucketName=${s3BucketName}&key=${filePath}&contentType=${contentType}`
+ const requestUrl = new URL(this.$config.public.portal_api + '/download')
+ requestUrl.searchParams.append('s3BucketName', s3BucketName)
+ requestUrl.searchParams.append('key', filePath)
+ requestUrl.searchParams.append('contentType', contentType)
return this.$axios.get(requestUrl).then(({ data }) => {
const url = data
From 4e50575971e540eae44295f3ee37cbffa25d476a Mon Sep 17 00:00:00 2001
From: Ignacio Pascual <4764217+ignapas@users.noreply.github.com>
Date: Tue, 2 Jul 2024 14:03:59 +0200
Subject: [PATCH 3/7] fetching styles in beformount to avoid immediate
consortiatype watcher executing at the beginning
---
pages/about/projects/index.vue | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/pages/about/projects/index.vue b/pages/about/projects/index.vue
index 940e9a7f..b1402f9e 100644
--- a/pages/about/projects/index.vue
+++ b/pages/about/projects/index.vue
@@ -281,11 +281,9 @@ export default {
items: [],
total: 0
}
- this.fetchConsortiaStyle(this.consortiaType.id)
this.fetchResults()
}
- },
- immediate: true
+ }
},
'$route.query.search': {
handler: function () {
@@ -307,6 +305,7 @@ export default {
beforeMount: function () {
this.windowWidth = window.innerWidth
+ this.fetchConsortiaStyle(this.consortiaType.id)
},
mounted: function () {
if (!this.$route.query.consortiaType) {
From 3e6cbc138a4d45cf5aed318b28092f6134fc2ddb Mon Sep 17 00:00:00 2001
From: Ignacio Pascual <4764217+ignapas@users.noreply.github.com>
Date: Wed, 3 Jul 2024 10:24:34 +0200
Subject: [PATCH 4/7] migrated hook to vue 3 syntax
---
pages/about/projects/index.vue | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pages/about/projects/index.vue b/pages/about/projects/index.vue
index b1402f9e..1bce9d93 100644
--- a/pages/about/projects/index.vue
+++ b/pages/about/projects/index.vue
@@ -42,7 +42,7 @@
@@ -272,7 +272,7 @@ export default {
// Added route name check bc clicking on Data & Models header link was causing this to still fire after navigating to the data page
if (!this.$route.query.consortiaType && this.$route.name == 'about-projects') {
this.$router.push({
- query: {consortiaType: this.consortiaType.id }
+ query: { consortiaType: this.consortiaType.id }
})
} else {
this.searchData = {
@@ -281,6 +281,7 @@ export default {
items: [],
total: 0
}
+ this.fetchConsortiaStyle(this.consortiaType.id)
this.fetchResults()
}
}
From fc2953ee8d5188e964cec7902322d545b6dbb00b Mon Sep 17 00:00:00 2001
From: Ignacio Pascual <4764217+ignapas@users.noreply.github.com>
Date: Wed, 10 Jul 2024 11:53:49 +0200
Subject: [PATCH 5/7] reverted changes in filestable
---
components/FilesTable/FilesTable.vue | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/components/FilesTable/FilesTable.vue b/components/FilesTable/FilesTable.vue
index 7236d977..1cc533af 100644
--- a/components/FilesTable/FilesTable.vue
+++ b/components/FilesTable/FilesTable.vue
@@ -680,10 +680,7 @@ export default {
const fileType = scope.row.fileType.toLowerCase()
const contentType = contentTypes[fileType]
- const requestUrl = new URL(this.$config.public.portal_api + '/download')
- requestUrl.searchParams.append('s3BucketName', s3BucketName)
- requestUrl.searchParams.append('key', filePath)
- requestUrl.searchParams.append('contentType', contentType)
+ const requestUrl = `${this.$config.public.portal_api}/download?s3BucketName=${s3BucketName}&key=${filePath}&contentType=${contentType}`
return this.$axios.get(requestUrl).then(({ data }) => {
const url = data
From beb74afec6f8031cba5ad5e492ed5168bc504b76 Mon Sep 17 00:00:00 2001
From: Ignacio Pascual <4764217+ignapas@users.noreply.github.com>
Date: Wed, 10 Jul 2024 11:54:03 +0200
Subject: [PATCH 6/7] final fix?
---
pages/about/projects/index.vue | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/pages/about/projects/index.vue b/pages/about/projects/index.vue
index 1bce9d93..e0d36ead 100644
--- a/pages/about/projects/index.vue
+++ b/pages/about/projects/index.vue
@@ -42,8 +42,7 @@
+ @projects-selections-changed="onFacetSelectionChange" ref="projectsFacetMenu" />
{
this.isLoadingSearch = false
+ console.log('fetched', origin, {
+ content_type: contentType,
+ query: this.$route.query.search,
+ limit: this.searchData.limit,
+ skip: this.searchData.skip,
+ order: sortOrder,
+ 'fields.focus[in]': anatomicalFocus,
+ 'fields.program[in]': consortiaType
+ })
})
}
this.$refs.altSearchResults?.retrieveAltTotals()
@@ -376,7 +384,7 @@ export default {
onFacetSelectionChange: function () {
this.searchData.skip = 0
- this.fetchResults()
+ this.fetchResults(7)
},
onPaginationPageChange: function (page) {
@@ -387,7 +395,7 @@ export default {
query: { ...this.$route.query, skip: offset }
})
- this.fetchResults()
+ this.fetchResults(8)
},
onResize: function (width) {
From c00bc18736e684d757c4dd600660633b570ca830 Mon Sep 17 00:00:00 2001
From: Ignacio Pascual <4764217+ignapas@users.noreply.github.com>
Date: Wed, 10 Jul 2024 13:40:01 +0200
Subject: [PATCH 7/7] emitting change even if there are no facets selected
---
components/FacetMenu/ProjectsFacetMenu.vue | 3 +++
pages/about/projects/index.vue | 27 ++++++++--------------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/components/FacetMenu/ProjectsFacetMenu.vue b/components/FacetMenu/ProjectsFacetMenu.vue
index 78b78308..17f2c015 100644
--- a/components/FacetMenu/ProjectsFacetMenu.vue
+++ b/components/FacetMenu/ProjectsFacetMenu.vue
@@ -80,6 +80,9 @@ export default {
if (this.$route.query.selectedProjectsAnatomicalFocusIds) {
this.defaultCheckedAnatomicalFocusIds = this.$route.query.selectedProjectsAnatomicalFocusIds.split(",")
}
+ else {
+ this.$emit('projects-selections-changed')
+ }
},
methods: {
diff --git a/pages/about/projects/index.vue b/pages/about/projects/index.vue
index e0d36ead..c6ebba36 100644
--- a/pages/about/projects/index.vue
+++ b/pages/about/projects/index.vue
@@ -281,24 +281,24 @@ export default {
total: 0
}
this.fetchConsortiaStyle(this.consortiaType.id)
- this.fetchResults(1)
+ this.fetchResults()
}
}
},
'$route.query.search': {
handler: function () {
this.searchQuery = this.$route.query.search
- this.fetchResults(2)
+ this.fetchResults()
}
},
'$route.query.projectsSort': {
handler: function (option) {
- this.fetchResults(3)
+ this.fetchResults()
}
},
'$route.query.selectedProjectsAnatomicalFocusIds': {
handler: function (option) {
- this.fetchResults(4)
+ this.fetchResults()
}
},
},
@@ -333,14 +333,14 @@ export default {
this.$router.replace({
query: { ...this.$route.query, limit: newLimit, skip: 0 }
})
- this.fetchResults(5)
+ this.fetchResults()
},
facetMenuMounted: function () {
- this.fetchResults(6)
+ this.fetchResults()
},
- fetchResults: function (origin) {
+ fetchResults: function () {
this.isLoadingSearch = true
var contentType = 'sparcAward'
var consortiaType = this.$route.query.consortiaType
@@ -368,15 +368,6 @@ export default {
})
.finally(() => {
this.isLoadingSearch = false
- console.log('fetched', origin, {
- content_type: contentType,
- query: this.$route.query.search,
- limit: this.searchData.limit,
- skip: this.searchData.skip,
- order: sortOrder,
- 'fields.focus[in]': anatomicalFocus,
- 'fields.program[in]': consortiaType
- })
})
}
this.$refs.altSearchResults?.retrieveAltTotals()
@@ -384,7 +375,7 @@ export default {
onFacetSelectionChange: function () {
this.searchData.skip = 0
- this.fetchResults(7)
+ this.fetchResults()
},
onPaginationPageChange: function (page) {
@@ -395,7 +386,7 @@ export default {
query: { ...this.$route.query, skip: offset }
})
- this.fetchResults(8)
+ this.fetchResults()
},
onResize: function (width) {