Fixed: App command status not showing in UI (No Spin)

pull/17/head
Qstick 4 years ago
parent b870f96ec8
commit 59e30805a2

@ -1,19 +1,9 @@
export const APPLICATION_UPDATE = 'ApplicationUpdate'; export const APPLICATION_UPDATE = 'ApplicationUpdate';
export const BACKUP = 'Backup'; export const BACKUP = 'Backup';
export const REFRESH_MONITORED_DOWNLOADS = 'RefreshMonitoredDownloads';
export const CLEAR_BLACKLIST = 'ClearBlacklist';
export const CLEAR_LOGS = 'ClearLog'; export const CLEAR_LOGS = 'ClearLog';
export const CUTOFF_UNMET_MOVIES_SEARCH = 'CutoffUnmetMoviesSearch';
export const DELETE_LOG_FILES = 'DeleteLogFiles'; export const DELETE_LOG_FILES = 'DeleteLogFiles';
export const DELETE_UPDATE_LOG_FILES = 'DeleteUpdateLogFiles'; export const DELETE_UPDATE_LOG_FILES = 'DeleteUpdateLogFiles';
export const DOWNLOADED_MOVIES_SCAN = 'DownloadedMoviesScan';
export const INTERACTIVE_IMPORT = 'ManualImport'; export const INTERACTIVE_IMPORT = 'ManualImport';
export const MISSING_MOVIES_SEARCH = 'MissingMoviesSearch';
export const MOVE_MOVIE = 'MoveMovie';
export const REFRESH_MOVIE = 'RefreshMovie';
export const RENAME_FILES = 'RenameFiles';
export const RENAME_MOVIE = 'RenameMovie';
export const RESET_API_KEY = 'ResetApiKey'; export const RESET_API_KEY = 'ResetApiKey';
export const RSS_SYNC = 'RssSync'; export const RSS_SYNC = 'RssSync';
export const MOVIE_SEARCH = 'MoviesSearch'; export const APP_INDEXER_SYNC = 'ApplicationIndexerSync';
export const IMPORT_LIST_SYNC = 'ImportListSync';

