From ef8b62ae0ac8d99fc452a94e5f9a1adff250a255 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 7 Jan 2025 15:17:36 +1100 Subject: [PATCH] UX: Admin setting page consistency - Developer (#30607) Create a basic config page that only contains developer-related settings, to replace the "developer" category view linked to from "Developer" in the admin sidebar. --- .../admin-config-developer-settings.js | 3 ++ .../addon/routes/admin-config-developer.js | 8 +++++ .../admin/addon/routes/admin-route-map.js | 3 ++ .../templates/config-developer-settings.gjs | 29 +++++++++++++++++++ .../app/lib/sidebar/admin-nav-map.js | 4 +-- config/locales/client.en.yml | 3 ++ config/routes.rb | 1 + config/site_settings.yml | 14 ++++----- 8 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 app/assets/javascripts/admin/addon/controllers/admin-config-developer-settings.js create mode 100644 app/assets/javascripts/admin/addon/routes/admin-config-developer.js create mode 100644 app/assets/javascripts/admin/addon/templates/config-developer-settings.gjs diff --git a/app/assets/javascripts/admin/addon/controllers/admin-config-developer-settings.js b/app/assets/javascripts/admin/addon/controllers/admin-config-developer-settings.js new file mode 100644 index 00000000000..8453e8a885a --- /dev/null +++ b/app/assets/javascripts/admin/addon/controllers/admin-config-developer-settings.js @@ -0,0 +1,3 @@ +import AdminAreaSettingsBaseController from "admin/controllers/admin-area-settings-base"; + +export default class AdminConfigDeveloperSettingsController extends AdminAreaSettingsBaseController {} diff --git a/app/assets/javascripts/admin/addon/routes/admin-config-developer.js b/app/assets/javascripts/admin/addon/routes/admin-config-developer.js new file mode 100644 index 00000000000..27761603c9b --- /dev/null +++ b/app/assets/javascripts/admin/addon/routes/admin-config-developer.js @@ -0,0 +1,8 @@ +import DiscourseRoute from "discourse/routes/discourse"; +import { i18n } from "discourse-i18n"; + +export default class AdminConfigDeveloperRoute extends DiscourseRoute { + titleToken() { + return i18n("admin.advanced.sidebar_link.developer"); + } +} diff --git a/app/assets/javascripts/admin/addon/routes/admin-route-map.js b/app/assets/javascripts/admin/addon/routes/admin-route-map.js index d1dd5fe873a..41780eac78b 100644 --- a/app/assets/javascripts/admin/addon/routes/admin-route-map.js +++ b/app/assets/javascripts/admin/addon/routes/admin-route-map.js @@ -291,6 +291,9 @@ export default function () { this.route("settings"); } ); + this.route("developer", function () { + this.route("settings", { path: "/" }); + }); this.route("fonts", function () { this.route("settings", { path: "/" }); }); diff --git a/app/assets/javascripts/admin/addon/templates/config-developer-settings.gjs b/app/assets/javascripts/admin/addon/templates/config-developer-settings.gjs new file mode 100644 index 00000000000..b6baa7d0861 --- /dev/null +++ b/app/assets/javascripts/admin/addon/templates/config-developer-settings.gjs @@ -0,0 +1,29 @@ +import RouteTemplate from "ember-route-template"; +import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item"; +import DPageHeader from "discourse/components/d-page-header"; +import { i18n } from "discourse-i18n"; +import AdminAreaSettings from "admin/components/admin-area-settings"; + +export default RouteTemplate(); diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js b/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js index ced9ea3f4c7..0ab8fd8a543 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js @@ -226,9 +226,7 @@ export const ADMIN_NAV_MAP = [ }, { name: "admin_developer", - route: "adminSiteSettingsCategory", - routeModels: ["developer"], - query: { filter: "" }, + route: "adminConfig.developer.settings", label: "admin.advanced.sidebar_link.developer", icon: "keyboard", }, diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 70cc9882bd8..fb15c901247 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -5134,6 +5134,9 @@ en: all: "All reports" config: + developer: + title: "Developer" + header_description: "Developer settings to control rate limits, multipliers and calculations, safe mode, and other advanced features" experimental: title: "Experimental" header_description: "Toggle experimental features on or off for your site, most of these can be controlled on a group basis" diff --git a/config/routes.rb b/config/routes.rb index 78a35b27fbe..7564b834a50 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -393,6 +393,7 @@ Discourse::Application.routes.draw do namespace :config, constraints: StaffConstraint.new do resources :site_settings, only: %i[index] + get "developer" => "site_settings#index" get "fonts" => "site_settings#index" get "legal" => "site_settings#index" get "login-and-authentication" => "site_settings#index" diff --git a/config/site_settings.yml b/config/site_settings.yml index 90e60a89732..881eb95d5e0 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -2566,13 +2566,6 @@ developer: instrument_gc_stat_per_request: default: false hidden: true - admin_sidebar_enabled_groups: - type: group_list - list_type: compact - default: "1|2" - allow_any: false - refresh: true - area: "group_permissions|navigation" warn_critical_js_deprecations: default: true client: true @@ -2611,6 +2604,13 @@ navigation: - "top" - "bottom" area: "navigation" + admin_sidebar_enabled_groups: + type: group_list + list_type: compact + default: "1|2" + allow_any: false + refresh: true + area: "group_permissions|navigation" embedding: embed_by_username: