better toasts, better dashboard, first implementation of consumer status

This commit is contained in:
Jonas Winkler
2020-11-07 12:05:15 +01:00
parent 572e40ca27
commit 036f11acaa
28 changed files with 450 additions and 134 deletions

View File

@@ -5,7 +5,7 @@ import { Observable } from 'rxjs';
import { MATCHING_ALGORITHMS } from 'src/app/data/matching-model';
import { ObjectWithId } from 'src/app/data/object-with-id';
import { AbstractPaperlessService } from 'src/app/services/rest/abstract-paperless-service';
import { Toast, ToastService } from 'src/app/services/toast.service';
import { ToastService } from 'src/app/services/toast.service';
@Directive()
export abstract class EditDialogComponent<T extends ObjectWithId> implements OnInit {
@@ -66,7 +66,7 @@ export abstract class EditDialogComponent<T extends ObjectWithId> implements OnI
this.activeModal.close()
this.success.emit(result)
}, error => {
this.toastService.showToast(Toast.makeError(`Could not save ${this.entityName}: ${error.error.name}`))
this.toastService.showError(`Could not save ${this.entityName}: ${error.error.name}`)
})
}

View File

@@ -1,7 +1,8 @@
<ngb-toast
*ngFor="let toast of toasts"
[header]="toast.title" [autohide]="true" [delay]="toast.delay"
[header]="toast.title" [autohide]="true" [delay]="toast.delay || 5000"
[class]="toast.classname"
(hide)="toastService.closeToast(toast)">
{{toast.content}}
<p>{{toast.content}}</p>
<p *ngIf="toast.action"><button class="btn btn-sm btn-outline-secondary" (click)="toastService.closeToast(toast); toast.action()">{{toast.actionName}}</button></p>
</ngb-toast>