New: Rename Protocol to Preferred Protocol in Delay Profiles

Closes #4951
This commit is contained in:
Mark McDowall 2022-04-30 16:55:33 -07:00
parent 52d95fa632
commit 704cf7aebe
4 changed files with 22 additions and 21 deletions

View File

@ -84,7 +84,7 @@ class DelayProfile extends Component {
connectDragSource connectDragSource
} = this.props; } = this.props;
let preferred = titleCase(preferredProtocol); let preferred = `Prefer ${titleCase(preferredProtocol)}`;
if (!enableUsenet) { if (!enableUsenet) {
preferred = 'Only Torrent'; preferred = 'Only Torrent';

View File

@ -81,7 +81,7 @@ class DelayProfiles extends Component {
> >
<div> <div>
<div className={styles.delayProfilesHeader}> <div className={styles.delayProfilesHeader}>
<div className={styles.column}>Protocol</div> <div className={styles.column}>Preferred Protocol</div>
<div className={styles.column}>Usenet Delay</div> <div className={styles.column}>Usenet Delay</div>
<div className={styles.column}>Torrent Delay</div> <div className={styles.column}>Torrent Delay</div>
<div className={styles.tags}>Tags</div> <div className={styles.tags}>Tags</div>

View File

@ -16,6 +16,13 @@ import FormLabel from 'Components/Form/FormLabel';
import FormInputGroup from 'Components/Form/FormInputGroup'; import FormInputGroup from 'Components/Form/FormInputGroup';
import styles from './EditDelayProfileModalContent.css'; import styles from './EditDelayProfileModalContent.css';
const protocolOptions = [
{ key: 'preferUsenet', value: 'Prefer Usenet' },
{ key: 'preferTorrent', value: 'Prefer Torrent' },
{ key: 'onlyUsenet', value: 'Only Usenet' },
{ key: 'onlyTorrent', value: 'Only Torrent' }
];
function EditDelayProfileModalContent(props) { function EditDelayProfileModalContent(props) {
const { const {
id, id,
@ -25,7 +32,6 @@ function EditDelayProfileModalContent(props) {
saveError, saveError,
item, item,
protocol, protocol,
protocolOptions,
onInputChange, onInputChange,
onProtocolChange, onProtocolChange,
onSavePress, onSavePress,
@ -51,20 +57,22 @@ function EditDelayProfileModalContent(props) {
<ModalBody> <ModalBody>
{ {
isFetching && isFetching ?
<LoadingIndicator /> <LoadingIndicator /> :
null
} }
{ {
!isFetching && !!error && !isFetching && !!error ?
<div>Unable to add a new quality profile, please try again.</div> <div>Unable to add a new quality profile, please try again.</div> :
null
} }
{ {
!isFetching && !error && !isFetching && !error ?
<Form {...otherProps}> <Form {...otherProps}>
<FormGroup> <FormGroup>
<FormLabel>Protocol</FormLabel> <FormLabel>Preferred Protocol</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.SELECT} type={inputTypes.SELECT}
@ -140,19 +148,21 @@ function EditDelayProfileModalContent(props) {
/> />
</FormGroup> </FormGroup>
} }
</Form> </Form> :
null
} }
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
{ {
id && id > 1 && id && id > 1 ?
<Button <Button
className={styles.deleteButton} className={styles.deleteButton}
kind={kinds.DANGER} kind={kinds.DANGER}
onPress={onDeleteDelayProfilePress} onPress={onDeleteDelayProfilePress}
> >
Delete Delete
</Button> </Button> :
null
} }
<Button <Button
@ -190,7 +200,6 @@ EditDelayProfileModalContent.propTypes = {
saveError: PropTypes.object, saveError: PropTypes.object,
item: PropTypes.shape(delayProfileShape).isRequired, item: PropTypes.shape(delayProfileShape).isRequired,
protocol: PropTypes.string.isRequired, protocol: PropTypes.string.isRequired,
protocolOptions: PropTypes.arrayOf(PropTypes.object).isRequired,
onInputChange: PropTypes.func.isRequired, onInputChange: PropTypes.func.isRequired,
onProtocolChange: PropTypes.func.isRequired, onProtocolChange: PropTypes.func.isRequired,
onSavePress: PropTypes.func.isRequired, onSavePress: PropTypes.func.isRequired,

View File

@ -16,13 +16,6 @@ const newDelayProfile = {
tags: [] tags: []
}; };
const protocolOptions = [
{ key: 'preferUsenet', value: 'Prefer Usenet' },
{ key: 'preferTorrent', value: 'Prefer Torrent' },
{ key: 'onlyUsenet', value: 'Only Usenet' },
{ key: 'onlyTorrent', value: 'Only Torrent' }
];
function createDelayProfileSelector() { function createDelayProfileSelector() {
return createSelector( return createSelector(
(state, { id }) => id, (state, { id }) => id,
@ -78,7 +71,6 @@ function createMapStateToProps() {
return { return {
protocol, protocol,
protocolOptions,
...delayProfile ...delayProfile
}; };
} }