mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-06 08:34:28 +01:00
Fixed: Refresh Indicator always spinning after refresh
This commit is contained in:
parent
7760248e6b
commit
286f73f38d
4 changed files with 69 additions and 48 deletions
|
|
@ -7,12 +7,14 @@ import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector';
|
||||||
import PageJumpBar from 'Components/Page/PageJumpBar';
|
import PageJumpBar from 'Components/Page/PageJumpBar';
|
||||||
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
||||||
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
import NoMovie from 'Movie/NoMovie';
|
import NoMovie from 'Movie/NoMovie';
|
||||||
import MovieIndexTableConnector from './Table/MovieIndexTableConnector';
|
import MovieIndexTableConnector from './Table/MovieIndexTableConnector';
|
||||||
|
import MovieIndexTableOptionsConnector from './Table/MovieIndexTableOptionsConnector';
|
||||||
import MovieIndexPosterOptionsModal from './Posters/Options/MovieIndexPosterOptionsModal';
|
import MovieIndexPosterOptionsModal from './Posters/Options/MovieIndexPosterOptionsModal';
|
||||||
import MovieIndexPostersConnector from './Posters/MovieIndexPostersConnector';
|
import MovieIndexPostersConnector from './Posters/MovieIndexPostersConnector';
|
||||||
import MovieIndexOverviewOptionsModal from './Overview/Options/MovieIndexOverviewOptionsModal';
|
import MovieIndexOverviewOptionsModal from './Overview/Options/MovieIndexOverviewOptionsModal';
|
||||||
|
|
@ -182,6 +184,7 @@ class MovieIndex extends Component {
|
||||||
error,
|
error,
|
||||||
totalItems,
|
totalItems,
|
||||||
items,
|
items,
|
||||||
|
columns,
|
||||||
selectedFilterKey,
|
selectedFilterKey,
|
||||||
filters,
|
filters,
|
||||||
customFilters,
|
customFilters,
|
||||||
|
|
@ -251,7 +254,7 @@ class MovieIndex extends Component {
|
||||||
<PageToolbarSeparator />
|
<PageToolbarSeparator />
|
||||||
|
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
label="Edit Mode"
|
label="Movie Editor"
|
||||||
iconName={icons.EDIT}
|
iconName={icons.EDIT}
|
||||||
isDisabled={hasNoMovie}
|
isDisabled={hasNoMovie}
|
||||||
/>
|
/>
|
||||||
|
|
@ -262,25 +265,41 @@ class MovieIndex extends Component {
|
||||||
alignContent={align.RIGHT}
|
alignContent={align.RIGHT}
|
||||||
collapseButtons={false}
|
collapseButtons={false}
|
||||||
>
|
>
|
||||||
|
{
|
||||||
|
view === 'table' ?
|
||||||
|
<TableOptionsModalWrapper
|
||||||
|
{...otherProps}
|
||||||
|
columns={columns}
|
||||||
|
optionsComponent={MovieIndexTableOptionsConnector}
|
||||||
|
>
|
||||||
|
<PageToolbarButton
|
||||||
|
label="Options"
|
||||||
|
iconName={icons.TABLE}
|
||||||
|
/>
|
||||||
|
</TableOptionsModalWrapper> :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
view === 'posters' &&
|
view === 'posters' ?
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
label="Options"
|
label="Options"
|
||||||
iconName={icons.POSTER}
|
iconName={icons.POSTER}
|
||||||
isDisabled={hasNoMovie}
|
isDisabled={hasNoMovie}
|
||||||
onPress={this.onPosterOptionsPress}
|
onPress={this.onPosterOptionsPress}
|
||||||
/>
|
/> :
|
||||||
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
view === 'overview' &&
|
view === 'overview' ?
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
label="Options"
|
label="Options"
|
||||||
iconName={icons.OVERVIEW}
|
iconName={icons.OVERVIEW}
|
||||||
isDisabled={hasNoMovie}
|
isDisabled={hasNoMovie}
|
||||||
onPress={this.onOverviewOptionsPress}
|
onPress={this.onOverviewOptionsPress}
|
||||||
/>
|
/> :
|
||||||
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -388,6 +407,7 @@ MovieIndex.propTypes = {
|
||||||
error: PropTypes.object,
|
error: PropTypes.object,
|
||||||
totalItems: PropTypes.number.isRequired,
|
totalItems: PropTypes.number.isRequired,
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
||||||
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
customFilters: 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 createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
import { fetchMovies } from 'Store/Actions/movieActions';
|
import { fetchMovies } from 'Store/Actions/movieActions';
|
||||||
import scrollPositions from 'Store/scrollPositions';
|
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 { executeCommand } from 'Store/Actions/commandActions';
|
||||||
import * as commandNames from 'Commands/commandNames';
|
import * as commandNames from 'Commands/commandNames';
|
||||||
import withScrollPosition from 'Components/withScrollPosition';
|
import withScrollPosition from 'Components/withScrollPosition';
|
||||||
|
|
@ -59,13 +59,41 @@ function createMapStateToProps() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
function createMapDispatchToProps(dispatch, props) {
|
||||||
fetchMovies,
|
return {
|
||||||
setMovieSort,
|
dispatchFetchMovies() {
|
||||||
setMovieFilter,
|
dispatch(fetchMovies);
|
||||||
setMovieView,
|
},
|
||||||
executeCommand
|
|
||||||
};
|
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 {
|
class MovieIndexConnector extends Component {
|
||||||
|
|
||||||
|
|
@ -87,24 +115,16 @@ class MovieIndexConnector extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.fetchMovies();
|
this.props.dispatchFetchMovies();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onSortSelect = (sortKey) => {
|
|
||||||
this.props.setMovieSort({ sortKey });
|
|
||||||
}
|
|
||||||
|
|
||||||
onFilterSelect = (selectedFilterKey) => {
|
|
||||||
this.props.setMovieFilter({ selectedFilterKey });
|
|
||||||
}
|
|
||||||
|
|
||||||
onViewSelect = (view) => {
|
onViewSelect = (view) => {
|
||||||
// Reset the scroll position before changing the view
|
// Reset the scroll position before changing the view
|
||||||
this.setState({ scrollTop: 0 }, () => {
|
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
|
// Render
|
||||||
|
|
||||||
|
|
@ -136,12 +144,8 @@ class MovieIndexConnector extends Component {
|
||||||
<MovieIndex
|
<MovieIndex
|
||||||
{...this.props}
|
{...this.props}
|
||||||
scrollTop={this.state.scrollTop}
|
scrollTop={this.state.scrollTop}
|
||||||
onSortSelect={this.onSortSelect}
|
|
||||||
onFilterSelect={this.onFilterSelect}
|
|
||||||
onViewSelect={this.onViewSelect}
|
onViewSelect={this.onViewSelect}
|
||||||
onScroll={this.onScroll}
|
onScroll={this.onScroll}
|
||||||
onRefreshMoviePress={this.onRefreshMoviePress}
|
|
||||||
onRssSyncPress={this.onRssSyncPress}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -151,14 +155,11 @@ MovieIndexConnector.propTypes = {
|
||||||
isSmallScreen: PropTypes.bool.isRequired,
|
isSmallScreen: PropTypes.bool.isRequired,
|
||||||
view: PropTypes.string.isRequired,
|
view: PropTypes.string.isRequired,
|
||||||
scrollTop: PropTypes.number.isRequired,
|
scrollTop: PropTypes.number.isRequired,
|
||||||
fetchMovies: PropTypes.func.isRequired,
|
dispatchFetchMovies: PropTypes.func.isRequired,
|
||||||
setMovieSort: PropTypes.func.isRequired,
|
dispatchSetMovieView: PropTypes.func.isRequired
|
||||||
setMovieFilter: PropTypes.func.isRequired,
|
|
||||||
setMovieView: PropTypes.func.isRequired,
|
|
||||||
executeCommand: PropTypes.func.isRequired
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withScrollPosition(
|
export default withScrollPosition(
|
||||||
connect(createMapStateToProps, mapDispatchToProps)(MovieIndexConnector),
|
connect(createMapStateToProps, createMapDispatchToProps)(MovieIndexConnector),
|
||||||
'movieIndex'
|
'movieIndex'
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import createMovieSelector from 'Store/Selectors/createMovieSelector';
|
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 createMovieQualityProfileSelector from 'Store/Selectors/createMovieQualityProfileSelector';
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
import * as commandNames from 'Commands/commandNames';
|
import * as commandNames from 'Commands/commandNames';
|
||||||
|
|
|
||||||
|
|
@ -64,12 +64,12 @@ public List<CommandModel> FindQueuedOrStarted(string name)
|
||||||
|
|
||||||
public List<CommandModel> Queued()
|
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()
|
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)
|
public void Start(CommandModel command)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue