Fixed: Refresh Indicator always spinning after refresh

pull/2/head
Qstick 5 years ago
parent 7760248e6b
commit 286f73f38d

@ -7,12 +7,14 @@ import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import PageContent from 'Components/Page/PageContent';
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
import PageJumpBar from 'Components/Page/PageJumpBar';
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
import NoMovie from 'Movie/NoMovie';
import MovieIndexTableConnector from './Table/MovieIndexTableConnector';
import MovieIndexTableOptionsConnector from './Table/MovieIndexTableOptionsConnector';
import MovieIndexPosterOptionsModal from './Posters/Options/MovieIndexPosterOptionsModal';
import MovieIndexPostersConnector from './Posters/MovieIndexPostersConnector';
import MovieIndexOverviewOptionsModal from './Overview/Options/MovieIndexOverviewOptionsModal';
@ -182,6 +184,7 @@ class MovieIndex extends Component {
error,
totalItems,
items,
columns,
selectedFilterKey,
filters,
customFilters,
@ -251,7 +254,7 @@ class MovieIndex extends Component {
<PageToolbarSeparator />
<PageToolbarButton
label="Edit Mode"
label="Movie Editor"
iconName={icons.EDIT}
isDisabled={hasNoMovie}
/>
@ -262,25 +265,41 @@ class MovieIndex extends Component {
alignContent={align.RIGHT}
collapseButtons={false}
>
{
view === 'table' ?
<TableOptionsModalWrapper
{...otherProps}
columns={columns}
optionsComponent={MovieIndexTableOptionsConnector}
>
<PageToolbarButton
label="Options"
iconName={icons.TABLE}
/>
</TableOptionsModalWrapper> :
null
}
{
view === 'posters' &&
view === 'posters' ?
<PageToolbarButton
label="Options"
iconName={icons.POSTER}
isDisabled={hasNoMovie}
onPress={this.onPosterOptionsPress}
/>
/> :
null
}
{
view === 'overview' &&
view === 'overview' ?
<PageToolbarButton
label="Options"
iconName={icons.OVERVIEW}
isDisabled={hasNoMovie}
onPress={this.onOverviewOptionsPress}
/>
/> :
null
}
{
@ -388,6 +407,7 @@ MovieIndex.propTypes = {
error: PropTypes.object,
totalItems: PropTypes.number.isRequired,
items: PropTypes.arrayOf(PropTypes.object).isRequired,
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
customFilters: PropTypes.arrayOf(PropTypes.object).isRequired,

@ -8,7 +8,7 @@ import createCommandExecutingSelector from 'Store/Selectors/createCommandExecuti
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
import { fetchMovies } from 'Store/Actions/movieActions';
import scrollPositions from 'Store/scrollPositions';
import { setMovieSort, setMovieFilter, setMovieView } from 'Store/Actions/movieIndexActions';
import { setMovieSort, setMovieFilter, setMovieView, setMovieTableOption } from 'Store/Actions/movieIndexActions';
import { executeCommand } from 'Store/Actions/commandActions';
import * as commandNames from 'Commands/commandNames';
import withScrollPosition from 'Components/withScrollPosition';
@ -59,13 +59,41 @@ function createMapStateToProps() {
);
}
const mapDispatchToProps = {
fetchMovies,
setMovieSort,
setMovieFilter,
setMovieView,
executeCommand
};
function createMapDispatchToProps(dispatch, props) {
return {
dispatchFetchMovies() {
dispatch(fetchMovies);
},
onTableOptionChange(payload) {
dispatch(setMovieTableOption(payload));
},
onSortSelect(sortKey) {
dispatch(setMovieSort({ sortKey }));
},
onFilterSelect(selectedFilterKey) {
dispatch(setMovieFilter({ selectedFilterKey }));
},
dispatchSetMovieView(view) {
dispatch(setMovieView({ view }));
},
onRefreshMoviePress() {
dispatch(executeCommand({
name: commandNames.REFRESH_MOVIE
}));
},
onRssSyncPress() {
dispatch(executeCommand({
name: commandNames.RSS_SYNC
}));
}
};
}
class MovieIndexConnector extends Component {
@ -87,24 +115,16 @@ class MovieIndexConnector extends Component {
}
componentDidMount() {
this.props.fetchMovies();
this.props.dispatchFetchMovies();
}
//
// Listeners
onSortSelect = (sortKey) => {
this.props.setMovieSort({ sortKey });
}
onFilterSelect = (selectedFilterKey) => {
this.props.setMovieFilter({ selectedFilterKey });
}
onViewSelect = (view) => {
// Reset the scroll position before changing the view
this.setState({ scrollTop: 0 }, () => {
this.props.setMovieView({ view });
this.props.dispatchSetMovieView(view);
});
}
@ -116,18 +136,6 @@ class MovieIndexConnector extends Component {
});
}
onRefreshMoviePress = () => {
this.props.executeCommand({
name: commandNames.REFRESH_MOVIE
});
}
onRssSyncPress = () => {
this.props.executeCommand({
name: commandNames.RSS_SYNC
});
}
//
// Render
@ -136,12 +144,8 @@ class MovieIndexConnector extends Component {
<MovieIndex
{...this.props}
scrollTop={this.state.scrollTop}
onSortSelect={this.onSortSelect}
onFilterSelect={this.onFilterSelect}
onViewSelect={this.onViewSelect}
onScroll={this.onScroll}
onRefreshMoviePress={this.onRefreshMoviePress}
onRssSyncPress={this.onRssSyncPress}
/>
);
}
@ -151,14 +155,11 @@ MovieIndexConnector.propTypes = {
isSmallScreen: PropTypes.bool.isRequired,
view: PropTypes.string.isRequired,
scrollTop: PropTypes.number.isRequired,
fetchMovies: PropTypes.func.isRequired,
setMovieSort: PropTypes.func.isRequired,
setMovieFilter: PropTypes.func.isRequired,
setMovieView: PropTypes.func.isRequired,
executeCommand: PropTypes.func.isRequired
dispatchFetchMovies: PropTypes.func.isRequired,
dispatchSetMovieView: PropTypes.func.isRequired
};
export default withScrollPosition(
connect(createMapStateToProps, mapDispatchToProps)(MovieIndexConnector),
connect(createMapStateToProps, createMapDispatchToProps)(MovieIndexConnector),
'movieIndex'
);

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import createMovieSelector from 'Store/Selectors/createMovieSelector';
import createExecutingCommandsSelector from 'Store/Selectors/createCommandsSelector';
import createExecutingCommandsSelector from 'Store/Selectors/createExecutingCommandsSelector';
import createMovieQualityProfileSelector from 'Store/Selectors/createMovieQualityProfileSelector';
import { executeCommand } from 'Store/Actions/commandActions';
import * as commandNames from 'Commands/commandNames';

@ -64,12 +64,12 @@ namespace NzbDrone.Core.Messaging.Commands
public List<CommandModel> Queued()
{
return Query.Where(c => c.Status == CommandStatus.Queued).ToList();
return Query.Where(c => c.Status == CommandStatus.Queued);
}
public List<CommandModel> Started()
{
return Query.Where(c => c.Status == CommandStatus.Started).ToList();
return Query.Where(c => c.Status == CommandStatus.Started);
}
public void Start(CommandModel command)

Loading…
Cancel
Save