mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-31 04:00:18 -07:00
Fixed: Improve Selection of Executing Commands in Artist list
This commit is contained in:
parent
789ce8a58f
commit
63f9338d2f
3 changed files with 22 additions and 13 deletions
|
@ -4,9 +4,8 @@ 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 { isCommandExecuting } from 'Utilities/Command';
|
|
||||||
import createArtistSelector from 'Store/Selectors/createArtistSelector';
|
import createArtistSelector from 'Store/Selectors/createArtistSelector';
|
||||||
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
import createExecutingCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
||||||
import createQualityProfileSelector from 'Store/Selectors/createQualityProfileSelector';
|
import createQualityProfileSelector from 'Store/Selectors/createQualityProfileSelector';
|
||||||
import createLanguageProfileSelector from 'Store/Selectors/createLanguageProfileSelector';
|
import createLanguageProfileSelector from 'Store/Selectors/createLanguageProfileSelector';
|
||||||
import createMetadataProfileSelector from 'Store/Selectors/createMetadataProfileSelector';
|
import createMetadataProfileSelector from 'Store/Selectors/createMetadataProfileSelector';
|
||||||
|
@ -40,28 +39,26 @@ function createMapStateToProps() {
|
||||||
createLanguageProfileSelector(),
|
createLanguageProfileSelector(),
|
||||||
createMetadataProfileSelector(),
|
createMetadataProfileSelector(),
|
||||||
selectShowSearchAction(),
|
selectShowSearchAction(),
|
||||||
createCommandsSelector(),
|
createExecutingCommandsSelector(),
|
||||||
(
|
(
|
||||||
artist,
|
artist,
|
||||||
qualityProfile,
|
qualityProfile,
|
||||||
languageProfile,
|
languageProfile,
|
||||||
metadataProfile,
|
metadataProfile,
|
||||||
showSearchAction,
|
showSearchAction,
|
||||||
commands
|
executingCommands
|
||||||
) => {
|
) => {
|
||||||
const isRefreshingArtist = commands.some((command) => {
|
const isRefreshingArtist = executingCommands.some((command) => {
|
||||||
return (
|
return (
|
||||||
command.name === commandNames.REFRESH_ARTIST &&
|
command.name === commandNames.REFRESH_ARTIST &&
|
||||||
command.body.artistId === artist.id &&
|
command.body.artistId === artist.id
|
||||||
isCommandExecuting(command)
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const isSearchingArtist = commands.some((command) => {
|
const isSearchingArtist = executingCommands.some((command) => {
|
||||||
return (
|
return (
|
||||||
command.name === commandNames.ARTIST_SEARCH &&
|
command.name === commandNames.ARTIST_SEARCH &&
|
||||||
command.body.artistId === artist.id &&
|
command.body.artistId === artist.id
|
||||||
isCommandExecuting(command)
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import createAllArtistSelector from './createAllArtistSelector';
|
import createAllArtistSelector from './createAllArtistSelector';
|
||||||
|
|
||||||
|
@ -6,8 +5,8 @@ function createArtistSelector() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state, { artistId }) => artistId,
|
(state, { artistId }) => artistId,
|
||||||
createAllArtistSelector(),
|
createAllArtistSelector(),
|
||||||
(artistId, artist) => {
|
(artistId, allArtists) => {
|
||||||
return _.find(artist, { id: artistId });
|
return allArtists.find((artist) => artist.id === artistId );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
Loading…
Add table
Add a link
Reference in a new issue