correct it so we always load Chart just before creating it
This commit is contained in:
parent
565fa1f60e
commit
f9d2c69bbe
|
@ -2,6 +2,7 @@ import { ajax } from "discourse/lib/ajax";
|
||||||
import AsyncReport from "admin/mixins/async-report";
|
import AsyncReport from "admin/mixins/async-report";
|
||||||
import Report from "admin/models/report";
|
import Report from "admin/models/report";
|
||||||
import { number } from 'discourse/lib/formatter';
|
import { number } from 'discourse/lib/formatter';
|
||||||
|
import loadScript from "discourse/lib/load-script";
|
||||||
|
|
||||||
function collapseWeekly(data, average) {
|
function collapseWeekly(data, average) {
|
||||||
let aggregate = [];
|
let aggregate = [];
|
||||||
|
@ -110,7 +111,10 @@ export default Ember.Component.extend(AsyncReport, {
|
||||||
if (this._chart) {
|
if (this._chart) {
|
||||||
this._chart.destroy();
|
this._chart.destroy();
|
||||||
}
|
}
|
||||||
this._chart = new window.Chart(context, this._buildChartConfig(data));
|
|
||||||
|
loadScript("/javascripts/Chart.min.js").then(() => {
|
||||||
|
this._chart = new window.Chart(context, this._buildChartConfig(data));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
import loadScript from "discourse/lib/load-script";
|
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
activate() {
|
activate() {
|
||||||
loadScript("/javascripts/Chart.min.js").then(() => {
|
this.controllerFor('admin-dashboard-next').fetchDashboard();
|
||||||
this.controllerFor('admin-dashboard-next').fetchDashboard();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue