Mercurial > gemma
changeset 2732:0ab7985ef008
import_review: fixed flakey display of logs
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 19 Mar 2019 14:50:56 +0100 |
parents | 7e97337054b9 |
children | 4ae3453fcf50 |
files | client/src/components/importoverview/AdditionalDetail.vue client/src/components/importoverview/AdditionalLog.vue client/src/components/importoverview/ApprovedGaugeMeasurementDetail.vue client/src/components/importoverview/BottleneckDetail.vue client/src/components/importoverview/LogDetail.vue client/src/components/importoverview/LogEntry.vue client/src/components/importoverview/SoundingResultDetail.vue client/src/components/importoverview/StretchDetails.vue client/src/store/imports.js |
diffstat | 9 files changed, 50 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/importoverview/AdditionalDetail.vue Tue Mar 19 14:50:06 2019 +0100 +++ b/client/src/components/importoverview/AdditionalDetail.vue Tue Mar 19 14:50:56 2019 +0100 @@ -32,10 +32,11 @@ * Author(s): * Thomas Junk <thomas.junk@intevation.de> */ +import { mapState } from "vuex"; export default { name: "additionaldetail", - props: ["entry", "details"], + props: ["entry"], components: { BottleneckDetail: () => import("./BottleneckDetail.vue"), ApprovedGaugeMeasurementDetail: () => @@ -43,6 +44,7 @@ FairwayDimensionDetail: () => import("./FairwayDimension.vue") }, computed: { + ...mapState("imports", ["showLogs", "details"]), kind() { return this.entry.kind.toUpperCase(); },
--- a/client/src/components/importoverview/AdditionalLog.vue Tue Mar 19 14:50:06 2019 +0100 +++ b/client/src/components/importoverview/AdditionalLog.vue Tue Mar 19 14:50:56 2019 +0100 @@ -11,7 +11,11 @@ } ]" > - <div class="d-flex flex-row" v-for="(line, index) in logLines" :key="index"> + <div + class="d-flex flex-row" + v-for="(line, index) in details.entries" + :key="index" + > <span :class="[ 'kind', @@ -67,14 +71,8 @@ export default { name: "additionallogs", - props: ["details"], - data() { - return { - logLines: this.details.entries - }; - }, computed: { - ...mapState("imports", ["showAdditional"]) + ...mapState("imports", ["showAdditional", "details"]) }, NODETAILS: -1 };
--- a/client/src/components/importoverview/ApprovedGaugeMeasurementDetail.vue Tue Mar 19 14:50:06 2019 +0100 +++ b/client/src/components/importoverview/ApprovedGaugeMeasurementDetail.vue Tue Mar 19 14:50:56 2019 +0100 @@ -112,14 +112,14 @@ export default { name: "agmdetails", - props: ["entry", "details"], + props: ["entry"], data() { return { showDiff: NODIFF }; }, computed: { - ...mapState("imports", ["showLogs"]) + ...mapState("imports", ["showLogs", "details"]) }, methods: { toggleDiff(number) {
--- a/client/src/components/importoverview/BottleneckDetail.vue Tue Mar 19 14:50:06 2019 +0100 +++ b/client/src/components/importoverview/BottleneckDetail.vue Tue Mar 19 14:50:56 2019 +0100 @@ -80,7 +80,7 @@ export default { name: "bottleneckdetails", - props: ["entry", "details"], + props: ["entry"], data() { return { bottlenecks: [], @@ -91,7 +91,7 @@ this.loadBottlenecks(); }, computed: { - ...mapState("imports", ["showLogs"]) + ...mapState("imports", ["showLogs", "details"]) }, methods: { loadBottlenecks() {
--- a/client/src/components/importoverview/LogDetail.vue Tue Mar 19 14:50:06 2019 +0100 +++ b/client/src/components/importoverview/LogDetail.vue Tue Mar 19 14:50:56 2019 +0100 @@ -32,14 +32,9 @@ {{ details.summary.los }})</span > </div> - <StretchDetail - v-if="isStretch" - :entry="entry" - :details="details" - ></StretchDetail> + <StretchDetail v-if="isStretch" :entry="entry"></StretchDetail> <SoundingResultDetail :entry="entry" - :details="details" v-if="isSoundingResult" ></SoundingResultDetail> </div> @@ -47,7 +42,6 @@ v-if="entry.id === showAdditional" class="ml-2 d-flex flex-row" :entry="entry" - :details="details" ></AdditionalDetail> <div class="d-flex fex-row" style="padding-left: 3px;"> <font-awesome-icon @@ -69,7 +63,6 @@ <AdditionalLog v-if="entry.id === showLogs" class="mx-4 pb-1 d-flex flex-row small" - :details="details" ></AdditionalLog> </div> </template> @@ -90,10 +83,12 @@ */ import { mapState } from "vuex"; +import { displayError } from "@/lib/errors.js"; +import { HTTP } from "@/lib/http.js"; export default { name: "logdetail", - props: ["entry", "details"], + props: ["entry"], components: { SoundingResultDetail: () => import("./SoundingResultDetail.vue"), StretchDetail: () => import("./StretchDetails.vue"), @@ -101,10 +96,23 @@ AdditionalLog: () => import("./AdditionalLog.vue") }, mounted() { - if (this.entry.state === "pending") { - this.$store.commit("imports/showAdditionalInfoFor", this.entry.id); - } - this.$store.commit("imports/showAdditionalLogsFor", this.entry.id); + HTTP.get("/imports/" + this.entry.id, { + headers: { "X-Gemma-Auth": localStorage.getItem("token") } + }) + .then(response => { + this.$store.commit("imports/setCurrentDetails", response.data); + if (this.entry.state === "pending") { + this.$store.commit("imports/showAdditionalInfoFor", this.entry.id); + } + this.$store.commit("imports/showAdditionalLogsFor", this.entry.id); + }) + .catch(error => { + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }); }, methods: { toggleAdditionalInfo() {
--- a/client/src/components/importoverview/LogEntry.vue Tue Mar 19 14:50:06 2019 +0100 +++ b/client/src/components/importoverview/LogEntry.vue Tue Mar 19 14:50:56 2019 +0100 @@ -117,8 +117,6 @@ */ import { mapState } from "vuex"; import { STATES } from "@/store/imports.js"; -import { displayError } from "@/lib/errors.js"; -import { HTTP } from "@/lib/http.js"; export default { name: "importlogentry", @@ -128,21 +126,6 @@ details: null }; }, - mounted() { - HTTP.get("/imports/" + this.entry.id, { - headers: { "X-Gemma-Auth": localStorage.getItem("token") } - }) - .then(response => { - this.details = response.data; - }) - .catch(error => { - const { status, data } = error.response; - displayError({ - title: this.$gettext("Backend Error"), - message: `${status}: ${data.message || data}` - }); - }); - }, components: { LogDetail: () => import("./LogDetail.vue") },
--- a/client/src/components/importoverview/SoundingResultDetail.vue Tue Mar 19 14:50:06 2019 +0100 +++ b/client/src/components/importoverview/SoundingResultDetail.vue Tue Mar 19 14:50:56 2019 +0100 @@ -21,12 +21,17 @@ * Author(s): * Thomas Junk <thomas.junk@intevation.de> */ +import { mapState } from "vuex"; + export default { name: "soundingresultdetails", - props: ["entry", "details"], + props: ["entry"], mounted() { this.$store.commit("imports/hideAdditionalInfo"); }, + computed: { + ...mapState("imports", ["showAdditional", "details"]) + }, methods: { moveMap(coordinates) { this.$store.commit("map/moveMap", {
--- a/client/src/components/importoverview/StretchDetails.vue Tue Mar 19 14:50:06 2019 +0100 +++ b/client/src/components/importoverview/StretchDetails.vue Tue Mar 19 14:50:56 2019 +0100 @@ -23,13 +23,17 @@ */ import { displayError } from "@/lib/errors.js"; import { LAYERS } from "@/store/map.js"; +import { mapState } from "vuex"; export default { name: "stretchdetails", - props: ["entry", "details"], + props: ["entry"], mounted() { this.$store.commit("imports/hideAdditionalInfo"); }, + computed: { + ...mapState("imports", ["showAdditional", "details"]) + }, methods: { moveToExtent(feature) { this.$store.commit("map/moveToExtent", {
--- a/client/src/store/imports.js Tue Mar 19 14:50:06 2019 +0100 +++ b/client/src/store/imports.js Tue Mar 19 14:50:56 2019 +0100 @@ -39,7 +39,8 @@ reviewed: [], show: NODETAILS, showAdditional: NODETAILS, - showLogs: NODETAILS + showLogs: NODETAILS, + details: null }; }; @@ -93,6 +94,9 @@ } }, mutations: { + setCurrentDetails: (state, details) => { + state.details = details; + }, toggleFilter: (state, name) => { state[name] = !state[name]; const allSet =