diff --git a/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 index bc38648d..6352b3b2 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 @@ -1,34 +1,36 @@ import Controller from "@ember/controller"; import { fmt } from "discourse/lib/computed"; -import { empty } from '@ember/object/computed'; +import { empty } from "@ember/object/computed"; import CustomWizard from "../models/custom-wizard"; export default Controller.extend({ downloadUrl: fmt("wizard.id", "/admin/wizards/submissions/%@/download"), - noResults: empty('submissions'), + noResults: empty("submissions"), page: 0, total: 0, loadMoreSubmissions() { - const page = this.get('page'); - const wizardId = this.get('wizard.id'); + const page = this.get("page"); + const wizardId = this.get("wizard.id"); - this.set('loadingMore', true); - CustomWizard.submissions(wizardId, page).then(result => { - if (result.submissions) { - this.get('submissions').pushObjects(result.submissions); - } - }).finally(() => { - this.set('loadingMore', false); - }); + this.set("loadingMore", true); + CustomWizard.submissions(wizardId, page) + .then((result) => { + if (result.submissions) { + this.get("submissions").pushObjects(result.submissions); + } + }) + .finally(() => { + this.set("loadingMore", false); + }); }, actions: { loadMore() { - if (!this.loadingMore && (this.submissions.length < this.total)) { - this.set('page', this.get('page') + 1); + if (!this.loadingMore && this.submissions.length < this.total) { + this.set("page", this.get("page") + 1); this.loadMoreSubmissions(); } - } - } + }, + }, }); diff --git a/assets/javascripts/discourse/models/custom-wizard.js.es6 b/assets/javascripts/discourse/models/custom-wizard.js.es6 index e4b0a530..5e94e31e 100644 --- a/assets/javascripts/discourse/models/custom-wizard.js.es6 +++ b/assets/javascripts/discourse/models/custom-wizard.js.es6 @@ -220,43 +220,45 @@ CustomWizard.reopenClass({ return ajax(`/admin/wizards/submissions/${wizardId}`, { type: "GET", - data - }).then(result => { - if (result.wizard) { - let fields = ["username"]; - let submissions = []; - let wizard = result.wizard; - let total = result.total; + data, + }) + .then((result) => { + if (result.wizard) { + let fields = ["username"]; + let submissions = []; + let wizard = result.wizard; + let total = result.total; - result.submissions.forEach((s) => { - let submission = { - username: s.username, - }; + result.submissions.forEach((s) => { + let submission = { + username: s.username, + }; - Object.keys(s.fields).forEach((f) => { - if (fields.indexOf(f) < 0) { - fields.push(f); - } + Object.keys(s.fields).forEach((f) => { + if (fields.indexOf(f) < 0) { + fields.push(f); + } - if (fields.includes(f)) { - submission[f] = s.fields[f]; - } + if (fields.includes(f)) { + submission[f] = s.fields[f]; + } + }); + + submission["submitted_at"] = s.submitted_at; + submissions.push(submission); }); - - submission['submitted_at'] = s.submitted_at; - submissions.push(submission); - }); - fields.push("submitted_at"); + fields.push("submitted_at"); - return { - wizard, - fields, - submissions, - total - }; - } - }).catch(popupAjaxError); + return { + wizard, + fields, + submissions, + total, + }; + } + }) + .catch(popupAjaxError); }, create(wizardJson = {}) { diff --git a/assets/javascripts/discourse/routes/admin-wizards-submissions-show.js.es6 b/assets/javascripts/discourse/routes/admin-wizards-submissions-show.js.es6 index 509816da..2ff9fbf9 100644 --- a/assets/javascripts/discourse/routes/admin-wizards-submissions-show.js.es6 +++ b/assets/javascripts/discourse/routes/admin-wizards-submissions-show.js.es6 @@ -12,7 +12,7 @@ export default DiscourseRoute.extend({ wizard: model.wizard, fields: model.fields, submissions: A(model.submissions), - total: model.total + total: model.total, }); }, });