DEV: Change to use DPageSubheader (#1033)

Previously was AdminPageSubheader until https://github.com/discourse/discourse/pull/30146
This commit is contained in:
Martin Brennan 2024-12-18 17:39:31 +10:00 committed by GitHub
parent fae2d5ff2c
commit f35db8068b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 38 additions and 34 deletions

View File

@ -4,9 +4,9 @@ import { action } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import DPageSubheader from "discourse/components/d-page-subheader";
import i18n from "discourse-common/helpers/i18n";
import I18n from "discourse-i18n";
import AdminPageSubheader from "admin/components/admin-page-subheader";
import AdminSectionLandingItem from "admin/components/admin-section-landing-item";
import AdminSectionLandingWrapper from "admin/components/admin-section-landing-wrapper";
import AiLlmEditor from "./ai-llm-editor";
@ -121,9 +121,11 @@ export default class AiLlmsListEditor extends Component {
{{else}}
{{#if this.hasLlmElements}}
<section class="ai-llms-list-editor__configured">
<AdminPageSubheader
@titleLabel="discourse_ai.llms.configured.title"
@descriptionLabel="discourse_ai.llms.preconfigured.description"
<DPageSubheader
@titleLabel={{i18n "discourse_ai.llms.configured.title"}}
@descriptionLabel={{i18n
"discourse_ai.llms.preconfigured.description"
}}
@learnMoreUrl="https://meta.discourse.org/t/discourse-ai-large-language-model-llm-settings-page/319903"
/>
<table class="d-admin-table">
@ -183,11 +185,11 @@ export default class AiLlmsListEditor extends Component {
</section>
{{/if}}
<section class="ai-llms-list-editor__templates">
<AdminPageSubheader
@titleLabel={{this.preconfiguredTitle}}
<DPageSubheader
@titleLabel={{i18n this.preconfiguredTitle}}
@descriptionLabel={{unless
this.hasLlmElements
"discourse_ai.llms.preconfigured.description"
(i18n "discourse_ai.llms.preconfigured.description")
}}
@learnMoreUrl={{unless
this.hasLlmElements

View File

@ -5,12 +5,12 @@ import { action } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import DPageSubheader from "discourse/components/d-page-subheader";
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 {
@ -39,9 +39,11 @@ export default class AiPersonaListEditor extends Component {
{{#if @currentPersona}}
<AiPersonaEditor @model={{@currentPersona}} @personas={{@personas}} />
{{else}}
<AdminPageSubheader
@titleLabel="discourse_ai.ai_persona.short_title"
@descriptionLabel="discourse_ai.ai_persona.persona_description"
<DPageSubheader
@titleLabel={{i18n "discourse_ai.ai_persona.short_title"}}
@descriptionLabel={{i18n
"discourse_ai.ai_persona.persona_description"
}}
@learnMoreUrl="https://meta.discourse.org/t/ai-bot-personas/306099"
>
<:actions as |actions|>
@ -52,7 +54,7 @@ export default class AiPersonaListEditor extends Component {
class="ai-persona-list-editor__new-button"
/>
</:actions>
</AdminPageSubheader>
</DPageSubheader>
{{#if @personas}}
<table class="content-list ai-persona-list-editor d-admin-table">

View File

@ -6,6 +6,7 @@ import { action } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import DButton from "discourse/components/d-button";
import DPageSubheader from "discourse/components/d-page-subheader";
import DStatTiles from "discourse/components/d-stat-tiles";
import DToggleSwitch from "discourse/components/d-toggle-switch";
import DTooltip from "discourse/components/d-tooltip";
@ -15,7 +16,6 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import i18n from "discourse-common/helpers/i18n";
import getURL from "discourse-common/lib/get-url";
import AdminConfigAreaCard from "admin/components/admin-config-area-card";
import AdminPageSubheader from "admin/components/admin-page-subheader";
import ComboBox from "select-kit/components/combo-box";
import SpamTestModal from "./modal/spam-test-modal";
@ -165,9 +165,9 @@ export default class AiSpam extends Component {
<template>
<div class="ai-spam">
<section class="ai-spam__settings">
<AdminPageSubheader
@titleLabel="discourse_ai.spam.title"
@descriptionLabel="discourse_ai.spam.spam_description"
<DPageSubheader
@titleLabel={{i18n "discourse_ai.spam.title"}}
@descriptionLabel={{i18n "discourse_ai.spam.spam_description"}}
/>
<div class="control-group ai-spam__enabled">

View File

@ -2,10 +2,10 @@ import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import DPageSubheader from "discourse/components/d-page-subheader";
import i18n from "discourse-common/helpers/i18n";
import I18n from "discourse-i18n";
import AdminConfigAreaEmptyList from "admin/components/admin-config-area-empty-list";
import AdminPageSubheader from "admin/components/admin-page-subheader";
export default class AiToolListEditor extends Component {
@service adminPluginNavManager;
@ -16,10 +16,10 @@ export default class AiToolListEditor extends Component {
@label={{i18n "discourse_ai.tools.short_title"}}
/>
<section class="ai-tool-list-editor__current admin-detail pull-left">
<AdminPageSubheader
@titleLabel="discourse_ai.tools.short_title"
<DPageSubheader
@titleLabel={{i18n "discourse_ai.tools.short_title"}}
@learnMoreUrl="https://meta.discourse.org/t/ai-bot-custom-tools/314103"
@descriptionLabel="discourse_ai.tools.subheader_description"
@descriptionLabel={{i18n "discourse_ai.tools.subheader_description"}}
>
<:actions as |actions|>
<actions.Primary
@ -29,7 +29,7 @@ export default class AiToolListEditor extends Component {
class="ai-tool-list-editor__new-button"
/>
</:actions>
</AdminPageSubheader>
</DPageSubheader>
{{#if @tools}}
<table class="d-admin-table ai-tool-list-editor">

View File

@ -7,6 +7,7 @@ import { service } from "@ember/service";
import { eq, gt, lt } from "truth-helpers";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import DPageSubheader from "discourse/components/d-page-subheader";
import DStatTiles from "discourse/components/d-stat-tiles";
import DateTimeInputRange from "discourse/components/date-time-input-range";
import avatar from "discourse/helpers/avatar";
@ -17,7 +18,6 @@ import i18n from "discourse-common/helpers/i18n";
import { bind } from "discourse-common/utils/decorators";
import AdminConfigAreaCard from "admin/components/admin-config-area-card";
import AdminConfigAreaEmptyList from "admin/components/admin-config-area-empty-list";
import AdminPageSubheader from "admin/components/admin-page-subheader";
import Chart from "admin/components/chart";
import ComboBox from "select-kit/components/combo-box";
@ -309,10 +309,10 @@ export default class AiUsage extends Component {
<template>
<div class="ai-usage admin-detail">
<AdminPageSubheader
@titleLabel="discourse_ai.usage.short_title"
<DPageSubheader
@titleLabel={{i18n "discourse_ai.usage.short_title"}}
@learnMoreUrl="https://meta.discourse.org/t/estimating-costs-of-using-llms-for-discourse-ai/307243"
@descriptionLabel="discourse_ai.usage.subheader_description"
@descriptionLabel={{i18n "discourse_ai.usage.subheader_description"}}
/>
<div class="ai-usage__filters">
<div class="ai-usage__filters-dates">

View File

@ -2,7 +2,7 @@
RSpec.describe "Admin AI persona configuration", type: :system, js: true do
fab!(:admin)
let(:admin_header) { PageObjects::Components::AdminHeader.new }
let(:page_header) { PageObjects::Components::DPageHeader.new }
before do
SiteSetting.ai_bot_enabled = true
@ -13,11 +13,11 @@ RSpec.describe "Admin AI persona configuration", type: :system, js: true do
it "allows creation of a persona" do
visit "/admin/plugins/discourse-ai/ai-personas"
expect(admin_header).to be_visible
expect(page_header).to be_visible
find(".ai-persona-list-editor__new-button").click()
expect(admin_header).to be_hidden
expect(page_header).to be_hidden
find(".ai-persona-editor__name").set("Test Persona")
find(".ai-persona-editor__description").fill_in(with: "I am a test persona")

View File

@ -4,7 +4,7 @@ require "rails_helper"
describe "AI Tool Management", type: :system do
fab!(:admin)
let(:admin_header) { PageObjects::Components::AdminHeader.new }
let(:page_header) { PageObjects::Components::DPageHeader.new }
before do
SiteSetting.ai_embeddings_enabled = true
@ -37,11 +37,11 @@ describe "AI Tool Management", type: :system do
it "allows admin to create a new AI tool from preset" do
visit "/admin/plugins/discourse-ai/ai-tools"
expect(admin_header).to be_visible
expect(page_header).to be_visible
expect(page).to have_content("Tools")
find(".ai-tool-list-editor__new-button").click
expect(admin_header).to be_hidden
expect(page_header).to be_hidden
select_kit = PageObjects::Components::SelectKit.new(".ai-tool-editor__presets")
select_kit.expand

View File

@ -2,7 +2,7 @@
RSpec.describe "Managing LLM configurations", type: :system, js: true do
fab!(:admin)
let(:admin_header) { PageObjects::Components::AdminHeader.new }
let(:page_header) { PageObjects::Components::DPageHeader.new }
before do
SiteSetting.ai_bot_enabled = true
@ -37,10 +37,10 @@ RSpec.describe "Managing LLM configurations", type: :system, js: true do
it "manually configures an LLM" do
visit "/admin/plugins/discourse-ai/ai-llms"
expect(admin_header).to be_visible
expect(page_header).to be_visible
find("[data-llm-id='none'] button").click()
expect(admin_header).to be_hidden
expect(page_header).to be_hidden
find("input.ai-llm-editor__display-name").fill_in(with: "Self-hosted LLM")
find("input.ai-llm-editor__name").fill_in(with: "llava-hf/llava-v1.6-mistral-7b-hf")