Mercurial > gemma
comparison client/src/store/diagram.js @ 3191:c0cd5dfec153
statistics: persist fields to vuex
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 08 May 2019 11:25:11 +0200 |
parents | 505414dfe3e7 |
children | 88c31298eba8 |
comparison
equal
deleted
inserted
replaced
3190:54a3e40cfbed | 3191:c0cd5dfec153 |
---|---|
22 05-2019, 30.000,0.000,0.000,0.000, 30.000`; | 22 05-2019, 30.000,0.000,0.000,0.000, 30.000`; |
23 | 23 |
24 const init = () => { | 24 const init = () => { |
25 return { | 25 return { |
26 selectedFairwayAvailabilityFeature: null, | 26 selectedFairwayAvailabilityFeature: null, |
27 from: null, | |
28 to: null, | |
29 frequency: null, | |
27 fwData: null, | 30 fwData: null, |
28 legend: null | 31 legend: null |
29 }; | 32 }; |
30 }; | 33 }; |
31 | 34 |
32 const diagram = { | 35 const diagram = { |
33 init, | 36 init, |
34 namespaced: true, | 37 namespaced: true, |
35 state: init(), | 38 state: init(), |
36 mutations: { | 39 mutations: { |
40 setFrequency: (state, frequency) => { | |
41 state.frequency = frequency; | |
42 }, | |
43 setFrom: (state, from) => { | |
44 state.from = from; | |
45 }, | |
46 setTo: (state, to) => { | |
47 state.to = to; | |
48 }, | |
37 setSelectedFairwayAvailability: (state, feature) => { | 49 setSelectedFairwayAvailability: (state, feature) => { |
38 state.selectedFairwayAvailabilityFeature = feature; | 50 state.selectedFairwayAvailabilityFeature = feature; |
39 }, | 51 }, |
40 setFwData: (state, fwData) => { | 52 setFwData: (state, fwData) => { |
41 state.fwData = fwData; | 53 state.fwData = fwData; |
49 } | 61 } |
50 }, | 62 }, |
51 actions: { | 63 actions: { |
52 loadAvailableFairwayDepth: ({ commit }, options) => { | 64 loadAvailableFairwayDepth: ({ commit }, options) => { |
53 return new Promise((resolve, reject) => { | 65 return new Promise((resolve, reject) => { |
54 const { featureName } = options; | 66 const { feature, from, to, frequency } = options; |
55 const URL = `/data/bottleneck/fairway-depth/${featureName}?from=2019-01-01T15:04:05%2b00:00&to=2019-05-02T15:04:05%2b07:00&mode=monthly`; | 67 const URL = `/data/bottleneck/fairway-depth/${ |
68 feature.properties.name | |
69 }?from=${from}T00:00:00%2b00:00&to=${to}T23:59:59%2b07:00&mode=${frequency}`; | |
56 HTTP.get(URL, { | 70 HTTP.get(URL, { |
57 headers: { "X-Gemma-Auth": localStorage.getItem("token") } | 71 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
58 }) | 72 }) |
59 .then(response => { | 73 .then(response => { |
60 const data = MOCKDATA; | 74 const data = MOCKDATA; |