changeset 2789:c1e832f77726

import_overview: setting a sane default window in case of reload When the overview is initially opened the default window is start: begin of current hour end: end of current hour depending on interval size the window is widened to e.g. begin and end of day. When a reload is triggered, the reload puts "now" within the selected window when the window was 'hour' it uses start: begin of current hour end: end of current hour which should behave consistent.
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 25 Mar 2019 11:03:23 +0100
parents ff3b89ff07bd
children 563bcd8b7d7b
files client/src/components/importoverview/ImportOverview.vue client/src/store/imports.js
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importoverview/ImportOverview.vue	Mon Mar 25 10:38:37 2019 +0100
+++ b/client/src/components/importoverview/ImportOverview.vue	Mon Mar 25 11:03:23 2019 +0100
@@ -4,7 +4,7 @@
       icon="clipboard-check"
       :title="importReviewLabel"
       :closeCallback="$parent.close"
-      :actions="[{ callback: loadLogs, icon: 'redo' }]"
+      :actions="[{ callback: loadUpdatedLogs, icon: 'redo' }]"
     />
     <div class="position-relative">
       <transition name="fade">
@@ -234,6 +234,12 @@
     filteredImports() {
       return this.imports;
     },
+    loadUpdatedLogs() {
+      const [start, end] = this.determineInterval(new Date());
+      this.$store.commit("imports/setStartDate", start);
+      this.$store.commit("imports/setEndDate", end);
+      this.loadLogs();
+    },
     loadLogs() {
       this.loading = true;
       this.$store
--- a/client/src/store/imports.js	Mon Mar 25 10:38:37 2019 +0100
+++ b/client/src/store/imports.js	Mon Mar 25 11:03:23 2019 +0100
@@ -15,7 +15,7 @@
 import { HTTP } from "@/lib/http";
 import { WFS } from "ol/format.js";
 import { equalTo as equalToFilter } from "ol/format/filter.js";
-import { startOfHour } from "date-fns";
+import { startOfHour, endOfHour } from "date-fns";
 
 /* eslint-disable no-unused-vars */
 /* eslint-disable no-unreachable */
@@ -43,7 +43,7 @@
     showLogs: NODETAILS,
     details: [],
     startDate: startOfHour(new Date()),
-    endDate: new Date(),
+    endDate: endOfHour(new Date()),
     prev: null,
     next: null
   };