FEATURE: Use DBreadcrumbsItem in admin UI (#631)

This commit uses the new DBreadcrumbsItem and DBreadcrumbsContainer
from core to show a path back to the admin plugins list.
This commit is contained in:
Martin Brennan 2024-05-22 09:19:53 +10:00 committed by GitHub
parent 59e63a2da9
commit 06137ac706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,9 @@
<DBreadcrumbsItem as |linkClass|>
<LinkTo @route="adminPlugins.show.discourse-ai-personas" class={{linkClass}}>
{{@model.plugin.nameTitleized}}
</LinkTo>
</DBreadcrumbsItem>
<AiPersonaListEditor <AiPersonaListEditor
@personas={{this.allPersonas}} @personas={{this.allPersonas}}
@currentPersona={{this.model}} @currentPersona={{this.model}}

View File

@ -1,6 +1,7 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import { concat } from "@ember/helper"; import { concat } from "@ember/helper";
import { LinkTo } from "@ember/routing"; import { LinkTo } from "@ember/routing";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import icon from "discourse-common/helpers/d-icon"; import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n"; import i18n from "discourse-common/helpers/i18n";
import I18n from "discourse-i18n"; import I18n from "discourse-i18n";
@ -12,6 +13,15 @@ export default class AiLlmsListEditor extends Component {
} }
<template> <template>
<DBreadcrumbsItem as |linkClass|>
<LinkTo
@route="adminPlugins.show.discourse-ai-personas"
class={{linkClass}}
>
{{i18n "discourse_ai.llms.short_title"}}
</LinkTo>
</DBreadcrumbsItem>
<section class="ai-llms-list-editor admin-detail pull-left"> <section class="ai-llms-list-editor admin-detail pull-left">
{{#if @currentLlm}} {{#if @currentLlm}}
<AiLlmEditor @model={{@currentLlm}} @llms={{@llms}} /> <AiLlmEditor @model={{@currentLlm}} @llms={{@llms}} />

View File

@ -4,6 +4,7 @@ import { fn } from "@ember/helper";
import { on } from "@ember/modifier"; import { on } from "@ember/modifier";
import { action } from "@ember/object"; import { action } from "@ember/object";
import { LinkTo } from "@ember/routing"; import { LinkTo } from "@ember/routing";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import DToggleSwitch from "discourse/components/d-toggle-switch"; import DToggleSwitch from "discourse/components/d-toggle-switch";
import concatClass from "discourse/helpers/concat-class"; import concatClass from "discourse/helpers/concat-class";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -42,6 +43,15 @@ export default class AiPersonaListEditor extends Component {
} }
<template> <template>
<DBreadcrumbsItem as |linkClass|>
<LinkTo
@route="adminPlugins.show.discourse-ai-personas"
class={{linkClass}}
>
{{i18n "discourse_ai.ai_persona.short_title"}}
</LinkTo>
</DBreadcrumbsItem>
<section class="ai-persona-list-editor__current admin-detail pull-left"> <section class="ai-persona-list-editor__current admin-detail pull-left">
{{#if @currentPersona}} {{#if @currentPersona}}
<AiPersonaEditor @model={{@currentPersona}} @personas={{@personas}} /> <AiPersonaEditor @model={{@currentPersona}} @personas={{@personas}} />