mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-26 23:06:43 -04:00
Fixed delete from mass editor
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import _ from 'lodash';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { bulkDeleteIndexers } from 'Store/Actions/indexerIndexActions';
|
||||
import createAllIndexersSelector from 'Store/Selectors/createAllIndexersSelector';
|
||||
import DeleteIndexerModalContent from './DeleteIndexerModalContent';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state, { indexerIds }) => indexerIds,
|
||||
createAllIndexersSelector(),
|
||||
(indexerIds, allIndexers) => {
|
||||
const selectedMovie = _.intersectionWith(allIndexers, indexerIds, (s, id) => {
|
||||
return s.id === id;
|
||||
});
|
||||
|
||||
const sortedMovies = _.orderBy(selectedMovie, 'name');
|
||||
const indexers = _.map(sortedMovies, (s) => {
|
||||
return {
|
||||
name: s.name
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
indexers
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function createMapDispatchToProps(dispatch, props) {
|
||||
return {
|
||||
onDeleteSelectedPress() {
|
||||
dispatch(bulkDeleteIndexers({
|
||||
indexerIds: props.indexerIds
|
||||
}));
|
||||
|
||||
props.onModalClose();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(createMapStateToProps, createMapDispatchToProps)(DeleteIndexerModalContent);
|
||||
Reference in New Issue
Block a user