2017-09-04 02:20:56 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React, { Component } from 'react';
|
2019-12-16 21:21:32 +00:00
|
|
|
import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props';
|
2017-09-04 02:20:56 +00:00
|
|
|
import Button from 'Components/Link/Button';
|
|
|
|
import SpinnerButton from 'Components/Link/SpinnerButton';
|
|
|
|
import ModalContent from 'Components/Modal/ModalContent';
|
|
|
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
|
|
|
import ModalBody from 'Components/Modal/ModalBody';
|
|
|
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
|
|
|
import Form from 'Components/Form/Form';
|
|
|
|
import FormGroup from 'Components/Form/FormGroup';
|
|
|
|
import FormLabel from 'Components/Form/FormLabel';
|
|
|
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
2019-12-16 21:21:32 +00:00
|
|
|
import Icon from 'Components/Icon';
|
|
|
|
import Popover from 'Components/Tooltip/Popover';
|
2017-12-30 03:23:04 +00:00
|
|
|
import MoveArtistModal from 'Artist/MoveArtist/MoveArtistModal';
|
2019-12-16 21:21:32 +00:00
|
|
|
import ArtistMetadataProfilePopoverContent from 'AddArtist/ArtistMetadataProfilePopoverContent';
|
2017-09-04 02:20:56 +00:00
|
|
|
import styles from './EditArtistModalContent.css';
|
|
|
|
|
|
|
|
class EditArtistModalContent extends Component {
|
|
|
|
|
|
|
|
//
|
2017-12-30 03:23:04 +00:00
|
|
|
// Lifecycle
|
|
|
|
|
|
|
|
constructor(props, context) {
|
|
|
|
super(props, context);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
isConfirmMoveModalOpen: false
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Listeners
|
|
|
|
|
|
|
|
onSavePress = () => {
|
|
|
|
const {
|
|
|
|
isPathChanging,
|
|
|
|
onSavePress
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
if (isPathChanging && !this.state.isConfirmMoveModalOpen) {
|
|
|
|
this.setState({ isConfirmMoveModalOpen: true });
|
|
|
|
} else {
|
|
|
|
this.setState({ isConfirmMoveModalOpen: false });
|
|
|
|
|
|
|
|
onSavePress(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onMoveArtistPress = () => {
|
|
|
|
this.setState({ isConfirmMoveModalOpen: false });
|
|
|
|
|
|
|
|
this.props.onSavePress(true);
|
|
|
|
}
|
|
|
|
|
2018-01-26 03:01:53 +00:00
|
|
|
//
|
2017-09-04 02:20:56 +00:00
|
|
|
// Render
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
artistName,
|
|
|
|
item,
|
|
|
|
isSaving,
|
2017-11-26 03:51:37 +00:00
|
|
|
showMetadataProfile,
|
2017-12-30 03:23:04 +00:00
|
|
|
originalPath,
|
2017-09-04 02:20:56 +00:00
|
|
|
onInputChange,
|
|
|
|
onModalClose,
|
2017-09-16 20:22:06 +00:00
|
|
|
onDeleteArtistPress,
|
2017-09-04 02:20:56 +00:00
|
|
|
...otherProps
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
monitored,
|
|
|
|
albumFolder,
|
|
|
|
qualityProfileId,
|
2017-11-26 03:51:37 +00:00
|
|
|
metadataProfileId,
|
2017-09-04 02:20:56 +00:00
|
|
|
path,
|
|
|
|
tags
|
|
|
|
} = item;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ModalContent onModalClose={onModalClose}>
|
|
|
|
<ModalHeader>
|
|
|
|
Edit - {artistName}
|
|
|
|
</ModalHeader>
|
|
|
|
|
|
|
|
<ModalBody>
|
2019-02-23 22:39:11 +00:00
|
|
|
<Form {...otherProps}>
|
2017-09-04 02:20:56 +00:00
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Monitored</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.CHECK}
|
|
|
|
name="monitored"
|
|
|
|
helpText="Download monitored albums from this artist"
|
|
|
|
{...monitored}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Use Album Folder</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.CHECK}
|
|
|
|
name="albumFolder"
|
|
|
|
helpText="Sort tracks into album folders"
|
|
|
|
{...albumFolder}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Quality Profile</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.QUALITY_PROFILE_SELECT}
|
|
|
|
name="qualityProfileId"
|
|
|
|
{...qualityProfileId}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
2017-11-26 03:51:37 +00:00
|
|
|
{
|
|
|
|
showMetadataProfile &&
|
|
|
|
<FormGroup>
|
2019-12-16 21:21:32 +00:00
|
|
|
<FormLabel>
|
|
|
|
Metadata Profile
|
|
|
|
|
|
|
|
<Popover
|
|
|
|
anchor={
|
|
|
|
<Icon
|
|
|
|
className={styles.labelIcon}
|
|
|
|
name={icons.INFO}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
title="Metadata Profile"
|
|
|
|
body={<ArtistMetadataProfilePopoverContent />}
|
|
|
|
position={tooltipPositions.RIGHT}
|
|
|
|
/>
|
|
|
|
|
|
|
|
</FormLabel>
|
2017-11-26 03:51:37 +00:00
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.METADATA_PROFILE_SELECT}
|
|
|
|
name="metadataProfileId"
|
|
|
|
helpText="Changes will take place on next artist refresh"
|
2019-12-16 21:21:32 +00:00
|
|
|
includeNone={true}
|
2017-11-26 03:51:37 +00:00
|
|
|
{...metadataProfileId}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
}
|
|
|
|
|
2017-09-04 02:20:56 +00:00
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Path</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.PATH}
|
|
|
|
name="path"
|
|
|
|
{...path}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Tags</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.TAG}
|
|
|
|
name="tags"
|
|
|
|
{...tags}
|
|
|
|
onChange={onInputChange}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
</Form>
|
|
|
|
</ModalBody>
|
|
|
|
<ModalFooter>
|
|
|
|
<Button
|
|
|
|
className={styles.deleteButton}
|
|
|
|
kind={kinds.DANGER}
|
2017-09-16 20:22:06 +00:00
|
|
|
onPress={onDeleteArtistPress}
|
2017-09-04 02:20:56 +00:00
|
|
|
>
|
|
|
|
Delete
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
onPress={onModalClose}
|
|
|
|
>
|
|
|
|
Cancel
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
<SpinnerButton
|
|
|
|
isSpinning={isSaving}
|
2017-12-30 03:23:04 +00:00
|
|
|
onPress={this.onSavePress}
|
2017-09-04 02:20:56 +00:00
|
|
|
>
|
|
|
|
Save
|
|
|
|
</SpinnerButton>
|
|
|
|
</ModalFooter>
|
2017-12-30 03:23:04 +00:00
|
|
|
|
|
|
|
<MoveArtistModal
|
|
|
|
originalPath={originalPath}
|
|
|
|
destinationPath={path.value}
|
|
|
|
isOpen={this.state.isConfirmMoveModalOpen}
|
|
|
|
onSavePress={this.onSavePress}
|
|
|
|
onMoveArtistPress={this.onMoveArtistPress}
|
|
|
|
/>
|
|
|
|
|
2017-09-04 02:20:56 +00:00
|
|
|
</ModalContent>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EditArtistModalContent.propTypes = {
|
|
|
|
artistId: PropTypes.number.isRequired,
|
|
|
|
artistName: PropTypes.string.isRequired,
|
|
|
|
item: PropTypes.object.isRequired,
|
|
|
|
isSaving: PropTypes.bool.isRequired,
|
2017-11-26 03:51:37 +00:00
|
|
|
showMetadataProfile: PropTypes.bool.isRequired,
|
2017-12-30 03:23:04 +00:00
|
|
|
isPathChanging: PropTypes.bool.isRequired,
|
|
|
|
originalPath: PropTypes.string.isRequired,
|
2017-09-04 02:20:56 +00:00
|
|
|
onInputChange: PropTypes.func.isRequired,
|
|
|
|
onSavePress: PropTypes.func.isRequired,
|
|
|
|
onModalClose: PropTypes.func.isRequired,
|
2017-09-16 20:22:06 +00:00
|
|
|
onDeleteArtistPress: PropTypes.func.isRequired
|
2017-09-04 02:20:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default EditArtistModalContent;
|