New: Simplify Connection trigger settings

Closes #4351
This commit is contained in:
Mark McDowall 2021-03-07 16:24:09 -08:00
parent 675c72f02e
commit e1f7bce14b
2 changed files with 96 additions and 107 deletions

View File

@ -9,3 +9,12 @@
margin-bottom: 30px; margin-bottom: 30px;
} }
.triggers {
margin-top: 3px;
}
.triggerEvents {
margin-top: 10px;
user-select: none;
}

View File

@ -13,6 +13,7 @@ import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup'; import FormGroup from 'Components/Form/FormGroup';
import FormLabel from 'Components/Form/FormLabel'; import FormLabel from 'Components/Form/FormLabel';
import FormInputGroup from 'Components/Form/FormInputGroup'; import FormInputGroup from 'Components/Form/FormInputGroup';
import FormInputHelpText from 'Components/Form/FormInputHelpText';
import ProviderFieldFormGroup from 'Components/Form/ProviderFieldFormGroup'; import ProviderFieldFormGroup from 'Components/Form/ProviderFieldFormGroup';
import styles from './EditNotificationModalContent.css'; import styles from './EditNotificationModalContent.css';
@ -102,131 +103,110 @@ function EditNotificationModalContent(props) {
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<FormLabel>On Grab</FormLabel> <FormLabel>Triggers</FormLabel>
<div className={styles.triggers}>
<FormInputHelpText
text="Select which events should trigger this conection"
link="https://wiki.servarr.com/Sonarr_Settings#Connections"
/>
<div className={styles.triggerEvents}>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="onGrab" name="onGrab"
helpText="Be notified when episodes are available for download and has been sent to a download client" helpText="On Grab"
isDisabled={!supportsOnGrab.value} isDisabled={!supportsOnGrab.value}
{...onGrab} {...onGrab}
onChange={onInputChange} onChange={onInputChange}
/> />
</FormGroup>
<FormGroup>
<FormLabel>On Import</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="onDownload" name="onDownload"
helpText="Be notified when episodes are successfully imported" helpText="On Download"
isDisabled={!supportsOnDownload.value} isDisabled={!supportsOnDownload.value}
{...onDownload} {...onDownload}
onChange={onInputChange} onChange={onInputChange}
/> />
</FormGroup>
{ {
onDownload.value && onDownload.value ?
<FormGroup>
<FormLabel>On Upgrade</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="onUpgrade" name="onUpgrade"
helpText="Be notified when episodes are upgraded to a better quality" helpText="On Upgrade"
isDisabled={!supportsOnUpgrade.value} isDisabled={!supportsOnUpgrade.value}
{...onUpgrade} {...onUpgrade}
onChange={onInputChange} onChange={onInputChange}
/> /> :
</FormGroup> null
} }
<FormGroup>
<FormLabel>On Rename</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="onRename" name="onRename"
helpText="Be notified when episodes are renamed" helpText="On Rename"
isDisabled={!supportsOnRename.value} isDisabled={!supportsOnRename.value}
{...onRename} {...onRename}
onChange={onInputChange} onChange={onInputChange}
/> />
</FormGroup>
<FormGroup>
<FormLabel>On Series Delete</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="onSeriesDelete" name="onSeriesDelete"
helpText="Be notified when series are deleted" helpText="On Series Delete"
isDisabled={!supportsOnSeriesDelete.value} isDisabled={!supportsOnSeriesDelete.value}
{...onSeriesDelete} {...onSeriesDelete}
onChange={onInputChange} onChange={onInputChange}
/> />
</FormGroup>
<FormGroup>
<FormLabel>On Episode File Delete</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="onEpisodeFileDelete" name="onEpisodeFileDelete"
helpText="Be notified when episode files are deleted" helpText="On Episode File Delete"
isDisabled={!supportsOnEpisodeFileDelete.value} isDisabled={!supportsOnEpisodeFileDelete.value}
{...onEpisodeFileDelete} {...onEpisodeFileDelete}
onChange={onInputChange} onChange={onInputChange}
/> />
</FormGroup>
{ {
onEpisodeFileDelete.value ? onEpisodeFileDelete.value ?
<FormGroup>
<FormLabel>On Episode File Delete For Upgrade</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="onEpisodeFileDeleteForUpgrade" name="onEpisodeFileDeleteForUpgrade"
helpText="Be notified when episode files are deleted for upgrades" helpText="On Episode File Delete For Upgrade"
isDisabled={!supportsOnEpisodeFileDeleteForUpgrade.value} isDisabled={!supportsOnEpisodeFileDeleteForUpgrade.value}
{...onEpisodeFileDeleteForUpgrade} {...onEpisodeFileDeleteForUpgrade}
onChange={onInputChange} onChange={onInputChange}
/> /> :
</FormGroup> :
null null
} }
<FormGroup>
<FormLabel>On Health Issue</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="onHealthIssue" name="onHealthIssue"
helpText="Be notified on health check failures" helpText="On Health Issue"
isDisabled={!supportsOnHealthIssue.value} isDisabled={!supportsOnHealthIssue.value}
{...onHealthIssue} {...onHealthIssue}
onChange={onInputChange} onChange={onInputChange}
/> />
</FormGroup>
{ {
onHealthIssue.value && onHealthIssue.value ?
<FormGroup>
<FormLabel>Include Health Warnings</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
name="includeHealthWarnings" name="includeHealthWarnings"
helpText="Be notified on health warnings in addition to errors" helpText="Include Health Warnings"
isDisabled={!supportsOnHealthIssue.value} isDisabled={!supportsOnHealthIssue.value}
{...includeHealthWarnings} {...includeHealthWarnings}
onChange={onInputChange} onChange={onInputChange}
/> /> :
</FormGroup> null
} }
</div>
</div>
</FormGroup>
<FormGroup> <FormGroup>
<FormLabel>Tags</FormLabel> <FormLabel>Tags</FormLabel>