feat(actions): qbit add options content layout and skip hash check (#393)

* feat(actions): qbit content layout and skip hash check

* feat(actions): qbit options
This commit is contained in:
ze0s 2022-08-02 18:06:45 +02:00 committed by GitHub
parent db9d048f5d
commit 9508cbb46c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 394 additions and 50 deletions

View file

@ -244,6 +244,12 @@ export const ActionTypeNameMap = {
"WHISPARR": "Whisparr"
};
export const ActionContentLayoutOptions: SelectGenericOption<ActionContentLayout>[] = [
{ label: "Original", description: "Original", value: "ORIGINAL" },
{ label: "Create subfolder", description: "Create subfolder", value: "SUBFOLDER_CREATE" },
{ label: "Don't create subfolder", description: "Don't create subfolder", value: "SUBFOLDER_NONE" },
];
export interface OptionBasic {
label: string;
value: string;
@ -308,6 +314,12 @@ export interface SelectOption {
value: NotificationEvent;
}
export interface SelectGenericOption<T> {
label: string;
description: string;
value: T;
}
export const EventOptions: SelectOption[] = [
{
label: "Push Rejected",

View file

@ -27,7 +27,8 @@ import {
RELEASE_TYPE_MUSIC_OPTIONS,
OTHER_OPTIONS,
ORIGIN_OPTIONS,
downloadsPerUnitOptions
downloadsPerUnitOptions,
ActionContentLayoutOptions
} from "../../domain/constants";
import { queryClient } from "../../App";
import { APIClient } from "../../api/APIClient";
@ -632,6 +633,8 @@ export function FilterActions({ filter, values }: FilterActionsProps) {
save_path: "",
paused: false,
ignore_rules: false,
skip_hash_check: false,
content_layout: "",
limit_upload_speed: 0,
limit_download_speed: 0,
limit_ratio: 0,
@ -658,7 +661,7 @@ export function FilterActions({ filter, values }: FilterActionsProps) {
<div className="ml-4 mt-4">
<h3 className="text-lg leading-6 font-medium text-gray-900 dark:text-gray-200">Actions</h3>
<p className="mt-1 text-sm text-gray-500 dark:text-gray-400">
Add to download clients or run custom commands.
Add to download clients or run custom commands.
</p>
</div>
<div className="ml-4 mt-4 flex-shrink-0">
@ -667,7 +670,7 @@ export function FilterActions({ filter, values }: FilterActionsProps) {
className="relative inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 dark:bg-blue-600 hover:bg-indigo-700 dark:hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-blue-500"
onClick={() => push(newAction)}
>
Add new
Add new
</button>
</div>
</div>
@ -790,11 +793,11 @@ const TypeForm = ({ action, idx, clients }: TypeFormProps) => {
<div className="mt-6 grid grid-cols-12 gap-6">
<NumberField
name={`actions.${idx}.limit_download_speed`}
label="Limit download speed (KB/s)"
label="Limit download speed (KiB/s)"
/>
<NumberField
name={`actions.${idx}.limit_upload_speed`}
label="Limit upload speed (KB/s)"
label="Limit upload speed (KiB/s)"
/>
</div>
@ -822,6 +825,21 @@ const TypeForm = ({ action, idx, clients }: TypeFormProps) => {
description="Download if max active reached"
/>
</div>
<div className="col-span-6">
<Select
name={`actions.${idx}.content_layout`}
label="Content Layout"
optionDefaultText="Select content layout"
options={ActionContentLayoutOptions}
/>
<div className="mt-2">
<SwitchGroup
name={`actions.${idx}.skip_hash_check`}
label="Skip hash check"
description="Add torrent and skip hash check"
/>
</div>
</div>
</CollapsableSection>
<CollapsableSection title="Advanced" subtitle="Advanced options">

View file

@ -77,6 +77,8 @@ interface Action {
save_path?: string;
paused?: boolean;
ignore_rules?: boolean;
skip_hash_check: boolean;
content_layout?: ActionContentLayout;
limit_upload_speed?: number;
limit_download_speed?: number;
limit_ratio?: number;
@ -94,4 +96,6 @@ interface Action {
client_id?: number;
}
type ActionContentLayout = "ORIGINAL" | "SUBFOLDER_CREATE" | "SUBFOLDER_NONE";
type ActionType = "TEST" | "EXEC" | "WATCH_FOLDER" | "WEBHOOK" | DownloadClientType;