Skip to content

Commit

Permalink
style: Improve variable naming and comments in disk analytics page
Browse files Browse the repository at this point in the history
  • Loading branch information
pacholoamit committed May 20, 2024
1 parent fa088d1 commit 38b29ea
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/features/metrics/pages/disk-analytics.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,16 @@ const DiskAnalyticsPage: React.FC<DiskAnalyticsPageProps> = () => {
const item = await commands.deepScan({ path: disk.mountPoint });
setIsLoading(false);
// Populate File Explorer
const flattened = flattenTree({
name: disk.mountPoint,
children: item as any, //TODO: Crutch fix this later
});
const flattened = flattenTree(item as any);
setDiskAnalysis(flattened);

// TODO: Move to rust?
const stortedBySize = flattened.sort((a, b) => {
return (b.metadata?.size as number) - (a.metadata?.size as number);
});

// First 500
const sample = stortedBySize.slice(0, 1000);
// Remove roout node and get top 500
const sample = stortedBySize.slice(1, 500);

const data = sample.map((i) => {
const id = i.id.toString();
Expand Down

0 comments on commit 38b29ea

Please sign in to comment.