New: Sort by Status in Artist Index/Editor

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
pull/528/head
Qstick 6 years ago
parent 07a1388758
commit 69b6b67bf4

@ -22,6 +22,7 @@ function getColumns(showLanguageProfile, showMetadataProfile) {
return [
{
name: 'status',
isSortable: true,
isVisible: true
},
{

@ -19,6 +19,15 @@ function ArtistIndexSortMenu(props) {
alignMenu={align.RIGHT}
>
<MenuContent>
<SortMenuItem
name="status"
sortKey={sortKey}
sortDirection={sortDirection}
onPress={onSortSelect}
>
Monitored/Status
</SortMenuItem>
<SortMenuItem
name="sortName"
sortKey={sortKey}

@ -120,6 +120,22 @@ export const filterPredicates = {
}
};
export const sortPredicates = {
status: function(item) {
let result = 0;
if (item.monitored) {
result += 2;
}
if (item.status === 'continuing') {
result++;
}
return result;
}
};
//
// State

@ -7,7 +7,7 @@ import createSetClientSideCollectionSortReducer from './Creators/Reducers/create
import createSetClientSideCollectionFilterReducer from './Creators/Reducers/createSetClientSideCollectionFilterReducer';
import createHandleActions from './Creators/createHandleActions';
import { set, updateItem } from './baseActions';
import { filters, filterPredicates } from './artistActions';
import { filters, filterPredicates, sortPredicates } from './artistActions';
//
// Variables
@ -77,7 +77,9 @@ export const defaultState = {
type: filterBuilderTypes.ARRAY,
valueType: filterBuilderValueTypes.TAG
}
]
],
sortPredicates
};
export const persistState = [

@ -6,7 +6,7 @@ import createSetTableOptionReducer from './Creators/Reducers/createSetTableOptio
import createSetClientSideCollectionSortReducer from './Creators/Reducers/createSetClientSideCollectionSortReducer';
import createSetClientSideCollectionFilterReducer from './Creators/Reducers/createSetClientSideCollectionFilterReducer';
import createHandleActions from './Creators/createHandleActions';
import { filters, filterPredicates } from './artistActions';
import { filters, filterPredicates, sortPredicates } from './artistActions';
//
// Variables
@ -56,6 +56,7 @@ export const defaultState = {
{
name: 'status',
columnLabel: 'Status',
isSortable: true,
isVisible: true,
isModifiable: false
},
@ -166,6 +167,8 @@ export const defaultState = {
],
sortPredicates: {
...sortPredicates,
trackProgress: function(item) {
const { statistics = {} } = item;

Loading…
Cancel
Save