Compare commits

..

2 Commits

Author SHA1 Message Date
shamoon
6e1918a425
Add setting, trigger global refresh when needed 2025-06-21 12:12:23 -07:00
shamoon
516dcdcc9b
Include count badge on dashboard widgets 2025-06-21 12:12:22 -07:00
5 changed files with 12 additions and 2 deletions

View File

@ -212,7 +212,7 @@ describe('SettingsComponent', () => {
expect(toastErrorSpy).toHaveBeenCalled() expect(toastErrorSpy).toHaveBeenCalled()
expect(storeSpy).toHaveBeenCalled() expect(storeSpy).toHaveBeenCalled()
expect(appearanceSettingsSpy).not.toHaveBeenCalled() expect(appearanceSettingsSpy).not.toHaveBeenCalled()
expect(setSpy).toHaveBeenCalledTimes(29) expect(setSpy).toHaveBeenCalledTimes(30)
// succeed // succeed
storeSpy.mockReturnValueOnce(of(true)) storeSpy.mockReturnValueOnce(of(true))

View File

@ -1,6 +1,7 @@
<pngx-widget-frame <pngx-widget-frame
*pngxIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }" *pngxIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }"
[title]="savedView.name" [title]="savedView.name"
[badge]="count"
[loading]="loading" [loading]="loading"
[draggable]="savedView" [draggable]="savedView"
> >

View File

@ -121,6 +121,8 @@ export class SavedViewWidgetComponent
displayFields: DisplayField[] = DEFAULT_DASHBOARD_DISPLAY_FIELDS displayFields: DisplayField[] = DEFAULT_DASHBOARD_DISPLAY_FIELDS
count: number
ngOnInit(): void { ngOnInit(): void {
this.reload() this.reload()
this.displayMode = this.savedView.display_mode ?? DisplayMode.TABLE this.displayMode = this.savedView.display_mode ?? DisplayMode.TABLE
@ -181,6 +183,7 @@ export class SavedViewWidgetComponent
tap((result) => { tap((result) => {
this.show = true this.show = true
this.documents = result.results this.documents = result.results
this.count = result.count
}), }),
delay(500) delay(500)
) )

View File

@ -2,13 +2,16 @@
<div class="card shadow-sm bg-light fade" [class.show]="show" cdkDrag [cdkDragDisabled]="!draggable" cdkDragPreviewContainer="parent"> <div class="card shadow-sm bg-light fade" [class.show]="show" cdkDrag [cdkDragDisabled]="!draggable" cdkDragPreviewContainer="parent">
<div class="card-header"> <div class="card-header">
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div class="d-flex"> <div class="d-flex align-items-center">
@if (draggable) { @if (draggable) {
<div class="ms-n2 me-1" cdkDragHandle> <div class="ms-n2 me-1" cdkDragHandle>
<i-bs name="grip-vertical"></i-bs> <i-bs name="grip-vertical"></i-bs>
</div> </div>
} }
<h6 class="card-title mb-0">{{title}}</h6> <h6 class="card-title mb-0">{{title}}</h6>
@if (badge) {
<span class="badge bg-info text-light ms-2">{{badge}}</span>
}
</div> </div>
@if (loading) { @if (loading) {
<div class="spinner-border spinner-border-sm fw-normal ms-2 me-auto" role="status"></div> <div class="spinner-border spinner-border-sm fw-normal ms-2 me-auto" role="status"></div>

View File

@ -30,6 +30,9 @@ export class WidgetFrameComponent
@Input() @Input()
cardless: boolean = false cardless: boolean = false
@Input()
badge: string
ngAfterViewInit(): void { ngAfterViewInit(): void {
setTimeout(() => { setTimeout(() => {
this.show = true this.show = true