Rename Episode Instances to Album to fix AlbumModal

pull/94/head
Qstick 7 years ago
parent bd3bd9a378
commit 02925245c2

@ -112,7 +112,7 @@ class HistoryRow extends Component {
return (
<TableRowCell key={name}>
<EpisodeTitleLink
episodeId={albumId}
albumId={albumId}
episodeEntity={episodeEntities.EPISODES}
artistId={artist.id}
episodeTitle={album.title}

@ -193,7 +193,7 @@ class Queue extends Component {
return (
<QueueRowConnector
key={item.id}
episodeId={item.albumId}
albumId={item.albumId}
isSelected={selectedState[item.id]}
columns={columns}
{...item}

@ -157,7 +157,7 @@ class QueueRow extends Component {
return (
<TableRowCell key={name}>
<EpisodeTitleLink
episodeId={episode.id}
albumId={episode.id}
artistId={series.id}
trackFileId={episode.trackFileId}
episodeTitle={episode.title}

@ -47,9 +47,9 @@ class AlbumStudioRowConnector extends Component {
});
}
onAlbumMonitoredPress = (episodeId, monitored) => {
onAlbumMonitoredPress = (albumId, monitored) => {
this.props.toggleEpisodeMonitored({
episodeId,
albumId,
monitored: !monitored
});
}

@ -112,7 +112,7 @@ class AlbumRow extends Component {
className={styles.title}
>
<EpisodeTitleLink
episodeId={id}
albumId={id}
artistId={artistId}
episodeTitle={title}
showOpenArtistButton={false}
@ -183,7 +183,7 @@ class AlbumRow extends Component {
return (
<EpisodeSearchCellConnector
key={name}
episodeId={id}
albumId={id}
artistId={artistId}
episodeTitle={title}
/>

@ -119,7 +119,7 @@ class AgendaEvent extends Component {
<EpisodeDetailsModal
isOpen={this.state.isDetailsModalOpen}
episodeId={id}
albumId={id}
episodeEntity={episodeEntities.CALENDAR}
artistId={artist.id}
episodeTitle={title}

@ -37,7 +37,7 @@ function CalendarDay(props) {
return (
<CalendarEventConnector
key={event.id}
episodeId={event.id}
albumId={event.id}
{...event}
onEventModalOpenToggle={onEventModalOpenToggle}
/>

@ -112,7 +112,7 @@ class CalendarEvent extends Component {
<EpisodeDetailsModal
isOpen={this.state.isDetailsModalOpen}
episodeId={id}
albumId={id}
episodeEntity={episodeEntities.CALENDAR}
artistId={artist.id}
episodeTitle={title}

@ -44,7 +44,7 @@ class EpisodeDetailsModalContent extends Component {
render() {
const {
episodeId,
albumId,
episodeEntity,
artistId,
artistName,
@ -70,7 +70,7 @@ class EpisodeDetailsModalContent extends Component {
<ModalHeader>
<MonitorToggleButton
className={styles.toggleButton}
id={episodeId}
id={albumId}
monitored={monitored}
size={18}
isDisabled={!artistMonitored}
@ -120,7 +120,7 @@ class EpisodeDetailsModalContent extends Component {
<TabPanel className={styles.tabPanel}>
<EpisodeSummaryConnector
episodeId={episodeId}
albumId={albumId}
episodeEntity={episodeEntity}
releaseDate={releaseDate}
albumLabel={albumLabel}
@ -130,13 +130,13 @@ class EpisodeDetailsModalContent extends Component {
<TabPanel className={styles.tabPanel}>
<AlbumHistoryConnector
albumId={episodeId}
albumId={albumId}
/>
</TabPanel>
<TabPanel className={styles.tabPanel}>
<EpisodeSearchConnector
albumId={episodeId}
albumId={albumId}
startInteractiveSearch={startInteractiveSearch}
onModalClose={onModalClose}
/>
@ -168,7 +168,7 @@ class EpisodeDetailsModalContent extends Component {
}
EpisodeDetailsModalContent.propTypes = {
episodeId: PropTypes.number.isRequired,
albumId: PropTypes.number.isRequired,
episodeEntity: PropTypes.string.isRequired,
artistId: PropTypes.number.isRequired,
artistName: PropTypes.string.isRequired,

@ -15,7 +15,7 @@ function createMapStateToProps() {
return createSelector(
createEpisodeSelector(),
createArtistSelector(),
(episode, series) => {
(album, series) => {
const {
artistName,
nameSlug,
@ -28,7 +28,7 @@ function createMapStateToProps() {
nameSlug,
artistMonitored,
seriesType,
...episode
...album
};
}
);
@ -63,7 +63,7 @@ class EpisodeDetailsModalContentConnector extends Component {
_populate() {
const artistId = this.props.artistId;
const albumId = this.props.episodeId;
const albumId = this.props.albumId;
this.props.fetchTracks({ artistId, albumId });
// this.props.fetchTrackFiles({ artistId, albumId });
}
@ -78,13 +78,13 @@ class EpisodeDetailsModalContentConnector extends Component {
onMonitorAlbumPress = (monitored) => {
const {
episodeId,
albumId,
episodeEntity
} = this.props;
this.props.toggleEpisodeMonitored({
episodeEntity,
episodeId,
albumId,
monitored
});
}
@ -103,7 +103,7 @@ class EpisodeDetailsModalContentConnector extends Component {
}
EpisodeDetailsModalContentConnector.propTypes = {
episodeId: PropTypes.number.isRequired,
albumId: PropTypes.number.isRequired,
episodeEntity: PropTypes.string.isRequired,
artistId: PropTypes.number.isRequired,
fetchTracks: PropTypes.func.isRequired,

@ -36,7 +36,7 @@ class EpisodeSearchCell extends Component {
render() {
const {
episodeId,
albumId,
artistId,
episodeTitle,
isSearching,
@ -59,7 +59,7 @@ class EpisodeSearchCell extends Component {
<EpisodeDetailsModal
isOpen={this.state.isDetailsModalOpen}
episodeId={episodeId}
albumId={albumId}
artistId={artistId}
episodeTitle={episodeTitle}
selectedTab="search"
@ -73,7 +73,7 @@ class EpisodeSearchCell extends Component {
}
EpisodeSearchCell.propTypes = {
episodeId: PropTypes.number.isRequired,
albumId: PropTypes.number.isRequired,
artistId: PropTypes.number.isRequired,
episodeTitle: PropTypes.string.isRequired,
isSearching: PropTypes.bool.isRequired,

@ -9,11 +9,11 @@ import EpisodeSearchCell from './EpisodeSearchCell';
function createMapStateToProps() {
return createSelector(
(state, { episodeId }) => episodeId,
(state, { albumId }) => albumId,
(state, { sceneSeasonNumber }) => sceneSeasonNumber,
createArtistSelector(),
createCommandsSelector(),
(episodeId, sceneSeasonNumber, series, commands) => {
(albumId, sceneSeasonNumber, series, commands) => {
const isSearching = _.some(commands, (command) => {
const episodeSearch = command.name === commandNames.EPISODE_SEARCH;
@ -21,7 +21,7 @@ function createMapStateToProps() {
return false;
}
return command.body.albumIds.indexOf(episodeId) > -1;
return command.body.albumIds.indexOf(albumId) > -1;
});
return {
@ -38,7 +38,7 @@ function createMapDispatchToProps(dispatch, props) {
onSearchPress(name, path) {
dispatch(executeCommand({
name: commandNames.EPISODE_SEARCH,
albumIds: [props.episodeId]
albumIds: [props.albumId]
}));
}
};

@ -46,7 +46,7 @@ class EpisodeStatusConnector extends Component {
}
EpisodeStatusConnector.propTypes = {
episodeId: PropTypes.number.isRequired,
albumId: PropTypes.number.isRequired,
trackFileId: PropTypes.number.isRequired
};

@ -88,8 +88,8 @@ class EpisodeSummary extends Component {
<div className={styles.overview}>
{
hasOverview ?
overview :
'No album overview.'
overview :
'No album overview.'
}
</div>

@ -20,7 +20,7 @@ function createMapStateToProps() {
return {
network: episode.label,
qualityProfileId: episode.profileId,
airDateUtc: episode.releaseDate,
releaseDate: episode.releaseDate,
overview: episode.overview,
items,
columns: tracks.columns

@ -96,7 +96,7 @@ class TrackDetailRow extends Component {
className={styles.status}
>
<EpisodeStatusConnector
episodeId={id}
albumId={id}
trackFileId={trackFileId}
/>
</TableRowCell>

@ -5,32 +5,32 @@ function createBatchToggleEpisodeMonitoredHandler(section, getFromState) {
return function(payload) {
return function(dispatch, getState) {
const {
episodeIds,
albumIds,
monitored
} = payload;
const state = getFromState(getState());
updateEpisodes(dispatch, section, state.items, episodeIds, {
updateEpisodes(dispatch, section, state.items, albumIds, {
isSaving: true
});
const promise = $.ajax({
url: '/episode/monitor',
method: 'PUT',
data: JSON.stringify({ episodeIds, monitored }),
data: JSON.stringify({ albumIds, monitored }),
dataType: 'json'
});
promise.done(() => {
updateEpisodes(dispatch, section, state.items, episodeIds, {
updateEpisodes(dispatch, section, state.items, albumIds, {
isSaving: false,
monitored
});
});
promise.fail(() => {
updateEpisodes(dispatch, section, state.items, episodeIds, {
updateEpisodes(dispatch, section, state.items, albumIds, {
isSaving: false
});
});

@ -5,32 +5,32 @@ function createToggleEpisodeMonitoredHandler(section, getFromState) {
return function(payload) {
return function(dispatch, getState) {
const {
episodeId,
albumId,
monitored
} = payload;
const state = getFromState(getState());
updateEpisodes(dispatch, section, state.items, [episodeId], {
updateEpisodes(dispatch, section, state.items, [albumId], {
isSaving: true
});
const promise = $.ajax({
url: `/episode/${episodeId}`,
url: `/episode/${albumId}`,
method: 'PUT',
data: JSON.stringify({ monitored }),
dataType: 'json'
});
promise.done(() => {
updateEpisodes(dispatch, section, state.items, [episodeId], {
updateEpisodes(dispatch, section, state.items, [albumId], {
isSaving: false,
monitored
});
});
promise.fail(() => {
updateEpisodes(dispatch, section, state.items, [episodeId], {
updateEpisodes(dispatch, section, state.items, [albumId], {
isSaving: false
});
});

@ -14,7 +14,7 @@ const episodeActionHandlers = {
[types.TOGGLE_EPISODE_MONITORED]: function(payload) {
return function(dispatch, getState) {
const {
episodeId: id,
albumId: id,
episodeEntity = episodeEntities.EPISODES,
monitored
} = payload;
@ -64,9 +64,9 @@ const episodeActionHandlers = {
const episodeSection = _.last(episodeEntity.split('.'));
dispatch(batchActions(
albumIds.map((episodeId) => {
albumIds.map((albumId) => {
return updateItem({
id: episodeId,
id: albumId,
section: episodeSection,
isSaving: true
});
@ -82,9 +82,9 @@ const episodeActionHandlers = {
promise.done((data) => {
dispatch(batchActions(
albumIds.map((episodeId) => {
albumIds.map((albumId) => {
return updateItem({
id: episodeId,
id: albumId,
section: episodeSection,
isSaving: false,
monitored
@ -95,9 +95,9 @@ const episodeActionHandlers = {
promise.fail((xhr) => {
dispatch(batchActions(
albumIds.map((episodeId) => {
albumIds.map((albumId) => {
return updateItem({
id: episodeId,
id: albumId,
section: episodeSection,
isSaving: false
});

@ -3,15 +3,15 @@ import { createSelector } from 'reselect';
function createQueueItemSelector() {
return createSelector(
(state, { episodeId }) => episodeId,
(state, { albumId }) => albumId,
(state) => state.queue.details,
(episodeId, details) => {
if (!episodeId) {
(albumId, details) => {
if (!albumId) {
return null;
}
return _.find(details.items, (item) => {
return item.album.id === episodeId;
return item.album.id === albumId;
});
}
);

@ -1,9 +1,9 @@
import _ from 'lodash';
import { update } from 'Store/Actions/baseActions';
function updateEpisodes(dispatch, section, episodes, episodeIds, options) {
function updateEpisodes(dispatch, section, episodes, albumIds, options) {
const data = _.reduce(episodes, (result, item) => {
if (episodeIds.indexOf(item.id) > -1) {
if (albumIds.indexOf(item.id) > -1) {
result.push({
...item,
...options

@ -121,7 +121,7 @@ class CutoffUnmetConnector extends Component {
} = this.props;
this.props.batchToggleCutoffUnmetEpisodes({
episodeIds: selected,
albumIds: selected,
monitored: filterKey !== 'monitored' || !filterValue
});
}

@ -84,7 +84,7 @@ function CutoffUnmetRow(props) {
return (
<TableRowCell key={name}>
<EpisodeTitleLink
episodeId={id}
albumId={id}
artistId={series.id}
episodeEntity={episodeEntities.WANTED_CUTOFF_UNMET}
episodeTitle={title}
@ -123,7 +123,7 @@ function CutoffUnmetRow(props) {
className={styles.status}
>
<EpisodeStatusConnector
episodeId={id}
albumId={id}
trackFileId={trackFileId}
episodeEntity={episodeEntities.WANTED_CUTOFF_UNMET}
/>
@ -135,7 +135,7 @@ function CutoffUnmetRow(props) {
return (
<EpisodeSearchCellConnector
key={name}
episodeId={id}
albumId={id}
artistId={series.id}
episodeTitle={title}
episodeEntity={episodeEntities.WANTED_CUTOFF_UNMET}

@ -111,7 +111,7 @@ class MissingConnector extends Component {
} = this.props;
this.props.batchToggleMissingEpisodes({
episodeIds: selected,
albumIds: selected,
monitored: filterKey !== 'monitored' || !filterValue
});
}

@ -83,7 +83,7 @@ function MissingRow(props) {
return (
<TableRowCell key={name}>
<EpisodeTitleLink
episodeId={id}
albumId={id}
artistId={artist.id}
episodeEntity={episodeEntities.WANTED_MISSING}
episodeTitle={title}
@ -109,7 +109,7 @@ function MissingRow(props) {
// className={styles.status}
// >
// <EpisodeStatusConnector
// episodeId={id}
// albumId={id}
// trackFileId={trackFileId}
// episodeEntity={episodeEntities.WANTED_MISSING}
// />
@ -121,7 +121,7 @@ function MissingRow(props) {
return (
<EpisodeSearchCellConnector
key={name}
episodeId={id}
albumId={id}
artistId={artist.id}
episodeTitle={title}
episodeEntity={episodeEntities.WANTED_MISSING}

Loading…
Cancel
Save