mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-12 17:47:08 +01:00
Chore: refactor loading stuff to be more DRY
This commit is contained in:
parent
c2e34b36ce
commit
0a7c296194
34 changed files with 87 additions and 110 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<div class="card document-card-large mb-3 shadow-sm bg-light placeholder-glow" [class.card-selected]="selected" [class.document-card]="selectable" (mouseleave)="mouseLeaveCard()">
|
||||
<div class="card document-card-large mb-3 shadow-sm bg-light placeholder-glow fade" [class.show]="show" [class.card-selected]="selected" [class.document-card]="selectable" (mouseleave)="mouseLeaveCard()">
|
||||
<div class="row g-0">
|
||||
<div class="col-md-2 doc-img-container rounded-start" (click)="this.toggleSelected.emit($event)" (dblclick)="dblClickDocument.emit()">
|
||||
@if (document) {
|
||||
|
|
|
|||
|
|
@ -71,6 +71,14 @@ describe('DocumentCardLargeComponent', () => {
|
|||
component = fixture.componentInstance
|
||||
component.document = doc
|
||||
fixture.detectChanges()
|
||||
jest.useFakeTimers()
|
||||
})
|
||||
|
||||
it('should show the card', () => {
|
||||
expect(component.show).toBeFalsy()
|
||||
component.ngAfterViewInit()
|
||||
jest.advanceTimersByTime(100)
|
||||
expect(component.show).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should display a document', () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
AfterViewInit,
|
||||
Component,
|
||||
EventEmitter,
|
||||
Input,
|
||||
|
|
@ -13,7 +14,7 @@ import {
|
|||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
||||
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
|
||||
import { PreviewPopupComponent } from '../../common/preview-popup/preview-popup.component'
|
||||
|
||||
@Component({
|
||||
|
|
@ -21,7 +22,10 @@ import { PreviewPopupComponent } from '../../common/preview-popup/preview-popup.
|
|||
templateUrl: './document-card-large.component.html',
|
||||
styleUrls: ['./document-card-large.component.scss'],
|
||||
})
|
||||
export class DocumentCardLargeComponent extends ComponentWithPermissions {
|
||||
export class DocumentCardLargeComponent
|
||||
extends LoadingComponentWithPermissions
|
||||
implements AfterViewInit
|
||||
{
|
||||
DisplayField = DisplayField
|
||||
|
||||
constructor(
|
||||
|
|
@ -70,6 +74,12 @@ export class DocumentCardLargeComponent extends ComponentWithPermissions {
|
|||
mouseOnPreview = false
|
||||
popoverHidden = true
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
setInterval(() => {
|
||||
this.show = true
|
||||
}, 100)
|
||||
}
|
||||
|
||||
get searchScoreClass() {
|
||||
if (this.document.__search_hit__) {
|
||||
if (this.document.__search_hit__.score > 0.7) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue