dashboard next: perf and UI tweaks

* cache CORE reports
* adds backups/uploads section
* few css tweaks
This commit is contained in:
Joffrey JAFFEUX
2018-04-18 21:30:41 +02:00
committed by GitHub
parent 5b93d69939
commit 01c061d20d
14 changed files with 269 additions and 55 deletions

View File

@ -13,11 +13,24 @@ export default Ember.Component.extend({
isLoading: false,
help: null,
helpPage: null,
model: null,
didInsertElement() {
this._super();
this.fetchReport();
if (this.get("dataSourceName")){
this._fetchReport();
} else if (this.get("model")) {
this._setPropertiesFromModel(this.get("model"));
}
},
didUpdateAttrs() {
this._super();
if (this.get("model")) {
this._setPropertiesFromModel(this.get("model"));
}
},
@computed("dataSourceName")
@ -25,25 +38,28 @@ export default Ember.Component.extend({
return `/admin/reports/${dataSourceName}`;
},
fetchReport() {
_fetchReport() {
if (this.get("isLoading")) return;
this.set("isLoading", true);
ajax(this.get("dataSource"))
.then((response) => {
const report = response.report;
const data = report.data.sort((a, b) => a.x >= b.x);
this.setProperties({
labels: data.map(r => r.x),
dataset: data.map(r => r.y),
total: report.total,
title: report.title,
chartData: data
});
this._setPropertiesFromModel(response.report);
}).finally(() => {
this.set("isLoading", false);
});
},
_setPropertiesFromModel(model) {
const data = model.data.sort((a, b) => a.x >= b.x);
this.setProperties({
labels: data.map(r => r.x),
dataset: data.map(r => r.y),
total: model.total,
title: model.title,
chartData: data
});
}
});