2018-02-06 23:08:36 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
2022-04-28 20:04:09 +00:00
|
|
|
import ArtistMonitorNewItemsOptionsPopoverContent from 'AddArtist/ArtistMonitorNewItemsOptionsPopoverContent';
|
2021-05-07 11:50:48 +00:00
|
|
|
import Alert from 'Components/Alert';
|
2020-09-07 01:33:10 +00:00
|
|
|
import DescriptionList from 'Components/DescriptionList/DescriptionList';
|
|
|
|
import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem';
|
2022-04-28 20:04:09 +00:00
|
|
|
import FieldSet from 'Components/FieldSet';
|
2020-09-07 01:33:10 +00:00
|
|
|
import Form from 'Components/Form/Form';
|
|
|
|
import FormGroup from 'Components/Form/FormGroup';
|
|
|
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
|
|
|
import FormLabel from 'Components/Form/FormLabel';
|
|
|
|
import ProviderFieldFormGroup from 'Components/Form/ProviderFieldFormGroup';
|
2019-07-25 21:22:38 +00:00
|
|
|
import Icon from 'Components/Icon';
|
2018-02-06 23:08:36 +00:00
|
|
|
import Button from 'Components/Link/Button';
|
|
|
|
import SpinnerErrorButton from 'Components/Link/SpinnerErrorButton';
|
|
|
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
|
|
import ModalBody from 'Components/Modal/ModalBody';
|
2020-09-07 01:33:10 +00:00
|
|
|
import ModalContent from 'Components/Modal/ModalContent';
|
2018-02-06 23:08:36 +00:00
|
|
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
2020-09-07 01:33:10 +00:00
|
|
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
2019-07-25 21:22:38 +00:00
|
|
|
import Popover from 'Components/Tooltip/Popover';
|
2020-09-07 01:33:10 +00:00
|
|
|
import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props';
|
2021-10-03 15:01:09 +00:00
|
|
|
import translate from 'Utilities/String/translate';
|
2018-02-06 23:08:36 +00:00
|
|
|
import styles from './EditImportListModalContent.css';
|
|
|
|
|
2019-07-25 21:22:38 +00:00
|
|
|
function ImportListMonitoringOptionsPopoverContent() {
|
|
|
|
return (
|
|
|
|
<DescriptionList>
|
|
|
|
<DescriptionListItem
|
2021-10-03 15:01:09 +00:00
|
|
|
title={translate('None')}
|
2019-07-25 21:22:38 +00:00
|
|
|
data="Do not monitor artists or albums"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<DescriptionListItem
|
2021-10-03 15:01:09 +00:00
|
|
|
title={translate('SpecificAlbum')}
|
2019-07-25 21:22:38 +00:00
|
|
|
data="Monitor artists but only monitor albums explicitly included in the list"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<DescriptionListItem
|
2021-10-03 15:01:09 +00:00
|
|
|
title={translate('AllArtistAlbums')}
|
2019-07-25 21:22:38 +00:00
|
|
|
data="Monitor artists and all albums for each artist included on the import list"
|
|
|
|
/>
|
|
|
|
</DescriptionList>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-02-06 23:08:36 +00:00
|
|
|
function EditImportListModalContent(props) {
|
2019-07-25 21:22:38 +00:00
|
|
|
|
|
|
|
const monitorOptions = [
|
|
|
|
{ key: 'none', value: 'None' },
|
|
|
|
{ key: 'specificAlbum', value: 'Specific Album' },
|
|
|
|
{ key: 'entireArtist', value: 'All Artist Albums' }
|
|
|
|
];
|
|
|
|
|
2018-02-06 23:08:36 +00:00
|
|
|
const {
|
|
|
|
advancedSettings,
|
|
|
|
isFetching,
|
|
|
|
error,
|
|
|
|
isSaving,
|
|
|
|
isTesting,
|
|
|
|
saveError,
|
|
|
|
item,
|
|
|
|
onInputChange,
|
|
|
|
onFieldChange,
|
|
|
|
onModalClose,
|
|
|
|
onSavePress,
|
|
|
|
onTestPress,
|
|
|
|
onDeleteImportListPress,
|
|
|
|
showMetadataProfile,
|
|
|
|
...otherProps
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
enableAutomaticAdd,
|
|
|
|
shouldMonitor,
|
|
|
|
rootFolderPath,
|
2022-04-28 20:04:09 +00:00
|
|
|
monitorNewItems,
|
2018-04-08 02:28:16 +00:00
|
|
|
qualityProfileId,
|
2018-02-06 23:08:36 +00:00
|
|
|
metadataProfileId,
|
2018-10-09 00:56:05 +00:00
|
|
|
tags,
|
2021-05-07 11:50:48 +00:00
|
|
|
fields,
|
|
|
|
message
|
2018-02-06 23:08:36 +00:00
|
|
|
} = item;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ModalContent onModalClose={onModalClose}>
|
|
|
|
<ModalHeader>
|
|
|
|
{id ? 'Edit List' : 'Add List'}
|
|
|
|
</ModalHeader>
|
|
|
|
|
|
|
|
<ModalBody>
|
|
|
|
{
|
|
|
|
isFetching &&
|
|
|
|
<LoadingIndicator />
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
!isFetching && !!error &&
|
2021-10-03 15:01:09 +00:00
|
|
|
<div>
|
|
|
|
{translate('UnableToAddANewListPleaseTryAgain')}
|
|
|
|
</div>
|
2018-02-06 23:08:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
!isFetching && !error &&
|
2019-02-23 22:39:11 +00:00
|
|
|
<Form {...otherProps}>
|
2021-05-07 11:50:48 +00:00
|
|
|
{
|
|
|
|
!!message &&
|
|
|
|
<Alert
|
|
|
|
className={styles.message}
|
|
|
|
kind={message.value.type}
|
|
|
|
>
|
|
|
|
{message.value.message}
|
|
|
|
</Alert>
|
|
|
|
}
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FieldSet legend={translate('ImportListSettings')} >
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>
|
|
|
|
{translate('Name')}
|
|
|
|
</FormLabel>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.TEXT}
|
|
|
|
name="name"
|
|
|
|
{...name}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>
|
|
|
|
{translate('EnableAutomaticAdd')}
|
|
|
|
</FormLabel>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.CHECK}
|
|
|
|
name="enableAutomaticAdd"
|
|
|
|
helpText={translate('EnableAutomaticAddHelpText')}
|
|
|
|
{...enableAutomaticAdd}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2019-07-25 21:22:38 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>
|
|
|
|
Monitor
|
|
|
|
|
|
|
|
<Popover
|
|
|
|
anchor={
|
|
|
|
<Icon
|
|
|
|
className={styles.labelIcon}
|
|
|
|
name={icons.INFO}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
title={translate('MonitoringOptions')}
|
|
|
|
body={<ImportListMonitoringOptionsPopoverContent />}
|
|
|
|
position={tooltipPositions.RIGHT}
|
|
|
|
/>
|
|
|
|
</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.SELECT}
|
|
|
|
name="shouldMonitor"
|
|
|
|
values={monitorOptions}
|
|
|
|
helpText={translate('ShouldMonitorHelpText')}
|
|
|
|
{...shouldMonitor}
|
|
|
|
onChange={onInputChange}
|
2019-07-25 21:22:38 +00:00
|
|
|
/>
|
2022-04-28 20:04:09 +00:00
|
|
|
</FormGroup>
|
|
|
|
</FieldSet>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FieldSet legend={translate('AddedArtistSettings')} >
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>
|
|
|
|
{translate('RootFolder')}
|
|
|
|
</FormLabel>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.ROOT_FOLDER_SELECT}
|
|
|
|
name="rootFolderPath"
|
|
|
|
helpText={translate('RootFolderPathHelpText')}
|
|
|
|
{...rootFolderPath}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>
|
|
|
|
{translate('MonitorNewItems')}
|
|
|
|
<Popover
|
|
|
|
anchor={
|
|
|
|
<Icon
|
|
|
|
className={styles.labelIcon}
|
|
|
|
name={icons.INFO}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
title={translate('MonitorNewItems')}
|
|
|
|
body={<ArtistMonitorNewItemsOptionsPopoverContent />}
|
|
|
|
position={tooltipPositions.RIGHT}
|
|
|
|
/>
|
|
|
|
</FormLabel>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.MONITOR_NEW_ITEMS_SELECT}
|
|
|
|
name="monitorNewItems"
|
|
|
|
helpText={translate('MonitorNewItemsHelpText')}
|
|
|
|
{...monitorNewItems}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>
|
|
|
|
{translate('QualityProfile')}
|
|
|
|
</FormLabel>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.QUALITY_PROFILE_SELECT}
|
|
|
|
name="qualityProfileId"
|
|
|
|
helpText={translate('QualityProfileIdHelpText')}
|
|
|
|
{...qualityProfileId}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormGroup className={showMetadataProfile ? undefined : styles.hideMetadataProfile}>
|
|
|
|
<FormLabel>
|
|
|
|
{translate('MetadataProfile')}
|
|
|
|
</FormLabel>
|
2018-02-06 23:08:36 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.METADATA_PROFILE_SELECT}
|
|
|
|
name="metadataProfileId"
|
|
|
|
helpText={translate('MetadataProfileIdHelpText')}
|
|
|
|
{...metadataProfileId}
|
|
|
|
includeNone={true}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2018-10-09 00:56:05 +00:00
|
|
|
|
2022-04-28 20:04:09 +00:00
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>
|
|
|
|
{translate('ReadarrTags')}
|
|
|
|
</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.TAG}
|
|
|
|
name="tags"
|
|
|
|
helpText={translate('TagsHelpText')}
|
|
|
|
{...tags}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
</FieldSet>
|
2018-10-09 00:56:05 +00:00
|
|
|
|
2018-02-06 23:08:36 +00:00
|
|
|
{
|
|
|
|
!!fields && !!fields.length &&
|
2022-04-28 20:04:09 +00:00
|
|
|
<FieldSet legend={translate('ImportListSpecificSettings')} >
|
2020-06-27 21:51:59 +00:00
|
|
|
{
|
|
|
|
fields.map((field) => {
|
|
|
|
return (
|
|
|
|
<ProviderFieldFormGroup
|
|
|
|
key={field.name}
|
|
|
|
advancedSettings={advancedSettings}
|
|
|
|
provider="importList"
|
|
|
|
providerData={item}
|
|
|
|
section="settings.importLists"
|
|
|
|
{...field}
|
|
|
|
onChange={onFieldChange}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
})
|
|
|
|
}
|
2022-04-28 20:04:09 +00:00
|
|
|
</FieldSet>
|
2018-02-06 23:08:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
</Form>
|
|
|
|
}
|
|
|
|
</ModalBody>
|
|
|
|
<ModalFooter>
|
|
|
|
{
|
|
|
|
id &&
|
|
|
|
<Button
|
|
|
|
className={styles.deleteButton}
|
|
|
|
kind={kinds.DANGER}
|
|
|
|
onPress={onDeleteImportListPress}
|
|
|
|
>
|
|
|
|
Delete
|
|
|
|
</Button>
|
|
|
|
}
|
|
|
|
|
|
|
|
<SpinnerErrorButton
|
|
|
|
isSpinning={isTesting}
|
|
|
|
error={saveError}
|
|
|
|
onPress={onTestPress}
|
|
|
|
>
|
|
|
|
Test
|
|
|
|
</SpinnerErrorButton>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
onPress={onModalClose}
|
|
|
|
>
|
|
|
|
Cancel
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
<SpinnerErrorButton
|
|
|
|
isSpinning={isSaving}
|
|
|
|
error={saveError}
|
|
|
|
onPress={onSavePress}
|
|
|
|
>
|
|
|
|
Save
|
|
|
|
</SpinnerErrorButton>
|
|
|
|
</ModalFooter>
|
|
|
|
</ModalContent>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
EditImportListModalContent.propTypes = {
|
|
|
|
advancedSettings: PropTypes.bool.isRequired,
|
|
|
|
isFetching: PropTypes.bool.isRequired,
|
|
|
|
error: PropTypes.object,
|
|
|
|
isSaving: PropTypes.bool.isRequired,
|
|
|
|
isTesting: PropTypes.bool.isRequired,
|
|
|
|
saveError: PropTypes.object,
|
|
|
|
item: PropTypes.object.isRequired,
|
|
|
|
showMetadataProfile: PropTypes.bool.isRequired,
|
|
|
|
onInputChange: PropTypes.func.isRequired,
|
|
|
|
onFieldChange: PropTypes.func.isRequired,
|
|
|
|
onModalClose: PropTypes.func.isRequired,
|
|
|
|
onSavePress: PropTypes.func.isRequired,
|
|
|
|
onTestPress: PropTypes.func.isRequired,
|
|
|
|
onDeleteImportListPress: PropTypes.func
|
|
|
|
};
|
|
|
|
|
|
|
|
export default EditImportListModalContent;
|