mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Lots of workings to search processing, UI Categories
This commit is contained in:
@@ -4,48 +4,25 @@ import Label from 'Components/Label';
|
||||
|
||||
function CapabilitiesLabel(props) {
|
||||
const {
|
||||
movieSearchAvailable,
|
||||
tvSearchAvailable,
|
||||
musicSearchAvailable,
|
||||
bookSearchAvailable
|
||||
categories
|
||||
} = props.capabilities;
|
||||
|
||||
const filteredList = categories.filter((item) => item.id < 100000).map((item) => item.name).sort();
|
||||
|
||||
return (
|
||||
<span>
|
||||
{
|
||||
bookSearchAvailable ?
|
||||
<Label>
|
||||
{'Books'}
|
||||
</Label> :
|
||||
null
|
||||
filteredList.map((category) => {
|
||||
return (
|
||||
<Label key={category}>
|
||||
{category}
|
||||
</Label>
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
movieSearchAvailable ?
|
||||
<Label>
|
||||
{'Movies'}
|
||||
</Label> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
musicSearchAvailable ?
|
||||
<Label>
|
||||
{'Music'}
|
||||
</Label> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
tvSearchAvailable ?
|
||||
<Label>
|
||||
{'TV'}
|
||||
</Label> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
!tvSearchAvailable && !musicSearchAvailable && !movieSearchAvailable && !bookSearchAvailable ?
|
||||
filteredList.length === 0 ?
|
||||
<Label>
|
||||
{'None'}
|
||||
</Label> :
|
||||
@@ -61,10 +38,7 @@ CapabilitiesLabel.propTypes = {
|
||||
|
||||
CapabilitiesLabel.defaultProps = {
|
||||
capabilities: {
|
||||
movieSearchAvailable: false,
|
||||
tvSearchAvailable: false,
|
||||
musicSearchAvailable: false,
|
||||
bookSearchAvailable: false
|
||||
categories: []
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
.capabilities {
|
||||
composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css';
|
||||
|
||||
flex: 0 0 180px;
|
||||
flex: 0 0 350px;
|
||||
}
|
||||
|
||||
.added {
|
||||
|
@@ -28,7 +28,7 @@
|
||||
.capabilities {
|
||||
composes: cell;
|
||||
|
||||
flex: 0 0 180px;
|
||||
flex: 0 0 350px;
|
||||
}
|
||||
|
||||
.added {
|
||||
|
23
frontend/src/Search/Table/CategoryLabel.js
Normal file
23
frontend/src/Search/Table/CategoryLabel.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import Label from 'Components/Label';
|
||||
|
||||
function CategoryLabel({ categories }) {
|
||||
let catName = '';
|
||||
|
||||
if (categories && categories.length > 0) {
|
||||
catName = categories[0].name;
|
||||
}
|
||||
|
||||
return (
|
||||
<Label>
|
||||
{catName}
|
||||
</Label>
|
||||
);
|
||||
}
|
||||
|
||||
CategoryLabel.propTypes = {
|
||||
categories: PropTypes.arrayOf(PropTypes.object).isRequired
|
||||
};
|
||||
|
||||
export default CategoryLabel;
|
@@ -10,6 +10,7 @@
|
||||
flex: 4 0 110px;
|
||||
}
|
||||
|
||||
.category,
|
||||
.indexer {
|
||||
composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css';
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
flex: 4 0 110px;
|
||||
}
|
||||
|
||||
.category,
|
||||
.indexer {
|
||||
composes: cell;
|
||||
|
||||
|
@@ -10,6 +10,7 @@ import formatDateTime from 'Utilities/Date/formatDateTime';
|
||||
import formatAge from 'Utilities/Number/formatAge';
|
||||
import formatBytes from 'Utilities/Number/formatBytes';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import CategoryLabel from './CategoryLabel';
|
||||
import Peers from './Peers';
|
||||
import ProtocolLabel from './ProtocolLabel';
|
||||
import styles from './SearchIndexRow.css';
|
||||
@@ -22,6 +23,7 @@ class SearchIndexRow extends Component {
|
||||
render() {
|
||||
const {
|
||||
protocol,
|
||||
categories,
|
||||
age,
|
||||
ageHours,
|
||||
ageMinutes,
|
||||
@@ -132,6 +134,19 @@ class SearchIndexRow extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
if (column.name === 'category') {
|
||||
return (
|
||||
<VirtualTableRowCell
|
||||
key={column.name}
|
||||
className={styles[column.name]}
|
||||
>
|
||||
<CategoryLabel
|
||||
categories={categories}
|
||||
/>
|
||||
</VirtualTableRowCell>
|
||||
);
|
||||
}
|
||||
|
||||
if (column.name === 'indexerFlags') {
|
||||
return (
|
||||
<VirtualTableRowCell
|
||||
@@ -192,6 +207,7 @@ class SearchIndexRow extends Component {
|
||||
|
||||
SearchIndexRow.propTypes = {
|
||||
guid: PropTypes.string.isRequired,
|
||||
categories: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
protocol: PropTypes.string.isRequired,
|
||||
age: PropTypes.number.isRequired,
|
||||
ageHours: PropTypes.number.isRequired,
|
||||
|
@@ -66,6 +66,12 @@ export const defaultState = {
|
||||
isSortable: true,
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'category',
|
||||
label: translate('Category'),
|
||||
isSortable: true,
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'indexerFlags',
|
||||
label: React.createElement(Icon, { name: icons.FLAG }),
|
||||
|
Reference in New Issue
Block a user