mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(filters): show current download count in list (#2001)
* feat(filters): show current and max downloads in list * feat(filters): remove unused func param
This commit is contained in:
parent
c85fa3f31a
commit
ef7317dde6
5 changed files with 63 additions and 9 deletions
|
@ -612,7 +612,7 @@ function FilterListItem({ filter, idx }: FilterListItemProps) {
|
|||
className="flex items-center cursor-pointer hover:text-black dark:hover:text-gray-300"
|
||||
>
|
||||
<span className={filter.actions_count === 0 || filter.actions_enabled_count === 0 ? "text-red-500 hover:text-red-400 dark:hover:text-red-400" : ""}>
|
||||
Actions: {filter.actions_enabled_count}/{filter.actions_count}
|
||||
Actions: {filter.actions_enabled_count}/{filter.actions_count}
|
||||
</span>
|
||||
</Link>
|
||||
}
|
||||
|
@ -636,11 +636,16 @@ function FilterListItem({ filter, idx }: FilterListItemProps) {
|
|||
className="flex items-center cursor-pointer hover:text-black dark:hover:text-gray-300"
|
||||
>
|
||||
<span>
|
||||
Actions: {filter.actions_enabled_count}/{filter.actions_count}
|
||||
Actions: {filter.actions_enabled_count}/{filter.actions_count}
|
||||
</span>
|
||||
</Link>
|
||||
)}
|
||||
</span>
|
||||
{filter.max_downloads_unit !== "" && filter.downloads !== undefined && (
|
||||
<span className="ml-2 whitespace-nowrap text-xs font-medium text-gray-600 dark:text-gray-400">
|
||||
Downloads: {renderMaxDownloads(filter.max_downloads_unit, filter.downloads)}/{filter.max_downloads} per {filter.max_downloads_unit}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<span className="hidden md:flex px-4 whitespace-nowrap text-sm font-medium text-gray-900">
|
||||
|
@ -656,6 +661,23 @@ function FilterListItem({ filter, idx }: FilterListItemProps) {
|
|||
);
|
||||
}
|
||||
|
||||
function renderMaxDownloads(unit: string, downloads: FilterDownloads): number {
|
||||
switch (unit) {
|
||||
case "HOUR":
|
||||
return downloads.hour_count
|
||||
case "DAY":
|
||||
return downloads.day_count
|
||||
case "WEEK":
|
||||
return downloads.week_count
|
||||
case "MONTH":
|
||||
return downloads.month_count
|
||||
case "EVER":
|
||||
return downloads.total_count
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
interface IndexerTagProps {
|
||||
indexer: Indexer;
|
||||
}
|
||||
|
|
10
web/src/types/Filter.d.ts
vendored
10
web/src/types/Filter.d.ts
vendored
|
@ -82,6 +82,7 @@ interface Filter {
|
|||
actions: Action[];
|
||||
indexers: Indexer[];
|
||||
external: ExternalFilter[];
|
||||
downloads?: FilterDownloads;
|
||||
release_profile_duplicate_id?: number;
|
||||
}
|
||||
|
||||
|
@ -152,3 +153,12 @@ interface ExternalFilter {
|
|||
webhook_retry_delay_seconds?: number;
|
||||
filter_id?: number;
|
||||
}
|
||||
|
||||
interface FilterDownloads {
|
||||
hour_count: number;
|
||||
day_count: number;
|
||||
week_count: number;
|
||||
month_count: number;
|
||||
year_count: number;
|
||||
total_count: number;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue