comparison client/src/components/importoverview/LogDetail.vue @ 2799:e19fac818aab

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
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 25 Mar 2019 16:16:58 +0100
parents c4821579cfaf
children 84effca50751
comparison
equal deleted inserted replaced
2798:c9032a57996e 2799:e19fac818aab
90 * Author(s): 90 * Author(s):
91 * Thomas Junk <thomas.junk@intevation.de> 91 * Thomas Junk <thomas.junk@intevation.de>
92 */ 92 */
93 93
94 import { mapState } from "vuex"; 94 import { mapState } from "vuex";
95 import { displayError } from "@/lib/errors.js";
96 import { HTTP } from "@/lib/http.js";
97 95
98 export default { 96 export default {
99 name: "logdetail", 97 name: "logdetail",
100 props: ["entry"], 98 props: ["entry"],
101 components: { 99 components: {
103 StretchDetail: () => import("./StretchDetails.vue"), 101 StretchDetail: () => import("./StretchDetails.vue"),
104 AdditionalDetail: () => import("./AdditionalDetail.vue"), 102 AdditionalDetail: () => import("./AdditionalDetail.vue"),
105 AdditionalLog: () => import("./AdditionalLog.vue") 103 AdditionalLog: () => import("./AdditionalLog.vue")
106 }, 104 },
107 mounted() { 105 mounted() {
108 HTTP.get("/imports/" + this.entry.id, { 106 if (this.entry.state === "pending") {
109 headers: { "X-Gemma-Auth": localStorage.getItem("token") } 107 this.$store.commit("imports/showAdditionalInfoFor", this.entry.id);
110 }) 108 }
111 .then(response => { 109 this.$store.commit("imports/showAdditionalLogsFor", this.entry.id);
112 this.$store.commit("imports/setCurrentDetails", response.data);
113 if (this.entry.state === "pending") {
114 this.$store.commit("imports/showAdditionalInfoFor", this.entry.id);
115 }
116 this.$store.commit("imports/showAdditionalLogsFor", this.entry.id);
117 })
118 .catch(error => {
119 const { status, data } = error.response;
120 displayError({
121 title: this.$gettext("Backend Error"),
122 message: `${status}: ${data.message || data}`
123 });
124 });
125 }, 110 },
126 methods: { 111 methods: {
127 toggleAdditionalInfo() { 112 toggleAdditionalInfo() {
128 if (this.entry.id === this.showAdditional) { 113 if (this.entry.id === this.showAdditional) {
129 this.$store.commit("imports/hideAdditionalInfo"); 114 this.$store.commit("imports/hideAdditionalInfo");