RockteMQ-AI commented on code in PR #3147:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/3147#discussion_r3935603297


##########
web/src/utils/instanceCapabilityMatrix.ts:
##########
@@ -0,0 +1,178 @@
+/*
+ * 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 type {
+  Instance,
+  InstanceCapabilities,
+  InstanceCapability,
+  InstanceType,
+  InstanceVendor,
+} from '../api/instance';
+
+export const INSTANCE_CAPABILITIES: readonly InstanceCapability[] = [
+  'TOPIC_MANAGEMENT',
+  'CONSUMER_GROUP_MANAGEMENT',
+  'MESSAGE_QUERY',
+  'MESSAGE_TRACE',
+  'ACL_MANAGEMENT',
+  'DLQ_MANAGEMENT',
+];
+
+export type CapabilityLoadStatus = 'AVAILABLE' | 'FAILED';
+
+export interface InstanceCapabilityMatrixRow {
+  key: string;
+  instanceId: string;
+  vendor: InstanceVendor;
+  accessType: InstanceType;
+  endpoint: string;

Review Comment:
   The buildInstanceCapabilityMatrix function correctly preserves successful 
rows on partial failure and reports failed discovery as unknown rather than 
unsupported. This distinction is important for accurate fleet-wide capability 
assessment.



##########
web/src/components/InstanceCapabilityMatrixDrawer.tsx:
##########
@@ -0,0 +1,480 @@
+/*
+ * 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 { useEffect, useMemo, useRef, useState } from 'react';
+import {
+  Alert,
+  Button,
+  Card,
+  Drawer,
+  Empty,
+  Flex,
+  Input,
+  Progress,
+  Select,
+  Space,
+  Statistic,
+  Table,
+  Tag,
+  Tooltip,
+  Typography,
+  message,
+} from 'antd';
+import type { TableColumnsType } from 'antd';
+import { CheckOutlined, CloseOutlined, DownloadOutlined, SearchOutlined } from 
'@ant-design/icons';
+import type { Instance, InstanceCapability, InstanceType, InstanceVendor } 
from '../api/instance';
+import { getInstanceCapabilities } from '../services/instanceService';
+import { useLang } from '../i18n/LangContext';
+import { buildCsv, downloadCsv, type CsvColumn } from '../utils/download';
+import { tableScrollX } from '../utils/table';
+import {
+  buildInstanceCapabilityMatrix,
+  describeCapabilityGaps,
+  filterInstanceCapabilityRows,
+  INSTANCE_CAPABILITIES,
+  summarizeVisibleCapabilityRows,
+  type CapabilityLoadResult,
+  type CapabilityLoadStatus,
+  type InstanceCapabilityMatrix,
+  type InstanceCapabilityMatrixRow,
+} from '../utils/instanceCapabilityMatrix';
+
+interface InstanceCapabilityMatrixDrawerProps {
+  open: boolean;
+  instances: Instance[];
+  onClose: () => void;
+}
+
+const LOAD_BATCH_SIZE = 4;
+
+const CSV_COLUMNS: CsvColumn<InstanceCapabilityMatrixRow>[] = [
+  { header: 'Instance', value: (row) => row.instanceId },
+  { header: 'Vendor', value: (row) => row.vendor },
+  { header: 'Access Type', value: (row) => row.accessType },
+  { header: 'Endpoint', value: (row) => row.endpoint },
+  { header: 'Discovery Status', value: (row) => row.status },
+  ...INSTANCE_CAPABILITIES.map((capability) => ({
+    header: capability,
+    value: (row: InstanceCapabilityMatrixRow) =>
+      row.status === 'FAILED'
+        ? 'UNKNOWN'
+        : row.capabilities.includes(capability)
+          ? 'SUPPORTED'
+          : 'MISSING',
+  })),
+  { header: 'Supported Count', value: (row) => row.supportedCount },
+  { header: 'Missing Capabilities', value: (row) => 
row.missingCapabilities.join(';') },
+  { header: 'Error', value: (row) => row.error },
+];
+
+const errorMessage = (error: unknown): string => {
+  const serverMessage = (error as { response?: { data?: { message?: unknown } 
} })?.response?.data

Review Comment:
   The LOAD_BATCH_SIZE = 4 is a good balance between parallelism and avoiding 
overwhelming the API. Consider making this configurable or documenting why 4 
was chosen.



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