chihsuan commented on code in PR #10968:
URL: https://github.com/apache/ozone/pull/10968#discussion_r3750238520
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/bucketsTable.tsx:
##########
@@ -78,6 +79,30 @@ function renderBucketLayout(bucketLayout: BucketLayout) {
return <Tag color={color}>{bucketLayout}</Tag>;
};
+// StandaloneReplicationConfig serializes replicationType as STANDALONE, while
the
+// ReplicationType enum name is STAND_ALONE, so both spellings are mapped here
+const REPLICATION_TYPE_LABELS: Record<string, string> = {
+ RATIS: 'Ratis',
+ STAND_ALONE: 'Standalone',
+ STANDALONE: 'Standalone'
+};
+
+// Mirrors the replication strings Ozone uses elsewhere, e.g. Ratis-3 and
RS-6-3-1024k
+function formatReplicationType(replicationConfigInfo?: BucketReplicationConfig
| null) {
+ const replicationConfig = replicationConfigInfo?.replicationConfig;
+ if (replicationConfig?.replicationType === 'EC') {
+ const { codec, data, parity, ecChunkSize } = replicationConfig;
+ return `${codec}-${data}-${parity}-${Math.floor(ecChunkSize / 1024)}k`;
Review Comment:
Minor: Ozone itself prints rs-6-3-1024k (lowercase) everywhere else. Would
it make sense to use `codec.toLowerCase()` here for consistency?
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/types/bucket.types.ts:
##########
@@ -37,6 +37,37 @@ export const BucketLayoutTypeList = [
export type BucketLayout = typeof BucketLayoutTypeList[number];
+// Corresponds to the serialized
org.apache.hadoop.hdds.client.RatisReplicationConfig
+// 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 = {
Review 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.
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/bucketsTable.tsx:
##########
@@ -78,6 +79,30 @@ function renderBucketLayout(bucketLayout: BucketLayout) {
return <Tag color={color}>{bucketLayout}</Tag>;
};
+// StandaloneReplicationConfig serializes replicationType as STANDALONE, while
the
+// ReplicationType enum name is STAND_ALONE, so both spellings are mapped here
+const REPLICATION_TYPE_LABELS: Record<string, string> = {
+ RATIS: 'Ratis',
+ STAND_ALONE: 'Standalone',
+ STANDALONE: 'Standalone'
+};
+
+// Mirrors the replication strings Ozone uses elsewhere, e.g. Ratis-3 and
RS-6-3-1024k
Review 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."?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]