unbridled-41 opened a new pull request, #3982:
URL: https://github.com/apache/rocketmq-dashboard/pull/3982

   Fixes #3565.
   
   ## Problem / Evidence
   
   The instance page has create, edit, and delete actions but no export action, 
and the backend has no instance export endpoint. Topic, consumer group, user, 
and audit inventories can already be exported in this project, so the instance 
inventory is the gap described in `#3565`: operators preparing environment 
reviews or capacity planning have to copy rows manually.
   
   ## What was added
   
   - `GET /api/instances/export` with the same `type`/`search` params as the 
list API, returning the CSV inside the standard result envelope. It reuses 
`InstanceService.listInstances` directly, so the export shows exactly what the 
page shows: same filter normalization, same vendor/region/name ordering, same 
resolved region display names, and same bounded resource-count resolution.
   - Export columns are the non-sensitive fields requested in the issue: name, 
type, vendor, endpoint, region id/name, topic count, consumer group count, 
resource-counts-available flag, and timestamps. Credential references 
(`credentialId`, `adminCredentialRef`, cloud instance ids) are intentionally 
omitted — regression-tested.
   - CSV rendering reuses the shared `CsvUtil` quoting/formula-injection guard 
and the UTF-8 BOM header treatment established by the audit export.
   - Instance page: an export button next to the batch actions that downloads 
`rocketmq-instances-YYYY-MM-DD.csv` with the currently applied filters (the 
handler passes the same `listQueryRef` state the table is loaded with), with a 
localized failure message; the service layer renders mock-mode data through the 
same column set so the demo build stays consistent.
   
   ## Priority & scoring
   
   FEATURE_PRIORITY = 90 (project need 37: explicit maintainer-evaluated issue 
#3565; external maturity 26: seven in-repo export endpoints including the audit 
backend-export precedent establish the pattern; fit 18: audit/capacity-planning 
use case with the issue's field list honored; testability 9: 
service/controller/UI all covered). IMPLEMENTATION_CONFIDENCE = 86: minimal 
diff reusing `listInstances`/`CsvUtil`/blob-download infrastructure, no new 
dependencies, no API breaking changes.
   
   ## Tests
   
   - New regressions first failed (frontend: two page tests could not find an 
export control and the API test failed on the missing client function; backend: 
5 × `cannot find symbol exportInstancesCsv`), then passed:
     - `npx vitest run src/api/instance.test.ts 
src/pages/instance/__tests__/InstancePage.test.tsx` → 32 passed (32): filter 
passthrough with trimmed search, blob download with `text/csv` type and dated 
filename, failure message without download, plus all pre-existing coverage.
     - `mvn test -Dtest='InstanceServiceTest,InstanceControllerTest'` → `Tests 
run: 98, Failures: 0` (84 service + 14 controller), `BUILD SUCCESS`: CSV 
header/row contents, resource counts from the vendor provider, region names 
resolved, credential references absent, search normalization, envelope payload, 
filter passthrough.
   - Full backend suite `mvn test`: 2039 tests, 4 failures — the two 
pre-existing `AuthCorsIntegrationTest` failures and 
`AliyunInstanceProviderTest.getGroupProgressShouldMapLagRowsTest` (identical to 
the pristine baseline), plus 
`OpenAiCompatibleLlmGatewayTest.successfulAndFailedStreamsEmitOneTerminalSequence`,
 the known load-flaky case that passes 9/9 in isolation. Zero new failures.
   - Full web suite `npx vitest run --testTimeout=60000`: 925 tests, failures 
only in `ConsumerPage.test.tsx` (1–2 cases per run, the known load-flaky file 
untouched by this PR; 29/29 pass in isolation). Zero new failures.
   - `npm run build`, `tsc -b`, and `eslint` on touched files: clean.
   
   ## Risk
   
   Low. Additive only: one read-only endpoint, one button, no changes to 
existing endpoints or components. Instance inventories are bounded (the list 
API is already unpaginated), so the export matches the page view without an 
extra cap; counts still respect the existing 3s per-row deadline and mark 
unavailable counts explicitly.


-- 
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]

Reply via email to