Fixed: Better sorting of releases in manual search

Fixes #1472
pull/1486/head
Qstick 2 years ago
parent ed8a979fc6
commit 05b477e9d1

@ -10,7 +10,7 @@ function SearchIndexFilterMenu(props) {
filters,
customFilters,
isDisabled,
onFilterSelect
onFilterSelect,
} = props;
return (
@ -27,15 +27,16 @@ function SearchIndexFilterMenu(props) {
}
SearchIndexFilterMenu.propTypes = {
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
.isRequired,
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
customFilters: PropTypes.arrayOf(PropTypes.object).isRequired,
isDisabled: PropTypes.bool.isRequired,
onFilterSelect: PropTypes.func.isRequired
onFilterSelect: PropTypes.func.isRequired,
};
SearchIndexFilterMenu.defaultProps = {
showCustomFilters: false
showCustomFilters: false,
};
export default SearchIndexFilterMenu;

@ -7,18 +7,10 @@ import { align, sortDirections } from 'Helpers/Props';
import translate from 'Utilities/String/translate';
function SearchIndexSortMenu(props) {
const {
sortKey,
sortDirection,
isDisabled,
onSortSelect
} = props;
const { sortKey, sortDirection, isDisabled, onSortSelect } = props;
return (
<SortMenu
isDisabled={isDisabled}
alignMenu={align.RIGHT}
>
<SortMenu isDisabled={isDisabled} alignMenu={align.RIGHT}>
<MenuContent>
<SortMenuItem
name="protocol"
@ -39,7 +31,7 @@ function SearchIndexSortMenu(props) {
</SortMenuItem>
<SortMenuItem
name="title"
name="sortTitle"
sortKey={sortKey}
sortDirection={sortDirection}
onPress={onSortSelect}
@ -109,7 +101,7 @@ SearchIndexSortMenu.propTypes = {
sortKey: PropTypes.string,
sortDirection: PropTypes.oneOf(sortDirections.all),
isDisabled: PropTypes.bool.isRequired,
onSortSelect: PropTypes.func.isRequired
onSortSelect: PropTypes.func.isRequired,
};
export default SearchIndexSortMenu;

@ -6,9 +6,9 @@ import IconButton from 'Components/Link/IconButton';
import Link from 'Components/Link/Link';
import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
import { icons, kinds } from 'Helpers/Props';
import ProtocolLabel from 'Indexer/Index/Table/ProtocolLabel';
import CategoryLabel from 'Search/Table/CategoryLabel';
import Peers from 'Search/Table/Peers';
import ProtocolLabel from 'Search/Table/ProtocolLabel';
import dimensions from 'Styles/Variables/dimensions';
import formatAge from 'Utilities/Number/formatAge';
import formatBytes from 'Utilities/Number/formatBytes';

@ -1,13 +0,0 @@
.torrent {
composes: label from '~Components/Label.css';
border-color: var(--torrentColor);
background-color: var(--torrentColor);
}
.usenet {
composes: label from '~Components/Label.css';
border-color: var(--usenetColor);
background-color: var(--usenetColor);
}

@ -1,8 +0,0 @@
// This file is automatically generated.
// Please do not change this file!
interface CssExports {
'torrent': string;
'usenet': string;
}
export const cssExports: CssExports;
export default cssExports;

@ -1,20 +0,0 @@
import PropTypes from 'prop-types';
import React from 'react';
import Label from 'Components/Label';
import styles from './ProtocolLabel.css';
function ProtocolLabel({ protocol }) {
const protocolName = protocol === 'usenet' ? 'nzb' : protocol;
return (
<Label className={styles[protocol]}>
{protocolName}
</Label>
);
}
ProtocolLabel.propTypes = {
protocol: PropTypes.string.isRequired
};
export default ProtocolLabel;

@ -4,7 +4,7 @@
flex: 0 0 90px;
}
.title {
.sortTitle {
composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css';
flex: 4 0 110px;

@ -11,7 +11,7 @@ interface CssExports {
'peers': string;
'protocol': string;
'size': string;
'title': string;
'sortTitle': string;
}
export const cssExports: CssExports;
export default cssExports;

@ -11,7 +11,7 @@
flex: 0 0 90px;
}
.title {
.sortTitle {
composes: cell;
flex: 4 0 110px;

@ -15,7 +15,7 @@ interface CssExports {
'peers': string;
'protocol': string;
'size': string;
'title': string;
'sortTitle': string;
}
export const cssExports: CssExports;
export default cssExports;

@ -8,6 +8,7 @@ import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell';
import VirtualTableSelectCell from 'Components/Table/Cells/VirtualTableSelectCell';
import Popover from 'Components/Tooltip/Popover';
import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import ProtocolLabel from 'Indexer/Index/Table/ProtocolLabel';
import formatDateTime from 'Utilities/Date/formatDateTime';
import formatAge from 'Utilities/Number/formatAge';
import formatBytes from 'Utilities/Number/formatBytes';
@ -15,7 +16,6 @@ import titleCase from 'Utilities/String/titleCase';
import translate from 'Utilities/String/translate';
import CategoryLabel from './CategoryLabel';
import Peers from './Peers';
import ProtocolLabel from './ProtocolLabel';
import styles from './SearchIndexRow.css';
function getDownloadIcon(isGrabbing, isGrabbed, grabError) {
@ -165,7 +165,7 @@ class SearchIndexRow extends Component {
);
}
if (column.name === 'title') {
if (column.name === 'sortTitle') {
return (
<VirtualTableRowCell
key={column.name}

@ -65,7 +65,7 @@ export const defaultState = {
isVisible: true
},
{
name: 'title',
name: 'sortTitle',
label: translate('Title'),
isSortable: true,
isVisible: true

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Routing.Constraints;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using Prowlarr.Http.REST;
@ -22,6 +23,7 @@ namespace Prowlarr.Api.V1.Search
public string SubGroup { get; set; }
public string ReleaseHash { get; set; }
public string Title { get; set; }
public string SortTitle { get; set; }
public bool Approved { get; set; }
public int ImdbId { get; set; }
public DateTime PublishDate { get; set; }
@ -77,6 +79,7 @@ namespace Prowlarr.Api.V1.Search
IndexerId = releaseInfo.IndexerId,
Indexer = releaseInfo.Indexer,
Title = releaseInfo.Title,
SortTitle = releaseInfo.Title.NormalizeTitle(),
ImdbId = releaseInfo.ImdbId,
PublishDate = releaseInfo.PublishDate,
CommentUrl = releaseInfo.CommentUrl,

Loading…
Cancel
Save