Commit graph

13 commits

Author SHA1 Message Date
SergeantPanda
5263e18ed9 fix(api): improve error handling for API responses
- Enhanced the `formatApiError` function to better format failed API responses, preventing raw HTML error pages from being displayed in toasts. JSON error bodies are now prioritized for user-friendly messages, while HTML and empty bodies are collapsed to a concise status line. Long plain-text bodies are truncated for readability.
- Updated tests to cover new error formatting behavior, ensuring accurate extraction of error messages from various JSON structures.
2026-07-17 15:31:56 +00:00
nagelm
ed1c449234 fix(ui): stop rendering raw HTML error pages in toast notifications (#1261)
Failed API responses whose body is not JSON - Django's HTML "Server
Error (500)" page, nginx's HTML 502/504 pages when the backend is down
or timing out - were interpolated verbatim into the error toast,
showing users a wall of markup.

request() deliberately keeps the raw text when JSON.parse fails, and
errorNotification() rendered `${status} - ${body}` unconditionally.
Route the body through a new formatApiError() helper (in utils.js so it
is unit-testable without importing the store-heavy api module):

- JSON object bodies keep their existing pretty-printed formatting
- markup and empty bodies collapse to the response's own status line:
  the declared Content-Type decides what counts as markup (body
  sniffing only as fallback when the header is missing), and the label
  comes from the fetch Response's statusText - the protocol's reason
  phrase, defined for every status code, rather than a hardcoded status
  map. HTTP/2+ transmits no reason phrase, so an empty statusText falls
  back to a generic label. request() already attaches the Response to
  the error, so no call-site changes are needed.
- the full suppressed body goes to console.debug so the markup stays
  available for troubleshooting (deliberate, not a leftover debug
  statement)
- plain-text bodies are truncated at 200 chars as a backstop
- errors without a status keep the error.message fallback
2026-07-14 20:37:58 +12:00
SergeantPanda
aa1f627402 Enhancement: Refactored copyToClipboard utility function to include notification handling internally, eliminating duplicate notification code across the frontend. The function now accepts optional parameters for customizing success/failure messages while providing consistent behavior across all copy operations.
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Frontend Tests / test (push) Waiting to run
2026-01-31 19:01:34 -06:00
SergeantPanda
9440bbe2ab Performance: Removed unnecessary double wait that was causing fetching of channel data to not run in parallel. 2026-01-25 20:56:41 -06:00
dekzter
f300da6eff case sensitive flag and other possible custom properties for filters 2025-08-03 08:40:00 -04:00
SergeantPanda
5b076fd00b Allow for clicking url badge and copy to clipboard. 2025-07-29 11:35:22 -05:00
dekzter
3f445607e0 looooots of updates for user-management, initial commit of access control 2025-05-31 18:01:46 -04:00
dekzter
0dc62fb039 refactored streams table as well, broke out custom table into smaller components 2025-04-23 18:04:00 -04:00
dekzter
ad8dde3e85 channel group filter fix, updated navbar links, removed old files 2025-04-11 15:24:57 -04:00
dekzter
663ea2c5b9 soooo many changes.... 2025-04-11 13:22:08 -04:00
dekzter
9ac73cf990 initial push for pagination with streams tables - still need to fix the channels form tables 2025-03-08 09:17:20 -05:00
kappa118
5dc4e54585 more changes, table styling and compacting 2025-02-26 20:01:11 -05:00
kappa118
73b48acb9e big frontend push 2025-02-24 19:42:59 -05:00