feat(actions): qbit rules set ratio and seed time limits (#264)

This commit is contained in:
Ludvig Lundgren 2022-05-03 14:57:47 +02:00 committed by GitHub
parent 43d37fc859
commit 8b1174c65f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 86 additions and 6 deletions

View file

@ -131,12 +131,14 @@ interface NumberFieldProps {
name: string;
label?: string;
placeholder?: string;
step?: number;
}
export const NumberField = ({
name,
label,
placeholder
placeholder,
step,
}: NumberFieldProps) => (
<div className="col-span-12 sm:col-span-6">
<label htmlFor={name} className="block text-xs font-bold text-gray-700 dark:text-gray-200 uppercase tracking-wide">
@ -151,6 +153,7 @@ export const NumberField = ({
<div className="sm:col-span-2">
<input
type="number"
step={step}
{...field}
className={classNames(
meta.touched && meta.error

View file

@ -587,6 +587,8 @@ function FilterActions({ filter, values }: FilterActionsProps) {
ignore_rules: false,
limit_upload_speed: 0,
limit_download_speed: 0,
limit_ratio: 0,
limit_seed_time: 0,
reannounce_skip: false,
reannounce_delete: false,
reannounce_interval: 7,
@ -746,7 +748,19 @@ function FilterActionsItem({ action, clients, idx, remove }: FilterActionsItemPr
label="Limit upload speed (KB/s)"
/>
</div>
</div>
<div className="mt-6 grid grid-cols-12 gap-6">
<NumberField
name={`actions.${idx}.limit_ratio`}
label="Ratio limit"
step={0.5}
/>
<NumberField
name={`actions.${idx}.limit_seed_time`}
label="Seed time limit (seconds)"
/>
</div>
</div>
<div className="col-span-6">
<SwitchGroup
name={`actions.${idx}.paused`}

View file

@ -68,6 +68,8 @@ interface Action {
ignore_rules?: boolean;
limit_upload_speed?: number;
limit_download_speed?: number;
limit_ratio?: number;
limit_seed_time?: number;
reannounce_skip: boolean;
reannounce_delete: boolean;
reannounce_interval: number;