mirror of
https://github.com/Radarr/Radarr
synced 2025-12-09 09:56:04 +01:00
New: Add enabled to manage import lists bulk
This commit is contained in:
parent
54d447d55f
commit
50465fd482
7 changed files with 53 additions and 6 deletions
|
|
@ -12,6 +12,7 @@ import translate from 'Utilities/String/translate';
|
|||
import styles from './ManageImportListsEditModalContent.css';
|
||||
|
||||
interface SavePayload {
|
||||
enabled?: boolean;
|
||||
enableAuto?: boolean;
|
||||
qualityProfileId?: number;
|
||||
rootFolderPath?: string;
|
||||
|
|
@ -25,7 +26,7 @@ interface ManageImportListsEditModalContentProps {
|
|||
|
||||
const NO_CHANGE = 'noChange';
|
||||
|
||||
const autoAddOptions = [
|
||||
const enableOptions = [
|
||||
{
|
||||
key: NO_CHANGE,
|
||||
get value() {
|
||||
|
|
@ -52,6 +53,7 @@ function ManageImportListsEditModalContent(
|
|||
) {
|
||||
const { importListIds, onSavePress, onModalClose } = props;
|
||||
|
||||
const [enabled, setEnabled] = useState(NO_CHANGE);
|
||||
const [enableAuto, setEnableAuto] = useState(NO_CHANGE);
|
||||
const [qualityProfileId, setQualityProfileId] = useState<string | number>(
|
||||
NO_CHANGE
|
||||
|
|
@ -62,6 +64,11 @@ function ManageImportListsEditModalContent(
|
|||
let hasChanges = false;
|
||||
const payload: SavePayload = {};
|
||||
|
||||
if (enabled !== NO_CHANGE) {
|
||||
hasChanges = true;
|
||||
payload.enabled = enabled === 'enabled';
|
||||
}
|
||||
|
||||
if (enableAuto !== NO_CHANGE) {
|
||||
hasChanges = true;
|
||||
payload.enableAuto = enableAuto === 'enabled';
|
||||
|
|
@ -82,11 +89,21 @@ function ManageImportListsEditModalContent(
|
|||
}
|
||||
|
||||
onModalClose();
|
||||
}, [enableAuto, qualityProfileId, rootFolderPath, onSavePress, onModalClose]);
|
||||
}, [
|
||||
enabled,
|
||||
enableAuto,
|
||||
qualityProfileId,
|
||||
rootFolderPath,
|
||||
onSavePress,
|
||||
onModalClose,
|
||||
]);
|
||||
|
||||
const onInputChange = useCallback(
|
||||
({ name, value }: { name: string; value: string }) => {
|
||||
switch (name) {
|
||||
case 'enabled':
|
||||
setEnabled(value);
|
||||
break;
|
||||
case 'enableAuto':
|
||||
setEnableAuto(value);
|
||||
break;
|
||||
|
|
@ -110,6 +127,18 @@ function ManageImportListsEditModalContent(
|
|||
<ModalHeader>{translate('EditSelectedImportLists')}</ModalHeader>
|
||||
|
||||
<ModalBody>
|
||||
<FormGroup>
|
||||
<FormLabel>{translate('Enabled')}</FormLabel>
|
||||
|
||||
<FormInputGroup
|
||||
type={inputTypes.SELECT}
|
||||
name="enabled"
|
||||
value={enabled}
|
||||
values={enableOptions}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup>
|
||||
<FormLabel>{translate('AutomaticAdd')}</FormLabel>
|
||||
|
||||
|
|
@ -117,7 +146,7 @@ function ManageImportListsEditModalContent(
|
|||
type={inputTypes.SELECT}
|
||||
name="enableAuto"
|
||||
value={enableAuto}
|
||||
values={autoAddOptions}
|
||||
values={enableOptions}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@ const COLUMNS = [
|
|||
isSortable: true,
|
||||
isVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'enabled',
|
||||
label: () => translate('Enabled'),
|
||||
isSortable: true,
|
||||
isVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'enableAuto',
|
||||
label: () => translate('AutomaticAdd'),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
.name,
|
||||
.tags,
|
||||
.enabled,
|
||||
.enableAuto,
|
||||
.qualityProfileId,
|
||||
.rootFolderPath,
|
||||
|
|
@ -7,4 +8,4 @@
|
|||
composes: cell from '~Components/Table/Cells/TableRowCell.css';
|
||||
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
'enableAuto': string;
|
||||
'enabled': string;
|
||||
'implementation': string;
|
||||
'name': string;
|
||||
'qualityProfileId': string;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import TableRow from 'Components/Table/TableRow';
|
|||
import TagListConnector from 'Components/TagListConnector';
|
||||
import { createQualityProfileSelectorForHook } from 'Store/Selectors/createQualityProfileSelector';
|
||||
import { SelectStateInputProps } from 'typings/props';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import styles from './ManageImportListsModalRow.css';
|
||||
|
||||
interface ManageImportListsModalRowProps {
|
||||
|
|
@ -16,6 +17,7 @@ interface ManageImportListsModalRowProps {
|
|||
qualityProfileId: number;
|
||||
implementation: string;
|
||||
tags: number[];
|
||||
enabled: boolean;
|
||||
enableAuto: boolean;
|
||||
columns: Column[];
|
||||
isSelected?: boolean;
|
||||
|
|
@ -30,6 +32,7 @@ function ManageImportListsModalRow(props: ManageImportListsModalRowProps) {
|
|||
rootFolderPath,
|
||||
qualityProfileId,
|
||||
implementation,
|
||||
enabled,
|
||||
enableAuto,
|
||||
tags,
|
||||
onSelectedChange,
|
||||
|
|
@ -63,15 +66,19 @@ function ManageImportListsModalRow(props: ManageImportListsModalRowProps) {
|
|||
</TableRowCell>
|
||||
|
||||
<TableRowCell className={styles.qualityProfileId}>
|
||||
{qualityProfile?.name ?? 'None'}
|
||||
{qualityProfile?.name ?? translate('None')}
|
||||
</TableRowCell>
|
||||
|
||||
<TableRowCell className={styles.rootFolderPath}>
|
||||
{rootFolderPath}
|
||||
</TableRowCell>
|
||||
|
||||
<TableRowCell className={styles.enabled}>
|
||||
{enabled ? translate('Yes') : translate('No')}
|
||||
</TableRowCell>
|
||||
|
||||
<TableRowCell className={styles.enableAuto}>
|
||||
{enableAuto ? 'Yes' : 'No'}
|
||||
{enableAuto ? translate('Yes') : translate('No')}
|
||||
</TableRowCell>
|
||||
|
||||
<TableRowCell className={styles.tags}>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ export interface Field {
|
|||
|
||||
interface ImportList extends ModelBase {
|
||||
enable: boolean;
|
||||
enabled: boolean;
|
||||
enableAuto: boolean;
|
||||
qualityProfileId: number;
|
||||
rootFolderPath: string;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace Radarr.Api.V3.ImportLists
|
|||
{
|
||||
public class ImportListBulkResource : ProviderBulkResource<ImportListBulkResource>
|
||||
{
|
||||
public bool? Enabled { get; set; }
|
||||
public bool? EnableAuto { get; set; }
|
||||
public string RootFolderPath { get; set; }
|
||||
public int? QualityProfileId { get; set; }
|
||||
|
|
@ -21,6 +22,7 @@ public override List<ImportListDefinition> UpdateModel(ImportListBulkResource re
|
|||
|
||||
existingDefinitions.ForEach(existing =>
|
||||
{
|
||||
existing.Enabled = resource.Enabled ?? existing.Enabled;
|
||||
existing.EnableAuto = resource.EnableAuto ?? existing.EnableAuto;
|
||||
existing.RootFolderPath = resource.RootFolderPath ?? existing.RootFolderPath;
|
||||
existing.QualityProfileId = resource.QualityProfileId ?? existing.QualityProfileId;
|
||||
|
|
|
|||
Loading…
Reference in a new issue