Fixed: Episode details on history episode file information
This commit is contained in:
parent
2b4519a4ad
commit
30a512c880
|
@ -8,6 +8,7 @@ import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
||||||
import withCurrentPage from 'Components/withCurrentPage';
|
import withCurrentPage from 'Components/withCurrentPage';
|
||||||
import * as historyActions from 'Store/Actions/historyActions';
|
import * as historyActions from 'Store/Actions/historyActions';
|
||||||
import { fetchEpisodes, clearEpisodes } from 'Store/Actions/episodeActions';
|
import { fetchEpisodes, clearEpisodes } from 'Store/Actions/episodeActions';
|
||||||
|
import { clearEpisodeFiles } from 'Store/Actions/episodeFileActions';
|
||||||
import History from './History';
|
import History from './History';
|
||||||
|
|
||||||
function createMapStateToProps() {
|
function createMapStateToProps() {
|
||||||
|
@ -28,7 +29,8 @@ function createMapStateToProps() {
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
...historyActions,
|
...historyActions,
|
||||||
fetchEpisodes,
|
fetchEpisodes,
|
||||||
clearEpisodes
|
clearEpisodes,
|
||||||
|
clearEpisodeFiles
|
||||||
};
|
};
|
||||||
|
|
||||||
class HistoryConnector extends Component {
|
class HistoryConnector extends Component {
|
||||||
|
@ -68,6 +70,7 @@ class HistoryConnector extends Component {
|
||||||
unregisterPagePopulator(this.repopulate);
|
unregisterPagePopulator(this.repopulate);
|
||||||
this.props.clearHistory();
|
this.props.clearHistory();
|
||||||
this.props.clearEpisodes();
|
this.props.clearEpisodes();
|
||||||
|
this.props.clearEpisodeFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -150,7 +153,8 @@ HistoryConnector.propTypes = {
|
||||||
setHistoryTableOption: PropTypes.func.isRequired,
|
setHistoryTableOption: PropTypes.func.isRequired,
|
||||||
clearHistory: PropTypes.func.isRequired,
|
clearHistory: PropTypes.func.isRequired,
|
||||||
fetchEpisodes: PropTypes.func.isRequired,
|
fetchEpisodes: PropTypes.func.isRequired,
|
||||||
clearEpisodes: PropTypes.func.isRequired
|
clearEpisodes: PropTypes.func.isRequired,
|
||||||
|
clearEpisodeFiles: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withCurrentPage(
|
export default withCurrentPage(
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { deleteEpisodeFile } from 'Store/Actions/episodeFileActions';
|
import { fetchEpisodeFile, deleteEpisodeFile } from 'Store/Actions/episodeFileActions';
|
||||||
import createEpisodeSelector from 'Store/Selectors/createEpisodeSelector';
|
import createEpisodeSelector from 'Store/Selectors/createEpisodeSelector';
|
||||||
import createEpisodeFileSelector from 'Store/Selectors/createEpisodeFileSelector';
|
import createEpisodeFileSelector from 'Store/Selectors/createEpisodeFileSelector';
|
||||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
||||||
|
@ -52,8 +54,50 @@ function createMapDispatchToProps(dispatch, props) {
|
||||||
id: props.episodeFileId,
|
id: props.episodeFileId,
|
||||||
episodeEntity: props.episodeEntity
|
episodeEntity: props.episodeEntity
|
||||||
}));
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
dispatchFetchEpisodeFile() {
|
||||||
|
dispatch(fetchEpisodeFile({
|
||||||
|
id: props.episodeFileId
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(createMapStateToProps, createMapDispatchToProps)(EpisodeSummary);
|
class EpisodeSummaryConnector extends Component {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lifecycle
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const {
|
||||||
|
episodeFileId,
|
||||||
|
path,
|
||||||
|
dispatchFetchEpisodeFile
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
if (episodeFileId && !path) {
|
||||||
|
dispatchFetchEpisodeFile({ id: episodeFileId });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Render
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
dispatchFetchEpisodeFile,
|
||||||
|
...otherProps
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
return <EpisodeSummary {...otherProps} />;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EpisodeSummaryConnector.propTypes = {
|
||||||
|
episodeFileId: PropTypes.number,
|
||||||
|
path: PropTypes.string,
|
||||||
|
dispatchFetchEpisodeFile: PropTypes.func.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(createMapStateToProps, createMapDispatchToProps)(EpisodeSummaryConnector);
|
||||||
|
|
|
@ -31,6 +31,7 @@ export const defaultState = {
|
||||||
//
|
//
|
||||||
// Actions Types
|
// Actions Types
|
||||||
|
|
||||||
|
export const FETCH_EPISODE_FILE = 'episodeFiles/fetchEpisodeFile';
|
||||||
export const FETCH_EPISODE_FILES = 'episodeFiles/fetchEpisodeFiles';
|
export const FETCH_EPISODE_FILES = 'episodeFiles/fetchEpisodeFiles';
|
||||||
export const DELETE_EPISODE_FILE = 'episodeFiles/deleteEpisodeFile';
|
export const DELETE_EPISODE_FILE = 'episodeFiles/deleteEpisodeFile';
|
||||||
export const DELETE_EPISODE_FILES = 'episodeFiles/deleteEpisodeFiles';
|
export const DELETE_EPISODE_FILES = 'episodeFiles/deleteEpisodeFiles';
|
||||||
|
@ -40,6 +41,7 @@ export const CLEAR_EPISODE_FILES = 'episodeFiles/clearEpisodeFiles';
|
||||||
//
|
//
|
||||||
// Action Creators
|
// Action Creators
|
||||||
|
|
||||||
|
export const fetchEpisodeFile = createThunk(FETCH_EPISODE_FILE);
|
||||||
export const fetchEpisodeFiles = createThunk(FETCH_EPISODE_FILES);
|
export const fetchEpisodeFiles = createThunk(FETCH_EPISODE_FILES);
|
||||||
export const deleteEpisodeFile = createThunk(DELETE_EPISODE_FILE);
|
export const deleteEpisodeFile = createThunk(DELETE_EPISODE_FILE);
|
||||||
export const deleteEpisodeFiles = createThunk(DELETE_EPISODE_FILES);
|
export const deleteEpisodeFiles = createThunk(DELETE_EPISODE_FILES);
|
||||||
|
@ -55,6 +57,7 @@ const deleteEpisodeFileHelper = createRemoveItemHandler(section, '/episodeFile')
|
||||||
// Action Handlers
|
// Action Handlers
|
||||||
|
|
||||||
export const actionHandlers = handleThunks({
|
export const actionHandlers = handleThunks({
|
||||||
|
[FETCH_EPISODE_FILE]: createFetchHandler(section, '/episodeFile'),
|
||||||
[FETCH_EPISODE_FILES]: createFetchHandler(section, '/episodeFile'),
|
[FETCH_EPISODE_FILES]: createFetchHandler(section, '/episodeFile'),
|
||||||
|
|
||||||
[DELETE_EPISODE_FILE]: function(getState, payload, dispatch) {
|
[DELETE_EPISODE_FILE]: function(getState, payload, dispatch) {
|
||||||
|
|
Loading…
Reference in New Issue