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

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