import Component from "@glimmer/component"; import { fn } from "@ember/helper"; import { on } from "@ember/modifier"; import { action } from "@ember/object"; import { LinkTo } from "@ember/routing"; import { service } from "@ember/service"; import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item"; import DToggleSwitch from "discourse/components/d-toggle-switch"; import concatClass from "discourse/helpers/concat-class"; import { popupAjaxError } from "discourse/lib/ajax-error"; import i18n from "discourse-common/helpers/i18n"; import AdminConfigAreaEmptyList from "admin/components/admin-config-area-empty-list"; import AdminPageSubheader from "admin/components/admin-page-subheader"; import AiPersonaEditor from "./ai-persona-editor"; export default class AiPersonaListEditor extends Component { @service adminPluginNavManager; @action async toggleEnabled(persona) { const oldValue = persona.enabled; const newValue = !oldValue; try { persona.set("enabled", newValue); await persona.save(); } catch (err) { persona.set("enabled", oldValue); popupAjaxError(err); } } }