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 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';

@ -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 {
<ItemComponent
{...otherProps}
id={id}
onRefreshMoviePress={this.onRefreshMoviePress}
onSearchPress={this.onSearchPress}
/>
);
}

@ -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 {
<PageToolbarButton
label={translate('SyncAppIndexers')}
iconName={icons.REFRESH}
isSpinning={isSyncingIndexers}
onPress={onAppIndexerSyncPress}
/>
<PageToolbarButton
label={translate('TestAllApps')}
iconName={icons.TEST}
isSpinning={isTestingAll}
onPress={dispatchTestAllApplications}
onPress={onTestAllPress}
/>
</Fragment>
}
@ -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;

@ -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);

Loading…
Cancel
Save