DEV: introduces prettier for es6 files

This commit is contained in:
Joffrey JAFFEUX
2018-06-15 17:03:24 +02:00
committed by GitHub
parent c7ee70941e
commit 03a7d532cf
1162 changed files with 60667 additions and 29659 deletions

View File

@ -26,31 +26,46 @@ export default Ember.Controller.extend({
fetchDashboard() {
if (this.get("isLoading")) return;
if (!this.get("dashboardFetchedAt") || moment().subtract(30, "minutes").toDate() > this.get("dashboardFetchedAt")) {
if (
!this.get("dashboardFetchedAt") ||
moment()
.subtract(30, "minutes")
.toDate() > this.get("dashboardFetchedAt")
) {
this.set("isLoading", true);
const versionChecks = this.siteSettings.version_checks;
AdminDashboardNext.find().then(adminDashboardNextModel => {
AdminDashboardNext.find()
.then(adminDashboardNextModel => {
if (versionChecks) {
this.set(
"versionCheck",
VersionCheck.create(adminDashboardNextModel.version_check)
);
}
if (versionChecks) {
this.set("versionCheck", VersionCheck.create(adminDashboardNextModel.version_check));
}
this.setProperties({
dashboardFetchedAt: new Date(),
model: adminDashboardNextModel,
reports: adminDashboardNextModel.reports.map(x => Report.create(x))
this.setProperties({
dashboardFetchedAt: new Date(),
model: adminDashboardNextModel,
reports: adminDashboardNextModel.reports.map(x => Report.create(x))
});
})
.catch(e => {
this.get("exceptionController").set("thrown", e.jqXHR);
this.replaceRoute("exception");
})
.finally(() => {
this.set("isLoading", false);
});
}).catch(e => {
this.get("exceptionController").set("thrown", e.jqXHR);
this.replaceRoute("exception");
}).finally(() => {
this.set("isLoading", false);
});
}
if (!this.get("problemsFetchedAt") || moment().subtract(PROBLEMS_CHECK_MINUTES, "minutes").toDate() > this.get("problemsFetchedAt")) {
if (
!this.get("problemsFetchedAt") ||
moment()
.subtract(PROBLEMS_CHECK_MINUTES, "minutes")
.toDate() > this.get("problemsFetchedAt")
) {
this.loadProblems();
}
},
@ -58,21 +73,28 @@ export default Ember.Controller.extend({
loadProblems() {
this.set("loadingProblems", true);
this.set("problemsFetchedAt", new Date());
AdminDashboardNext.fetchProblems().then(d => {
this.set("problems", d.problems);
}).finally(() => {
this.set("loadingProblems", false);
});
AdminDashboardNext.fetchProblems()
.then(d => {
this.set("problems", d.problems);
})
.finally(() => {
this.set("loadingProblems", false);
});
},
@computed("problemsFetchedAt")
problemsTimestamp(problemsFetchedAt) {
return moment(problemsFetchedAt).locale("en").format("LLL");
return moment(problemsFetchedAt)
.locale("en")
.format("LLL");
},
@computed("period")
startDate(period) {
let fullDay = moment().locale("en").utc().subtract(1, "day");
let fullDay = moment()
.locale("en")
.utc()
.subtract(1, "day");
switch (period) {
case "yearly":
@ -94,12 +116,20 @@ export default Ember.Controller.extend({
@computed()
lastWeek() {
return moment().locale("en").utc().endOf("day").subtract(1, "week");
return moment()
.locale("en")
.utc()
.endOf("day")
.subtract(1, "week");
},
@computed()
endDate() {
return moment().locale("en").utc().subtract(1, "day").endOf("day");
return moment()
.locale("en")
.utc()
.subtract(1, "day")
.endOf("day");
},
@computed("model.attributes.updated_at")
@ -118,7 +148,7 @@ export default Ember.Controller.extend({
},
refreshProblems() {
this.loadProblems();
},
}
},
_reportsForPeriodURL(period) {