mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 19:53:53 -06:00
DEV: drops jquery usage un admin-report-chart (#14661)
This commit is contained in:
parent
ae45c5efb5
commit
adb302f801
@ -5,6 +5,7 @@ import loadScript from "discourse/lib/load-script";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { number } from "discourse/lib/formatter";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import { bind } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["admin-report-chart"],
|
||||
@ -12,23 +13,16 @@ export default Component.extend({
|
||||
total: 0,
|
||||
options: null,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.resizeHandler = () =>
|
||||
discourseDebounce(this, this._scheduleChartRendering, 500);
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
$(window).on("resize.chart", this.resizeHandler);
|
||||
window.addEventListener("resize", this._resizeHandler);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
$(window).off("resize.chart", this.resizeHandler);
|
||||
window.removeEventListener("resize", this._resizeHandler);
|
||||
|
||||
this._resetChart();
|
||||
},
|
||||
@ -179,4 +173,9 @@ export default Component.extend({
|
||||
_applyChartGrouping(model, data, options) {
|
||||
return Report.collapse(model, data, options.chartGrouping);
|
||||
},
|
||||
|
||||
@bind
|
||||
_resizeHandler() {
|
||||
discourseDebounce(this, this._scheduleChartRendering, 500);
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user