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


##########
web/src/pages/settings/CloudCredentialUsageDrawer.tsx:
##########
@@ -0,0 +1,360 @@
+/*
+ * 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.
+ */
+
+import { useCallback, useMemo, useState } from 'react';
+import {
+  Alert,
+  Button,
+  Card,
+  Col,
+  Drawer,
+  Empty,
+  Flex,
+  Input,
+  Row,
+  Select,
+  Space,
+  Statistic,
+  Table,
+  Tabs,
+  Tag,
+  Typography,
+  message,
+} from 'antd';
+import { DownloadOutlined, ReloadOutlined } from '@ant-design/icons';
+import type { ColumnsType } from 'antd/es/table';
+import { listCloudCredentials } from '../../api/cloudCredential';
+import type { CloudCredential } from '../../api/cloudCredential';
+import { listInstances } from '../../api/instance';
+import type { InstanceVendor } from '../../api/instance';
+import { useLang } from '../../i18n/LangContext';
+import { buildCsv, downloadCsv } from '../../utils/download';
+import {
+  buildCredentialUsageReport,
+  credentialUsageCsvRows,
+  filterCredentialUsageRows,
+} from './cloudCredentialUsage';
+import type {
+  CredentialUsageRow,
+  CredentialUsageStatus,
+  OrphanCredentialReference,
+} from './cloudCredentialUsage';
+
+const CREDENTIAL_PAGE_SIZE = 100;
+const MAX_CREDENTIAL_PAGES = 100;
+
+interface Props {
+  open: boolean;
+  onClose: () => void;
+}
+
+const loadAllCredentials = async () => {
+  const credentials: CloudCredential[] = [];

Review Comment:
   Consider adding a progress indicator or warning when loading large 
credential sets (up to 10,000). Users may wonder if the operation is stuck on 
slow connections.



##########
web/src/pages/settings/CloudCredentialUsageDrawer.tsx:
##########
@@ -0,0 +1,360 @@
+/*
+ * 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.
+ */
+
+import { useCallback, useMemo, useState } from 'react';
+import {
+  Alert,
+  Button,
+  Card,
+  Col,
+  Drawer,
+  Empty,
+  Flex,
+  Input,
+  Row,
+  Select,
+  Space,
+  Statistic,
+  Table,
+  Tabs,
+  Tag,
+  Typography,
+  message,
+} from 'antd';
+import { DownloadOutlined, ReloadOutlined } from '@ant-design/icons';
+import type { ColumnsType } from 'antd/es/table';
+import { listCloudCredentials } from '../../api/cloudCredential';
+import type { CloudCredential } from '../../api/cloudCredential';
+import { listInstances } from '../../api/instance';
+import type { InstanceVendor } from '../../api/instance';
+import { useLang } from '../../i18n/LangContext';
+import { buildCsv, downloadCsv } from '../../utils/download';
+import {
+  buildCredentialUsageReport,
+  credentialUsageCsvRows,
+  filterCredentialUsageRows,
+} from './cloudCredentialUsage';
+import type {
+  CredentialUsageRow,
+  CredentialUsageStatus,
+  OrphanCredentialReference,
+} from './cloudCredentialUsage';
+
+const CREDENTIAL_PAGE_SIZE = 100;
+const MAX_CREDENTIAL_PAGES = 100;
+
+interface Props {
+  open: boolean;
+  onClose: () => void;
+}
+
+const loadAllCredentials = async () => {
+  const credentials: CloudCredential[] = [];
+  for (let page = 1; page <= MAX_CREDENTIAL_PAGES; page += 1) {
+    const result = await listCloudCredentials(undefined, undefined, page, 
CREDENTIAL_PAGE_SIZE);
+    credentials.push(...result.items);
+    if (credentials.length >= result.total || result.items.length < 
CREDENTIAL_PAGE_SIZE) {
+      return credentials;
+    }
+  }

Review Comment:
   The error message credential page limit exceeded is developer-facing. 
Consider a user-friendly message.



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