Allow for clickable history timeline

- Add a link to the subject of the history
- Takes you to the record that is shown
This commit is contained in:
Jack Anderson 2022-07-12 16:38:14 +01:00 committed by Clemente Raposo
parent 9d91000e28
commit 0f39a0f264
3 changed files with 24 additions and 2 deletions

View file

@ -65,11 +65,22 @@
<div class="card"> <div class="card">
<div class="card-body p-1 pr-2 pl-2"> <div class="card-body p-1 pr-2 pl-2">
<p class="card-title text-break history-timeline-entry-title"> <p class="card-title text-break history-timeline-entry-title">
<a *ngIf="entry.record.module !== 'audit'"
[routerLink]="redirectLink(entry.record.module, entry.record.id)"
>
<scrm-field [type]="entry.title.type" <scrm-field [type]="entry.title.type"
mode="list" mode="list"
[field]="entry.title" [field]="entry.title"
[record]="entry.record"> [record]="entry.record">
</scrm-field> </scrm-field>
</a>
<a *ngIf="entry.record.module === 'audit'">
<scrm-field [type]="entry.title.type"
mode="list"
[field]="entry.title"
[record]="entry.record">
</scrm-field>
</a>
</p> </p>
<div *ngIf="entry.description" <div *ngIf="entry.description"
class="card-text history-timeline-entry-description"> class="card-text history-timeline-entry-description">

View file

@ -33,6 +33,7 @@ import {combineLatest, Subscription, timer} from 'rxjs';
import {debounce, map} from 'rxjs/operators'; import {debounce, map} from 'rxjs/operators';
import {floor} from 'lodash-es'; import {floor} from 'lodash-es';
import {CdkVirtualScrollViewport} from '@angular/cdk/scrolling'; import {CdkVirtualScrollViewport} from '@angular/cdk/scrolling';
import {ModuleNavigation} from "../../../../services/navigation/module-navigation/module-navigation.service";
@Component({ @Component({
selector: 'scrm-history-timeline-widget', selector: 'scrm-history-timeline-widget',
@ -48,7 +49,8 @@ export class HistorySidebarWidgetComponent extends BaseWidgetComponent implement
constructor( constructor(
protected historyTimelineAdapterFactory: HistoryTimelineAdapterFactory, protected historyTimelineAdapterFactory: HistoryTimelineAdapterFactory,
protected languageStore: LanguageStore) { protected languageStore: LanguageStore,
protected navigation: ModuleNavigation) {
super(); super();
} }
@ -120,4 +122,11 @@ export class HistorySidebarWidgetComponent extends BaseWidgetComponent implement
} }
} }
redirectLink(module: string, id: string) {
if (module === 'audit') {
return;
}
return this.navigation.getRecordRouterLink(module, id)
}
} }

View file

@ -34,6 +34,7 @@ import {ImageModule} from '../../../../components/image/image.module';
import {LoadingSpinnerModule} from '../../../../components/loading-spinner/loading-spinner.module'; import {LoadingSpinnerModule} from '../../../../components/loading-spinner/loading-spinner.module';
import {LabelModule} from '../../../../components/label/label.module'; import {LabelModule} from '../../../../components/label/label.module';
import {ChartMessageAreaModule} from '../../../../components/chart/components/chart-message-area/chart-message-area.module'; import {ChartMessageAreaModule} from '../../../../components/chart/components/chart-message-area/chart-message-area.module';
import {RouterModule} from "@angular/router";
@NgModule({ @NgModule({
declarations: [HistorySidebarWidgetComponent], declarations: [HistorySidebarWidgetComponent],
@ -48,7 +49,8 @@ import {ChartMessageAreaModule} from '../../../../components/chart/components/ch
WidgetPanelModule, WidgetPanelModule,
LoadingSpinnerModule, LoadingSpinnerModule,
LabelModule, LabelModule,
ChartMessageAreaModule ChartMessageAreaModule,
RouterModule,
] ]
}) })
export class HistorySidebarWidgetModule { export class HistorySidebarWidgetModule {