import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; import { fn } from "@ember/helper"; import { action } from "@ember/object"; import { LinkTo } from "@ember/routing"; import { service } from "@ember/service"; import DButton from "discourse/components/d-button"; import DropdownMenu from "discourse/components/dropdown-menu"; import avatar from "discourse/helpers/avatar"; import formatDate from "discourse/helpers/format-date"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { i18n } from "discourse-i18n"; import DMenu from "float-kit/components/d-menu"; export default class ApiKeysList extends Component { @service router; @tracked apiKey = this.args.apiKey; @action onRegisterApi(api) { this.dMenu = api; } @action async revokeKey(key) { try { await key.revoke(); await this.dMenu.close(); } catch (error) { popupAjaxError(error); } } @action async undoRevokeKey(key) { try { await key.undoRevoke(); await this.dMenu.close(); } catch (error) { popupAjaxError(error); } } @action edit() { this.router.transitionTo("adminApiKeys.show", this.apiKey); } }