mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-19 22:04:56 -04:00
76f30e7682
(cherry picked from commit 1a1c8e6c08a6db5fcd2b5d17e65fa1f943d2e746)
66 lines
1.6 KiB
JavaScript
66 lines
1.6 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import React, { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { createSelector } from 'reselect';
|
|
import { deleteIndexerProxy, fetchIndexerProxies } from 'Store/Actions/settingsActions';
|
|
import createSortedSectionSelector from 'Store/Selectors/createSortedSectionSelector';
|
|
import createTagsSelector from 'Store/Selectors/createTagsSelector';
|
|
import sortByProp from 'Utilities/Array/sortByProp';
|
|
import IndexerProxies from './IndexerProxies';
|
|
|
|
function createMapStateToProps() {
|
|
return createSelector(
|
|
createSortedSectionSelector('settings.indexerProxies', sortByProp('name')),
|
|
createSortedSectionSelector('indexers', sortByProp('name')),
|
|
createTagsSelector(),
|
|
(indexerProxies, indexers, tagList) => {
|
|
return {
|
|
...indexerProxies,
|
|
indexerList: indexers.items,
|
|
tagList
|
|
};
|
|
}
|
|
);
|
|
}
|
|
|
|
const mapDispatchToProps = {
|
|
fetchIndexerProxies,
|
|
deleteIndexerProxy
|
|
};
|
|
|
|
class IndexerProxiesConnector extends Component {
|
|
|
|
//
|
|
// Lifecycle
|
|
|
|
componentDidMount() {
|
|
this.props.fetchIndexerProxies();
|
|
}
|
|
|
|
//
|
|
// Listeners
|
|
|
|
onConfirmDeleteIndexerProxy = (id) => {
|
|
this.props.deleteIndexerProxy({ id });
|
|
};
|
|
|
|
//
|
|
// Render
|
|
|
|
render() {
|
|
return (
|
|
<IndexerProxies
|
|
{...this.props}
|
|
onConfirmDeleteIndexerProxy={this.onConfirmDeleteIndexerProxy}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
IndexerProxiesConnector.propTypes = {
|
|
fetchIndexerProxies: PropTypes.func.isRequired,
|
|
deleteIndexerProxy: PropTypes.func.isRequired
|
|
};
|
|
|
|
export default connect(createMapStateToProps, mapDispatchToProps)(IndexerProxiesConnector);
|