mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
Renames in Frontend
This commit is contained in:
@@ -6,8 +6,8 @@ import IconButton from 'Components/Link/IconButton';
|
||||
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
||||
import TableRow from 'Components/Table/TableRow';
|
||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||
import TrackQuality from 'Album/TrackQuality';
|
||||
import ArtistNameLink from 'Artist/ArtistNameLink';
|
||||
import BookQuality from 'Book/BookQuality';
|
||||
import AuthorNameLink from 'Author/AuthorNameLink';
|
||||
import BlacklistDetailsModal from './BlacklistDetailsModal';
|
||||
import styles from './BlacklistRow.css';
|
||||
|
||||
@@ -40,7 +40,7 @@ class BlacklistRow extends Component {
|
||||
|
||||
render() {
|
||||
const {
|
||||
artist,
|
||||
author,
|
||||
sourceTitle,
|
||||
quality,
|
||||
date,
|
||||
@@ -51,7 +51,7 @@ class BlacklistRow extends Component {
|
||||
onRemovePress
|
||||
} = this.props;
|
||||
|
||||
if (!artist) {
|
||||
if (!author) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -71,9 +71,9 @@ class BlacklistRow extends Component {
|
||||
if (name === 'authors.sortName') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
<ArtistNameLink
|
||||
titleSlug={artist.titleSlug}
|
||||
artistName={artist.artistName}
|
||||
<AuthorNameLink
|
||||
titleSlug={author.titleSlug}
|
||||
authorName={author.authorName}
|
||||
/>
|
||||
</TableRowCell>
|
||||
);
|
||||
@@ -93,7 +93,7 @@ class BlacklistRow extends Component {
|
||||
key={name}
|
||||
className={styles.quality}
|
||||
>
|
||||
<TrackQuality
|
||||
<BookQuality
|
||||
quality={quality}
|
||||
/>
|
||||
</TableRowCell>
|
||||
@@ -161,7 +161,7 @@ class BlacklistRow extends Component {
|
||||
|
||||
BlacklistRow.propTypes = {
|
||||
id: PropTypes.number.isRequired,
|
||||
artist: PropTypes.object.isRequired,
|
||||
author: PropTypes.object.isRequired,
|
||||
sourceTitle: PropTypes.string.isRequired,
|
||||
quality: PropTypes.object.isRequired,
|
||||
date: PropTypes.string.isRequired,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import createArtistSelector from 'Store/Selectors/createArtistSelector';
|
||||
import createAuthorSelector from 'Store/Selectors/createAuthorSelector';
|
||||
import { removeFromBlacklist } from 'Store/Actions/blacklistActions';
|
||||
import BlacklistRow from './BlacklistRow';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
createArtistSelector(),
|
||||
(artist) => {
|
||||
createAuthorSelector(),
|
||||
(author) => {
|
||||
return {
|
||||
artist
|
||||
author
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -170,7 +170,7 @@ function HistoryDetails(props) {
|
||||
);
|
||||
}
|
||||
|
||||
if (eventType === 'trackFileImported') {
|
||||
if (eventType === 'bookFileImported') {
|
||||
const {
|
||||
droppedPath,
|
||||
importedPath
|
||||
@@ -205,7 +205,7 @@ function HistoryDetails(props) {
|
||||
);
|
||||
}
|
||||
|
||||
if (eventType === 'trackFileDeleted') {
|
||||
if (eventType === 'bookFileDeleted') {
|
||||
const {
|
||||
reason
|
||||
} = data;
|
||||
@@ -241,7 +241,7 @@ function HistoryDetails(props) {
|
||||
);
|
||||
}
|
||||
|
||||
if (eventType === 'trackFileRenamed') {
|
||||
if (eventType === 'bookFileRenamed') {
|
||||
const {
|
||||
sourcePath,
|
||||
path
|
||||
@@ -262,7 +262,7 @@ function HistoryDetails(props) {
|
||||
);
|
||||
}
|
||||
|
||||
if (eventType === 'trackFileRetagged') {
|
||||
if (eventType === 'bookFileRetagged') {
|
||||
const {
|
||||
diff,
|
||||
tagsScrubbed
|
||||
@@ -293,7 +293,7 @@ function HistoryDetails(props) {
|
||||
);
|
||||
}
|
||||
|
||||
if (eventType === 'albumImportIncomplete') {
|
||||
if (eventType === 'bookImportIncomplete') {
|
||||
const {
|
||||
statusMessages
|
||||
} = data;
|
||||
|
||||
@@ -17,16 +17,16 @@ function getHeaderTitle(eventType) {
|
||||
return 'Grabbed';
|
||||
case 'downloadFailed':
|
||||
return 'Download Failed';
|
||||
case 'trackFileImported':
|
||||
return 'Track Imported';
|
||||
case 'trackFileDeleted':
|
||||
return 'Track File Deleted';
|
||||
case 'trackFileRenamed':
|
||||
return 'Track File Renamed';
|
||||
case 'trackFileRetagged':
|
||||
return 'Track File Tags Updated';
|
||||
case 'albumImportIncomplete':
|
||||
return 'Album Import Incomplete';
|
||||
case 'bookFileImported':
|
||||
return 'Book Imported';
|
||||
case 'bookFileDeleted':
|
||||
return 'Book File Deleted';
|
||||
case 'bookFileRenamed':
|
||||
return 'Book File Renamed';
|
||||
case 'bookFileRetagged':
|
||||
return 'Book File Tags Updated';
|
||||
case 'bookImportIncomplete':
|
||||
return 'Book Import Incomplete';
|
||||
case 'downloadImported':
|
||||
return 'Download Completed';
|
||||
case 'downloadIgnored':
|
||||
|
||||
@@ -22,7 +22,7 @@ class History extends Component {
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
// Don't update when fetching has completed if items have changed,
|
||||
// before albums start fetching or when albums start fetching.
|
||||
// before books start fetching or when books start fetching.
|
||||
|
||||
if (
|
||||
(
|
||||
@@ -30,7 +30,7 @@ class History extends Component {
|
||||
nextProps.isPopulated &&
|
||||
hasDifferentItems(this.props.items, nextProps.items)
|
||||
) ||
|
||||
(!this.props.isAlbumsFetching && nextProps.isAlbumsFetching)
|
||||
(!this.props.isBooksFetching && nextProps.isBooksFetching)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
@@ -51,17 +51,17 @@ class History extends Component {
|
||||
selectedFilterKey,
|
||||
filters,
|
||||
totalRecords,
|
||||
isAlbumsFetching,
|
||||
isAlbumsPopulated,
|
||||
albumsError,
|
||||
isBooksFetching,
|
||||
isBooksPopulated,
|
||||
booksError,
|
||||
onFilterSelect,
|
||||
onFirstPagePress,
|
||||
...otherProps
|
||||
} = this.props;
|
||||
|
||||
const isFetchingAny = isFetching || isAlbumsFetching;
|
||||
const isAllPopulated = isPopulated && (isAlbumsPopulated || !items.length);
|
||||
const hasError = error || albumsError;
|
||||
const isFetchingAny = isFetching || isBooksFetching;
|
||||
const isAllPopulated = isPopulated && (isBooksPopulated || !items.length);
|
||||
const hasError = error || booksError;
|
||||
|
||||
return (
|
||||
<PageContent title="History">
|
||||
@@ -109,7 +109,7 @@ class History extends Component {
|
||||
|
||||
{
|
||||
// If history isPopulated and it's empty show no history found and don't
|
||||
// wait for the albums to populate because they are never coming.
|
||||
// wait for the books to populate because they are never coming.
|
||||
|
||||
isPopulated && !hasError && !items.length &&
|
||||
<div>
|
||||
@@ -162,9 +162,9 @@ History.propTypes = {
|
||||
selectedFilterKey: PropTypes.string.isRequired,
|
||||
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
totalRecords: PropTypes.number,
|
||||
isAlbumsFetching: PropTypes.bool.isRequired,
|
||||
isAlbumsPopulated: PropTypes.bool.isRequired,
|
||||
albumsError: PropTypes.object,
|
||||
isBooksFetching: PropTypes.bool.isRequired,
|
||||
isBooksPopulated: PropTypes.bool.isRequired,
|
||||
booksError: PropTypes.object,
|
||||
onFilterSelect: PropTypes.func.isRequired,
|
||||
onFirstPagePress: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
@@ -7,23 +7,18 @@ import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
||||
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
||||
import withCurrentPage from 'Components/withCurrentPage';
|
||||
import * as historyActions from 'Store/Actions/historyActions';
|
||||
import { fetchAlbums, clearAlbums } from 'Store/Actions/albumActions';
|
||||
import { fetchTracks, clearTracks } from 'Store/Actions/trackActions';
|
||||
import { fetchBooks, clearBooks } from 'Store/Actions/bookActions';
|
||||
import History from './History';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.history,
|
||||
(state) => state.albums,
|
||||
(state) => state.tracks,
|
||||
(history, albums, tracks) => {
|
||||
(state) => state.books,
|
||||
(history, books) => {
|
||||
return {
|
||||
isAlbumsFetching: albums.isFetching,
|
||||
isAlbumsPopulated: albums.isPopulated,
|
||||
albumsError: albums.error,
|
||||
isTracksFetching: tracks.isFetching,
|
||||
isTracksPopulated: tracks.isPopulated,
|
||||
tracksError: tracks.error,
|
||||
isBooksFetching: books.isFetching,
|
||||
isBooksPopulated: books.isPopulated,
|
||||
booksError: books.error,
|
||||
...history
|
||||
};
|
||||
}
|
||||
@@ -32,10 +27,8 @@ function createMapStateToProps() {
|
||||
|
||||
const mapDispatchToProps = {
|
||||
...historyActions,
|
||||
fetchAlbums,
|
||||
clearAlbums,
|
||||
fetchTracks,
|
||||
clearTracks
|
||||
fetchBooks,
|
||||
clearBooks
|
||||
};
|
||||
|
||||
class HistoryConnector extends Component {
|
||||
@@ -62,16 +55,10 @@ class HistoryConnector extends Component {
|
||||
componentDidUpdate(prevProps) {
|
||||
if (hasDifferentItems(prevProps.items, this.props.items)) {
|
||||
const bookIds = selectUniqueIds(this.props.items, 'bookId');
|
||||
const trackIds = selectUniqueIds(this.props.items, 'trackId');
|
||||
if (bookIds.length) {
|
||||
this.props.fetchAlbums({ bookIds });
|
||||
this.props.fetchBooks({ bookIds });
|
||||
} else {
|
||||
this.props.clearAlbums();
|
||||
}
|
||||
if (trackIds.length) {
|
||||
this.props.fetchTracks({ trackIds });
|
||||
} else {
|
||||
this.props.clearTracks();
|
||||
this.props.clearBooks();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,8 +66,7 @@ class HistoryConnector extends Component {
|
||||
componentWillUnmount() {
|
||||
unregisterPagePopulator(this.repopulate);
|
||||
this.props.clearHistory();
|
||||
this.props.clearAlbums();
|
||||
this.props.clearTracks();
|
||||
this.props.clearBooks();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -162,10 +148,8 @@ HistoryConnector.propTypes = {
|
||||
setHistoryFilter: PropTypes.func.isRequired,
|
||||
setHistoryTableOption: PropTypes.func.isRequired,
|
||||
clearHistory: PropTypes.func.isRequired,
|
||||
fetchAlbums: PropTypes.func.isRequired,
|
||||
clearAlbums: PropTypes.func.isRequired,
|
||||
fetchTracks: PropTypes.func.isRequired,
|
||||
clearTracks: PropTypes.func.isRequired
|
||||
fetchBooks: PropTypes.func.isRequired,
|
||||
clearBooks: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default withCurrentPage(
|
||||
|
||||
@@ -9,19 +9,19 @@ function getIconName(eventType) {
|
||||
switch (eventType) {
|
||||
case 'grabbed':
|
||||
return icons.DOWNLOADING;
|
||||
case 'artistFolderImported':
|
||||
case 'authorFolderImported':
|
||||
return icons.DRIVE;
|
||||
case 'trackFileImported':
|
||||
case 'bookFileImported':
|
||||
return icons.DOWNLOADED;
|
||||
case 'downloadFailed':
|
||||
return icons.DOWNLOADING;
|
||||
case 'trackFileDeleted':
|
||||
case 'bookFileDeleted':
|
||||
return icons.DELETE;
|
||||
case 'trackFileRenamed':
|
||||
case 'bookFileRenamed':
|
||||
return icons.ORGANIZE;
|
||||
case 'trackFileRetagged':
|
||||
case 'bookFileRetagged':
|
||||
return icons.RETAG;
|
||||
case 'albumImportIncomplete':
|
||||
case 'bookImportIncomplete':
|
||||
return icons.DOWNLOADED;
|
||||
case 'downloadImported':
|
||||
return icons.DOWNLOADED;
|
||||
@@ -36,7 +36,7 @@ function getIconKind(eventType) {
|
||||
switch (eventType) {
|
||||
case 'downloadFailed':
|
||||
return kinds.DANGER;
|
||||
case 'albumImportIncomplete':
|
||||
case 'bookImportIncomplete':
|
||||
return kinds.WARNING;
|
||||
default:
|
||||
return kinds.DEFAULT;
|
||||
@@ -46,25 +46,25 @@ function getIconKind(eventType) {
|
||||
function getTooltip(eventType, data) {
|
||||
switch (eventType) {
|
||||
case 'grabbed':
|
||||
return `Album grabbed from ${data.indexer} and sent to ${data.downloadClient}`;
|
||||
case 'artistFolderImported':
|
||||
return 'Track imported from artist folder';
|
||||
case 'trackFileImported':
|
||||
return 'Track downloaded successfully and picked up from download client';
|
||||
return `Book grabbed from ${data.indexer} and sent to ${data.downloadClient}`;
|
||||
case 'authorFolderImported':
|
||||
return 'Book imported from author folder';
|
||||
case 'bookFileImported':
|
||||
return 'Book downloaded successfully and picked up from download client';
|
||||
case 'downloadFailed':
|
||||
return 'Album download failed';
|
||||
case 'trackFileDeleted':
|
||||
return 'Track file deleted';
|
||||
case 'trackFileRenamed':
|
||||
return 'Track file renamed';
|
||||
case 'trackFileRetagged':
|
||||
return 'Track file tags updated';
|
||||
case 'albumImportIncomplete':
|
||||
return 'Book download failed';
|
||||
case 'bookFileDeleted':
|
||||
return 'Book file deleted';
|
||||
case 'bookFileRenamed':
|
||||
return 'Book file renamed';
|
||||
case 'bookFileRetagged':
|
||||
return 'Book file tags updated';
|
||||
case 'bookImportIncomplete':
|
||||
return 'Files downloaded but not all could be imported';
|
||||
case 'downloadImported':
|
||||
return 'Download completed and successfully imported';
|
||||
case 'downloadIgnored':
|
||||
return 'Album Download Ignored';
|
||||
return 'Book Download Ignored';
|
||||
default:
|
||||
return 'Unknown event';
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ import IconButton from 'Components/Link/IconButton';
|
||||
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
||||
import TableRow from 'Components/Table/TableRow';
|
||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||
import AlbumTitleLink from 'Album/AlbumTitleLink';
|
||||
import TrackQuality from 'Album/TrackQuality';
|
||||
import ArtistNameLink from 'Artist/ArtistNameLink';
|
||||
import BookTitleLink from 'Book/BookTitleLink';
|
||||
import BookQuality from 'Book/BookQuality';
|
||||
import AuthorNameLink from 'Author/AuthorNameLink';
|
||||
import HistoryEventTypeCell from './HistoryEventTypeCell';
|
||||
import HistoryDetailsModal from './Details/HistoryDetailsModal';
|
||||
import styles from './HistoryRow.css';
|
||||
@@ -51,8 +51,8 @@ class HistoryRow extends Component {
|
||||
|
||||
render() {
|
||||
const {
|
||||
artist,
|
||||
album,
|
||||
author,
|
||||
book,
|
||||
quality,
|
||||
qualityCutoffNotMet,
|
||||
eventType,
|
||||
@@ -66,7 +66,7 @@ class HistoryRow extends Component {
|
||||
onMarkAsFailedPress
|
||||
} = this.props;
|
||||
|
||||
if (!artist || !album) {
|
||||
if (!author || !book) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ class HistoryRow extends Component {
|
||||
if (name === 'authors.sortName') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
<ArtistNameLink
|
||||
titleSlug={artist.titleSlug}
|
||||
artistName={artist.artistName}
|
||||
<AuthorNameLink
|
||||
titleSlug={author.titleSlug}
|
||||
authorName={author.authorName}
|
||||
/>
|
||||
</TableRowCell>
|
||||
);
|
||||
@@ -107,10 +107,10 @@ class HistoryRow extends Component {
|
||||
if (name === 'books.title') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
<AlbumTitleLink
|
||||
titleSlug={album.titleSlug}
|
||||
title={album.title}
|
||||
disambiguation={album.disambiguation}
|
||||
<BookTitleLink
|
||||
titleSlug={book.titleSlug}
|
||||
title={book.title}
|
||||
disambiguation={book.disambiguation}
|
||||
/>
|
||||
</TableRowCell>
|
||||
);
|
||||
@@ -119,7 +119,7 @@ class HistoryRow extends Component {
|
||||
if (name === 'quality') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
<TrackQuality
|
||||
<BookQuality
|
||||
quality={quality}
|
||||
isCutoffMet={qualityCutoffNotMet}
|
||||
/>
|
||||
@@ -206,8 +206,8 @@ class HistoryRow extends Component {
|
||||
|
||||
HistoryRow.propTypes = {
|
||||
bookId: PropTypes.number,
|
||||
artist: PropTypes.object.isRequired,
|
||||
album: PropTypes.object,
|
||||
author: PropTypes.object.isRequired,
|
||||
book: PropTypes.object,
|
||||
quality: PropTypes.object.isRequired,
|
||||
qualityCutoffNotMet: PropTypes.bool.isRequired,
|
||||
eventType: PropTypes.string.isRequired,
|
||||
|
||||
@@ -3,23 +3,20 @@ import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { fetchHistory, markAsFailed } from 'Store/Actions/historyActions';
|
||||
import createArtistSelector from 'Store/Selectors/createArtistSelector';
|
||||
import createAlbumSelector from 'Store/Selectors/createAlbumSelector';
|
||||
import createTrackSelector from 'Store/Selectors/createTrackSelector';
|
||||
import createAuthorSelector from 'Store/Selectors/createAuthorSelector';
|
||||
import createBookSelector from 'Store/Selectors/createBookSelector';
|
||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||
import HistoryRow from './HistoryRow';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
createArtistSelector(),
|
||||
createAlbumSelector(),
|
||||
createTrackSelector(),
|
||||
createAuthorSelector(),
|
||||
createBookSelector(),
|
||||
createUISettingsSelector(),
|
||||
(artist, album, track, uiSettings) => {
|
||||
(author, book, uiSettings) => {
|
||||
return {
|
||||
artist,
|
||||
album,
|
||||
track,
|
||||
author,
|
||||
book,
|
||||
shortDateFormat: uiSettings.shortDateFormat,
|
||||
timeFormat: uiSettings.timeFormat
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ class Queue extends Component {
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
// Don't update when fetching has completed if items have changed,
|
||||
// before albums start fetching or when albums start fetching.
|
||||
// before books start fetching or when books start fetching.
|
||||
|
||||
if (
|
||||
this.props.isFetching &&
|
||||
@@ -53,7 +53,7 @@ class Queue extends Component {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.props.isAlbumsFetching && nextProps.isAlbumsFetching) {
|
||||
if (!this.props.isBooksFetching && nextProps.isBooksFetching) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -125,9 +125,9 @@ class Queue extends Component {
|
||||
isPopulated,
|
||||
error,
|
||||
items,
|
||||
isAlbumsFetching,
|
||||
isAlbumsPopulated,
|
||||
albumsError,
|
||||
isBooksFetching,
|
||||
isBooksPopulated,
|
||||
booksError,
|
||||
columns,
|
||||
totalRecords,
|
||||
isGrabbing,
|
||||
@@ -145,9 +145,9 @@ class Queue extends Component {
|
||||
isPendingSelected
|
||||
} = this.state;
|
||||
|
||||
const isRefreshing = isFetching || isAlbumsFetching || isRefreshMonitoredDownloadsExecuting;
|
||||
const isAllPopulated = isPopulated && (isAlbumsPopulated || !items.length || items.every((e) => !e.bookId));
|
||||
const hasError = error || albumsError;
|
||||
const isRefreshing = isFetching || isBooksFetching || isRefreshMonitoredDownloadsExecuting;
|
||||
const isAllPopulated = isPopulated && (isBooksPopulated || !items.length || items.every((e) => !e.bookId));
|
||||
const hasError = error || booksError;
|
||||
const selectedIds = this.getSelectedIds();
|
||||
const selectedCount = selectedIds.length;
|
||||
const disableSelectedActions = selectedCount === 0;
|
||||
@@ -280,9 +280,9 @@ Queue.propTypes = {
|
||||
isPopulated: PropTypes.bool.isRequired,
|
||||
error: PropTypes.object,
|
||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
isAlbumsFetching: PropTypes.bool.isRequired,
|
||||
isAlbumsPopulated: PropTypes.bool.isRequired,
|
||||
albumsError: PropTypes.object,
|
||||
isBooksFetching: PropTypes.bool.isRequired,
|
||||
isBooksPopulated: PropTypes.bool.isRequired,
|
||||
booksError: PropTypes.object,
|
||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
totalRecords: PropTypes.number,
|
||||
isGrabbing: PropTypes.bool.isRequired,
|
||||
|
||||
@@ -9,21 +9,21 @@ import withCurrentPage from 'Components/withCurrentPage';
|
||||
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
||||
import { executeCommand } from 'Store/Actions/commandActions';
|
||||
import * as queueActions from 'Store/Actions/queueActions';
|
||||
import { fetchAlbums, clearAlbums } from 'Store/Actions/albumActions';
|
||||
import { fetchBooks, clearBooks } from 'Store/Actions/bookActions';
|
||||
import * as commandNames from 'Commands/commandNames';
|
||||
import Queue from './Queue';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.albums,
|
||||
(state) => state.books,
|
||||
(state) => state.queue.options,
|
||||
(state) => state.queue.paged,
|
||||
createCommandExecutingSelector(commandNames.REFRESH_MONITORED_DOWNLOADS),
|
||||
(albums, options, queue, isRefreshMonitoredDownloadsExecuting) => {
|
||||
(books, options, queue, isRefreshMonitoredDownloadsExecuting) => {
|
||||
return {
|
||||
isAlbumsFetching: albums.isFetching,
|
||||
isAlbumsPopulated: albums.isPopulated,
|
||||
albumsError: albums.error,
|
||||
isBooksFetching: books.isFetching,
|
||||
isBooksPopulated: books.isPopulated,
|
||||
booksError: books.error,
|
||||
isRefreshMonitoredDownloadsExecuting,
|
||||
...options,
|
||||
...queue
|
||||
@@ -34,8 +34,8 @@ function createMapStateToProps() {
|
||||
|
||||
const mapDispatchToProps = {
|
||||
...queueActions,
|
||||
fetchAlbums,
|
||||
clearAlbums,
|
||||
fetchBooks,
|
||||
clearBooks,
|
||||
executeCommand
|
||||
};
|
||||
|
||||
@@ -65,15 +65,15 @@ class QueueConnector extends Component {
|
||||
const bookIds = selectUniqueIds(this.props.items, 'bookId');
|
||||
|
||||
if (bookIds.length) {
|
||||
this.props.fetchAlbums({ bookIds });
|
||||
this.props.fetchBooks({ bookIds });
|
||||
} else {
|
||||
this.props.clearAlbums();
|
||||
this.props.clearBooks();
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
this.props.includeUnknownArtistItems !==
|
||||
prevProps.includeUnknownArtistItems
|
||||
this.props.includeUnknownAuthorItems !==
|
||||
prevProps.includeUnknownAuthorItems
|
||||
) {
|
||||
this.repopulate();
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class QueueConnector extends Component {
|
||||
componentWillUnmount() {
|
||||
unregisterPagePopulator(this.repopulate);
|
||||
this.props.clearQueue();
|
||||
this.props.clearAlbums();
|
||||
this.props.clearBooks();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -166,7 +166,7 @@ class QueueConnector extends Component {
|
||||
QueueConnector.propTypes = {
|
||||
useCurrentPage: PropTypes.bool.isRequired,
|
||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
includeUnknownArtistItems: PropTypes.bool.isRequired,
|
||||
includeUnknownAuthorItems: PropTypes.bool.isRequired,
|
||||
fetchQueue: PropTypes.func.isRequired,
|
||||
gotoQueueFirstPage: PropTypes.func.isRequired,
|
||||
gotoQueuePreviousPage: PropTypes.func.isRequired,
|
||||
@@ -178,8 +178,8 @@ QueueConnector.propTypes = {
|
||||
clearQueue: PropTypes.func.isRequired,
|
||||
grabQueueItems: PropTypes.func.isRequired,
|
||||
removeQueueItems: PropTypes.func.isRequired,
|
||||
fetchAlbums: PropTypes.func.isRequired,
|
||||
clearAlbums: PropTypes.func.isRequired,
|
||||
fetchBooks: PropTypes.func.isRequired,
|
||||
clearBooks: PropTypes.func.isRequired,
|
||||
executeCommand: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ function QueueDetails(props) {
|
||||
return (
|
||||
<Icon
|
||||
name={icons.DOWNLOADING}
|
||||
title={`Album is downloading - ${progress.toFixed(1)}% ${title}`}
|
||||
title={`Book is downloading - ${progress.toFixed(1)}% ${title}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,18 +14,18 @@ class QueueOptions extends Component {
|
||||
super(props, context);
|
||||
|
||||
this.state = {
|
||||
includeUnknownArtistItems: props.includeUnknownArtistItems
|
||||
includeUnknownAuthorItems: props.includeUnknownAuthorItems
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const {
|
||||
includeUnknownArtistItems
|
||||
includeUnknownAuthorItems
|
||||
} = this.props;
|
||||
|
||||
if (includeUnknownArtistItems !== prevProps.includeUnknownArtistItems) {
|
||||
if (includeUnknownAuthorItems !== prevProps.includeUnknownAuthorItems) {
|
||||
this.setState({
|
||||
includeUnknownArtistItems
|
||||
includeUnknownAuthorItems
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -48,19 +48,19 @@ class QueueOptions extends Component {
|
||||
|
||||
render() {
|
||||
const {
|
||||
includeUnknownArtistItems
|
||||
includeUnknownAuthorItems
|
||||
} = this.state;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<FormGroup>
|
||||
<FormLabel>Show Unknown Artist Items</FormLabel>
|
||||
<FormLabel>Show Unknown Author Items</FormLabel>
|
||||
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="includeUnknownArtistItems"
|
||||
value={includeUnknownArtistItems}
|
||||
helpText="Show items without a artist in the queue, this could include removed artists, movies or anything else in Readarr's category"
|
||||
name="includeUnknownAuthorItems"
|
||||
value={includeUnknownAuthorItems}
|
||||
helpText="Show items without a author in the queue, this could include removed authors, movies or anything else in Readarr's category"
|
||||
onChange={this.onOptionChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
@@ -70,7 +70,7 @@ class QueueOptions extends Component {
|
||||
}
|
||||
|
||||
QueueOptions.propTypes = {
|
||||
includeUnknownArtistItems: PropTypes.bool.isRequired,
|
||||
includeUnknownAuthorItems: PropTypes.bool.isRequired,
|
||||
onOptionChange: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||
import Icon from 'Components/Icon';
|
||||
import Popover from 'Components/Tooltip/Popover';
|
||||
import ProtocolLabel from 'Activity/Queue/ProtocolLabel';
|
||||
import AlbumTitleLink from 'Album/AlbumTitleLink';
|
||||
import TrackQuality from 'Album/TrackQuality';
|
||||
import BookTitleLink from 'Book/BookTitleLink';
|
||||
import BookQuality from 'Book/BookQuality';
|
||||
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
|
||||
import ArtistNameLink from 'Artist/ArtistNameLink';
|
||||
import AuthorNameLink from 'Author/AuthorNameLink';
|
||||
import QueueStatusCell from './QueueStatusCell';
|
||||
import TimeleftCell from './TimeleftCell';
|
||||
import RemoveQueueItemModal from './RemoveQueueItemModal';
|
||||
@@ -71,8 +71,8 @@ class QueueRow extends Component {
|
||||
trackedDownloadState,
|
||||
statusMessages,
|
||||
errorMessage,
|
||||
artist,
|
||||
album,
|
||||
author,
|
||||
book,
|
||||
quality,
|
||||
protocol,
|
||||
indexer,
|
||||
@@ -141,10 +141,10 @@ class QueueRow extends Component {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
{
|
||||
artist ?
|
||||
<ArtistNameLink
|
||||
titleSlug={artist.titleSlug}
|
||||
artistName={artist.artistName}
|
||||
author ?
|
||||
<AuthorNameLink
|
||||
titleSlug={author.titleSlug}
|
||||
authorName={author.authorName}
|
||||
/> :
|
||||
title
|
||||
}
|
||||
@@ -156,11 +156,11 @@ class QueueRow extends Component {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
{
|
||||
album ?
|
||||
<AlbumTitleLink
|
||||
titleSlug={album.titleSlug}
|
||||
title={album.title}
|
||||
disambiguation={album.disambiguation}
|
||||
book ?
|
||||
<BookTitleLink
|
||||
titleSlug={book.titleSlug}
|
||||
title={book.title}
|
||||
disambiguation={book.disambiguation}
|
||||
/> :
|
||||
'-'
|
||||
}
|
||||
@@ -169,11 +169,11 @@ class QueueRow extends Component {
|
||||
}
|
||||
|
||||
if (name === 'books.releaseDate') {
|
||||
if (album) {
|
||||
if (book) {
|
||||
return (
|
||||
<RelativeDateCellConnector
|
||||
key={name}
|
||||
date={album.releaseDate}
|
||||
date={book.releaseDate}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ class QueueRow extends Component {
|
||||
if (name === 'quality') {
|
||||
return (
|
||||
<TableRowCell key={name}>
|
||||
<TrackQuality
|
||||
<BookQuality
|
||||
quality={quality}
|
||||
/>
|
||||
</TableRowCell>
|
||||
@@ -335,7 +335,7 @@ class QueueRow extends Component {
|
||||
<RemoveQueueItemModal
|
||||
isOpen={isRemoveQueueItemModalOpen}
|
||||
sourceTitle={title}
|
||||
canIgnore={!!(artist && album)}
|
||||
canIgnore={!!(author && book)}
|
||||
onRemovePress={this.onRemoveQueueItemModalConfirmed}
|
||||
onModalClose={this.onRemoveQueueItemModalClose}
|
||||
/>
|
||||
@@ -354,8 +354,8 @@ QueueRow.propTypes = {
|
||||
trackedDownloadState: PropTypes.string,
|
||||
statusMessages: PropTypes.arrayOf(PropTypes.object),
|
||||
errorMessage: PropTypes.string,
|
||||
artist: PropTypes.object,
|
||||
album: PropTypes.object,
|
||||
author: PropTypes.object,
|
||||
book: PropTypes.object,
|
||||
quality: PropTypes.object.isRequired,
|
||||
protocol: PropTypes.string.isRequired,
|
||||
indexer: PropTypes.string,
|
||||
|
||||
@@ -4,25 +4,25 @@ import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { grabQueueItem, removeQueueItem } from 'Store/Actions/queueActions';
|
||||
import createArtistSelector from 'Store/Selectors/createArtistSelector';
|
||||
import createAlbumSelector from 'Store/Selectors/createAlbumSelector';
|
||||
import createAuthorSelector from 'Store/Selectors/createAuthorSelector';
|
||||
import createBookSelector from 'Store/Selectors/createBookSelector';
|
||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||
import QueueRow from './QueueRow';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
createArtistSelector(),
|
||||
createAlbumSelector(),
|
||||
createAuthorSelector(),
|
||||
createBookSelector(),
|
||||
createUISettingsSelector(),
|
||||
(artist, album, uiSettings) => {
|
||||
(author, book, uiSettings) => {
|
||||
const result = _.pick(uiSettings, [
|
||||
'showRelativeDates',
|
||||
'shortDateFormat',
|
||||
'timeFormat'
|
||||
]);
|
||||
|
||||
result.artist = artist;
|
||||
result.album = album;
|
||||
result.author = author;
|
||||
result.book = book;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ class QueueRowConnector extends Component {
|
||||
|
||||
QueueRowConnector.propTypes = {
|
||||
id: PropTypes.number.isRequired,
|
||||
album: PropTypes.object,
|
||||
book: PropTypes.object,
|
||||
grabQueueItem: PropTypes.func.isRequired,
|
||||
removeQueueItem: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
@@ -9,8 +9,8 @@ function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.app,
|
||||
(state) => state.queue.status,
|
||||
(state) => state.queue.options.includeUnknownArtistItems,
|
||||
(app, status, includeUnknownArtistItems) => {
|
||||
(state) => state.queue.options.includeUnknownAuthorItems,
|
||||
(app, status, includeUnknownAuthorItems) => {
|
||||
const {
|
||||
errors,
|
||||
warnings,
|
||||
@@ -25,9 +25,9 @@ function createMapStateToProps() {
|
||||
isReconnecting: app.isReconnecting,
|
||||
isPopulated: status.isPopulated,
|
||||
...status.item,
|
||||
count: includeUnknownArtistItems ? totalCount : count,
|
||||
errors: includeUnknownArtistItems ? errors || unknownErrors : errors,
|
||||
warnings: includeUnknownArtistItems ? warnings || unknownWarnings : warnings
|
||||
count: includeUnknownAuthorItems ? totalCount : count,
|
||||
errors: includeUnknownAuthorItems ? errors || unknownErrors : errors,
|
||||
warnings: includeUnknownAuthorItems ? warnings || unknownWarnings : warnings
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user