Skip to content

Conversation

@SamP231004
Copy link

Fixes #7323

Summary

Prefer per-folder FolderSizeBytes and DriveTotalBytes returned by the backend when rendering the Dashboard → Paths widget. Only show a progress bar when folder-level sizes exist to avoid misleading identical bars per path.

Changes

  • Use FolderSizeBytes / DriveTotalBytes in src/apps/dashboard/features/storage/utils/space.ts.
  • Render progress bar and text in StorageListItem.tsx only when per-folder sizes exist.
  • Added debug logging in useSystemStorage to confirm API returns the new fields.
  • Recovered/updated src/lib/jellyfin-apiclient/* files as needed.

Verification

  • Confirmed locally on Windows: each path shows unique storage usage.
  • Web folder on T:\ shows its separate drive capacity; other paths on C:\ show different totals.
  • Screenshots attached (before/after).

Notes

This PR depends on backend changes that provide FolderSizeBytes and DriveTotalBytes via the System Storage API. See backend PR: jellyfin/jellyfin#<backend-pr-number> (link when created).

Screenshot 2025-11-11 231054

@SamP231004 SamP231004 requested a review from a team as a code owner November 11, 2025 17:47
@jellyfin-bot
Copy link
Collaborator

jellyfin-bot commented Nov 11, 2025

Cloudflare Pages deployment

Latest commit b5882ac
Status ✅ Deployed!
Preview URL https://9da7689a.jellyfin-web.pages.dev
Type 🔀 Preview

View build logs

@sonarqubecloud
Copy link

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint doesn't pass. Please fix all ESLint issues.

Comment on lines +21 to +22
refetchOnWindowFocus: false,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected trailing comma. @stylistic/comma-dangle

Fix available:

Suggested change
refetchOnWindowFocus: false,
});
refetchOnWindowFocus: false
});

const hasFolderSize = typeof folderSize === 'number' && folderSize >= 0;
const driveTotal = (folder as any)?.DriveTotalBytes ?? (folder as any)?.DriveCapacity;
const readableFolderSize = hasFolderSize ? getReadableSize(folderSize) : undefined;
const readableDriveTotal = typeof driveTotal === 'number' && driveTotal >= 0 ? getReadableSize(driveTotal) : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

Suggestion(s) available:

Suggested change
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as any)?.Size;
const folderSize = (folder as unknown)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as any)?.Size;
Suggested change
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as any)?.Size;
const folderSize = (folder as never)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as any)?.Size;

const hasFolderSize = typeof folderSize === 'number' && folderSize >= 0;
const driveTotal = (folder as any)?.DriveTotalBytes ?? (folder as any)?.DriveCapacity;
const readableFolderSize = hasFolderSize ? getReadableSize(folderSize) : undefined;
const readableDriveTotal = typeof driveTotal === 'number' && driveTotal >= 0 ? getReadableSize(driveTotal) : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

Suggestion(s) available:

Suggested change
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as any)?.Size;
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as unknown)?.SizeBytes ?? (folder as any)?.Size;
Suggested change
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as any)?.Size;
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as never)?.SizeBytes ?? (folder as any)?.Size;

const hasFolderSize = typeof folderSize === 'number' && folderSize >= 0;
const driveTotal = (folder as any)?.DriveTotalBytes ?? (folder as any)?.DriveCapacity;
const readableFolderSize = hasFolderSize ? getReadableSize(folderSize) : undefined;
const readableDriveTotal = typeof driveTotal === 'number' && driveTotal >= 0 ? getReadableSize(driveTotal) : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

Suggestion(s) available:

Suggested change
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as any)?.Size;
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as unknown)?.Size;
Suggested change
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as any)?.Size;
const folderSize = (folder as any)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as never)?.Size;

const readableFolderSize = hasFolderSize ? getReadableSize(folderSize) : undefined;
const readableDriveTotal = typeof driveTotal === 'number' && driveTotal >= 0 ? getReadableSize(driveTotal) : undefined;

return (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

Suggestion(s) available:

Suggested change
const driveTotal = (folder as any)?.DriveTotalBytes ?? (folder as any)?.DriveCapacity;
const driveTotal = (folder as unknown)?.DriveTotalBytes ?? (folder as any)?.DriveCapacity;
Suggested change
const driveTotal = (folder as any)?.DriveTotalBytes ?? (folder as any)?.DriveCapacity;
const driveTotal = (folder as never)?.DriveTotalBytes ?? (folder as any)?.DriveCapacity;

Comment on lines +25 to +26
: (typeof folderTotal === 'number' && folderTotal > 0) ? folderTotal
: calculateTotal(folder);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

':' should be placed at the end of the line. @stylistic/operator-linebreak

Fix available:

Suggested change
: (typeof folderTotal === 'number' && folderTotal > 0) ? folderTotal
: calculateTotal(folder);
(typeof folderTotal === 'number' && folderTotal > 0) ? folderTotal
: calculateTotal(folder);

const folderTotal = (folder as any)?.FolderSizeBytes ?? (folder as any)?.SizeBytes ?? (folder as any)?.Size;

const total = (typeof driveTotal === 'number' && driveTotal > 0) ? driveTotal
: (typeof folderTotal === 'number' && folderTotal > 0) ? folderTotal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract this nested ternary operation into an independent statement. sonarjs/no-nested-conditional


const total = (typeof driveTotal === 'number' && driveTotal > 0) ? driveTotal
: (typeof folderTotal === 'number' && folderTotal > 0) ? folderTotal
: calculateTotal(folder);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 12 spaces but found 8. @stylistic/indent

Fix available:

Suggested change
: calculateTotal(folder);
: calculateTotal(folder);

Comment on lines +26 to +27
: calculateTotal(folder);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

':' should be placed at the end of the line. @stylistic/operator-linebreak

Fix available:

Suggested change
: calculateTotal(folder);
calculateTotal(folder);

if (total <= 0) return 0;

return Math.min(100, (used / total) * 100);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found. @stylistic/eol-last

Fix available:

Suggested change
};
};

@theguymadmax theguymadmax added the backend Requires work on the server to finish label Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Requires work on the server to finish

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storage amount bars for paths show disk usage

3 participants