HDDS-13625. Recon UI: Add "Replication Type" col on Bucket page - #10968
HDDS-13625. Recon UI: Add "Replication Type" col on Bucket page#10968stantheman0128 wants to merge 2 commits into
Conversation
Show the default replication of each bucket on the Recon Bucket list page. The bucket endpoint already returns this as BucketObjectDBInfo#replicationConfigInfo, so no backend change is needed. The column renders the replication strings Ozone uses elsewhere: Ratis-3 for Ratis buckets, RS-6-3-1024k for EC buckets, Standalone-1 for single replica buckets, and NA when a bucket carries no default replication config. Sorting follows the rendered string. Three of the five mock buckets in api/db.json gain a replicationConfigInfo so the column can be exercised locally with pnpm dev. The column is plain text rather than the themeIcon component named in the JIRA description, because the change that generalizes themeIcon (HDDS-13623) has not been merged. The icon can be added on top later.
There was a problem hiding this comment.
Pull request overview
This PR updates the Recon UI bucket list (v2) to display each bucket’s default replication as a new “Replication Type” column, using the existing replicationConfigInfo already returned by the Recon bucket endpoint (no backend changes).
Changes:
- Extend bucket types to include
replicationConfigInfo(serializedDefaultReplicationConfig). - Plumb
replicationConfigInfothrough the buckets page data mapping and render/sort the new table column via a formatted replication string. - Add UI unit tests covering the new column’s rendering and update mock API data (
api/db.json) to exercise the column.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/bucket.types.ts | Add TypeScript types for replicationConfigInfo and extend Bucket with the new field. |
| hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/buckets/buckets.tsx | Include replicationConfigInfo when mapping API buckets into UI buckets. |
| hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/bucketsTable.tsx | Add “Replication Type” column and formatting/sorting logic. |
| hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/tests/buckets/BucketsTable.test.tsx | Add unit tests for the new column formatting and fallbacks. |
| hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json | Add replicationConfigInfo to several mock buckets to exercise the column in dev. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| type BucketRatisReplicationConfig = { | ||
| replicationType: 'RATIS' | 'STAND_ALONE'; | ||
| replicationFactor: string; | ||
| requiredNodes: number; | ||
| } |
| const REPLICATION_TYPE_LABELS: Record<string, string> = { | ||
| RATIS: 'Ratis', | ||
| STAND_ALONE: 'Standalone' | ||
| }; |
| test('renders the Standalone variant for a single replica bucket', () => { | ||
| render( | ||
| <BucketsTable | ||
| {...defaultProps} | ||
| data={[getBucketWith('standalone-bucket', { | ||
| type: 'STAND_ALONE', | ||
| replicationConfig: { | ||
| replicationType: 'STAND_ALONE', | ||
| replicationFactor: 'ONE', | ||
| requiredNodes: 1 | ||
| } | ||
| })]} | ||
| /> | ||
| ); | ||
|
|
||
| expect(screen.getByText('Standalone-1')).toBeInTheDocument(); | ||
| }); |
StandaloneReplicationConfig serializes replicationType as STANDALONE, without the underscore, while the ReplicationType enum name used elsewhere is STAND_ALONE. A Standalone bucket therefore reached the column as STANDALONE and rendered as STANDALONE-1 instead of Standalone-1. Map both spellings, widen the type accordingly, and cover each spelling with its own test. The mock bucket in api/db.json now uses the spelling the backend actually emits.
chihsuan
left a comment
There was a problem hiding this comment.
Thanks for the patch! @stantheman0128 Overall, looks good. I tested this on local mock site and verified form renders the column as described.
I left a few inline comments, mainly around the EC string and a type we could reuse.
| const replicationConfig = replicationConfigInfo?.replicationConfig; | ||
| if (replicationConfig?.replicationType === 'EC') { | ||
| const { codec, data, parity, ecChunkSize } = replicationConfig; | ||
| return `${codec}-${data}-${parity}-${Math.floor(ecChunkSize / 1024)}k`; |
There was a problem hiding this comment.
Minor: Ozone itself prints rs-6-3-1024k (lowercase) everywhere else. Would it make sense to use codec.toLowerCase() here for consistency?
| // and StandaloneReplicationConfig. The latter serializes its replicationType as | ||
| // STANDALONE, while the enum name used elsewhere is STAND_ALONE, so both spellings | ||
| // can reach the UI. | ||
| type BucketRatisReplicationConfig = { |
There was a problem hiding this comment.
These Ratis and EC response shapes are already defined as RatisInfo, EcInfo, and ReplicationInfo in insights.types.ts.
Could we add a StandaloneInfo variant there and reuse the shared ReplicationInfo here? That would avoid duplicating the serialized ReplicationConfig contract and would also include the backend’s minimumNodes field.
| STANDALONE: 'Standalone' | ||
| }; | ||
|
|
||
| // Mirrors the replication strings Ozone uses elsewhere, e.g. Ratis-3 and RS-6-3-1024k |
There was a problem hiding this comment.
nit: Ozone uses formats such as RATIS/THREE and rs-6-3-1024k elsewhere, rather than Ratis-3 and uppercase RS-.... Perhaps change it to a local description such as "Formats the bucket’s default replication configuration for display."?
What changes were proposed in this pull request?
The Recon UI Bucket list page does not show how each bucket is replicated, so a
reader cannot tell a Ratis bucket from an EC one without looking somewhere else.
This adds a
Replication Typecolumn to that page. The bucket endpoint alreadyreturns the information as
BucketObjectDBInfo#replicationConfigInfo, aserialized
DefaultReplicationConfig, so no backend change is needed. Thefrontend was not reading the field.
The column renders the replication strings Ozone uses elsewhere:
THREERatis-3RS-6-3-1024kStandalone-1NAgetReplication()carries@JsonIgnoreon bothRatisReplicationConfigandECReplicationConfig, so the ready-made string does not reach the browser. Thecolumn composes it from the fields that are serialized:
requiredNodesforRatis and Standalone, and
codec,data,parity,ecChunkSizefor EC.Sorting uses the rendered string.
The Jira description asks to reuse the
themeIconcomponent. That component isgeneralized in HDDS-13623, whose PR #9003 was closed without merging, so this
change renders plain text and does not depend on it. An icon can be layered on
top once HDDS-13623 lands.
Three of the five mock buckets in
api/db.jsonnow carry areplicationConfigInfo, so the column can be exercised withpnpm dev. Theother two are left without one to cover the
NAcase.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-13625
How was this patch tested?
src/__tests__/buckets/BucketsTable.test.tsxcover Ratis,EC, Standalone, a config that carries only the outer
type, and theundefinedandnullcases.npx vitest runreports 74 passing tests withone pre-existing skip.
npx vite buildsucceeds.npx eslinton the touched files reports no warning that is not alreadypresent on the same files before the change.
pnpm dev. The five mock bucketscover all four rendered forms:
build-branchworkflow run on the fork:https://github.com/stantheman0128/ozone/actions/runs/31186914918
43 of the 44 jobs pass. The
kubernetesjob fails on the fork runner acrossall three attempts because the minikube cluster never leaves safe mode:
HealthyPipelineSafeModeRulereports a pipeline count of 0, so no datanodepipeline forms. The Recon pod itself starts normally in those runs.
Generated-by: Claude Code (claude-opus-5)