@ -2,9 +2,7 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import * as commandNames from 'Commands/commandNames';
import { executeCommand } from 'Store/Actions/commandActions'; import { executeCommand } from 'Store/Actions/commandActions';
import createExecutingCommandsSelector from 'Store/Selectors/createExecutingCommandsSelector';
import createIndexerSelector from 'Store/Selectors/createIndexerSelector'; import createIndexerSelector from 'Store/Selectors/createIndexerSelector';
import createIndexerStatusSelector from 'Store/Selectors/createIndexerStatusSelector'; import createIndexerStatusSelector from 'Store/Selectors/createIndexerStatusSelector';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
@ -23,13 +21,11 @@ function createMapStateToProps() {
createIndexerSelector(), createIndexerSelector(),
createIndexerStatusSelector(), createIndexerStatusSelector(),
selectShowSearchAction(), selectShowSearchAction(),
createExecutingCommandsSelector(),
createUISettingsSelector(), createUISettingsSelector(),
( (
movie, movie,
status, status,
showSearchAction, showSearchAction,
executingCommands,
uiSettings uiSettings
) => { ) => {
@ -42,26 +38,10 @@ function createMapStateToProps() {
return {}; return {};
} }
const isRefreshingMovie = executingCommands.some((command) => {
return (
command.name === commandNames.REFRESH_MOVIE &&
command.body.movieIds.includes(movie.id)
);
});
const isSearchingMovie = executingCommands.some((command) => {
return (
command.name === commandNames.MOVIE_SEARCH &&
command.body.movieIds.includes(movie.id)
);
});
return { return {
...movie, ...movie,
status, status,
showSearchAction, showSearchAction,
isRefreshingMovie,
isSearchingMovie,
longDateFormat: uiSettings.longDateFormat, longDateFormat: uiSettings.longDateFormat,
timeFormat: uiSettings.timeFormat timeFormat: uiSettings.timeFormat
}; };
@ -75,23 +55,6 @@ const mapDispatchToProps = {
class MovieIndexItemConnector extends Component { class MovieIndexItemConnector extends Component {
//
// Listeners
onRefreshMoviePress = () => {
this.props.dispatchExecuteCommand({
name: commandNames.REFRESH_MOVIE,
movieIds: [this.props.id]
});
}
onSearchPress = () => {
this.props.dispatchExecuteCommand({
name: commandNames.MOVIE_SEARCH,
movieIds: [this.props.id]
});
}
// //
// Render // Render
@ -110,8 +73,6 @@ class MovieIndexItemConnector extends Component {
<ItemComponent <ItemComponent
{...otherProps} {...otherProps}
id={id} id={id}
onRefreshMoviePress={this.onRefreshMoviePress}
onSearchPress={this.onSearchPress}
/> />
); );
} }

@ -13,7 +13,9 @@ class ApplicationSettings extends Component {
render() { render() {
const { const {
isTestingAll, isTestingAll,
dispatchTestAllApplications isSyncingIndexers,
onTestAllPress,
onAppIndexerSyncPress
} = this.props; } = this.props;
return ( return (
@ -27,13 +29,15 @@ class ApplicationSettings extends Component {
<PageToolbarButton <PageToolbarButton
label={translate('SyncAppIndexers')} label={translate('SyncAppIndexers')}
iconName={icons.REFRESH} iconName={icons.REFRESH}
isSpinning={isSyncingIndexers}
onPress={onAppIndexerSyncPress}
/> />
<PageToolbarButton <PageToolbarButton
label={translate('TestAllApps')} label={translate('TestAllApps')}
iconName={icons.TEST} iconName={icons.TEST}
isSpinning={isTestingAll} isSpinning={isTestingAll}
onPress={dispatchTestAllApplications} onPress={onTestAllPress}
/> />
</Fragment> </Fragment>
} }
@ -49,7 +53,9 @@ class ApplicationSettings extends Component {
ApplicationSettings.propTypes = { ApplicationSettings.propTypes = {
isTestingAll: PropTypes.bool.isRequired, isTestingAll: PropTypes.bool.isRequired,
dispatchTestAllApplications: PropTypes.func.isRequired isSyncingIndexers: PropTypes.bool.isRequired,
onTestAllPress: PropTypes.func.isRequired,
onAppIndexerSyncPress: PropTypes.func.isRequired
}; };
export default ApplicationSettings; export default ApplicationSettings;

@ -1,21 +1,35 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import * as commandNames from 'Commands/commandNames';
import { executeCommand } from 'Store/Actions/commandActions';
import { testAllApplications } from 'Store/Actions/settingsActions'; import { testAllApplications } from 'Store/Actions/settingsActions';
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
import ApplicationSettings from './ApplicationSettings'; import ApplicationSettings from './ApplicationSettings';
function createMapStateToProps() { function createMapStateToProps() {
return createSelector( return createSelector(
(state) => state.settings.applications.isTestingAll, (state) => state.settings.applications.isTestingAll,
(isTestingAll) => { createCommandExecutingSelector(commandNames.APP_INDEXER_SYNC),
(isTestingAll, isSyncingIndexers) => {
return { return {
isTestingAll isTestingAll,
isSyncingIndexers
}; };
} }
); );
} }
const mapDispatchToProps = { function mapDispatchToProps(dispatch, props) {
dispatchTestAllApplications: testAllApplications return {
}; onTestAllPress() {
dispatch(testAllApplications());
},
onAppIndexerSyncPress() {
dispatch(executeCommand({
name: commandNames.APP_INDEXER_SYNC
}));
}
};
}
export default connect(createMapStateToProps, mapDispatchToProps)(ApplicationSettings); export default connect(createMapStateToProps, mapDispatchToProps)(ApplicationSettings);

Loading…
Cancel
Save