From 2986c819c12db68d773a0364b0728e0ffe100125 Mon Sep 17 00:00:00 2001 From: Jens Jonas Date: Wed, 15 Feb 2023 12:02:33 +0100 Subject: [PATCH] Add selections for items with non-unique URLs Change url id from geocase_id to id --- package-lock.json | 31 +- src/components/MapWrapper.vue | 2 +- src/components/detail_view/HeadlineBox.vue | 100 + src/components/front_page/MglPopupWrapper.vue | 4 +- src/components/image/ImageOverflow.vue | 2 +- src/components/tabs/TabTable.vue | 4 +- src/middleware/SearchService.js | 5 +- src/store/modules/detail/getters.js | 4 + src/views/DetailView.vue | 1875 ++++++++--------- vue.config.js | 1 + 10 files changed, 1068 insertions(+), 960 deletions(-) create mode 100644 src/components/detail_view/HeadlineBox.vue diff --git a/package-lock.json b/package-lock.json index 25144b6..ecdaf42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8208,6 +8208,16 @@ "node": ">=8" } }, + "node_modules/esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, "node_modules/espree": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", @@ -12070,11 +12080,11 @@ "integrity": "sha512-/xwPEBidtg69Q3HlqPdU3DnrXQOvQU/CCHA1tcDQVzOwm91YMYaILjNp7L4Eaw5Z4sOYdbBz6koWyibppd8Zqw==" }, "node_modules/leaflet.markercluster": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/leaflet.markercluster/-/leaflet.markercluster-1.4.1.tgz", - "integrity": "sha512-ZSEpE/EFApR0bJ1w/dUGwTSUvWlpalKqIzkaYdYB7jaftQA/Y2Jav+eT4CMtEYFj+ZK4mswP13Q2acnPBnhGOw==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/leaflet.markercluster/-/leaflet.markercluster-1.5.3.tgz", + "integrity": "sha512-vPTw/Bndq7eQHjLBVlWpnGeLa3t+3zGiuM7fJwCkiMFq+nmRuG3RI3f7f4N4TDX7T4NpbAXpR2+NTRSEGfCSeA==", "peerDependencies": { - "leaflet": "~1.3.1" + "leaflet": "^1.3.1" } }, "node_modules/left-pad": { @@ -26241,6 +26251,13 @@ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true }, + "esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "dev": true, + "peer": true + }, "espree": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", @@ -29318,9 +29335,9 @@ "integrity": "sha512-/xwPEBidtg69Q3HlqPdU3DnrXQOvQU/CCHA1tcDQVzOwm91YMYaILjNp7L4Eaw5Z4sOYdbBz6koWyibppd8Zqw==" }, "leaflet.markercluster": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/leaflet.markercluster/-/leaflet.markercluster-1.4.1.tgz", - "integrity": "sha512-ZSEpE/EFApR0bJ1w/dUGwTSUvWlpalKqIzkaYdYB7jaftQA/Y2Jav+eT4CMtEYFj+ZK4mswP13Q2acnPBnhGOw==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/leaflet.markercluster/-/leaflet.markercluster-1.5.3.tgz", + "integrity": "sha512-vPTw/Bndq7eQHjLBVlWpnGeLa3t+3zGiuM7fJwCkiMFq+nmRuG3RI3f7f4N4TDX7T4NpbAXpR2+NTRSEGfCSeA==", "requires": {} }, "left-pad": { diff --git a/src/components/MapWrapper.vue b/src/components/MapWrapper.vue index 46e80a7..be7370e 100644 --- a/src/components/MapWrapper.vue +++ b/src/components/MapWrapper.vue @@ -295,7 +295,7 @@ export default { marker.on("click", () => { if (this.isDetailView) window.open(item.recordURI, "RecordUriWindow"); - else this.$router.push({ path: `specimen/${encodeURIComponent(item.geocase_id)}` }); + else this.$router.push({ path: `specimen/${encodeURIComponent(item.id)}` }); }); } if (item.locality) { diff --git a/src/components/detail_view/HeadlineBox.vue b/src/components/detail_view/HeadlineBox.vue new file mode 100644 index 0000000..9692777 --- /dev/null +++ b/src/components/detail_view/HeadlineBox.vue @@ -0,0 +1,100 @@ + + + \ No newline at end of file diff --git a/src/components/front_page/MglPopupWrapper.vue b/src/components/front_page/MglPopupWrapper.vue index c068340..6031e43 100644 --- a/src/components/front_page/MglPopupWrapper.vue +++ b/src/components/front_page/MglPopupWrapper.vue @@ -46,7 +46,7 @@ {{ item.unitid }} diff --git a/src/components/image/ImageOverflow.vue b/src/components/image/ImageOverflow.vue index 80f4968..8c3b9bd 100644 --- a/src/components/image/ImageOverflow.vue +++ b/src/components/image/ImageOverflow.vue @@ -114,7 +114,7 @@ {{ $t("imageGallery.goToSpecimenView") }} diff --git a/src/components/tabs/TabTable.vue b/src/components/tabs/TabTable.vue index 191e29d..51c34fb 100644 --- a/src/components/tabs/TabTable.vue +++ b/src/components/tabs/TabTable.vue @@ -114,7 +114,7 @@ {{ item.unitid }} diff --git a/src/middleware/SearchService.js b/src/middleware/SearchService.js index f8a351c..efb4a93 100644 --- a/src/middleware/SearchService.js +++ b/src/middleware/SearchService.js @@ -35,7 +35,10 @@ class SearchService { static async getDetailView(id) { try { - let url = `${API_URL}?q=geocase_id:"${decodeURIComponent(id)}"`; + const searchValue = decodeURIComponent(id); + const searchField = /^\d+$/.test(searchValue) ? 'id' : 'geocase_id' + + const url = `${API_URL}?q=${searchField}:"${decodeURIComponent(id)}"`; const res = await axios.get(url); return res.data; diff --git a/src/store/modules/detail/getters.js b/src/store/modules/detail/getters.js index bdef885..e0fd325 100644 --- a/src/store/modules/detail/getters.js +++ b/src/store/modules/detail/getters.js @@ -13,6 +13,10 @@ const getters = { return getters.itemExists ? state.response[0] : []; }, + items: (state, getters) => { + return state.response ?? []; + }, + imageExists: (state, getters) => { return !!(getters.itemExists && getters.item && getters.item.images); }, diff --git a/src/views/DetailView.vue b/src/views/DetailView.vue index f79fd11..5c95067 100644 --- a/src/views/DetailView.vue +++ b/src/views/DetailView.vue @@ -1,1009 +1,992 @@ diff --git a/vue.config.js b/vue.config.js index 95dee8b..c4b9a6e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -3,6 +3,7 @@ const routes = require("./src/router/sitemapRoutes"); module.exports = { transpileDependencies: ["vuetify"], devServer: { + disableHostCheck: process.env.NODE_ENV === 'development', proxy: { "/api": { target: "http://api.geocase.eu/",