Search fixes
This commit is contained in:
parent
bb60f6090c
commit
6a09826947
@ -15,14 +15,15 @@
|
||||
[hasScrollButton]="true"
|
||||
[itemSize]="85"
|
||||
[noDataText]="'search-screen.no-data' | translate"
|
||||
[noMatchText]="'search-screen.no-match' | translate"
|
||||
noDataIcon="iqser:search"
|
||||
></iqser-table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<ng-template #tableItemTemplate let-entity="entity">
|
||||
<div *ngIf="cast(entity) as item">
|
||||
<ng-template #tableItemTemplate let-item="entity">
|
||||
<div>
|
||||
<div class="cell filename">
|
||||
<div [matTooltip]="item.filename" class="table-item-title heading" matTooltipPosition="above">
|
||||
<span
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
TableColumnConfig,
|
||||
} from '@iqser/common-ui';
|
||||
import { merge, Observable } from 'rxjs';
|
||||
import { debounceTime, map, startWith, switchMap, tap } from 'rxjs/operators';
|
||||
import { debounceTime, map, skip, startWith, switchMap, tap } from 'rxjs/operators';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { workflowFileStatusTranslations } from '../../translations/file-status-translations';
|
||||
@ -48,10 +48,11 @@ export class SearchScreenComponent extends ListingComponent<ISearchListItem> imp
|
||||
{ label: _('search-screen.cols.pages'), width: 'auto' },
|
||||
];
|
||||
|
||||
readonly searchResults$ = merge(this._searchChanged$, this._filtersChanged$).pipe(
|
||||
readonly searchResults$ = merge(this._searchChanged$, this._filtersChanged$.pipe(skip(1))).pipe(
|
||||
startWith(this._routeQuery),
|
||||
tap(value => (this.searchService.searchValue = value.query)),
|
||||
tap(() => this._loadingService.start()),
|
||||
tap(value => this.updateNavigation(value.query)),
|
||||
tap(value => this._updateNavigation(value.query)),
|
||||
switchMap(query => this._platformSearchService.search(query)),
|
||||
map(searchResult => this._toMatchedDocuments(searchResult)),
|
||||
map(docs => this._toListItems(docs)),
|
||||
@ -107,19 +108,18 @@ export class SearchScreenComponent extends ListingComponent<ISearchListItem> imp
|
||||
private get _routeQuery(): ISearchInput {
|
||||
const query = this._activatedRoute.snapshot.queryParamMap.get('query');
|
||||
const dossierId = this._activatedRoute.snapshot.queryParamMap.get('dossierId');
|
||||
this.searchService.searchValue = query;
|
||||
return { query, dossierIds: dossierId ? [dossierId] : [] };
|
||||
}
|
||||
|
||||
updateNavigation(query: string) {
|
||||
return this._router.navigate([], { queryParams: { query } });
|
||||
}
|
||||
|
||||
mustContain(value: string) {
|
||||
const newQuery = this.searchService.searchValue.replace(value, `"${value}"`);
|
||||
this.searchService.searchValue = newQuery ?? '';
|
||||
}
|
||||
|
||||
private _updateNavigation(query: string) {
|
||||
return this._router.navigate([], { queryParams: { query } });
|
||||
}
|
||||
|
||||
private _toMatchedDocuments({ matchedDocuments }: ISearchResponse): IMatchedDocument[] {
|
||||
return matchedDocuments.filter(doc => doc.score > 0 && doc.matchedTerms.length > 0);
|
||||
}
|
||||
|
||||
@ -1311,27 +1311,27 @@
|
||||
"generic": "Something went wrong... Preferences update failed!"
|
||||
},
|
||||
"groups": {
|
||||
"dossier": "Dossier related notifications",
|
||||
"document": "Document related notifications",
|
||||
"dossier": "Dossier related notifications",
|
||||
"other": "Other notifications"
|
||||
},
|
||||
"options-title": "Choose on which action you want to be notified",
|
||||
"options": {
|
||||
"DOSSIER_OWNER_SET": "When I become the dossier owner",
|
||||
"DOSSIER_OWNER_REMOVED": "When I loose dossier ownership",
|
||||
"USER_BECOMES_DOSSIER_MEMBER": "When a user was added to my dossier",
|
||||
"USER_REMOVED_AS_DOSSIER_MEMBER": "When I loose dossier membership",
|
||||
"USER_PROMOTED_TO_APPROVER": "When I become an Approver in a dossier",
|
||||
"USER_DEGRADED_TO_REVIEWER": "When I become a Reviewer in a dossier",
|
||||
"DOSSIER_OWNER_DELETED": "When the owner of a dossier got deleted",
|
||||
"DOSSIER_DELETED": "When a dossier was deleted",
|
||||
"ASSIGN_REVIEWER": "When I am assigned to a document as Reviewer",
|
||||
"ASSIGN_APPROVER": "When I am assigned to a document as Approver",
|
||||
"UNASSIGNED_FROM_FILE": "When I am unassigned from a document",
|
||||
"DOCUMENT_UNDER_REVIEW": "When the document status changes to Under Review",
|
||||
"DOCUMENT_UNDER_APPROVAL": "When the document status changes to Under Approval",
|
||||
"ASSIGN_REVIEWER": "When I am assigned to a document as Reviewer",
|
||||
"DOCUMENT_APPROVED": "When the document status changes to Approved",
|
||||
"DOWNLOAD_READY": "When a download is ready"
|
||||
"DOCUMENT_UNDER_APPROVAL": "When the document status changes to Under Approval",
|
||||
"DOCUMENT_UNDER_REVIEW": "When the document status changes to Under Review",
|
||||
"DOSSIER_DELETED": "When a dossier was deleted",
|
||||
"DOSSIER_OWNER_DELETED": "When the owner of a dossier got deleted",
|
||||
"DOSSIER_OWNER_REMOVED": "When I loose dossier ownership",
|
||||
"DOSSIER_OWNER_SET": "When I become the dossier owner",
|
||||
"DOWNLOAD_READY": "When a download is ready",
|
||||
"UNASSIGNED_FROM_FILE": "When I am unassigned from a document",
|
||||
"USER_BECOMES_DOSSIER_MEMBER": "When a user was added to my dossier",
|
||||
"USER_DEGRADED_TO_REVIEWER": "When I become a Reviewer in a dossier",
|
||||
"USER_PROMOTED_TO_APPROVER": "When I become an Approver in a dossier",
|
||||
"USER_REMOVED_AS_DOSSIER_MEMBER": "When I loose dossier membership"
|
||||
},
|
||||
"schedule": {
|
||||
"daily": "Daily Summary",
|
||||
@ -1497,6 +1497,7 @@
|
||||
"missing": "Missing",
|
||||
"must-contain": "Must contain",
|
||||
"no-data": "Please enter a keyword into the search bar to look for documents or document content.",
|
||||
"no-match": "No documents match your current filters.",
|
||||
"table-header": "{length} search {length, plural, one{result} other{results}}"
|
||||
},
|
||||
"search": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user