UX: Move first settings admin route to config page (#30510)

For consistency, we are updating all sidebar links that
point to an /admin/customize/site_settings URL to their
own config pages, in preparation for more focused config
pages in future. This will mitigate the issue we have now,
which is that every sidebar link you click showing a different
UI to admins.

This commit moves admin/config/login-and-authentication to
establish the pattern.
This commit is contained in:
Martin Brennan 2025-01-02 09:13:37 +10:00 committed by GitHub
parent 5711bf6f27
commit c2282439b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 63 additions and 7 deletions

View File

@ -0,0 +1,3 @@
import AdminAreaSettingsBaseController from "admin/controllers/admin-area-settings-base";
export default class AdminConfigLoginAndAuthenticationSettingsController extends AdminAreaSettingsBaseController {}

View File

@ -1,7 +1,12 @@
import Route from "@ember/routing/route";
import { ajax } from "discourse/lib/ajax";
import DiscourseRoute from "discourse/routes/discourse";
import { i18n } from "discourse-i18n";
export default class AdminConfigAboutRoute extends DiscourseRoute {
titleToken() {
return i18n("admin.community.sidebar_link.about_your_site");
}
export default class AdminConfigAboutRoute extends Route {
model() {
return ajax("/admin/config/site_settings.json", {
data: {

View File

@ -0,0 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import { i18n } from "discourse-i18n";
export default class AdminConfigLoginAndAuthenticationRoute extends DiscourseRoute {
titleToken() {
return i18n("admin.community.sidebar_link.login_and_authentication");
}
}

View File

@ -206,6 +206,11 @@ export default function () {
});
this.route("about");
this.route("loginAndAuthentication", { path: "/" }, function () {
this.route("settings", {
path: "/login-and-authentication",
});
});
this.route("lookAndFeel", { path: "/look-and-feel" }, function () {
this.route("themes");
});

View File

@ -0,0 +1,23 @@
<DPageHeader
@titleLabel={{i18n "admin.config.login_and_authentication.title"}}
@descriptionLabel={{i18n
"admin.config.login_and_authentication.header_description"
}}
>
<:breadcrumbs>
<DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
<DBreadcrumbsItem
@path="/admin/config/login-and-authentication"
@label={{i18n "admin.config.login_and_authentication.title"}}
/>
</:breadcrumbs>
</DPageHeader>
<div class="admin-config-page__main-area">
<AdminAreaSettings
@categories="login"
@path="/admin/config/login-and-authentication"
@filter={{this.filter}}
@adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}}
/>
</div>

View File

@ -42,9 +42,7 @@ export const ADMIN_NAV_MAP = [
},
{
name: "admin_login_and_authentication",
route: "adminSiteSettingsCategory",
routeModels: ["login"],
query: { filter: "" },
route: "adminConfig.loginAndAuthentication.settings",
label: "admin.community.sidebar_link.login_and_authentication",
icon: "unlock",
},
@ -301,8 +299,7 @@ export const ADMIN_NAV_MAP = [
{
name: "admin_experimental",
route: "adminSiteSettingsCategory",
routeModels: ["all_results"],
query: { filter: "experimental" },
routeModels: ["experimental"],
label: "admin.advanced.sidebar_link.experimental",
icon: "discourse-sparkles",
},

View File

@ -3,6 +3,7 @@ import { test } from "qunit";
import { AUTO_GROUPS } from "discourse/lib/constants";
import { withPluginApi } from "discourse/lib/plugin-api";
import PreloadStore from "discourse/lib/preload-store";
import pretender, { response } from "discourse/tests/helpers/create-pretender";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
@ -24,6 +25,12 @@ acceptance("Admin Sidebar - Sections", function (needs) {
},
},
]);
pretender.get("/admin/config/site_settings.json", () =>
response({
site_settings: [],
})
);
});
test("default sections are loaded", async function (assert) {

View File

@ -5133,6 +5133,11 @@ en:
sidebar_link:
all: "All reports"
config:
login_and_authentication:
title: "Login and authentication"
header_description: "Configure how users log in and authenticate, secrets and keys, OAuth2 providers, and more."
new_features:
title: "What's new?"
check_for_updates: "Check for updates"

View File

@ -391,6 +391,9 @@ Discourse::Application.routes.draw do
end
namespace :config, constraints: StaffConstraint.new do
resources :site_settings, only: %i[index]
resources :login_and_authentication, only: %i[index]
get "login-and-authentication" => "site_settings#index"
resources :flags, only: %i[index new create update destroy] do
put "toggle"