Commit 40d6e4bd authored by Jonathan Foucher's avatar Jonathan Foucher
Browse files

update graph automatically when changing action data.

parent 51cf81e9
Pipeline #31867 failed with stages
in 10 minutes and 49 seconds
......@@ -40,7 +40,8 @@ class Kernel extends HttpKernel
'api' => [
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
// 'throttle:api',
'throttle:6000,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
......
......@@ -83,7 +83,7 @@ export default {
evaluation.measure_levels = this.evaluation.measure_levels.map(m => m.measure_id === this.measure.id ? ({...m, expected_level : parseInt(newValue, 10) }) : m)
console.log(' evaluation.measure_levels', evaluation.measure_levels)
this.$store.dispatch('saveDraftEvaluation', evaluation).then(() => {
this.$store.dispatch('saveDraftEvaluation', {...evaluation, toast: false}).then(() => {
this.$store.dispatch('getGraphForEvaluation', {name: 'risks', id:evaluation.id})
this.$store.dispatch('getGraphForEvaluation', {name: 'futurerisks', id:evaluation.id})
this.$store.commit('updateEvaluation', evaluation)
......@@ -104,6 +104,11 @@ export default {
}
evaluation.measure_levels = this.evaluation.measure_levels.map(m => m.measure_id === this.measure.id ? ({...m, end_date : moment(newValue.startDate).format('YYYY-MM-DD'), expected_level : parseInt(this.expected_level, 10) }) : m)
this.$store.commit('updateEvaluation', evaluation)
this.$store.dispatch('saveDraftEvaluation', {...evaluation, toast: false}).then(() => {
this.$store.dispatch('getGraphForEvaluation', {name: 'risks', id:evaluation.id})
this.$store.dispatch('getGraphForEvaluation', {name: 'futurerisks', id:evaluation.id})
this.$store.commit('updateEvaluation', evaluation)
})
}
},
manager: {
......@@ -117,6 +122,11 @@ export default {
}
evaluation.measure_levels = this.evaluation.measure_levels.map(m => m.measure_id === this.measure.id ? ({...m, manager : newValue, expected_level : parseInt(this.expected_level, 10) }) : m)
this.$store.commit('updateEvaluation', evaluation)
this.$store.dispatch('saveDraftEvaluation', {...evaluation, toast: false}).then(() => {
this.$store.dispatch('getGraphForEvaluation', {name: 'risks', id:evaluation.id})
this.$store.dispatch('getGraphForEvaluation', {name: 'futurerisks', id:evaluation.id})
this.$store.commit('updateEvaluation', evaluation)
})
}
},
},
......
......@@ -63,6 +63,7 @@ export default {
computed : {
measures () {
if (!this.bestMeasures || !this.$store.state.measures.all) {
this.$store.dispatch('getBestMeasures', {id: this.evaluation.id})
return []
}
return this.$store.state.measures.all
......@@ -107,6 +108,7 @@ export default {
},
},
mounted() {
console.log('plan action mounted')
this.$store.dispatch('getBestMeasures', {id: this.evaluation.id})
}
}
......
......@@ -45,10 +45,12 @@ export default {
return req
},
updateEvaluation ({ commit }, item) {
const toast = item.toast
delete item.toast
const req = item.id ? axios.put(`/api/evaluations/${item.id}`, item) : axios.post('/api/evaluations', item)
req.then(res => {
commit('updateEvaluation', res.data)
item.id && toaster(this._vm, 'Mise à jour effectuée', 'bg-success', 'check')
item.id && toast && toaster(this._vm, 'Mise à jour effectuée', 'bg-success', 'check')
}).catch(err => {
console.log('could not update evaluation', err)
commit('setErrors', { errors: err.response.data, status: err.response.status })
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment