mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
Better selection of executing commands in series list
This commit is contained in:
parent
e5f264a510
commit
8087996c8e
@ -3,9 +3,8 @@ import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { isCommandExecuting } from 'Utilities/Command';
|
||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
||||
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
||||
import createExecutingCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
||||
import createQualityProfileSelector from 'Store/Selectors/createQualityProfileSelector';
|
||||
import createLanguageProfileSelector from 'Store/Selectors/createLanguageProfileSelector';
|
||||
import { executeCommand } from 'Store/Actions/commandActions';
|
||||
@ -35,27 +34,25 @@ function createMapStateToProps() {
|
||||
createQualityProfileSelector(),
|
||||
createLanguageProfileSelector(),
|
||||
selectShowSearchAction(),
|
||||
createCommandsSelector(),
|
||||
createExecutingCommandsSelector(),
|
||||
(
|
||||
series,
|
||||
qualityProfile,
|
||||
languageProfile,
|
||||
showSearchAction,
|
||||
commands
|
||||
executingCommands
|
||||
) => {
|
||||
const isRefreshingSeries = commands.some((command) => {
|
||||
const isRefreshingSeries = executingCommands.some((command) => {
|
||||
return (
|
||||
command.name === commandNames.REFRESH_SERIES &&
|
||||
command.body.seriesId === series.id &&
|
||||
isCommandExecuting(command)
|
||||
command.body.seriesId === series.id
|
||||
);
|
||||
});
|
||||
|
||||
const isSearchingSeries = commands.some((command) => {
|
||||
const isSearchingSeries = executingCommands.some((command) => {
|
||||
return (
|
||||
command.name === commandNames.SERIES_SEARCH &&
|
||||
command.body.seriesId === series.id &&
|
||||
isCommandExecuting(command)
|
||||
command.body.seriesId === series.id
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
import { createSelector } from 'reselect';
|
||||
import { isCommandExecuting } from 'Utilities/Command';
|
||||
|
||||
function createExecutingCommandsSelector() {
|
||||
return createSelector(
|
||||
(state) => state.commands.items,
|
||||
(commands) => {
|
||||
return commands.filter((command) => isCommandExecuting(command));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export default createExecutingCommandsSelector;
|
@ -1,4 +1,3 @@
|
||||
import _ from 'lodash';
|
||||
import { createSelector } from 'reselect';
|
||||
import createAllSeriesSelector from './createAllSeriesSelector';
|
||||
|
||||
@ -6,8 +5,8 @@ function createSeriesSelector() {
|
||||
return createSelector(
|
||||
(state, { seriesId }) => seriesId,
|
||||
createAllSeriesSelector(),
|
||||
(seriesId, series) => {
|
||||
return _.find(series, { id: seriesId });
|
||||
(seriesId, allSeries) => {
|
||||
return allSeries.find((series) => series.id === seriesId);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user