2024-06-07 23:26:00 +08:00
|
|
|
import { tracked } from "@glimmer/tracking";
|
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";
|
2024-03-07 01:05:11 +08:00
|
|
|
import { service } from "@ember/service";
|
2016-06-16 01:49:57 +08:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
2024-11-20 04:45:18 +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;
|
2024-06-07 23:26:00 +08:00
|
|
|
@tracked status;
|
|
|
|
|
|
|
|
queryParams = ["status"];
|
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({
|
2024-11-20 04:45:18 +08:00
|
|
|
message: i18n("admin.web_hooks.delete_confirm"),
|
2022-12-13 08:53:08 +08:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|