Mercurial > gemma
comparison client/src/store/imports.js @ 1365:da7ee82ad5d6
merge
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Tue, 27 Nov 2018 09:03:27 +0100 |
parents | ca33ad696594 58d41573e530 |
children | f4b3fb43b311 5e1218b5a123 |
comparison
equal
deleted
inserted
replaced
1364:0c5cbbafbd94 | 1365:da7ee82ad5d6 |
---|---|
28 imports: [], | 28 imports: [], |
29 staging: [] | 29 staging: [] |
30 }; | 30 }; |
31 }; | 31 }; |
32 | 32 |
33 export default { | 33 const imports = { |
34 init, | 34 init, |
35 namespaced: true, | 35 namespaced: true, |
36 state: init(), | 36 state: init(), |
37 mutations: { | 37 mutations: { |
38 setImports: (state, imports) => { | 38 setImports: (state, imports) => { |
39 state.imports = imports; | 39 state.imports = imports; |
40 }, | 40 }, |
41 setStaging: (state, staging) => { | 41 setStaging: (state, staging) => { |
42 state.staging = staging; | 42 const enriched = staging.map(x => { |
43 return { ...x, status: STATES.NEEDSAPPROVAL }; | |
44 }); | |
45 state.staging = enriched; | |
43 }, | 46 }, |
44 | 47 |
45 toggleApproval: (state, change) => { | 48 toggleApproval: (state, change) => { |
46 throw "Not implemented!"; | 49 const { id, newStatus } = change; |
47 const { id, newState } = change; | 50 const stagedResult = state.staging.find(e => { |
48 const stagedResult = this.state.staging.find(e => { | |
49 return e.id === id; | 51 return e.id === id; |
50 }); | 52 }); |
51 if (stagedResult.status === newState) { | 53 if (stagedResult.status === newStatus) { |
52 stagedResult.status = this.$options.STATES.NEEDSAPPROVAL; | 54 stagedResult.status = STATES.NEEDSAPPROVAL; |
53 } else { | 55 } else { |
54 stagedResult.status = newState; | 56 stagedResult.status = newStatus; |
55 } | 57 } |
56 } | 58 } |
57 }, | 59 }, |
58 actions: { | 60 actions: { |
59 getImports({ commit }) { | 61 getImports({ commit }) { |
99 }); | 101 }); |
100 }); | 102 }); |
101 } | 103 } |
102 } | 104 } |
103 }; | 105 }; |
106 | |
107 export { imports, STATES }; |