A platform for community discussion. Free, open, simple.
FEAT: Add a system section to the redesigned admin dashboar (#42743)
chapoifcc9e5f4606e
diff --git a/app/assets/stylesheets/admin/admin_dashboard.scss b/app/assets/stylesheets/admin/admin_dashboard.scssindex 01db5ddf5bf..6b11d8c444d 100644--- a/app/assets/stylesheets/admin/admin_dashboard.scss+++ b/app/assets/stylesheets/admin/admin_dashboard.scss@@ -137,6 +137,29 @@ $db-bar-height: var(--space-2);}}+.db-bar-track {+ display: flex;+ height: $db-bar-height;+ border-radius: 1em;+ background: var(--primary-low);+ overflow: hidden;+}++.db-bar-fill {+ display: block;+ height: 100%;+ border-radius: 4px;+ background: var(--tertiary);+ flex: 0 0 auto;++ // a real but tiny segment would otherwise round away to nothing+ min-width: 2px;++ &.--alt {+ background: var(--tertiary-medium);+ }+}+.db-configure {padding: var(--space-4);max-width: 100%;@@ -493,3 +516,113 @@ $db-bar-height: var(--space-2);}}}++.db-group {+ display: flex;+ align-items: center;+ gap: var(--space-2);+}++.db-system {+ &__block {+ display: flex;+ flex-direction: column;+ gap: var(--space-2);++ &:first-of-type {+ border-top-left-radius: var(--d-border-radius-large);+ border-bottom-left-radius: var(--d-border-radius-large);+ }++ &:last-of-type {+ border-top-right-radius: var(--d-border-radius-large);+ border-bottom-right-radius: var(--d-border-radius-large);+ }+ }++ &__value {+ font-size: var(--font-up-3-rem);+ font-weight: 500;+ color: var(--primary);+ }++ &__label {+ font-size: var(--font-down-1-rem);+ color: var(--primary-medium);+ }++ &__breakdown {+ display: flex;+ align-items: center;+ gap: var(--space-1);+ color: var(--primary-medium);+ font-size: var(--font-down-1-rem);+ }++ &__link {+ font-size: var(--font-down-1-rem);+ }++ &__footer {+ display: flex;+ align-items: center;+ margin-top: auto;++ &.--critical {+ .db-system__label {+ color: var(--danger);+ }+ }++ .--storage & {+ justify-content: space-between;+ }++ .--status & {+ justify-content: flex-end;+ }+ }++ &__status-icon {+ .--ok & {+ color: var(--success);+ }++ .--warning &,+ .--critical & {+ color: var(--danger);+ }+ }+}++.--system {+ @include viewport.until(sm) {+ .db-section__row-block {+ border-radius: var(--d-border-radius-large);+ flex-basis: calc(50% - var(--space-1));+ border: 1px solid var(--content-border-color);+ }+ }+}++.db-bar-track {+ .--system & {+ margin-block: var(--space-2);+ }+}++.db-bar-fill {+ &:first-child {+ .--system & {+ border-top-right-radius: 0;+ border-bottom-right-radius: 0;+ }+ }++ &:nth-child(2) {+ .--system & {+ border-top-left-radius: 0;+ border-bottom-left-radius: 0;+ }+ }+}diff --git a/app/assets/stylesheets/common/foundation/mixins.scss b/app/assets/stylesheets/common/foundation/mixins.scssindex b29a7ea676f..99aac6bd18c 100644--- a/app/assets/stylesheets/common/foundation/mixins.scss+++ b/app/assets/stylesheets/common/foundation/mixins.scss@@ -355,6 +355,7 @@ $hpad: 0.65em;}@mixin dot-separator($size: 0.35em) {+ display: inline-block;width: $size;height: $size;margin-inline: var(--space-1);diff --git a/app/services/admin_dashboard_section_configuration.rb b/app/services/admin_dashboard_section_configuration.rbindex 7a6fba372d3..b0d1ea52dba 100644--- a/app/services/admin_dashboard_section_configuration.rb+++ b/app/services/admin_dashboard_section_configuration.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueclass AdminDashboardSectionConfiguration- KNOWN_SECTIONS = %w[highlights reports traffic engagement search].freeze+ KNOWN_SECTIONS = %w[highlights reports traffic engagement search system].freezeACTIVITY_BY_CATEGORY_MAX = 10WHOS_POSTING_MAX = 10@@ -59,7 +59,13 @@ class AdminDashboardSectionConfigurationenddef self.all_known_section_ids- KNOWN_SECTIONS + available_plugin_section_ids+ builtin_section_ids + available_plugin_section_ids+ end++ def self.builtin_section_ids+ return KNOWN_SECTIONS if SiteSetting.version_checks?++ KNOWN_SECTIONS - ["system"]enddef self.sectionsdiff --git a/app/services/admin_dashboard_section_loader.rb b/app/services/admin_dashboard_section_loader.rbindex 0dc05d7753d..955acfc8fea 100644--- a/app/services/admin_dashboard_section_loader.rb+++ b/app/services/admin_dashboard_section_loader.rb@@ -103,6 +103,8 @@ class AdminDashboardSectionLoaderAdminDashboard::Reports::Section.build(guardian: user.guardian)when "search"AdminDashboardSearch.build(start_date: start_date, end_date: end_date)+ when "system"+ AdminDashboardSystem.build(guardian: user.guardian)elsesection = DiscoursePluginRegistry.admin_dashboard_sections.find { |s| s[:id] == id }section&.dig(:loader)&.call(start_date: start_date, end_date: end_date, current_user: user)diff --git a/app/services/admin_dashboard_system.rb b/app/services/admin_dashboard_system.rbnew file mode 100644index 00000000000..2779f9b340c--- /dev/null+++ b/app/services/admin_dashboard_system.rb@@ -0,0 +1,64 @@+# frozen_string_literal: true++class AdminDashboardSystem+ STORAGE_REPORT = "storage_stats"+ private_constant :STORAGE_REPORT++ def self.build(guardian:)+ new(guardian: guardian).build+ end++ def initialize(guardian:)+ @guardian = guardian+ end++ def build+ {+ version: version,+ storage: storage,+ discourse_updated_at: Discourse.last_commit_date,+ dashboard_updated_at: AdminDashboardIndexData.fetch_cached_stats["updated_at"],+ }+ end++ private++ attr_reader :guardian++ def version+ DiscourseUpdates.check_version.as_json+ end++ def storage+ stats = storage_stats+ return nil if stats.blank?++ stats = stats.except(:backups) if !guardian.is_admin?++ stats.each_with_object({}) do |(store, values), result|+ result[store] = values.nil? ? nil : values.merge(remote: remote?(store))+ end+ end++ def remote?(store)+ case store.to_s+ when "backups"+ SiteSetting.backup_location == BackupLocationSiteSetting::S3+ when "uploads"+ Discourse.store.external?+ else+ false+ end+ end++ def storage_stats+ cached = Report.find_cached(STORAGE_REPORT)+ return cached[:data] if cached.present?++ report = Report.find(STORAGE_REPORT)+ return nil if report.nil? || report.error.present?++ Report.cache(report)+ report.data+ end+enddiff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex bc0e9e464f2..3b4674cc1d5 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -7634,6 +7634,26 @@ en:no_match_tooltip: "Search terms with a 0% click-through rate (CTR)."poor_match: "Poor match"poor_match_tooltip: "Search terms with a click-through rate (CTR) between 1-20%."+ system:+ title: "System"+ storage: "Storage"+ status: "Status"+ fetch_error: "Couldn't load system information. Try refreshing the page."+ commits:+ one: "+%{count} commit"+ other: "+%{count} commits"+ view_on_github: "View on GitHub"+ update_check_failed: "Update check failed — ensure Sidekiq is running."+ update_available: "Update available: %{version}"+ space_free: "%{size} free"+ backups_size:+ one: "%{size} backup (%{count})"+ other: "%{size} backups (%{count})"+ uploads_size: "%{size} uploads"+ latest_backup: "Latest backup %{date}"+ manage_backups: "Manage backups"+ discourse_updated: "Discourse updated"+ dashboard_updated: "Dashboard updated"reports_section:header_action: "Manage"description: "Pin standard reports or Data Explorer queries to track what matters to your community."diff --git a/frontend/discourse/admin/components/dashboard/system.gjs b/frontend/discourse/admin/components/dashboard/system.gjsnew file mode 100644index 00000000000..059a9a3c595--- /dev/null+++ b/frontend/discourse/admin/components/dashboard/system.gjs@@ -0,0 +1,346 @@+import Component from "@glimmer/component";+import { LinkTo } from "@ember/routing";+import { trustHTML } from "@ember/template";+import DashboardSection from "discourse/admin/components/dashboard/section";+import VersionCheck from "discourse/admin/models/version-check";+import dashIfEmpty from "discourse/helpers/dash-if-empty";+import getUrl from "discourse/lib/get-url";+import dConcatClass from "discourse/ui-kit/helpers/d-concat-class";+import dFormatDate from "discourse/ui-kit/helpers/d-format-date";+import dIcon from "discourse/ui-kit/helpers/d-icon";+import I18n, { i18n } from "discourse-i18n";++const PREFIX = "admin.dashboard.sections.system";++export default class DashboardSystem extends Component {+ get versionCheck() {+ const version = this.args.data?.version;+ return version ? new VersionCheck(version) : null;+ }++ get versionStatus() {+ const check = this.versionCheck;++ if (+ check.noCheckPerformed ||+ (check.stale_data && !check.version_check_pending)+ ) {+ return {+ icon: "triangle-exclamation",+ className: "--critical",+ message: i18n(`${PREFIX}.update_check_failed`),+ };+ }++ if (check.stale_data) {+ return {+ icon: "circle-check",+ className: "--ok",+ message: i18n("admin.dashboard.version_check_pending"),+ };+ }++ if (check.upToDate) {+ return {+ icon: "circle-check",+ className: "--ok",+ message: check.newerCommitsAvailable+ ? i18n("admin.dashboard.up_to_date_newer_commits", {+ count: check.newChangesCount,+ })+ : i18n("admin.dashboard.up_to_date"),+ };+ }++ return {+ icon: "triangle-exclamation",+ className: "--warning",+ message: check.latest_version+ ? i18n(`${PREFIX}.update_available`, { version: check.latest_version })+ : i18n("admin.dashboard.updates_available"),+ };+ }++ get backups() {+ return this.args.data?.storage?.backups;+ }++ get uploads() {+ return this.args.data?.storage?.uploads;+ }++ get #storeEntries() {+ return [+ { key: "backups", stats: this.backups, className: "" },+ { key: "uploads", stats: this.uploads, className: "--alt" },+ ].filter((entry) => entry.stats);+ }++ // Only a local store is bounded, so only local stores can be charted against+ // free space. An external store has no ceiling to report at all.+ get #localEntries() {+ return this.#storeEntries.filter((entry) => !entry.stats.remote);+ }++ get #usedBytes() {+ return this.#localEntries.reduce(+ (sum, entry) => sum + (entry.stats.used_bytes ?? 0),+ 0+ );+ }++ get #freeBytes() {+ return (+ this.#localEntries.find((entry) => entry.stats.free_bytes != null)?.stats+ .free_bytes ?? null+ );+ }++ get usedSpace() {+ return I18n.toHumanSize(this.#usedBytes);+ }++ get freeSpace() {+ const free = this.#freeBytes;+ return free == null ? null : I18n.toHumanSize(free);+ }++ // Segments plus the remaining free space add up to the whole track, so the+ // denominator is the local disk rather than the total across every store.+ get barSegments() {+ const free = this.#freeBytes;++ if (free == null) {+ return [];+ }++ const local = this.#localEntries.filter((entry) => entry.stats.used_bytes);+ const total = local.reduce((sum, e) => sum + e.stats.used_bytes, 0) + free;++ return local.map((entry) => ({+ key: entry.key,+ className: entry.className,+ title: i18n(`admin.dashboard.${entry.key}`),+ style: trustHTML(+ `width: ${Math.min(100, (entry.stats.used_bytes / total) * 100).toFixed(1)}%`+ ),+ }));+ }++ get barLabel() {+ return i18n("admin.dashboard.space_used_and_free", {+ usedSize: this.usedSpace,+ freeSize: this.freeSpace,+ });+ }++ get hasStatus() {+ return !!(+ this.args.data?.discourse_updated_at ||+ this.args.data?.dashboard_updated_at+ );+ }++ get backupsSummary() {+ return i18n(`${PREFIX}.backups_size`, {+ count: this.backups.count,+ size: I18n.toHumanSize(this.backups.used_bytes),+ });+ }++ get uploadsSummary() {+ return i18n(`${PREFIX}.uploads_size`, {+ size: I18n.toHumanSize(this.uploads?.used_bytes ?? 0),+ });+ }++ <template>+ <DashboardSection+ @title={{i18n "admin.dashboard.sections.system.title"}}+ @layout="row"+ ...attributes+ >+ {{#if @fetchError}}+ <div class="db-section__error" role="alert">+ {{i18n "admin.dashboard.sections.system.fetch_error"}}+ </div>+ {{else if @data}}+ <div class="db-section__row-block db-system__block">+ <div class="db-section__row-block-header">+ <h3 class="db-section__header">+ {{dIcon "tag" class="db-system__block-icon"}}+ {{i18n "admin.dashboard.version"}}+ </h3>+ </div>++ <div class="db-system__headline">++ <div class="db-group">+ <div class="db-system__value">+ {{dashIfEmpty this.versionCheck.installed_version}}+ </div>++ {{#if this.versionCheck.installedCommitsAhead}}+ <span+ class="db-pill"+ title={{i18n+ "admin.dashboard.commits_ahead"+ count=this.versionCheck.installedCommitsAhead+ }}+ >+ {{i18n+ "admin.dashboard.sections.system.commits"+ count=this.versionCheck.installedCommitsAhead+ }}+ </span>+ {{/if}}+ </div>++ {{#if this.versionCheck.gitLink}}+ <a+ class="db-system__link"+ href={{this.versionCheck.gitLink}}+ rel="noopener noreferrer"+ target="_blank"+ title={{i18n+ "admin.dashboard.commit_on_github"+ sha=this.versionCheck.shortSha+ }}+ >+ {{i18n "admin.dashboard.sections.system.view_on_github"}}+ {{dIcon "up-right-from-square"}}+ </a>+ {{/if}}++ </div>++ <div+ class={{dConcatClass+ "db-system__footer"+ this.versionStatus.className+ }}+ >+ <span class="db-system__label">+ {{dIcon this.versionStatus.icon class="db-system__status-icon"}}+ {{this.versionStatus.message}}+ </span>+ </div>+ </div>++ {{#if @data.storage}}+ <div class="db-section__row-block db-system__block --storage">+ <div class="db-section__row-block-header">+ <h3 class="db-section__header">+ {{dIcon "database" class="db-system__block-icon"}}+ {{i18n "admin.dashboard.sections.system.storage"}}+ </h3>+ </div>++ <div class="db-system__headline">+ <div class="db-system__value">+ {{i18n "admin.dashboard.space_used" usedSize=this.usedSpace}}+ </div>+ {{#if this.freeSpace}}+ <div class="db-system__label">+ {{i18n+ "admin.dashboard.sections.system.space_free"+ size=this.freeSpace+ }}+ </div>+ {{/if}}+ </div>++ <div>+ {{#if this.barSegments}}+ <div+ class="db-bar-track"+ role="img"+ aria-label={{this.barLabel}}+ >+ {{#each this.barSegments key="key" as |segment|}}+ <span+ class={{dConcatClass "db-bar-fill" segment.className}}+ style={{segment.style}}+ title={{segment.title}}+ ></span>+ {{/each}}+ </div>+ {{/if}}++ <div class="db-system__breakdown">+ {{#if this.backups}}+ <span class="db-system__breakdown-item">+ {{this.backupsSummary}}+ </span>+ <span class="dot-separator"></span>+ {{/if}}+ <span class="db-system__breakdown-item">+ {{this.uploadsSummary}}+ </span>+ </div>+ </div>++ {{#if this.backups}}+ <div class="db-system__footer">+ {{#if this.backups.last_backup_taken_at}}+ <div class="db-system__label">+ <span>{{trustHTML+ (i18n+ "admin.dashboard.sections.system.latest_backup"+ date=(dFormatDate+ this.backups.last_backup_taken_at leaveAgo="true"+ )+ )+ }}</span>+ </div>+ {{/if}}+ <a class="db-system__link" href={{getUrl "/admin/backups"}}>+ {{i18n "admin.dashboard.sections.system.manage_backups"}}+ </a>+ </div>+ {{/if}}+ </div>+ {{/if}}++ {{#if this.hasStatus}}+ <div class="db-section__row-block db-system__block --status">+ <div class="db-section__row-block-header">+ <h3 class="db-section__header">+ {{dIcon "clock" class="db-system__block-icon"}}+ {{i18n "admin.dashboard.sections.system.status"}}+ </h3>+ </div>++ {{#if @data.discourse_updated_at}}+ <div class="db-system__headline">+ <div class="db-system__value">+ {{dFormatDate @data.discourse_updated_at leaveAgo="true"}}+ </div>+ <div class="db-system__label">+ {{i18n "admin.dashboard.sections.system.discourse_updated"}}+ </div>+ </div>+ {{/if}}++ {{#if @data.dashboard_updated_at}}+ <div class="db-system__headline">+ <div class="db-system__value">+ {{dFormatDate @data.dashboard_updated_at leaveAgo="true"}}+ </div>+ <div class="db-system__label">+ {{i18n "admin.dashboard.sections.system.dashboard_updated"}}+ </div>+ </div>+ {{/if}}++ <div class="db-system__footer">+ <LinkTo @route="admin.whatsNew" class="db-system__link">+ {{i18n "admin.dashboard.whats_new_in_discourse"}}+ </LinkTo>+ </div>+ </div>+ {{/if}}+ {{/if}}+ </DashboardSection>+ </template>+}diff --git a/frontend/discourse/admin/components/redesigned-admin-dashboard.gjs b/frontend/discourse/admin/components/redesigned-admin-dashboard.gjsindex a81a216a68a..ba85ab6e8de 100644--- a/frontend/discourse/admin/components/redesigned-admin-dashboard.gjs+++ b/frontend/discourse/admin/components/redesigned-admin-dashboard.gjs@@ -9,6 +9,7 @@ import DashboardReports from "discourse/admin/components/dashboard/reports";import DashboardSearch from "discourse/admin/components/dashboard/search";import DashboardSiteAdvice from "discourse/admin/components/dashboard/site-advice";import DashboardSkeleton from "discourse/admin/components/dashboard/skeleton";+import DashboardSystem from "discourse/admin/components/dashboard/system";import DashboardTraffic from "discourse/admin/components/dashboard/traffic";import { lookupAdminDashboardSection } from "discourse/admin/lib/admin-dashboard-sections";import PluginOutlet from "discourse/components/plugin-outlet";@@ -132,6 +133,14 @@ export default class RedesignedAdminDashboard extends Component {@startDate={{@loadedSections.startDate}}@endDate={{@loadedSections.endDate}}/>+ {{else if (eq section.id "system")}}+ <DashboardSystem+ class={{concat "--" section.id}}+ data-section-id={{section.id}}+ @data={{section.data}}+ @loading={{@loadingSections}}+ @fetchError={{section.error}}+ />{{else if (eq section.id "search")}}<DashboardSearchclass={{concat "--" section.id}}diff --git a/frontend/discourse/tests/integration/components/dashboard/system-test.gjs b/frontend/discourse/tests/integration/components/dashboard/system-test.gjsnew file mode 100644index 00000000000..25b85553ec3--- /dev/null+++ b/frontend/discourse/tests/integration/components/dashboard/system-test.gjs@@ -0,0 +1,44 @@+import { render } from "@ember/test-helpers";+import { module, test } from "qunit";+import DashboardSystem from "discourse/admin/components/dashboard/system";+import { setupRenderingTest } from "discourse/tests/helpers/component-test";++module("Integration | Component | Dashboard | System", function (hooks) {+ setupRenderingTest(hooks, { stubRouter: true });++ test("uses local storage for capacity and renders a full disk bar", async function (assert) {+ const data = {+ version: {+ installed_version: "3.6.0",+ missing_versions_count: 0,+ },+ storage: {+ backups: {+ count: 1,+ remote: true,+ used_bytes: 1024,+ },+ uploads: {+ free_bytes: 0,+ remote: false,+ used_bytes: 2048,+ },+ },+ };++ await render(<template><DashboardSystem @data={{data}} /></template>);++ assert+ .dom(".db-system__block.--storage .db-system__value")+ .hasText(+ "2 KB used",+ "excludes remote storage from the local disk total"+ );+ assert+ .dom(".db-system__block.--storage .db-bar-track")+ .exists("renders a capacity bar when no local space remains");+ assert+ .dom(".db-system__block.--storage .db-bar-fill")+ .hasAttribute("style", /width:\s*100(?:\.0)?%/, "fills the storage bar");+ });+});diff --git a/lib/disk_space.rb b/lib/disk_space.rbindex 71b8bfd17af..23fcadac4ae 100644--- a/lib/disk_space.rb+++ b/lib/disk_space.rb@@ -6,11 +6,9 @@ class DiskSpaceenddef self.uploads_free_bytes- if Discourse.store.external?- 0- else- free(uploads_path)- end+ return nil if Discourse.store.external?++ free(uploads_path)enddef self.free(path)diff --git a/spec/lib/seed_data/admin_dashboard_sections_spec.rb b/spec/lib/seed_data/admin_dashboard_sections_spec.rbindex 032d24f6180..2ee3cc254e0 100644--- a/spec/lib/seed_data/admin_dashboard_sections_spec.rb+++ b/spec/lib/seed_data/admin_dashboard_sections_spec.rb@@ -16,6 +16,7 @@ describe SeedData::AdminDashboardSections do["traffic", 2, true],["engagement", 3, true],["search", 4, true],+ ["system", 5, true],],)enddiff --git a/spec/requests/admin/dashboard_controller_spec.rb b/spec/requests/admin/dashboard_controller_spec.rbindex 634e74a03b7..814fa263c28 100644--- a/spec/requests/admin/dashboard_controller_spec.rb+++ b/spec/requests/admin/dashboard_controller_spec.rb@@ -408,6 +408,7 @@ RSpec.describe Admin::DashboardController do"traffic","engagement","search",+ "system",)expect(section_payloads.dig("highlights", "data")).to be_presentexpect(section_payloads.dig("traffic", "data")).to be_present@@ -538,7 +539,6 @@ RSpec.describe Admin::DashboardController doit "omits version_check when enabled for the admin" doSiteSetting.version_checks = true- DiscourseUpdates.expects(:check_version).neverget "/admin/dashboard.json"@@ -637,12 +637,38 @@ RSpec.describe Admin::DashboardController doexpect(configuration).to be_presentids = configuration["sections"].map { |s| s["id"] }- expect(ids).to match_array(%w[highlights reports traffic engagement search])+ expect(ids).to match_array(%w[highlights reports traffic engagement search system])visible = configuration["sections"].select { |s| s["visible"] }.map { |s| s["id"] }expect(visible).to eq(%w[highlights reports])end+ it "only exposes the system section when version checks are enabled" do+ configure_dashboard_sections(["system"])+ SiteSetting.version_checks = false+ sign_in(admin)++ get "/admin/dashboard.json"++ expect(response.parsed_body["sections"].map { |section| section["id"] }).not_to include(+ "system",+ )+ expect(+ response.parsed_body.dig("configuration", "sections").map { |section| section["id"] },+ ).not_to include("system")++ SiteSetting.version_checks = true++ get "/admin/dashboard.json"++ expect(response.parsed_body["sections"].map { |section| section["id"] }).to include(+ "system",+ )+ expect(+ response.parsed_body.dig("configuration", "sections").map { |section| section["id"] },+ ).to include("system")+ end+it "is omitted for moderators" dosign_in(moderator)@@ -682,7 +708,9 @@ RSpec.describe Admin::DashboardController do}expect(response.status).to eq(204)- expect(AdminDashboardSectionConfiguration.visible_section_ids).to eq(%w[reports highlights])+ expect(AdminDashboardSectionConfiguration.visible_section_ids).to eq(+ %w[reports highlights system],+ )endit "keeps a section's position when it is toggled off" do@@ -714,7 +742,7 @@ RSpec.describe Admin::DashboardController doexpect(response.status).to eq(204)expect(AdminDashboardSectionConfiguration.sections.map { |s| s[:id] }).to match_array(- %w[highlights reports traffic engagement search],+ %w[highlights reports traffic engagement search system],)end@@ -733,7 +761,7 @@ RSpec.describe Admin::DashboardController do}expect(AdminDashboardSectionConfiguration.visible_section_ids).to eq(- %w[highlights engagement],+ %w[highlights engagement system],)end@@ -776,7 +804,7 @@ RSpec.describe Admin::DashboardController doget "/admin/dashboard.json"ids = response.parsed_body["sections"].map { |s| s["id"] }- expect(ids).to eq(["highlights"])+ expect(ids).to eq(%w[highlights system])endenddiff --git a/spec/services/admin_dashboard_section_configuration_spec.rb b/spec/services/admin_dashboard_section_configuration_spec.rbindex 56009dbad69..4a51df61f6f 100644--- a/spec/services/admin_dashboard_section_configuration_spec.rb+++ b/spec/services/admin_dashboard_section_configuration_spec.rb@@ -14,6 +14,7 @@ describe AdminDashboardSectionConfiguration do{ id: "traffic", visible: true },{ id: "engagement", visible: true },{ id: "search", visible: true },+ { id: "system", visible: true },],)end@@ -36,6 +37,7 @@ describe AdminDashboardSectionConfiguration do{ id: "traffic", visible: true },{ id: "engagement", visible: true },{ id: "search", visible: true },+ { id: "system", visible: true },],)end@@ -54,7 +56,7 @@ describe AdminDashboardSectionConfiguration doactor: admin,)- expect(described_class.visible_section_ids).to eq(%w[reports engagement])+ expect(described_class.visible_section_ids).to eq(%w[reports engagement system])endend@@ -77,6 +79,7 @@ describe AdminDashboardSectionConfiguration do{ id: "reports", visible: true },{ id: "traffic", visible: true },{ id: "search", visible: true },+ { id: "system", visible: true },],)end@@ -95,6 +98,7 @@ describe AdminDashboardSectionConfiguration do{ id: "traffic", visible: true },{ id: "engagement", visible: true },{ id: "search", visible: true },+ { id: "system", visible: true },],)end@@ -111,7 +115,7 @@ describe AdminDashboardSectionConfiguration doactor: admin,)- expect(described_class.visible_section_ids).to eq(%w[highlights engagement])+ expect(described_class.visible_section_ids).to eq(%w[highlights engagement system])endit "drops unknown section ids" dodiff --git a/spec/system/admin_dashboard_configure_spec.rb b/spec/system/admin_dashboard_configure_spec.rbindex 3628e84f714..d83ca2bab43 100644--- a/spec/system/admin_dashboard_configure_spec.rb+++ b/spec/system/admin_dashboard_configure_spec.rb@@ -14,7 +14,7 @@ describe "Admin Dashboard Configure menu" doit "applies toggles immediately, persists across reload, and shows an empty state when everything is hidden" dodashboard.visitexpect(dashboard).to have_configure_button- %w[highlights reports traffic engagement search].each do |id|+ %w[highlights reports traffic engagement search system].each do |id|expect(dashboard).to have_section(id)end@@ -41,13 +41,16 @@ describe "Admin Dashboard Configure menu" do.toggle_section("highlights").toggle_section("reports").toggle_section("search")+ .toggle_section("system")expect(dashboard).to have_empty_stateendit "keeps a section's position when it is toggled off and back on" dodashboard.visit- expect(dashboard.section_ids_in_order).to eq(%w[highlights reports traffic engagement search])+ expect(dashboard.section_ids_in_order).to eq(+ %w[highlights reports traffic engagement search system],+ )dashboard.open_configure_menu.toggle_section("highlights")expect(dashboard).to have_no_section("highlights")@@ -56,7 +59,9 @@ describe "Admin Dashboard Configure menu" do# it reappears in its original slot, not pushed to the bottomexpect(dashboard).to have_first_section("highlights")- expect(dashboard.section_ids_in_order).to eq(%w[highlights reports traffic engagement search])+ expect(dashboard.section_ids_in_order).to eq(+ %w[highlights reports traffic engagement search system],+ )endit "reorders sections via the arrow buttons on mobile", mobile: true do