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";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { inject as service } from "@ember/service";
|
2016-06-16 01:49:57 +08:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
2023-10-18 18:07:09 +08:00
|
|
|
import I18n from "discourse-i18n";
|
2016-06-16 01:49:57 +08:00
|
|
|
|
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
|
2023-10-26 20:24:47 +08:00
|
|
|
destroyWebhook() {
|
2022-12-13 08:53:08 +08:00
|
|
|
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);
|
2023-07-19 03:53:23 +08:00
|
|
|
this.router.transitionTo("adminWebHooks");
|
2022-12-13 08:53:08 +08:00
|
|
|
} catch (e) {
|
|
|
|
popupAjaxError(e);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
2023-03-15 17:42:12 +08:00
|
|
|
}
|
|
|
|
}
|