chennaji9 opened a new pull request, #5884: URL: https://github.com/apache/rocketmq-dashboard/pull/5884
### Which Issue(s) This PR Fixes None — small self-contained improvement found by inspection (no issue tracked). ### Brief Description `getDashboardsArchive()` listed the dashboards once and then called `getDashboardJson(uid)` per archive entry. Each of those calls went through `findResource` → `resolveUniqueResources` → `resolveResources`, so exporting the archive re-scanned and re-sorted the whole `classpath*:grafana/*.json` pattern once per dashboard — 1 + N pattern resolutions for N dashboards (N is 10 on the current tree), plus a needless UTF-8 decode/re-encode of every body. - Resolve the pattern exactly once and derive both the visible list and the archive bodies from that single resolution. - Stream each resource directly into its zip entry instead of round-tripping through a `String`. - Skip semantics are unchanged and stay identical to `listDashboards()` (invalid and unreadable assets are skipped, empty set still 404s). ### How Did You Test This Change? `cd server && mvn -B -ntp test -Dtest='GrafanaDashboardServiceTest,GrafanaDashboardControllerTest' -DfailIfNoTests=false` → **Tests run: 18, Failures: 0, Errors: 0** (14 service tests including 2 new, 4 controller tests). New tests: - `getDashboardsArchiveShouldResolveResourcesOnce` — counts `resolveResources()` invocations during an export over 3 dashboards and asserts exactly **1** (the pre-change path resolves 1 + 3 = 4 times by inspection: one for `listDashboards()` plus one per `getDashboardJson(uid)`). - `getDashboardsArchiveShouldSkipUnreadableAssetsLikeTheVisibleList` — an unreadable asset is skipped in the archive exactly like in the visible list (previously untested skip branch). All 12 pre-existing service tests (bundle listing, single-uid model/raw JSON, 404s, dedup determinism, archive contents and ordering) pass unchanged, pinning output equivalence. Not run: the full `mvn test` suite (integration tests need MySQL 8 per CONTRIBUTING.md); the change is confined to the `grafana` package and adds no new architecture-relevant dependency. ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`perf:`) - [x] Tests added or updated for non-trivial changes (2 new service tests) - [x] New UI text has both Chinese and English entries under `web/src/i18n/` (n/a — no UI change) - [x] Architecture constraints stay green (same class, same package, no new dependency direction) - [x] New source files carry the ASF license header (n/a — no new source file) - [x] Documentation touched where behaviour changed (n/a — observable archive output is identical) 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
