discourse/app/assets/javascripts/admin/addon/controllers/admin-web-hooks-show.js
Jarek Radosz f9bdda84ca
DEV: Admin webhooks interface issues (#19360)
1. The events table had broken styling, making each row overflow
2. It had confusing routes: `/:id` for "edit" and `/:id/events` for "show" (now it's `/:id/edit` and `/:id` respectively)
3. There previously was an unused backend action (`#edit`) - now it is used (and `web_hooks/:id/events` route has been removed)
4. There was outdated/misplaced/duplicated CSS
5. And more
2022-12-13 01:53:08 +01:00

33 lines
863 B
JavaScript

import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import I18n from "I18n";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { inject as service } from "@ember/service";
export default Controller.extend({
adminWebHooks: controller(),
dialog: service(),
router: service(),
@action
edit() {
return this.router.transitionTo("adminWebHooks.edit", this.model);
},
@action
destroy() {
return this.dialog.deleteConfirm({
message: I18n.t("admin.web_hooks.delete_confirm"),
didConfirm: async () => {
try {
await this.model.destroyRecord();
this.adminWebHooks.model.removeObject(this.model);
this.transitionToRoute("adminWebHooks");
} catch (e) {
popupAjaxError(e);
}
},
});
},
});