2022-12-13 08:53:08 +08:00
|
|
|
import Controller, { inject as controller } from "@ember/controller";
|
|
|
|
import { action } from "@ember/object";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { alias } from "@ember/object/computed";
|
|
|
|
import { inject as service } from "@ember/service";
|
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
import I18n from "I18n";
|
2022-12-13 08:53:08 +08:00
|
|
|
|
2023-03-15 17:42:12 +08:00
|
|
|
export default class AdminWebHooksIndexController extends Controller {
|
|
|
|
@service dialog;
|
|
|
|
@controller adminWebHooks;
|
|
|
|
|
|
|
|
@alias("adminWebHooks.contentTypes") contentTypes;
|
|
|
|
@alias("adminWebHooks.defaultEventTypes") defaultEventTypes;
|
|
|
|
@alias("adminWebHooks.deliveryStatuses") deliveryStatuses;
|
|
|
|
@alias("adminWebHooks.eventTypes") eventTypes;
|
|
|
|
@alias("adminWebHooks.model") model;
|
2022-12-13 08:53:08 +08:00
|
|
|
|
|
|
|
@action
|
|
|
|
destroy(webhook) {
|
|
|
|
return this.dialog.deleteConfirm({
|
|
|
|
message: I18n.t("admin.web_hooks.delete_confirm"),
|
|
|
|
didConfirm: async () => {
|
|
|
|
try {
|
|
|
|
await webhook.destroyRecord();
|
|
|
|
this.model.removeObject(webhook);
|
|
|
|
} catch (e) {
|
|
|
|
popupAjaxError(e);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
2023-03-15 17:42:12 +08:00
|
|
|
}
|
2022-12-13 08:53:08 +08:00
|
|
|
|
|
|
|
@action
|
|
|
|
loadMore() {
|
|
|
|
this.model.loadMore();
|
2023-03-15 17:42:12 +08:00
|
|
|
}
|
|
|
|
}
|