sow status in search results & enable search for filter

This commit is contained in:
Dan Percic 2021-09-23 10:49:32 +03:00
parent 334d4de5d4
commit a2e5d7ff7a
4 changed files with 18 additions and 13 deletions

View File

@ -1,4 +1,4 @@
<section *ngIf="searchResults$ | async as searchResult">
<section *ngIf="searchResults$ | async">
<redaction-page-header
(closeAction)="routerHistoryService.navigateToLastDossiersScreen()"
[searchPlaceholder]="'search.placeholder' | translate"

View File

@ -16,8 +16,8 @@ import { RouterHistoryService } from '@services/router-history.service';
interface ListItem extends Listable {
readonly dossierId: string;
readonly filename: string;
readonly unmatched: string[] | null;
readonly highlights: { [key: string]: string[] };
readonly unmatched: readonly string[] | null;
readonly highlights: Record<string, readonly string[]>;
readonly routerLink: string;
readonly status: string;
readonly dossierName: string;
@ -25,8 +25,8 @@ interface ListItem extends Listable {
}
interface SearchInput {
query: string;
dossierIds?: string[];
readonly query: string;
readonly dossierIds?: readonly string[];
}
@Component({
@ -37,10 +37,12 @@ interface SearchInput {
export class SearchScreenComponent extends ListingComponent<ListItem> implements OnDestroy, OnInit {
readonly fileStatusTranslations = fileStatusTranslations;
readonly searchPositions = SearchPositions;
@ViewChild('filenameTemplate', { static: true }) filenameTemplate: TemplateRef<never>;
@ViewChild('statusTemplate', { static: true }) statusTemplate: TemplateRef<never>;
@ViewChild('dossierTemplate', { static: true }) dossierTemplate: TemplateRef<never>;
@ViewChild('pagesTemplate', { static: true }) pagesTemplate: TemplateRef<never>;
@ViewChild('filenameTemplate', { static: true }) readonly filenameTemplate: TemplateRef<unknown>;
@ViewChild('statusTemplate', { static: true }) readonly statusTemplate: TemplateRef<unknown>;
@ViewChild('dossierTemplate', { static: true }) readonly dossierTemplate: TemplateRef<unknown>;
@ViewChild('pagesTemplate', { static: true }) readonly pagesTemplate: TemplateRef<unknown>;
readonly tableHeaderLabel = _('search-screen.table-header');
tableColumnConfigs: TableColumnConfig<ListItem>[];
readonly search$ = new BehaviorSubject<SearchInput>(null);
@ -68,6 +70,7 @@ export class SearchScreenComponent extends ListingComponent<ListItem> implements
this.filterService.addFilterGroup({
slug: 'dossiers',
label: this._translateService.instant('search-screen.filters.by-dossier'),
filterceptionPlaceholder: this._translateService.instant('search-screen.filters.search-placeholder'),
icon: 'red:folder',
filters: this._appStateService.allDossiers.map(dossier => ({
key: dossier.dossierId,
@ -118,7 +121,7 @@ export class SearchScreenComponent extends ListingComponent<ListItem> implements
private _search(searchInput: SearchInput): Observable<SearchResult> {
return this._searchControllerService.search({
dossierIds: searchInput.dossierIds,
dossierIds: [...searchInput.dossierIds],
queryString: searchInput.query ?? '',
page: 1,
returnSections: false,
@ -161,7 +164,7 @@ export class SearchScreenComponent extends ListingComponent<ListItem> implements
dossierId,
unmatched: unmatchedTerms || null,
highlights,
status,
status: fileWrapper.status,
numberOfPages: fileWrapper.numberOfPages,
dossierName: this._getDossierWrapper(dossierId).dossierName,
filename: fileWrapper.filename,

View File

@ -1209,7 +1209,8 @@
"status": ""
},
"filters": {
"by-dossier": ""
"by-dossier": "",
"search-placeholder": "Dossier..."
},
"missing": "",
"must-contain": "",

View File

@ -1365,7 +1365,8 @@
"status": "Status"
},
"filters": {
"by-dossier": "Filter by Dossier"
"by-dossier": "Filter by Dossier",
"search-placeholder": "Dossier name..."
},
"missing": "Missing",
"must-contain": "Must contain",