Skip to content

feat(settings): add Administration Previews page - #63796

Open
rayvincent2 wants to merge 14 commits into
nextcloud:masterfrom
rayvincent2:feat/63795/previews-admin-page
Open

feat(settings): add Administration Previews page#63796
rayvincent2 wants to merge 14 commits into
nextcloud:masterfrom
rayvincent2:feat/63795/previews-admin-page

Conversation

@rayvincent2

Copy link
Copy Markdown

Summary

Adds a core Administration → Previews page (/settings/admin/previews) so admins can inspect and edit the existing preview config without hand-editing PHP arrays or fumbling with settings via occ.

This is a UI over the current keys (enable_previews, enabledPreviewProviders, size/memory/filesize limits, jpeg/webp quality, concurrency, Imaginary URL/key/preview_format, ffmpeg/LibreOffice paths, preview_expiration_days). No new public API for Memories or Preview Generator. An instance that never opens the page keeps today’s config.

Backwards compatible: same config keys, types, defaults, and IPreview API. The only change is that enabledPreviewProviders order is now try-order, not just a whitelist.

What the page does:

  • Full provider catalog with availability (ffmpeg, Imagick format, LibreOffice, Imaginary URL). A provider that still says “Requires …” cannot be enabled. Filling a path/URL unlocks the switch but does not auto-enable it. Save drops catalog providers that still fail their requirement.
  • Enable/disable and global try-order. enabledPreviewProviders stays a class-name whitelist; array order is now generation priority (IPreview::getProviders() is rebuilt in that order). Membership is unchanged. Unset lists are not rewritten on load; the first Save is what persists the key.
  • Reset to defaults restores the recommended list for this host (natives; Imaginary first if a URL is set; native HEIC only if Imagick can decode it). Movie / ImaginaryPDF are not auto-enabled.
  • Failed generations list with retry/clear (oc_preview_failures). Retry is getPreview() again, not a force-delete of cached blobs.
  • Master switch: when previews are off, the rest of the page is inert until Save.

Not in this PR (keep elsewhere):

Reviewers: the attached previews-admin-product-spec.md is the product spec for this page (config mapping, master vs this try-order, HEIC/Imaginary, failure recording, docs notes for previews_configuration.html). It is not the published admin manual and is not committed in the tree.

Screenshots

Previews-Administration-settings-Nextcloud-08-29-2026_12_08_PM

TODO

  • Unit tests for admin config, generator order, failure recording, section icon
  • Playwright admin-settings-previews.spec.ts
  • [X ] Attach screenshots (page + left-nav icon)
  • Attach previews-admin-product-spec.md

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits (verify the tip commit)
  • Tests (unit, integration, api and/or acceptance) are included
  • Screenshots before/after for front-end changes
  • Documentation (manuals or wiki) has been updated or is not required (spec attached; RST follow-up)
  • Backports requested where applicable (ex: critical bugfixes) (new 36 feature; no backport)
  • Labels added where applicable (ex: bug/enhancement, 3. to review, feature component)
  • Milestone added for target branch/version (ex: 32.x for stable32) (36.x / master)

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Assisted by Grok (grok-4.6). I reviewed, tested on a live instance, and signed the commits. The product spec attached here was also drafted with that assistance and is for reviewers/docs, not shipped UI copy.

Add typed preview admin config, a MIME provider-priority resolver, HTTP
cache policies for preview responses, and a preview_failures table used
when generation cannot produce a preview. Authenticated responses stay
private unless an admin configures otherwise.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Add an Administration → Previews section for general limits, Imaginary,
provider order, MIME overrides, HTTP cache headers, and failed
generations. Saving is admin-delegable and requires password
confirmation.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Add concurrency, preview file expiry, failure retention, WebP quality,
and ffmpeg/LibreOffice paths to Administration → Previews. Fields that
depend on Imagick, ffmpeg, LibreOffice, or Imaginary are labelled from
detected availability and hidden when they do not apply.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Keep WebP quality, external-tool paths, and s-maxage visible instead of
hiding them. Label each as in use, not enabled yet, or not detected, and
offer an action that enables the related provider or visibility.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Move the enable toggle next to Save and disable the remaining admin
sections when previews are off, using a native fieldset and inert so
those controls are visibly and programmatically uneditable.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Track form dirty state from a settings snapshot, disable Save until
something changes, prompt on leave/reload, and add a second Save
changes control at the bottom of the long admin page.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Remove preview_provider_mime_priority/deny and the resolver so provider
order is only enabledPreviewProviders. Clarify that preview_format is
Imaginary-only. Tighten HTTP cache fields (required s-maxage when public,
hidden when private) and polish provider availability, Imaginary/Movie
Office sections, and quality copy.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Drop the HTTP cache policy UI. Record a failed generation when a
higher-priority provider misses even if a later one succeeds, and when
a preview request 404s. Use recommended defaults (Imaginary first when
configured, HEIC fallback, Movie available but not enabled). Mark
discouraged providers as unsupported, restore default order on reset,
and replace the status buttons with a dropdown plus source MIME
filtering and drag-and-drop.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Address ESLint indent and NcButton variants, Psalm catalog typing, PHP
CS import order, and run the e2e spec serially with NcSelect helpers.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Disable enabling a provider while Availability still says Requires.
Typing an Imaginary URL, ffmpeg path, or LibreOffice path unlocks the
switch but does not auto-enable. Save drops catalog providers that
still do not meet their requirement.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
getProviders() still returns a MIME-regex map, but keys are inserted in
enabledPreviewProviders order instead of regex length. Generator walks
that map so overlapping providers (for example Imaginary then HEIC) run
in the admin table order, and a later provider still runs if an earlier
one fails.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Use longform watch handlers so Vue 2 object-shorthand and
new-line-between-multi-line-property pass.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Use a settings-owned template SVG instead of the themed MIME
filetypes/image.svg icon, which does not render in the left nav.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
Match the save toast exactly and query provider enable controls as
switches, matching NcCheckboxRadioSwitch.

Assisted-by: Grok:grok-4.6
Signed-off-by: Ray Vincent <rayhvincent@gmail.com>
@rayvincent2
rayvincent2 requested review from a team, hweihwang and sorbaugh as code owners August 29, 2026 19:13
@rayvincent2
rayvincent2 requested review from Altahrim, CarlSchwan, kristian-zendato, leftybournes and skjnldsv and removed request for a team August 29, 2026 19:13
@rayvincent2 rayvincent2 changed the title Feat/63795/previews admin page feat(settings): add Administration Previews page Aug 29, 2026
@CarlSchwan

Copy link
Copy Markdown
Member

I like the idea. I will have to careful review the code next week

@rayvincent2

Copy link
Copy Markdown
Author

Yeah, sorry it's a big one... I'm happy to split it up if needed. I learned a lot about how previews are generated by each provider which I'm excited to reveal through this admin page.

I left my commit history so you could see my thought process as I went along too. Happy to squash that as needed.

I look forward to your comments!

@skjnldsv

Copy link
Copy Markdown
Member

Wow, that is a great feature!
I'll add that to the to-do next week too!! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Administration UI for core preview settings

3 participants