diff --git a/frontend/src/Commands/commandNames.js b/frontend/src/Commands/commandNames.js index 25ac29640..ac6fd2b27 100644 --- a/frontend/src/Commands/commandNames.js +++ b/frontend/src/Commands/commandNames.js @@ -1,19 +1,9 @@ export const APPLICATION_UPDATE = 'ApplicationUpdate'; export const BACKUP = 'Backup'; -export const REFRESH_MONITORED_DOWNLOADS = 'RefreshMonitoredDownloads'; -export const CLEAR_BLACKLIST = 'ClearBlacklist'; export const CLEAR_LOGS = 'ClearLog'; -export const CUTOFF_UNMET_MOVIES_SEARCH = 'CutoffUnmetMoviesSearch'; export const DELETE_LOG_FILES = 'DeleteLogFiles'; export const DELETE_UPDATE_LOG_FILES = 'DeleteUpdateLogFiles'; -export const DOWNLOADED_MOVIES_SCAN = 'DownloadedMoviesScan'; 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 RSS_SYNC = 'RssSync'; -export const MOVIE_SEARCH = 'MoviesSearch'; -export const IMPORT_LIST_SYNC = 'ImportListSync'; +export const APP_INDEXER_SYNC = 'ApplicationIndexerSync'; diff --git a/frontend/src/Indexer/Index/MovieIndexItemConnector.js b/frontend/src/Indexer/Index/MovieIndexItemConnector.js index 48abd6ba8..4856cf140 100644 --- a/frontend/src/Indexer/Index/MovieIndexItemConnector.js +++ b/frontend/src/Indexer/Index/MovieIndexItemConnector.js @@ -2,9 +2,7 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; -import * as commandNames from 'Commands/commandNames'; import { executeCommand } from 'Store/Actions/commandActions'; -import createExecutingCommandsSelector from 'Store/Selectors/createExecutingCommandsSelector'; import createIndexerSelector from 'Store/Selectors/createIndexerSelector'; import createIndexerStatusSelector from 'Store/Selectors/createIndexerStatusSelector'; import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; @@ -23,13 +21,11 @@ function createMapStateToProps() { createIndexerSelector(), createIndexerStatusSelector(), selectShowSearchAction(), - createExecutingCommandsSelector(), createUISettingsSelector(), ( movie, status, showSearchAction, - executingCommands, uiSettings ) => { @@ -42,26 +38,10 @@ function createMapStateToProps() { 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 { ...movie, status, showSearchAction, - isRefreshingMovie, - isSearchingMovie, longDateFormat: uiSettings.longDateFormat, timeFormat: uiSettings.timeFormat }; @@ -75,23 +55,6 @@ const mapDispatchToProps = { 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 @@ -110,8 +73,6 @@ class MovieIndexItemConnector extends Component { ); } diff --git a/frontend/src/Settings/Applications/ApplicationSettings.js b/frontend/src/Settings/Applications/ApplicationSettings.js index 545fc81be..6c35724df 100644 --- a/frontend/src/Settings/Applications/ApplicationSettings.js +++ b/frontend/src/Settings/Applications/ApplicationSettings.js @@ -13,7 +13,9 @@ class ApplicationSettings extends Component { render() { const { isTestingAll, - dispatchTestAllApplications + isSyncingIndexers, + onTestAllPress, + onAppIndexerSyncPress } = this.props; return ( @@ -27,13 +29,15 @@ class ApplicationSettings extends Component { } @@ -49,7 +53,9 @@ class ApplicationSettings extends Component { ApplicationSettings.propTypes = { isTestingAll: PropTypes.bool.isRequired, - dispatchTestAllApplications: PropTypes.func.isRequired + isSyncingIndexers: PropTypes.bool.isRequired, + onTestAllPress: PropTypes.func.isRequired, + onAppIndexerSyncPress: PropTypes.func.isRequired }; export default ApplicationSettings; diff --git a/frontend/src/Settings/Applications/ApplicationSettingsConnector.js b/frontend/src/Settings/Applications/ApplicationSettingsConnector.js index 827abbe16..aece6e91f 100644 --- a/frontend/src/Settings/Applications/ApplicationSettingsConnector.js +++ b/frontend/src/Settings/Applications/ApplicationSettingsConnector.js @@ -1,21 +1,35 @@ import { connect } from 'react-redux'; import { createSelector } from 'reselect'; +import * as commandNames from 'Commands/commandNames'; +import { executeCommand } from 'Store/Actions/commandActions'; import { testAllApplications } from 'Store/Actions/settingsActions'; +import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector'; import ApplicationSettings from './ApplicationSettings'; function createMapStateToProps() { return createSelector( (state) => state.settings.applications.isTestingAll, - (isTestingAll) => { + createCommandExecutingSelector(commandNames.APP_INDEXER_SYNC), + (isTestingAll, isSyncingIndexers) => { return { - isTestingAll + isTestingAll, + isSyncingIndexers }; } ); } -const mapDispatchToProps = { - dispatchTestAllApplications: testAllApplications -}; +function mapDispatchToProps(dispatch, props) { + return { + onTestAllPress() { + dispatch(testAllApplications()); + }, + onAppIndexerSyncPress() { + dispatch(executeCommand({ + name: commandNames.APP_INDEXER_SYNC + })); + } + }; +} export default connect(createMapStateToProps, mapDispatchToProps)(ApplicationSettings);