refactor: enable full sort capabilites on search

This commit is contained in:
Rainer Killinger
2021-09-21 14:04:47 +02:00
committed by Jovan Krunić
parent 03084b1c96
commit a1bf950c88
5 changed files with 46 additions and 31 deletions

View File

@@ -75,7 +75,7 @@ export class ContextMenuService {
/**
* Container for the sort query
*/
sortQuery = new Subject<SCSearchSort>();
sortQuery = new Subject<SCSearchSort[]>();
/**
* Observable SortContext streams
@@ -144,20 +144,22 @@ export class ContextMenuService {
*
* @param sortContext SortContext to build SCSearchSort from
*/
buildSortQuery = (sortContext: SortContext): SCSearchSort | undefined => {
buildSortQuery = (sortContext: SortContext): SCSearchSort[] | undefined => {
if (
sortContext.value &&
sortContext.value.length > 0 &&
(sortContext.value === 'name' || sortContext.value === 'type')
) {
return {
arguments: {
field: sortContext.value,
position: 0,
return [
{
arguments: {
field: sortContext.value,
position: 0,
},
order: sortContext.reversed ? 'desc' : 'asc',
type: 'ducet',
},
order: sortContext.reversed ? 'desc' : 'asc',
type: 'ducet',
};
];
}
return;