2023-03-15 17:42:12 +08:00
|
|
|
import { inject as service } from "@ember/service";
|
2020-03-07 00:41:41 +08:00
|
|
|
import Controller, { inject as controller } from "@ember/controller";
|
2022-12-13 08:53:08 +08:00
|
|
|
import { action } from "@ember/object";
|
2020-05-14 04:23:41 +08:00
|
|
|
import I18n from "I18n";
|
2016-06-16 01:49:57 +08:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
|
2023-03-15 17:42:12 +08:00
|
|
|
export default class AdminWebHooksShowController extends Controller {
|
|
|
|
@service dialog;
|
|
|
|
@service router;
|
|
|
|
@controller adminWebHooks;
|
2016-06-16 01:49:57 +08:00
|
|
|
|
2022-12-13 08:53:08 +08:00
|
|
|
@action
|
|
|
|
edit() {
|
|
|
|
return this.router.transitionTo("adminWebHooks.edit", this.model);
|
2023-03-15 17:42:12 +08:00
|
|
|
}
|
2018-12-05 17:14:06 +08:00
|
|
|
|
2022-12-13 08:53:08 +08:00
|
|
|
@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);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
2023-03-15 17:42:12 +08:00
|
|
|
}
|
|
|
|
}
|