This is an automated email from the ASF dual-hosted git repository.

chihsuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new bd19cd0d457 HDDS-13625. Recon UI: Add "Replication Type" col on Bucket 
page (#10968)
bd19cd0d457 is described below

commit bd19cd0d4575e61f99e4883cc3b742b551a6336f
Author: Po-Han (Stan) Shih · 施博瀚 <[email protected]>
AuthorDate: Mon Oct 19 21:58:09 2026 +0800

    HDDS-13625. Recon UI: Add "Replication Type" col on Bucket page (#10968)
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
    Co-authored-by: Chi-Hsuan Huang <[email protected]>
---
 .../webapps/recon/ozone-recon-web/api/db.json      |  30 ++++
 .../src/__tests__/buckets/BucketsTable.test.tsx    | 164 +++++++++++++++++++++
 .../src/v2/components/tables/bucketsTable.tsx      |  31 ++++
 .../components/tables/insights/openKeysTable.tsx   |   6 +-
 .../src/v2/pages/buckets/buckets.tsx               |   3 +-
 .../ozone-recon-web/src/v2/types/bucket.types.ts   |  10 ++
 .../ozone-recon-web/src/v2/types/insights.types.ts |  11 +-
 .../ozone-recon-web/src/views/insights/om/om.tsx   |   6 +-
 8 files changed, 253 insertions(+), 8 deletions(-)

diff --git 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json
 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json
index e2d796e417c..775b390a5ed 100644
--- 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json
+++ 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json
@@ -4643,6 +4643,15 @@
         "quotaInNamespace": 50000,
         "owner": "testuser",
         "bucketLayout": "OBJECT_STORE",
+        "replicationConfigInfo": {
+          "type": "RATIS",
+          "replicationConfig": {
+            "replicationType": "RATIS",
+            "replicationFactor": "THREE",
+            "requiredNodes": 3,
+            "minimumNodes": 1
+          }
+        },
         "acls": [
           {
             "type": "USER",
@@ -4669,6 +4678,18 @@
         "quotaInNamespace": 10000,
         "owner": "testuser2",
         "bucketLayout": "LEGACY",
+        "replicationConfigInfo": {
+          "type": "EC",
+          "replicationConfig": {
+            "replicationType": "EC",
+            "codec": "RS",
+            "data": 6,
+            "parity": 3,
+            "ecChunkSize": 1048576,
+            "requiredNodes": 9,
+            "minimumNodes": 6
+          }
+        },
         "acls": [
           {
             "type": "GROUP",
@@ -4737,6 +4758,15 @@
         "quotaInNamespace": -1,
         "owner": "testuser3",
         "bucketLayout": "OBJECT_STORE",
+        "replicationConfigInfo": {
+          "type": "STAND_ALONE",
+          "replicationConfig": {
+            "replicationType": "STANDALONE",
+            "replicationFactor": "ONE",
+            "requiredNodes": 1,
+            "minimumNodes": 1
+          }
+        },
         "acls": [
           {
             "type": "GROUP",
diff --git 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/__tests__/buckets/BucketsTable.test.tsx
 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/__tests__/buckets/BucketsTable.test.tsx
new file mode 100644
index 00000000000..7ffb66e21cb
--- /dev/null
+++ 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/__tests__/buckets/BucketsTable.test.tsx
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React from 'react';
+import { vi } from 'vitest';
+import { render, screen } from '@testing-library/react';
+
+import BucketsTable from '@/v2/components/tables/bucketsTable';
+import { Bucket, BucketsTableProps } from '@/v2/types/bucket.types';
+
+function getBucketWith(
+  name: string,
+  replicationConfigInfo: Bucket['replicationConfigInfo']
+): Bucket {
+  return {
+    volumeName: 'vol1',
+    name,
+    versioning: false,
+    storageType: 'DISK',
+    creationTime: 1728280581608,
+    modificationTime: 1728280581608,
+    usedBytes: 0,
+    usedNamespace: 0,
+    quotaInBytes: -1,
+    quotaInNamespace: -1,
+    owner: 'om',
+    acls: [],
+    bucketLayout: 'FILE_SYSTEM_OPTIMIZED',
+    replicationConfigInfo
+  };
+}
+
+const defaultProps: BucketsTableProps = {
+  loading: false,
+  data: [],
+  handleAclClick: vi.fn(),
+  searchColumn: 'name',
+  searchTerm: '',
+  selectedColumns: [
+    { label: 'Bucket',
+      value: 'name' },
+    { label: 'Volume',
+      value: 'volumeName' },
+    { label: 'Replication Type',
+      value: 'replicationType' }
+  ]
+};
+
+describe('BucketsTable Replication Type column', () => {
+  test('renders the Ratis variant for a Ratis bucket', () => {
+    render(
+      <BucketsTable
+        {...defaultProps}
+        data={[getBucketWith('ratis-bucket', {
+          type: 'RATIS',
+          replicationConfig: {
+            replicationType: 'RATIS',
+            replicationFactor: 'THREE',
+            requiredNodes: 3,
+            minimumNodes: 1
+          }
+        })]}
+      />
+    );
+
+    expect(screen.getByText('Ratis-3')).toBeInTheDocument();
+  });
+
+  test.each([
+    ['RS', 6, 3, 1048576, 'rs-6-3-1024k'],
+    ['RS', 3, 2, 1048576, 'rs-3-2-1024k'],
+    ['RS', 10, 4, 1048576, 'rs-10-4-1024k'],
+    ['XOR', 10, 4, 2097152, 'xor-10-4-2048k']
+  ] as const)(
+    'renders an EC bucket with codec %s, %i data and %i parity and a %i byte 
chunk as %s',
+    (codec, data, parity, ecChunkSize, expected) => {
+      render(
+        <BucketsTable
+          {...defaultProps}
+          data={[getBucketWith('ec-bucket', {
+            type: 'EC',
+            replicationConfig: {
+              replicationType: 'EC',
+              codec,
+              data,
+              parity,
+              ecChunkSize,
+              requiredNodes: data + parity,
+              minimumNodes: data
+            }
+          })]}
+        />
+      );
+
+      expect(screen.getByText(expected)).toBeInTheDocument();
+    });
+
+  test('renders the Standalone variant for a single replica bucket', () => {
+    render(
+      <BucketsTable
+        {...defaultProps}
+        data={[getBucketWith('standalone-bucket', {
+          type: 'STAND_ALONE',
+          replicationConfig: {
+            replicationType: 'STANDALONE',
+            replicationFactor: 'ONE',
+            requiredNodes: 1,
+            minimumNodes: 1
+          }
+        })]}
+      />
+    );
+
+    expect(screen.getByText('Standalone-1')).toBeInTheDocument();
+  });
+
+  test('falls back to the replication type when the nested config is absent', 
() => {
+    render(
+      <BucketsTable
+        {...defaultProps}
+        data={[getBucketWith('type-only-bucket', { type: 'RATIS' })]}
+      />
+    );
+
+    expect(screen.getByText('RATIS')).toBeInTheDocument();
+  });
+
+  test('falls back to NA when replicationConfigInfo is missing', () => {
+    render(
+      <BucketsTable
+        {...defaultProps}
+        data={[getBucketWith('legacy-bucket', undefined)]}
+      />
+    );
+
+    expect(screen.getByText('NA')).toBeInTheDocument();
+  });
+
+  test('falls back to NA when replicationConfigInfo is null', () => {
+    render(
+      <BucketsTable
+        {...defaultProps}
+        data={[getBucketWith('null-bucket', null)]}
+      />
+    );
+
+    expect(screen.getByText('NA')).toBeInTheDocument();
+  });
+});
diff --git 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/bucketsTable.tsx
 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/bucketsTable.tsx
index a9013967e3e..b5e32b1f4c5 100644
--- 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/bucketsTable.tsx
+++ 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/bucketsTable.tsx
@@ -41,6 +41,7 @@ import {
   Bucket,
   BucketLayout,
   BucketLayoutTypeList,
+  BucketReplicationConfig,
   BucketsTableProps,
   BucketStorage,
   BucketStorageTypeList
@@ -78,6 +79,27 @@ function renderBucketLayout(bucketLayout: BucketLayout) {
   return <Tag color={color}>{bucketLayout}</Tag>;
 };
 
+const REPLICATION_TYPE_LABELS: Record<string, string> = {
+  RATIS: 'Ratis',
+  STANDALONE: 'Standalone'
+};
+
+// Formats the bucket's default replication configuration for display
+function formatReplicationType(replicationConfigInfo?: BucketReplicationConfig 
| null) {
+  const replicationConfig = replicationConfigInfo?.replicationConfig;
+  if (replicationConfig?.replicationType === 'EC') {
+    const { codec, data, parity, ecChunkSize } = replicationConfig;
+    return `${codec.toLowerCase()}-${data}-${parity}-${Math.floor(ecChunkSize 
/ 1024)}k`;
+  }
+  if (replicationConfig) {
+    const label = REPLICATION_TYPE_LABELS[replicationConfig.replicationType]
+      ?? replicationConfig.replicationType;
+    return `${label}-${replicationConfig.requiredNodes}`;
+  }
+  // Fall back to the bare type, then to NA for buckets with no default 
replication config
+  return replicationConfigInfo?.type ?? 'NA';
+};
+
 export const COLUMNS: ColumnsType<Bucket> = [
   {
     title: 'Bucket',
@@ -127,6 +149,15 @@ export const COLUMNS: ColumnsType<Bucket> = [
     sorter: (a: Bucket, b: Bucket) => 
a.bucketLayout.localeCompare(b.bucketLayout),
     render: (bucketLayout: BucketLayout) => renderBucketLayout(bucketLayout)
   },
+  {
+    title: 'Replication Type',
+    dataIndex: 'replicationConfigInfo',
+    key: 'replicationType',
+    sorter: (a: Bucket, b: Bucket) => 
formatReplicationType(a.replicationConfigInfo)
+      .localeCompare(formatReplicationType(b.replicationConfigInfo)),
+    render: (replicationConfigInfo: BucketReplicationConfig | null | 
undefined) =>
+      formatReplicationType(replicationConfigInfo)
+  },
   {
     title: 'Creation Time',
     dataIndex: 'creationTime',
diff --git 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/insights/openKeysTable.tsx
 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/insights/openKeysTable.tsx
index c7fc676bcd8..999406f9a14 100644
--- 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/insights/openKeysTable.tsx
+++ 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/insights/openKeysTable.tsx
@@ -145,9 +145,9 @@ const OpenKeysTable: React.FC<OpenKeysTableProps> = ({
     render: (replicationInfo: ReplicationInfo) => (
       <div>
         {
-          (replicationInfo.replicationType === "RATIS")
-          ? replicationInfo.replicationFactor
-          : 
`${replicationInfo.codec}-${replicationInfo.data}-${replicationInfo.parity}`
+          (replicationInfo.replicationType === "EC")
+          ? 
`${replicationInfo.codec}-${replicationInfo.data}-${replicationInfo.parity}`
+          : replicationInfo.replicationFactor
         }
       </div>
     )
diff --git 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/buckets/buckets.tsx
 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/buckets/buckets.tsx
index ae3376df480..4b8abb31eee 100644
--- 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/buckets/buckets.tsx
+++ 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/buckets/buckets.tsx
@@ -177,7 +177,8 @@ const Buckets: React.FC<{}> = () => {
         quotaInBytes: bucket.quotaInBytes,
         quotaInNamespace: bucket.quotaInNamespace,
         owner: bucket.owner,
-        acls: bucket.acls
+        acls: bucket.acls,
+        replicationConfigInfo: bucket.replicationConfigInfo
       }));
 
       const volumeBucketMap: Map<string, Set<Bucket>> = 
getVolumeBucketMap(buckets);
diff --git 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/bucket.types.ts
 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/bucket.types.ts
index eb499dc617e..98d033d1b1c 100644
--- 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/bucket.types.ts
+++ 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/bucket.types.ts
@@ -17,6 +17,7 @@
  */
 
 import { Acl } from "@/v2/types/acl.types";
+import { ReplicationInfo } from '@/v2/types/insights.types';
 import { Option as MultiOption } from "@/v2/components/select/multiSelect";
 
 // Corresponds to OzoneManagerProtocolProtos.StorageTypeProto
@@ -37,6 +38,14 @@ export const BucketLayoutTypeList = [
 export type BucketLayout = typeof BucketLayoutTypeList[number];
 
 
+// Corresponds to the serialized 
org.apache.hadoop.hdds.client.DefaultReplicationConfig
+// returned by the Recon bucket endpoint 
(BucketObjectDBInfo#replicationConfigInfo).
+// The nested config is the same shape the OM DB insights endpoints return.
+export type BucketReplicationConfig = {
+  type: string;
+  replicationConfig?: ReplicationInfo | null;
+}
+
 export type Bucket = {
   volumeName: string;
   name: string;
@@ -53,6 +62,7 @@ export type Bucket = {
   owner: string;
   acls?: Acl[];
   bucketLayout: BucketLayout;
+  replicationConfigInfo?: BucketReplicationConfig | null;
 }
 
 export type BucketResponse = {
diff --git 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/insights.types.ts
 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/insights.types.ts
index 55f2bc7a032..c93f028a220 100644
--- 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/insights.types.ts
+++ 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/insights.types.ts
@@ -119,7 +119,16 @@ export interface EcInfo {
   minimumNodes: number;
 }
 
-export type ReplicationInfo = RatisInfo | EcInfo;
+// StandaloneReplicationConfig serializes its replicationType as STANDALONE,
+// without the underscore used by the ReplicationType enum name STAND_ALONE
+export interface StandaloneInfo {
+  replicationType: 'STANDALONE';
+  replicationFactor: string;
+  requiredNodes: number;
+  minimumNodes: number;
+}
+
+export type ReplicationInfo = RatisInfo | EcInfo | StandaloneInfo;
 
 // Open Keys
 export type OpenKeys = {
diff --git 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/insights/om/om.tsx
 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/insights/om/om.tsx
index 7881d285582..966f414a2cd 100644
--- 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/insights/om/om.tsx
+++ 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/insights/om/om.tsx
@@ -217,9 +217,9 @@ const OPEN_KEY_TAB_COLUMNS = [
     render: (replicationInfo: ReplicationInfo) => (
       <div>
         {
-          (replicationInfo.replicationType === "RATIS")
-          ? replicationInfo.replicationFactor
-          : 
`${replicationInfo.codec}-${replicationInfo.data}-${replicationInfo.parity}`
+          (replicationInfo.replicationType === "EC")
+          ? 
`${replicationInfo.codec}-${replicationInfo.data}-${replicationInfo.parity}`
+          : replicationInfo.replicationFactor
         }
       </div>
     )


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to