diff --git a/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6 index aebc5d00..26e2d622 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6 @@ -2,6 +2,7 @@ import { default as computed } from 'discourse-common/utils/decorators'; import { popupAjaxError } from 'discourse/lib/ajax-error'; import { ajax } from 'discourse/lib/ajax'; import { notEmpty } from "@ember/object/computed"; +import CustomWizardLogs from '../models/custom-wizard-logs'; export default Ember.Controller.extend({ refreshing: false, @@ -15,11 +16,7 @@ export default Ember.Controller.extend({ this.set("refreshing", true); - ajax('/admin/wizards/logs', { - data: { - page: this.page - } - }).catch(popupAjaxError) + CustomWizardLogs.list() .then(result => { if (!result || result.length === 0) { this.set('canLoadMore', false); diff --git a/assets/javascripts/discourse/models/custom-wizard-logs.js.es6 b/assets/javascripts/discourse/models/custom-wizard-logs.js.es6 new file mode 100644 index 00000000..10f46d53 --- /dev/null +++ b/assets/javascripts/discourse/models/custom-wizard-logs.js.es6 @@ -0,0 +1,17 @@ +import { ajax } from 'discourse/lib/ajax'; +import { popupAjaxError } from 'discourse/lib/ajax-error'; +import EmberObject from "@ember/object"; + +const CustomWizardLogs = EmberObject.extend(); + +CustomWizardLogs.reopenClass({ + list(page = 0) { + return ajax('/admin/wizards/logs', { + data: { + page + } + }).catch(popupAjaxError); + } +}); + +export default CustomWizardLogs; \ No newline at end of file diff --git a/assets/javascripts/discourse/routes/admin-wizards-logs.js.es6 b/assets/javascripts/discourse/routes/admin-wizards-logs.js.es6 new file mode 100644 index 00000000..1c1de391 --- /dev/null +++ b/assets/javascripts/discourse/routes/admin-wizards-logs.js.es6 @@ -0,0 +1,11 @@ +import CustomWizardLogs from '../models/custom-wizard-logs'; + +export default Discourse.Route.extend({ + model() { + return CustomWizardLogs.list(); + }, + + setupController(controller, model) { + controller.set('logs', model); + } +}) \ No newline at end of file diff --git a/assets/javascripts/discourse/templates/admin-wizards-logs.hbs b/assets/javascripts/discourse/templates/admin-wizards-logs.hbs index 5843bb7b..28052fe2 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-logs.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-logs.hbs @@ -1,8 +1,14 @@
{{i18n 'search.no_results'}}
{{else}} @@ -10,14 +16,14 @@