Pull request #289: sow status in search results & enable search for filter

Merge in RED/ui from RED-2213 to master

* commit 'a2e5d7ff7a5630afe6f34007da3febfca6961c59':
  sow status in search results & enable search for filter
This commit is contained in:
Dan Percic 2021-09-23 11:20:08 +02:00
commit 0572959667
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 <redaction-page-header
(closeAction)="routerHistoryService.navigateToLastDossiersScreen()" (closeAction)="routerHistoryService.navigateToLastDossiersScreen()"
[searchPlaceholder]="'search.placeholder' | translate" [searchPlaceholder]="'search.placeholder' | translate"

View File

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

View File

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

View File

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