Skip to content

[stable35] feat(settings): split the admin page into Status and Background jobs - #1126

Merged
kesselb merged 2 commits into
stable35from
backport/1119/stable35
Sep 9, 2026
Merged

kesselb merged 2 commits into
stable35from
backport/1119/stable35

Conversation

@backportbot

@backportbot backportbot Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Backport of #1119

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Review and verify the backported changes
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot
backportbot Bot requested review from karlitschek and kesselb September 9, 2026 17:34
@backportbot backportbot Bot added 3. to review AI assisted This PR contains AI-assisted commits labels Sep 9, 2026
@backportbot backportbot Bot added this to the Nextcloud 35 milestone Sep 9, 2026
Frank Karlitschek and others added 2 commits September 9, 2026 17:43
Every "not available" figure in this app is -1, and several paths did
arithmetic on that sentinel or formatted it as though it were a reading:

- SystemStatistics scaled it to kB, so the OCS API answered
  mem_total: -1024 to external monitoring tools
- formatBytes() took the absolute value, so PHP's memory_limit = -1
  ("unlimited") rendered as "1.0 B"
- DatabaseStatistics returned the string 'N/A' for a field typed and
  formatted as a number, which reached the page as "NaN B"
- MemoryChartSection and ResourceOverviewSection guarded against an 'N/A'
  string the backend never sends, so -1 charted as a real series on a
  degenerate 0-to-0 axis
- the OS backends claimed a single core when the count was unknown, and
  that 1 became the divisor for the load average: an eight-core host under
  load read as "800 %"

Unknown values are now -1 throughout and render as "Unknown", or are left
out where a percentage cannot be computed. PHP's own "unlimited" sentinels
(memory_limit -1, max_execution_time 0) are labelled as such rather than
formatted as sizes. The load average survives a missing core count: it
comes from sys_getloadavg() and is real even when the count is not.

Read CPU, memory and uptime where /proc is hidden

Debian's and Ubuntu's apache2 unit ships ProcSubset=pid and
ProtectProc=invisible, so the web server sees only its own processes in
/proc. On those hosts -- a large share of installs -- this app has never
been able to report CPU, memory or uptime at all, and now reports honestly
that it cannot, which is worse to look at than it needs to be.

Commands still run there, so the Linux backend now falls back:

- threads: nproc, which uses sched_getaffinity rather than /proc
- memory: the per-NUMA-node meminfo files under /sys, which ProcSubset
  does not cover, before free(1) -- free reads /proc/meminfo itself and is
  bound to fail wherever that file is hidden, so trying /sys first settles
  which situation we are in without paying for a fork
- uptime: a process that has only just started carries the system uptime
  in its own /proc/<pid>/stat, and a process may always read its own entry

aarch64 and s390x are handled too: they list their processors but carry no
"model name" line, so the count is now taken separately from the name.

Cut the cost of the two-second poll

A poll spends about 1.3 ms collecting data inside a request that costs
hundreds of milliseconds, so the fix is fewer and cheaper requests, not
faster collection:

- useLiveData stops polling while the tab is hidden and polls immediately
  on return, so a page left open in the background no longer fetches
  numbers nobody can see
- getTime() no longer forks date(1) for something PHP can answer; the
  system zone is read from /etc/localtime because Nextcloud runs on UTC
- LiveData no longer calls getCPU() -- which parses /proc/cpuinfo, or forks
  nproc -- only to reach sys_getloadavg(), which uses none of it
- the sampled uptime is cached as a boot time and re-measured once a
  minute rather than once per poll

Together these leave the poll forking less than it did before: hosts with a
readable /proc now fork nothing at all, where every host used to fork date.

Signed-off-by: Frank Karlitschek <frank.karlitschek@nextcloud.com>
Assisted-by: Claude Code:claude-opus-5
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
The Monitoring page had grown to fourteen sections on one long scroll,
with the background job tables — three of them, each potentially long —
sitting in the middle of the hardware readings. Checking whether cron is
alive meant scrolling past the CPU and memory charts every time.

Add a navigation at the top of the page that switches between a "Status"
page, which keeps everything that describes the machine, and a new
"Background jobs" page, which the background jobs section moves to
unchanged.

The page body is split into StatusView and BackgroundJobsView so that
SettingsAdmin is left as a shell that fetches the data and picks a view.
The two are toggled with v-show rather than v-if on purpose: the CPU and
memory charts accumulate their history in the component, so v-if would
reset both graphs every time the admin glanced at the job tables.

The switch is an NcRadioGroup of NcRadioGroupButton, so it renders real
radio inputs with a group label rather than click handlers on divs.

Signed-off-by: Frank Karlitschek <frank.karlitschek@nextcloud.com>
Assisted-by: Claude Code:claude-opus-5
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb
kesselb force-pushed the backport/1119/stable35 branch from 78b5dde to 2e158b5 Compare September 9, 2026 17:45
@kesselb

kesselb commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Rebased on top of #1127

@kesselb
kesselb marked this pull request as ready for review September 9, 2026 17:46
@kesselb
kesselb merged commit 0508bc9 into stable35 Sep 9, 2026
45 of 46 checks passed
@kesselb
kesselb deleted the backport/1119/stable35 branch September 9, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants