# HG changeset patch # User Thomas Junk # Date 1553527018 -3600 # Node ID e19fac818aabb18ea10f233f9b0bbe3e5b9ad9ad # Parent c9032a57996e633a9481f9dd8c6c31ae60889c8a import_overview: specifying single imports via URL should open the overview with all logentries of the according hour and open the details for the specified import diff -r c9032a57996e -r e19fac818aab client/src/components/importoverview/ImportOverview.vue --- a/client/src/components/importoverview/ImportOverview.vue Mon Mar 25 15:42:53 2019 +0100 +++ b/client/src/components/importoverview/ImportOverview.vue Mon Mar 25 16:16:58 2019 +0100 @@ -195,6 +195,40 @@ } }, methods: { + showSingleRessource(id) { + id = id * 1; + this.loadDetails(id) + .then(response => { + this.$store.commit("imports/setCurrentDetails", response.data); + const { enqueued } = response.data; + this.$store.commit("imports/setStartDate", startOfHour(enqueued)); + this.$store.commit("imports/setEndDate", endOfHour(enqueued)); + this.$store.commit("imports/showDetailsFor", id); + this.loadLogs(); + }) + .catch(error => { + this.loading = false; + this.$store.commit("imports/setCurrentDetails", {}); + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }); + }, + loadDetails(id) { + return new Promise((resolve, reject) => { + HTTP.get("/imports/" + id, { + headers: { "X-Gemma-Auth": localStorage.getItem("token") } + }) + .then(response => { + resolve(response); + }) + .catch(error => { + reject(error); + }); + }); + }, determineInterval(pointInTime) { let start, end; switch (this.selectedInterval) { @@ -251,9 +285,7 @@ }) .then(() => { if (this.show != -1) { - HTTP.get("/imports/" + this.show, { - headers: { "X-Gemma-Auth": localStorage.getItem("token") } - }) + this.loadDetails(this.show) .then(response => { this.$store.commit("imports/setCurrentDetails", response.data); this.loading = false; @@ -348,6 +380,10 @@ } }, watch: { + $route() { + const { id } = this.$route.params; + if (id) this.showSingleRessource(id); + }, selectedInterval() { const now = new Date(); switch (this.selectedInterval) { @@ -396,13 +432,21 @@ } }, mounted() { - this.$store.commit("application/searchQuery", ""); - this.loadLogs(); + const { id } = this.$route.params; + if (!id) { + this.$store.commit("application/searchQuery", ""); + this.loadLogs(); + } else { + this.showSingleRessource(id); + } } };