Brijesh619 commented on code in PR #708:
URL: https://github.com/apache/atlas/pull/708#discussion_r3688425875


##########
dashboard/src/views/Administrator/Audits/AuditResults.tsx:
##########
@@ -15,130 +15,228 @@
  * limitations under the License.
  */
 
-import { Grid, Link, List, ListItem, ListItemText, Typography } from 
"@mui/material";
-import { auditAction, category } from "@utils/Enum";
+import { Grid, Link, List, ListItem, ListItemText, Typography, Divider, Alert, 
AlertTitle, Box, Drawer, IconButton, Stack, Tooltip, TextField, InputAdornment, 
CircularProgress } from "@mui/material";
+import ContentCopyIcon from "@mui/icons-material/ContentCopy";
+import SearchIcon from "@mui/icons-material/Search";
+import { auditAction, category, AuditOperation, PurgeActiveView } from 
"@utils/Enum";
 import { isEmpty, jsonParse } from "@utils/Utils";
+import { useVirtualization } from '@hooks/useVirtualization';
 import CustomModal from "@components/Modal";
 import TypeDefAuditDetailModal from "@components/TypeDefAuditDetailModal";
-import { useState } from "react";
-import { Item } from "@utils/Muiutils";
+import { useRef, useState } from "react";
 import AuditsTab from "@views/DetailPage/EntityDetailTabs/AuditsTab";
 import ImportExportAudits from "./ImportExportAudits";
+import { LightTooltip } from '@components/muiComponents';
 
-const AuditResults = ({ componentProps, row }: any) => {
+interface AuditEntry {
+  guid: string;
+  operation: string;
+  params?: string;
+  result?: string;
+  runId?: string;
+  [key: string]: unknown;
+}
+
+interface AuditResultsProps {
+  componentProps?: {
+    auditData?: AuditEntry[];
+  };
+  row: {
+    original: {
+      guid: string;
+      runId?: string;
+      [key: string]: unknown;
+    };
+  };
+}
+
+const AuditResults = ({ componentProps, row }: AuditResultsProps) => {
   const { auditData } = componentProps || {};
   const [openModal, setOpenModal] = useState<boolean>(false);
   const [openPurgeModal, setOpenPurgeModal] = useState<boolean>(false);
-  const [currentResultObj, setCurrentObj] = useState<any>({});
-  const [currentPurgeResultObj, setCurrentPurgeResultObj] = useState<any>("");
+  const [currentResultObj, setCurrentObj] = useState<Record<string, unknown> | 
undefined>();
+  // Stores the guid of the clicked purged entity
+  const [currentPurgeResultObj, setCurrentPurgeResultObj] = useState<string | 
undefined>();
+  const [activePurgeView, setActivePurgeView] = 
useState<PurgeActiveView>(PurgeActiveView.NONE);
+  const [drawerSearchText, setDrawerSearchText] = useState<string>('');
+  const [drawerPage, setDrawerPage] = useState<number>(1);
+  const [drawerPageSize, setDrawerPageSize] = useState<number>(10);
+  const [drawerPageSizeInput, setDrawerPageSizeInput] = useState<string>('10');
+  const [scrollTop, setScrollTop] = useState<number>(0);
+  const [copiedRunId, setCopiedRunId] = useState<boolean>(false);
+  const [purgedApiGuids, setPurgedApiGuids] = useState<string[]>([]);
+  const [loadingPurgedApi, setLoadingPurgedApi] = useState<boolean>(false);
+  const [purgedTotalCount, setPurgedTotalCount] = useState<number>(0);
+  const drawerScrollTimerRef = useRef<ReturnType<typeof setTimeout> | 
null>(null);
+
   const handleCloseModal = () => {
     setOpenModal(false);
   };
   const handleClosePurgeModal = () => {
     setOpenPurgeModal(false);
   };
-  const auditObj = !isEmpty(auditData)
-    ? auditData.find((obj: { guid: string }) => obj.guid == row.original.guid)
-    : {};
 
-  const { operation, params, result } = auditObj;
+  const auditObj: AuditEntry | undefined = !isEmpty(auditData)
+    ? (auditData as AuditEntry[]).find((obj) => obj.guid === row.original.guid)
+    : undefined;
+
+  const operation = auditObj?.operation ?? '';
+  const params = auditObj?.params;
+  const result = auditObj?.result;
+
+  let isPurgeOperation = operation === AuditOperation.PURGE || operation === 
AuditOperation.AUTO_PURGE;
+  let summary: Record<string, unknown> = {};
+  let requestedEntitiesList: string[] = [];
+  let legacyPurgedList: string[] = [];
+
+  if (isPurgeOperation) {
+    try {
+      const parsed = typeof result === "string" ? JSON.parse(result) : result;
+      if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
+        summary = (parsed as Record<string, unknown>).summary
+          ? (parsed as Record<string, unknown>).summary as Record<string, 
unknown>
+          : parsed as Record<string, unknown>;
+      } else if (Array.isArray(parsed)) {
+        legacyPurgedList = (parsed as unknown[]).map((item) =>
+          typeof item === "string" ? item : (item as { guid?: string }).guid 
|| String(item)
+        );
+      }
+    } catch (e) {

Review Comment:
   Renamed the unused catch block variable to _e to resolve the warning



##########
dashboard/src/views/Administrator/Audits/AuditResults.tsx:
##########
@@ -15,130 +15,228 @@
  * limitations under the License.
  */
 
-import { Grid, Link, List, ListItem, ListItemText, Typography } from 
"@mui/material";
-import { auditAction, category } from "@utils/Enum";
+import { Grid, Link, List, ListItem, ListItemText, Typography, Divider, Alert, 
AlertTitle, Box, Drawer, IconButton, Stack, Tooltip, TextField, InputAdornment, 
CircularProgress } from "@mui/material";
+import ContentCopyIcon from "@mui/icons-material/ContentCopy";
+import SearchIcon from "@mui/icons-material/Search";
+import { auditAction, category, AuditOperation, PurgeActiveView } from 
"@utils/Enum";
 import { isEmpty, jsonParse } from "@utils/Utils";
+import { useVirtualization } from '@hooks/useVirtualization';

Review Comment:
   Updated the imports to consistently use double quotes



##########
dashboard/src/views/Administrator/Audits/AuditsFilter/AuditFiltersFields.tsx:
##########
@@ -308,6 +308,10 @@ export const fields = (allDataObj) => {
   }
   if (!isEmpty(auditEntryAttributeDefs)) {
     for (const attributes in auditEntryAttributeDefs) {
+      if (auditEntryAttributeDefs[attributes]?.name === "auditRowKind") {
+        continue; // Backend-only field, do not display in UI filter
+      }
+
       let returnObj: any = getObjDef(
         allDataObj,

Review Comment:
   Replaced raw fetch with the standard fetchApi using axios, added error 
toasting, fixed the loading state, and added full test coverage for these 
features.



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