mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-22 22:14:44 -04:00
Renames in Frontend
This commit is contained in:
@@ -21,8 +21,8 @@ import ModalFooter from 'Components/Modal/ModalFooter';
|
||||
import Table from 'Components/Table/Table';
|
||||
import TableBody from 'Components/Table/TableBody';
|
||||
import SelectQualityModal from 'InteractiveImport/Quality/SelectQualityModal';
|
||||
import SelectArtistModal from 'InteractiveImport/Artist/SelectArtistModal';
|
||||
import SelectAlbumModal from 'InteractiveImport/Album/SelectAlbumModal';
|
||||
import SelectAuthorModal from 'InteractiveImport/Author/SelectAuthorModal';
|
||||
import SelectBookModal from 'InteractiveImport/Book/SelectBookModal';
|
||||
import ConfirmImportModal from 'InteractiveImport/Confirmation/ConfirmImportModal';
|
||||
import InteractiveImportRow from './InteractiveImportRow';
|
||||
import styles from './InteractiveImportModalContent.css';
|
||||
@@ -35,13 +35,13 @@ const columns = [
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'artist',
|
||||
label: 'Artist',
|
||||
name: 'author',
|
||||
label: 'Author',
|
||||
isSortable: true,
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'album',
|
||||
name: 'book',
|
||||
label: 'Book',
|
||||
isVisible: true
|
||||
},
|
||||
@@ -77,8 +77,8 @@ const importModeOptions = [
|
||||
];
|
||||
|
||||
const SELECT = 'select';
|
||||
const ARTIST = 'artist';
|
||||
const ALBUM = 'album';
|
||||
const AUTHOR = 'author';
|
||||
const BOOK = 'book';
|
||||
const QUALITY = 'quality';
|
||||
|
||||
const replaceExistingFilesOptions = {
|
||||
@@ -101,9 +101,9 @@ class InteractiveImportModalContent extends Component {
|
||||
selectedState: {},
|
||||
invalidRowsSelected: [],
|
||||
selectModalOpen: null,
|
||||
albumsImported: [],
|
||||
booksImported: [],
|
||||
isConfirmImportModalOpen: false,
|
||||
inconsistentAlbumReleases: false
|
||||
inconsistentBookReleases: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -112,14 +112,14 @@ class InteractiveImportModalContent extends Component {
|
||||
const selectedItems = _.filter(this.props.items, (x) => _.includes(selectedIds, x.id));
|
||||
|
||||
const inconsistent = _(selectedItems)
|
||||
.map((x) => ({ bookId: x.album ? x.album.id : 0, releaseId: x.albumReleaseId }))
|
||||
.map((x) => ({ bookId: x.book ? x.book.id : 0, releaseId: x.bookReleaseId }))
|
||||
.groupBy('bookId')
|
||||
.mapValues((album) => _(album).groupBy((x) => x.releaseId).values().value().length)
|
||||
.mapValues((book) => _(book).groupBy((x) => x.releaseId).values().value().length)
|
||||
.values()
|
||||
.some((x) => x !== undefined && x > 1);
|
||||
|
||||
if (inconsistent !== this.state.inconsistentAlbumReleases) {
|
||||
this.setState({ inconsistentAlbumReleases: inconsistent });
|
||||
if (inconsistent !== this.state.inconsistentBookReleases) {
|
||||
this.setState({ inconsistentBookReleases: inconsistent });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,16 +161,16 @@ class InteractiveImportModalContent extends Component {
|
||||
|
||||
// potentially deleting files
|
||||
const selectedIds = this.getSelectedIds();
|
||||
const albumsImported = _(this.props.items)
|
||||
const booksImported = _(this.props.items)
|
||||
.filter((x) => _.includes(selectedIds, x.id))
|
||||
.keyBy((x) => x.album.id)
|
||||
.map((x) => x.album)
|
||||
.keyBy((x) => x.book.id)
|
||||
.map((x) => x.book)
|
||||
.value();
|
||||
|
||||
console.log(albumsImported);
|
||||
console.log(booksImported);
|
||||
|
||||
this.setState({
|
||||
albumsImported,
|
||||
booksImported,
|
||||
isConfirmImportModalOpen: true
|
||||
});
|
||||
}
|
||||
@@ -205,7 +205,7 @@ class InteractiveImportModalContent extends Component {
|
||||
this.setState({ selectModalOpen: value });
|
||||
}
|
||||
|
||||
onClearTrackMappingPress = () => {
|
||||
onClearBookMappingPress = () => {
|
||||
const selectedIds = this.getSelectedIds();
|
||||
|
||||
selectedIds.forEach((id) => {
|
||||
@@ -216,7 +216,7 @@ class InteractiveImportModalContent extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
onGetTrackMappingPress = () => {
|
||||
onGetBookMappingPress = () => {
|
||||
this.props.saveInteractiveImportItem({ id: this.getSelectedIds() });
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ class InteractiveImportModalContent extends Component {
|
||||
render() {
|
||||
const {
|
||||
downloadId,
|
||||
allowArtistChange,
|
||||
allowAuthorChange,
|
||||
showFilterExistingFiles,
|
||||
showReplaceExistingFiles,
|
||||
showImportMode,
|
||||
@@ -261,9 +261,9 @@ class InteractiveImportModalContent extends Component {
|
||||
selectedState,
|
||||
invalidRowsSelected,
|
||||
selectModalOpen,
|
||||
albumsImported,
|
||||
booksImported,
|
||||
isConfirmImportModalOpen,
|
||||
inconsistentAlbumReleases
|
||||
inconsistentBookReleases
|
||||
} = this.state;
|
||||
|
||||
const selectedIds = this.getSelectedIds();
|
||||
@@ -272,14 +272,14 @@ class InteractiveImportModalContent extends Component {
|
||||
|
||||
const bulkSelectOptions = [
|
||||
{ key: SELECT, value: 'Select...', disabled: true },
|
||||
{ key: ALBUM, value: 'Select Album' },
|
||||
{ key: BOOK, value: 'Select Book' },
|
||||
{ key: QUALITY, value: 'Select Quality' }
|
||||
];
|
||||
|
||||
if (allowArtistChange) {
|
||||
if (allowAuthorChange) {
|
||||
bulkSelectOptions.splice(1, 0, {
|
||||
key: ARTIST,
|
||||
value: 'Select Artist'
|
||||
key: AUTHOR,
|
||||
value: 'Select Author'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ class InteractiveImportModalContent extends Component {
|
||||
isSelected={selectedState[item.id]}
|
||||
isSaving={isSaving}
|
||||
{...item}
|
||||
allowArtistChange={allowArtistChange}
|
||||
allowAuthorChange={allowAuthorChange}
|
||||
onSelectedChange={this.onSelectedChange}
|
||||
onValidRowChange={this.onValidRowChange}
|
||||
/>
|
||||
@@ -448,7 +448,7 @@ class InteractiveImportModalContent extends Component {
|
||||
|
||||
<Button
|
||||
kind={kinds.SUCCESS}
|
||||
isDisabled={!selectedIds.length || !!invalidRowsSelected.length || inconsistentAlbumReleases}
|
||||
isDisabled={!selectedIds.length || !!invalidRowsSelected.length || inconsistentBookReleases}
|
||||
onPress={this.onImportSelectedPress}
|
||||
>
|
||||
Import
|
||||
@@ -456,16 +456,16 @@ class InteractiveImportModalContent extends Component {
|
||||
</div>
|
||||
</ModalFooter>
|
||||
|
||||
<SelectArtistModal
|
||||
isOpen={selectModalOpen === ARTIST}
|
||||
<SelectAuthorModal
|
||||
isOpen={selectModalOpen === AUTHOR}
|
||||
ids={selectedIds}
|
||||
onModalClose={this.onSelectModalClose}
|
||||
/>
|
||||
|
||||
<SelectAlbumModal
|
||||
isOpen={selectModalOpen === ALBUM}
|
||||
<SelectBookModal
|
||||
isOpen={selectModalOpen === BOOK}
|
||||
ids={selectedIds}
|
||||
authorId={selectedItem && selectedItem.artist && selectedItem.artist.id}
|
||||
authorId={selectedItem && selectedItem.author && selectedItem.author.id}
|
||||
onModalClose={this.onSelectModalClose}
|
||||
/>
|
||||
|
||||
@@ -480,7 +480,7 @@ class InteractiveImportModalContent extends Component {
|
||||
|
||||
<ConfirmImportModal
|
||||
isOpen={isConfirmImportModalOpen}
|
||||
albums={albumsImported}
|
||||
books={booksImported}
|
||||
onModalClose={this.onConfirmImportModalClose}
|
||||
onConfirmImportPress={this.onConfirmImportPress}
|
||||
/>
|
||||
@@ -492,7 +492,7 @@ class InteractiveImportModalContent extends Component {
|
||||
|
||||
InteractiveImportModalContent.propTypes = {
|
||||
downloadId: PropTypes.string,
|
||||
allowArtistChange: PropTypes.bool.isRequired,
|
||||
allowAuthorChange: PropTypes.bool.isRequired,
|
||||
showImportMode: PropTypes.bool.isRequired,
|
||||
showFilterExistingFiles: PropTypes.bool.isRequired,
|
||||
showReplaceExistingFiles: PropTypes.bool.isRequired,
|
||||
@@ -520,7 +520,7 @@ InteractiveImportModalContent.propTypes = {
|
||||
};
|
||||
|
||||
InteractiveImportModalContent.defaultProps = {
|
||||
allowArtistChange: true,
|
||||
allowAuthorChange: true,
|
||||
showFilterExistingFiles: false,
|
||||
showReplaceExistingFiles: false,
|
||||
showImportMode: true,
|
||||
|
||||
+8
-8
@@ -122,19 +122,19 @@ class InteractiveImportModalContentConnector extends Component {
|
||||
|
||||
if (isSelected) {
|
||||
const {
|
||||
artist,
|
||||
album,
|
||||
author,
|
||||
book,
|
||||
quality,
|
||||
disableReleaseSwitching
|
||||
} = item;
|
||||
|
||||
if (!artist) {
|
||||
this.setState({ interactiveImportErrorMessage: 'Artist must be chosen for each selected file' });
|
||||
if (!author) {
|
||||
this.setState({ interactiveImportErrorMessage: 'Author must be chosen for each selected file' });
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!album) {
|
||||
this.setState({ interactiveImportErrorMessage: 'Album must be chosen for each selected file' });
|
||||
if (!book) {
|
||||
this.setState({ interactiveImportErrorMessage: 'Book must be chosen for each selected file' });
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -145,8 +145,8 @@ class InteractiveImportModalContentConnector extends Component {
|
||||
|
||||
files.push({
|
||||
path: item.path,
|
||||
authorId: artist.id,
|
||||
bookId: album.id,
|
||||
authorId: author.id,
|
||||
bookId: book.id,
|
||||
quality,
|
||||
downloadId: this.props.downloadId,
|
||||
disableReleaseSwitching
|
||||
|
||||
@@ -9,9 +9,9 @@ import TableRowCellButton from 'Components/Table/Cells/TableRowCellButton';
|
||||
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||
import Popover from 'Components/Tooltip/Popover';
|
||||
import Tooltip from 'Components/Tooltip/Tooltip';
|
||||
import TrackQuality from 'Album/TrackQuality';
|
||||
import SelectArtistModal from 'InteractiveImport/Artist/SelectArtistModal';
|
||||
import SelectAlbumModal from 'InteractiveImport/Album/SelectAlbumModal';
|
||||
import BookQuality from 'Book/BookQuality';
|
||||
import SelectAuthorModal from 'InteractiveImport/Author/SelectAuthorModal';
|
||||
import SelectBookModal from 'InteractiveImport/Book/SelectBookModal';
|
||||
import SelectQualityModal from 'InteractiveImport/Quality/SelectQualityModal';
|
||||
import InteractiveImportRowCellPlaceholder from './InteractiveImportRowCellPlaceholder';
|
||||
import styles from './InteractiveImportRow.css';
|
||||
@@ -25,8 +25,8 @@ class InteractiveImportRow extends Component {
|
||||
super(props, context);
|
||||
|
||||
this.state = {
|
||||
isSelectArtistModalOpen: false,
|
||||
isSelectAlbumModalOpen: false,
|
||||
isSelectAuthorModalOpen: false,
|
||||
isSelectBookModalOpen: false,
|
||||
isSelectQualityModalOpen: false
|
||||
};
|
||||
}
|
||||
@@ -34,14 +34,14 @@ class InteractiveImportRow extends Component {
|
||||
componentDidMount() {
|
||||
const {
|
||||
id,
|
||||
artist,
|
||||
album,
|
||||
author,
|
||||
book,
|
||||
quality
|
||||
} = this.props;
|
||||
|
||||
if (
|
||||
artist &&
|
||||
album != null &&
|
||||
author &&
|
||||
book != null &&
|
||||
quality
|
||||
) {
|
||||
this.props.onSelectedChange({ id, value: true });
|
||||
@@ -51,16 +51,16 @@ class InteractiveImportRow extends Component {
|
||||
componentDidUpdate(prevProps) {
|
||||
const {
|
||||
id,
|
||||
artist,
|
||||
album,
|
||||
author,
|
||||
book,
|
||||
quality,
|
||||
isSelected,
|
||||
onValidRowChange
|
||||
} = this.props;
|
||||
|
||||
if (
|
||||
prevProps.artist === artist &&
|
||||
prevProps.album === album &&
|
||||
prevProps.author === author &&
|
||||
prevProps.book === book &&
|
||||
prevProps.quality === quality &&
|
||||
prevProps.isSelected === isSelected
|
||||
) {
|
||||
@@ -68,8 +68,8 @@ class InteractiveImportRow extends Component {
|
||||
}
|
||||
|
||||
const isValid = !!(
|
||||
artist &&
|
||||
album &&
|
||||
author &&
|
||||
book &&
|
||||
quality
|
||||
);
|
||||
|
||||
@@ -97,25 +97,25 @@ class InteractiveImportRow extends Component {
|
||||
//
|
||||
// Listeners
|
||||
|
||||
onSelectArtistPress = () => {
|
||||
this.setState({ isSelectArtistModalOpen: true });
|
||||
onSelectAuthorPress = () => {
|
||||
this.setState({ isSelectAuthorModalOpen: true });
|
||||
}
|
||||
|
||||
onSelectAlbumPress = () => {
|
||||
this.setState({ isSelectAlbumModalOpen: true });
|
||||
onSelectBookPress = () => {
|
||||
this.setState({ isSelectBookModalOpen: true });
|
||||
}
|
||||
|
||||
onSelectQualityPress = () => {
|
||||
this.setState({ isSelectQualityModalOpen: true });
|
||||
}
|
||||
|
||||
onSelectArtistModalClose = (changed) => {
|
||||
this.setState({ isSelectArtistModalOpen: false });
|
||||
onSelectAuthorModalClose = (changed) => {
|
||||
this.setState({ isSelectAuthorModalOpen: false });
|
||||
this.selectRowAfterChange(changed);
|
||||
}
|
||||
|
||||
onSelectAlbumModalClose = (changed) => {
|
||||
this.setState({ isSelectAlbumModalOpen: false });
|
||||
onSelectBookModalClose = (changed) => {
|
||||
this.setState({ isSelectBookModalOpen: false });
|
||||
this.selectRowAfterChange(changed);
|
||||
}
|
||||
|
||||
@@ -130,10 +130,10 @@ class InteractiveImportRow extends Component {
|
||||
render() {
|
||||
const {
|
||||
id,
|
||||
allowArtistChange,
|
||||
allowAuthorChange,
|
||||
path,
|
||||
artist,
|
||||
album,
|
||||
author,
|
||||
book,
|
||||
quality,
|
||||
size,
|
||||
rejections,
|
||||
@@ -143,19 +143,19 @@ class InteractiveImportRow extends Component {
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
isSelectArtistModalOpen,
|
||||
isSelectAlbumModalOpen,
|
||||
isSelectAuthorModalOpen,
|
||||
isSelectBookModalOpen,
|
||||
isSelectQualityModalOpen
|
||||
} = this.state;
|
||||
|
||||
const artistName = artist ? artist.artistName : '';
|
||||
let albumTitle = '';
|
||||
if (album) {
|
||||
albumTitle = album.disambiguation ? `${album.title} (${album.disambiguation})` : album.title;
|
||||
const authorName = author ? author.authorName : '';
|
||||
let bookTitle = '';
|
||||
if (book) {
|
||||
bookTitle = book.disambiguation ? `${book.title} (${book.disambiguation})` : book.title;
|
||||
}
|
||||
|
||||
const showArtistPlaceholder = isSelected && !artist;
|
||||
const showAlbumNumberPlaceholder = isSelected && !!artist && !album;
|
||||
const showAuthorPlaceholder = isSelected && !author;
|
||||
const showBookNumberPlaceholder = isSelected && !!author && !book;
|
||||
const showQualityPlaceholder = isSelected && !quality;
|
||||
|
||||
const pathCellContents = (
|
||||
@@ -190,22 +190,22 @@ class InteractiveImportRow extends Component {
|
||||
</TableRowCell>
|
||||
|
||||
<TableRowCellButton
|
||||
isDisabled={!allowArtistChange}
|
||||
title={allowArtistChange ? 'Click to change artist' : undefined}
|
||||
onPress={this.onSelectArtistPress}
|
||||
isDisabled={!allowAuthorChange}
|
||||
title={allowAuthorChange ? 'Click to change author' : undefined}
|
||||
onPress={this.onSelectAuthorPress}
|
||||
>
|
||||
{
|
||||
showArtistPlaceholder ? <InteractiveImportRowCellPlaceholder /> : artistName
|
||||
showAuthorPlaceholder ? <InteractiveImportRowCellPlaceholder /> : authorName
|
||||
}
|
||||
</TableRowCellButton>
|
||||
|
||||
<TableRowCellButton
|
||||
isDisabled={!artist}
|
||||
title={artist ? 'Click to change album' : undefined}
|
||||
onPress={this.onSelectAlbumPress}
|
||||
isDisabled={!author}
|
||||
title={author ? 'Click to change book' : undefined}
|
||||
onPress={this.onSelectBookPress}
|
||||
>
|
||||
{
|
||||
showAlbumNumberPlaceholder ? <InteractiveImportRowCellPlaceholder /> : albumTitle
|
||||
showBookNumberPlaceholder ? <InteractiveImportRowCellPlaceholder /> : bookTitle
|
||||
}
|
||||
</TableRowCellButton>
|
||||
|
||||
@@ -221,7 +221,7 @@ class InteractiveImportRow extends Component {
|
||||
|
||||
{
|
||||
!showQualityPlaceholder && !!quality &&
|
||||
<TrackQuality
|
||||
<BookQuality
|
||||
className={styles.label}
|
||||
quality={quality}
|
||||
/>
|
||||
@@ -262,17 +262,17 @@ class InteractiveImportRow extends Component {
|
||||
}
|
||||
</TableRowCell>
|
||||
|
||||
<SelectArtistModal
|
||||
isOpen={isSelectArtistModalOpen}
|
||||
<SelectAuthorModal
|
||||
isOpen={isSelectAuthorModalOpen}
|
||||
ids={[id]}
|
||||
onModalClose={this.onSelectArtistModalClose}
|
||||
onModalClose={this.onSelectAuthorModalClose}
|
||||
/>
|
||||
|
||||
<SelectAlbumModal
|
||||
isOpen={isSelectAlbumModalOpen}
|
||||
<SelectBookModal
|
||||
isOpen={isSelectBookModalOpen}
|
||||
ids={[id]}
|
||||
authorId={artist && artist.id}
|
||||
onModalClose={this.onSelectAlbumModalClose}
|
||||
authorId={author && author.id}
|
||||
onModalClose={this.onSelectBookModalClose}
|
||||
/>
|
||||
|
||||
<SelectQualityModal
|
||||
@@ -291,10 +291,10 @@ class InteractiveImportRow extends Component {
|
||||
|
||||
InteractiveImportRow.propTypes = {
|
||||
id: PropTypes.number.isRequired,
|
||||
allowArtistChange: PropTypes.bool.isRequired,
|
||||
allowAuthorChange: PropTypes.bool.isRequired,
|
||||
path: PropTypes.string.isRequired,
|
||||
artist: PropTypes.object,
|
||||
album: PropTypes.object,
|
||||
author: PropTypes.object,
|
||||
book: PropTypes.object,
|
||||
quality: PropTypes.object,
|
||||
size: PropTypes.number.isRequired,
|
||||
rejections: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
|
||||
Reference in New Issue
Block a user