|
|
@ -1,4 +1,4 @@
|
|
|
|
import _ from 'lodash';
|
|
|
|
import { groupBy, map } from 'lodash';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
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';
|
|
|
@ -12,7 +12,7 @@ function createMapStateToProps() {
|
|
|
|
(state) => state.indexers,
|
|
|
|
(state) => state.indexers,
|
|
|
|
(value, indexers) => {
|
|
|
|
(value, indexers) => {
|
|
|
|
const values = [];
|
|
|
|
const values = [];
|
|
|
|
const groupedIndexers = _.map(_.groupBy(indexers.items, 'protocol'), (val, key) => ({ protocol: key, indexers: val }));
|
|
|
|
const groupedIndexers = map(groupBy(indexers.items, 'protocol'), (val, key) => ({ protocol: key, indexers: val }));
|
|
|
|
|
|
|
|
|
|
|
|
groupedIndexers.forEach((element) => {
|
|
|
|
groupedIndexers.forEach((element) => {
|
|
|
|
values.push({
|
|
|
|
values.push({
|
|
|
@ -25,6 +25,7 @@ function createMapStateToProps() {
|
|
|
|
values.push({
|
|
|
|
values.push({
|
|
|
|
key: indexer.id,
|
|
|
|
key: indexer.id,
|
|
|
|
value: indexer.name,
|
|
|
|
value: indexer.name,
|
|
|
|
|
|
|
|
hint: `(${indexer.id})`,
|
|
|
|
isDisabled: !indexer.enable,
|
|
|
|
isDisabled: !indexer.enable,
|
|
|
|
parentKey: element.protocol === 'usenet' ? -1 : -2
|
|
|
|
parentKey: element.protocol === 'usenet' ? -1 : -2
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -50,7 +51,6 @@ class IndexersSelectInputConnector extends Component {
|
|
|
|
// Render
|
|
|
|
// Render
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<EnhancedSelectInput
|
|
|
|
<EnhancedSelectInput
|
|
|
|
{...this.props}
|
|
|
|
{...this.props}
|
|
|
|