From 65862fbd5f1aaf78e2c85edf9ed1bf4b6844a5b4 Mon Sep 17 00:00:00 2001 From: MatheusGodinho Date: Oct 03 2017 20:47:57 +0000 Subject: Solving data presentation bug and vuex control to data Signed-off-by: matheusgodinho Signed-off-by: thiagocmoreira --- diff --git a/src/components/package/PackagePage.vue b/src/components/package/PackagePage.vue index d0a1be1..276519a 100644 --- a/src/components/package/PackagePage.vue +++ b/src/components/package/PackagePage.vue @@ -69,7 +69,6 @@ export default { const data = labels.map((key) => { return this.reports[key] }) - return data.reduce(function (a, b) { return a + b }, 0) } }, @@ -79,8 +78,11 @@ export default { ]), onSelectAnalizer (index) { this.selectedAnalizer = index - this.setSelected(index) + this.setSelected(this.analizers[this.selectedAnalizer].id) } + }, + mounted () { + this.setSelected(this.analizers[this.selectedAnalizer].id) } } diff --git a/src/components/package/PieChart.vue b/src/components/package/PieChart.vue index 83ddc06..d91f5c7 100644 --- a/src/components/package/PieChart.vue +++ b/src/components/package/PieChart.vue @@ -1,6 +1,6 @@ diff --git a/src/helpers/Charts.js b/src/helpers/Charts.js index 0eaf32a..15b3c86 100644 --- a/src/helpers/Charts.js +++ b/src/helpers/Charts.js @@ -1,9 +1,11 @@ import Chartjs from 'vue-chartjs' +const { reactiveProp } = Chartjs.mixins var PieChart = Chartjs.Pie.extend({ - props: ['data', 'options'], + mixins: [reactiveProp], + props: ['options'], mounted () { - this.renderChart(this.data, this.options) + this.renderChart(this.chartData, this.options) } }) diff --git a/src/store/modules/analysis.js b/src/store/modules/analysis.js index 62c578b..81fdfb9 100644 --- a/src/store/modules/analysis.js +++ b/src/store/modules/analysis.js @@ -294,10 +294,12 @@ const state = { }, 'report': { 'analysis_id': 1, - 'errors': 3, 'id': 1, - 'styles': 7, - 'warnings': 0 + 'results': { + 'errors': 3, + 'styles': 7, + 'warnings': 0 + } }, 'version_id': 1 }, @@ -318,11 +320,13 @@ const state = { 'results': [] }, 'report': { - 'analysis_id': 2, - 'errors': 4, 'id': 2, - 'styles': 10, - 'warnings': 3 + 'analyzer_id': 1, + 'results': { + 'styles': 10, + 'warnings': 3, + 'errors': 4 + } }, 'version_id': 2 } @@ -344,11 +348,7 @@ const getters = { return state.analysis.filter((analyzer) => { return analyzer.analyzer_id === state.selectedAnalyzer }).map((analizer) => { - return { - errors: analizer.report.errors, - warnings: analizer.report.warnings, - styles: analizer.report.styles - } + return analizer.report.results })[0] }, [getterNames.errorsList]: (state) => {