From a2049ebbb866cf587aad46c6bea0bc10c1be6431 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com> Date: Wed, 23 Sep 2020 22:55:38 -0400 Subject: [PATCH] Mithril 2 Update (#12) Update for Mithril 2 --- .../src/admin/components/StatisticsWidget.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/extensions/statistics/js/src/admin/components/StatisticsWidget.js b/extensions/statistics/js/src/admin/components/StatisticsWidget.js index da7d19c53..722ad760c 100644 --- a/extensions/statistics/js/src/admin/components/StatisticsWidget.js +++ b/extensions/statistics/js/src/admin/components/StatisticsWidget.js @@ -16,8 +16,8 @@ import abbreviateNumber from 'flarum/utils/abbreviateNumber'; import { Chart } from 'frappe-charts/dist/frappe-charts.esm.js'; export default class StatisticsWidget extends DashboardWidget { - init() { - super.init(); + oninit(vnode) { + super.oninit(vnode); // Create a Date object which represents the start of the day in the // configured timezone. To do this we convert a UTC time into that timezone, @@ -89,13 +89,13 @@ export default class StatisticsWidget extends DashboardWidget { ); })} -
+
); } - drawChart(elm, isInitialized, context) { - if (context.chart && context.entity === this.selectedEntity && context.period === this.selectedPeriod) { + drawChart(vnode) { + if (this.chart && this.entity === this.selectedEntity && this.period === this.selectedPeriod) { return; } @@ -135,8 +135,8 @@ export default class StatisticsWidget extends DashboardWidget { datasets }; - if (!context.chart) { - context.chart = new Chart(elm, { + if (!this.chart) { + this.chart = new Chart(vnode.dom, { data, type: 'line', height: 280, @@ -151,11 +151,11 @@ export default class StatisticsWidget extends DashboardWidget { colors: ['black', app.forum.attribute('themePrimaryColor')] }); } else { - context.chart.update(data); + this.chart.update(data); } - context.entity = this.selectedEntity; - context.period = this.selectedPeriod; + this.entity = this.selectedEntity; + this.period = this.selectedPeriod; } changeEntity(entity) {