Fixed: (History) Save limit and offset in history data

pull/1765/head
Bogdan 1 year ago
parent e68b45636e
commit 21cc96d683

@ -18,6 +18,8 @@ function HistoryDetails(props) {
query,
queryResults,
categories,
limit,
offset,
source,
url
} = data;
@ -31,43 +33,66 @@ function HistoryDetails(props) {
/>
{
!!indexer &&
indexer ?
<DescriptionListItem
title={translate('Indexer')}
data={indexer.name}
/>
/> :
null
}
{
!!data &&
data ?
<DescriptionListItem
title={translate('QueryResults')}
data={queryResults ? queryResults : '-'}
/>
/> :
null
}
{
!!data &&
data ?
<DescriptionListItem
title={translate('Categories')}
data={categories ? categories : '-'}
/>
/> :
null
}
{
!!data &&
limit ?
<DescriptionListItem
title={translate('Limit')}
data={limit}
/> :
null
}
{
offset ?
<DescriptionListItem
title={translate('Offset')}
data={offset}
/> :
null
}
{
data ?
<DescriptionListItem
title={translate('Source')}
data={source}
/>
/> :
null
}
{
!!data &&
data ?
<DescriptionListItem
title={translate('Url')}
data={url ? <Link to={url}>{translate('Link')}</Link> : '-'}
/>
/> :
null
}
</DescriptionList>
);
@ -83,35 +108,39 @@ function HistoryDetails(props) {
return (
<DescriptionList>
{
!!indexer &&
indexer ?
<DescriptionListItem
title={translate('Indexer')}
data={indexer.name}
/>
/> :
null
}
{
!!data &&
data ?
<DescriptionListItem
title={translate('Source')}
data={source ? source : '-'}
/>
/> :
null
}
{
!!data &&
data ?
<DescriptionListItem
title={translate('GrabTitle')}
data={grabTitle ? grabTitle : '-'}
/>
/> :
null
}
{
!!data &&
data ?
<DescriptionListItem
title={translate('Url')}
data={url ? <Link to={url}>{translate('Link')}</Link> : '-'}
/>
/> :
null
}
</DescriptionList>
);
@ -124,11 +153,12 @@ function HistoryDetails(props) {
title={translate('Auth')}
>
{
!!indexer &&
indexer ?
<DescriptionListItem
title={translate('Indexer')}
data={indexer.name}
/>
/> :
null
}
</DescriptionList>
);

@ -66,7 +66,7 @@ class HistoryRow extends Component {
data
} = this.props;
const { query, queryType } = data;
const { query, queryType, limit, offset } = data;
let searchQuery = query;
let categories = [];
@ -111,7 +111,7 @@ class HistoryRow extends Component {
searchQuery += `${searchParams}`;
}
this.props.onSearchPress(searchQuery, indexer.id, categories, queryType);
this.props.onSearchPress(searchQuery, indexer.id, categories, queryType, parseInt(limit), parseInt(offset));
};
onDetailsPress = () => {
@ -312,6 +312,12 @@ class HistoryRow extends Component {
key={name}
className={styles.details}
>
<IconButton
name={icons.INFO}
onPress={this.onDetailsPress}
title={translate('HistoryDetails')}
/>
{
eventType === 'indexerQuery' ?
<IconButton
@ -321,11 +327,6 @@ class HistoryRow extends Component {
/> :
null
}
<IconButton
name={icons.INFO}
onPress={this.onDetailsPress}
title={translate('HistoryDetails')}
/>
</TableRowCell>
);
}

@ -48,8 +48,15 @@ class HistoryRowConnector extends Component {
//
// Listeners
onSearchPress = (term, indexerId, categories, type) => {
this.props.setSearchDefault({ searchQuery: term, searchIndexerIds: [indexerId], searchCategories: categories, searchType: type });
onSearchPress = (query, indexerId, categories, type, limit, offset) => {
this.props.setSearchDefault({
searchQuery: query,
searchIndexerIds: [indexerId],
searchCategories: categories,
searchType: type,
searchLimit: limit,
searchOffset: offset
});
this.props.push(`${window.Prowlarr.urlBase}/search`);
};

@ -27,7 +27,9 @@ class SearchFooter extends Component {
defaultIndexerIds,
defaultCategories,
defaultSearchQuery,
defaultSearchType
defaultSearchType,
defaultSearchLimit,
defaultSearchOffset
} = props;
this.state = {
@ -38,8 +40,8 @@ class SearchFooter extends Component {
searchQuery: defaultSearchQuery || '',
searchIndexerIds: defaultIndexerIds,
searchCategories: defaultCategories,
searchLimit: 100,
searchOffset: 0,
searchLimit: defaultSearchLimit,
searchOffset: defaultSearchOffset,
newSearch: true
};
}
@ -303,6 +305,8 @@ SearchFooter.propTypes = {
defaultCategories: PropTypes.arrayOf(PropTypes.number).isRequired,
defaultSearchQuery: PropTypes.string.isRequired,
defaultSearchType: PropTypes.string.isRequired,
defaultSearchLimit: PropTypes.number.isRequired,
defaultSearchOffset: PropTypes.number.isRequired,
selectedCount: PropTypes.number.isRequired,
itemCount: PropTypes.number.isRequired,
isFetching: PropTypes.bool.isRequired,

@ -13,14 +13,18 @@ function createMapStateToProps() {
searchQuery: defaultSearchQuery,
searchIndexerIds: defaultIndexerIds,
searchCategories: defaultCategories,
searchType: defaultSearchType
searchType: defaultSearchType,
searchLimit: defaultSearchLimit,
searchOffset: defaultSearchOffset
} = releases.defaults;
return {
defaultSearchQuery,
defaultIndexerIds,
defaultCategories,
defaultSearchType
defaultSearchType,
defaultSearchLimit,
defaultSearchOffset
};
}
);

@ -40,7 +40,9 @@ export const defaultState = {
searchType: 'search',
searchQuery: '',
searchIndexerIds: [],
searchCategories: []
searchCategories: [],
searchLimit: 100,
searchOffset: 0
},
columns: [

@ -170,6 +170,9 @@ namespace NzbDrone.Core.History
history.Data.Add("Genre", bookSearchCriteria.Genre);
}
history.Data.Add("Limit", message.Query.Limit?.ToString());
history.Data.Add("Offset", message.Query.Offset?.ToString());
// Clean empty data
history.Data = history.Data.Where(d => d.Value != null).ToDictionary(x => x.Key, x => x.Value);

Loading…
Cancel
Save