Files
openobserve/web/src/components
171ba0df0f fix: templates fetch issue (#11795)
Summary
Migrated the "Add Dashboard from Gallery" feature from GitHub API to S3
(direct bucket access), removing the GitHub rate-limit dependency, and
updated all corresponding test mocks to match the new S3 XML response
format.

What changed
1. Data source: GitHub API → S3 List Objects V2
The gallery was previously fetched from
api.github.com/repos/openobserve/dashboards/contents, which is subject
to GitHub's rate limiting (60 req/hr for unauthenticated requests). It
now reads directly from the S3 bucket openobserve-datasources-bucket via
the List Objects V2 XML API.

loadDashboards() — folder listing now calls:


GET
https://...s3.amazonaws.com/?list-type=2&prefix=dashboards/&delimiter=/
And parses the XML response via parseS3Folders(), which reads
<CommonPrefixes><Prefix> elements.

handleNext() — file listing inside a folder now calls the same S3
endpoint with a deeper prefix, parsed via parseS3Files() which reads
<Contents><Key> elements.

confirmAdd() — dashboard JSON download changed from
raw.githubusercontent.com/... to the direct S3 object URL.

2. Test mock format: JSON → S3 XML
All tests that mocked fetch were still returning the old GitHub JSON
format ([{name, type}]). Since the component now calls
DOMParser.parseFromString(xml, "application/xml"), the JSON strings were
unparseable as XML, resulting in empty dashboards arrays and causing the
"sort dashboards alphabetically" test to fail with undefined.

Added two helpers (s3FolderListXml, s3FileListXml) and updated every
affected fetch mock to return valid S3 List Objects V2 XML. Also
strengthened a few assertions that were previously passing vacuously (an
empty array also "doesn't contain .github").

---------

Co-authored-by: Shrinath Rao <shnath@openobserve.ai>
Co-authored-by: Bhargav <BJP232004@GMAIL.COM>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 06:05:26 +00:00
..
2026-05-12 13:49:34 +00:00