discourse/app/assets/javascripts/admin/addon/controllers/admin-web-hooks-index.js
Penar Musaraj b8ee52c4cb
UX: Wait for render before invoking A11YDialog (#24100)
Previously, focus wasn't being applied correctly on dialogs using named
components. This was because the A11YDialog was being invoked before
the component was completely rendered.

The long-term plan is to move away from A11YDialog doing the rendering
here, but for now this should do.
2023-10-26 08:24:47 -04:00

38 lines
1.1 KiB
JavaScript

import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import { alias } from "@ember/object/computed";
import { inject as service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "discourse-i18n";
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;
@action
destroyWebhook(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);
}
},
});
}
@action
loadMore() {
this.model.loadMore();
}
}