Lots of workings to search processing, UI Categories

This commit is contained in:
Qstick
2020-11-19 16:32:15 -05:00
parent 710b4f5ec6
commit 8e72c7153d
51 changed files with 736 additions and 240 deletions

View File

@@ -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: []
}
};

View File

@@ -21,7 +21,7 @@
.capabilities {
composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css';
flex: 0 0 180px;
flex: 0 0 350px;
}
.added {

View File

@@ -28,7 +28,7 @@
.capabilities {
composes: cell;
flex: 0 0 180px;
flex: 0 0 350px;
}
.added {

View 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;

View File

@@ -10,6 +10,7 @@
flex: 4 0 110px;
}
.category,
.indexer {
composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css';

View File

@@ -17,6 +17,7 @@
flex: 4 0 110px;
}
.category,
.indexer {
composes: cell;

View File

@@ -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,

View File

@@ -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 }),