fix RED-2675: sort results in descending order
This commit is contained in:
parent
aeca9efa18
commit
f631d60d9d
@ -1,12 +1,14 @@
|
|||||||
import { ChangeDetectionStrategy, Component, forwardRef, Injector, OnDestroy } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, forwardRef, Injector, OnDestroy } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
DefaultListingServices,
|
DefaultListingServices,
|
||||||
|
IFilterGroup,
|
||||||
keyChecker,
|
keyChecker,
|
||||||
List,
|
List,
|
||||||
ListingComponent,
|
ListingComponent,
|
||||||
LoadingService,
|
LoadingService,
|
||||||
NestedFilter,
|
NestedFilter,
|
||||||
SearchPositions,
|
SearchPositions,
|
||||||
|
SortingOrders,
|
||||||
TableColumnConfig,
|
TableColumnConfig,
|
||||||
} from '@iqser/common-ui';
|
} from '@iqser/common-ui';
|
||||||
import { merge, Observable } from 'rxjs';
|
import { merge, Observable } from 'rxjs';
|
||||||
@ -18,7 +20,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { RouterHistoryService } from '@services/router-history.service';
|
import { RouterHistoryService } from '@services/router-history.service';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { PlatformSearchService } from '../../shared/services/platform-search.service';
|
import { PlatformSearchService } from '../../shared/services/platform-search.service';
|
||||||
import { IMatchedDocument, ISearchInput, ISearchListItem, ISearchResponse } from '@red/domain';
|
import { Dossier, IMatchedDocument, ISearchInput, ISearchListItem, ISearchResponse } from '@red/domain';
|
||||||
|
|
||||||
function toSearchInput(query: string, dossierIds: List | string): ISearchInput {
|
function toSearchInput(query: string, dossierIds: List | string): ISearchInput {
|
||||||
return {
|
return {
|
||||||
@ -68,25 +70,22 @@ export class SearchScreenComponent extends ListingComponent<ISearchListItem> imp
|
|||||||
) {
|
) {
|
||||||
super(_injector);
|
super(_injector);
|
||||||
this.searchService.skip = true;
|
this.searchService.skip = true;
|
||||||
|
this.sortingService.setSortingOption({ column: 'searchKey', order: SortingOrders.desc });
|
||||||
|
|
||||||
const dossierId = _activatedRoute.snapshot.queryParamMap.get('dossierId');
|
const dossierId = _activatedRoute.snapshot.queryParamMap.get('dossierId');
|
||||||
this.filterService.addFilterGroups([
|
const dossierToFilter = ({ dossierName, id }: Dossier) => {
|
||||||
{
|
const checked = id === dossierId;
|
||||||
slug: 'dossiers',
|
return new NestedFilter({ id, label: dossierName, checked });
|
||||||
label: this._translateService.instant('search-screen.filters.by-dossier'),
|
};
|
||||||
filterceptionPlaceholder: this._translateService.instant('search-screen.filters.search-placeholder'),
|
const dossierNameFilter: IFilterGroup = {
|
||||||
icon: 'red:folder',
|
slug: 'dossiers',
|
||||||
filters: this._dossiersService.all.map(
|
label: this._translateService.instant('search-screen.filters.by-dossier'),
|
||||||
dossier =>
|
filterceptionPlaceholder: this._translateService.instant('search-screen.filters.search-placeholder'),
|
||||||
new NestedFilter({
|
icon: 'red:folder',
|
||||||
id: dossier.id,
|
filters: this._dossiersService.all.map(dossierToFilter),
|
||||||
label: dossier.dossierName,
|
checker: keyChecker('dossierId'),
|
||||||
checked: dossier.id === dossierId,
|
};
|
||||||
}),
|
this.filterService.addFilterGroups([dossierNameFilter]);
|
||||||
),
|
|
||||||
checker: keyChecker('dossierId'),
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private get _searchChanged$(): Observable<ISearchInput> {
|
private get _searchChanged$(): Observable<ISearchInput> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user