RED-6457: Link the dossier in the search results
This commit is contained in:
parent
054e976f0f
commit
f161076771
@ -47,10 +47,10 @@
|
||||
></iqser-status-bar>
|
||||
</div>
|
||||
|
||||
<div class="cell small-label stats-subtitle">
|
||||
<div class="cell small-label full-opacity stats-subtitle">
|
||||
<div>
|
||||
<mat-icon *ngIf="item.archived" svgIcon="red:archive"></mat-icon>
|
||||
{{ item.dossierName }}
|
||||
<a [routerLink]="routerLink" stopPropagation> {{ item.dossierName }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -1,21 +1,32 @@
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { workflowFileStatusTranslations } from '@translations/file-status-translations';
|
||||
import { ISearchListItem } from '@red/domain';
|
||||
import { escapeHtml } from '@iqser/common-ui';
|
||||
import { getDossierRouterLink } from '@utils/router-links';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-search-item-template',
|
||||
templateUrl: './search-item-template.component.html',
|
||||
styleUrls: ['./search-item-template.component.scss'],
|
||||
})
|
||||
export class SearchItemTemplateComponent {
|
||||
export class SearchItemTemplateComponent implements OnChanges {
|
||||
@Input() item: ISearchListItem;
|
||||
@Output() readonly mustContain = new EventEmitter<string>();
|
||||
readonly fileStatusTranslations = workflowFileStatusTranslations;
|
||||
|
||||
routerLink: string;
|
||||
|
||||
sanitize(value: string) {
|
||||
return escapeHtml(value, {
|
||||
ignoreTags: ['em'],
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes.item) {
|
||||
this.routerLink = getDossierRouterLink(this.item.dossierTemplateId, this.item.dossierId, this.item.archived);
|
||||
} else {
|
||||
this.routerLink = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,6 +283,10 @@ export class SearchScreenComponent extends ListingComponent<ISearchListItem> imp
|
||||
}
|
||||
|
||||
const dossier = this._dossiersCacheService.get(dossierId);
|
||||
if (!dossier) {
|
||||
console.error('Missing dossier');
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
id: fileId,
|
||||
|
||||
@ -10,3 +10,4 @@ export * from './functions';
|
||||
export * from './global-error-handler.service';
|
||||
export * from './missing-translations-handler';
|
||||
export * from './page-stamper';
|
||||
export * from './router-links';
|
||||
|
||||
7
apps/red-ui/src/app/utils/router-links.ts
Normal file
7
apps/red-ui/src/app/utils/router-links.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { ARCHIVE_ROUTE, DOSSIERS_ROUTE } from '@red/domain';
|
||||
|
||||
export function getDossierRouterLink(dossierTemplateId: string, dossierId: string, isArchived: boolean): string {
|
||||
const routerPath = isArchived ? ARCHIVE_ROUTE : DOSSIERS_ROUTE;
|
||||
const dossiersListRouterLink = `/main/${dossierTemplateId}/${routerPath}`;
|
||||
return `${dossiersListRouterLink}/${dossierId}`;
|
||||
}
|
||||
@ -1 +1 @@
|
||||
Subproject commit 03421b43d9eeb0940e7cb7adc9905f0c1beb91e1
|
||||
Subproject commit 9eecf327c264ae65dc80dc474d5e02526d63597e
|
||||
Loading…
x
Reference in New Issue
Block a user