2024-06-07 10:26:00 -05:00
|
|
|
import { tracked } from "@glimmer/tracking";
|
2020-03-06 17:41:41 +01:00
|
|
|
import Controller, { inject as controller } from "@ember/controller";
|
2022-12-13 01:53:08 +01:00
|
|
|
import { action } from "@ember/object";
|
2024-03-06 18:05:11 +01:00
|
|
|
import { service } from "@ember/service";
|
2016-06-15 19:49:57 +02:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
2023-10-18 03:07:09 -07:00
|
|
|
import I18n from "discourse-i18n";
|
2016-06-15 19:49:57 +02:00
|
|
|
|
2023-03-15 09:42:12 +00:00
|
|
|
export default class AdminWebHooksShowController extends Controller {
|
|
|
|
@service dialog;
|
|
|
|
@service router;
|
|
|
|
@controller adminWebHooks;
|
2024-06-07 10:26:00 -05:00
|
|
|
@tracked status;
|
|
|
|
|
|
|
|
queryParams = ["status"];
|
2016-06-15 19:49:57 +02:00
|
|
|
|
2022-12-13 01:53:08 +01:00
|
|
|
@action
|
|
|
|
edit() {
|
|
|
|
return this.router.transitionTo("adminWebHooks.edit", this.model);
|
2023-03-15 09:42:12 +00:00
|
|
|
}
|
2018-12-05 14:44:06 +05:30
|
|
|
|
2022-12-13 01:53:08 +01:00
|
|
|
@action
|
2023-10-26 08:24:47 -04:00
|
|
|
destroyWebhook() {
|
2022-12-13 01:53:08 +01: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-18 14:53:23 -05:00
|
|
|
this.router.transitionTo("adminWebHooks");
|
2022-12-13 01:53:08 +01:00
|
|
|
} catch (e) {
|
|
|
|
popupAjaxError(e);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
2023-03-15 09:42:12 +00:00
|
|
|
}
|
|
|
|
}
|