mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
better toasts, better dashboard, first implementation of consumer status
This commit is contained in:
@@ -1,30 +1,17 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject, zip } from 'rxjs';
|
||||
|
||||
export class Toast {
|
||||
|
||||
static make(title: string, content: string, classname?: string, delay?: number): Toast {
|
||||
let t = new Toast()
|
||||
t.title = title
|
||||
t.content = content
|
||||
t.classname = classname
|
||||
if (delay) {
|
||||
t.delay = delay
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
static makeError(content: string) {
|
||||
return Toast.make("Error", content, null, 10000)
|
||||
}
|
||||
export interface Toast {
|
||||
|
||||
title: string
|
||||
|
||||
classname: string
|
||||
|
||||
content: string
|
||||
|
||||
delay: number = 5000
|
||||
delay?: number
|
||||
|
||||
action?: any
|
||||
|
||||
actionName?: string
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +31,14 @@ export class ToastService {
|
||||
this.toastsSubject.next(this.toasts)
|
||||
}
|
||||
|
||||
showInfo(message: string) {
|
||||
this.showToast({title: "Information", content: message, delay: 5000})
|
||||
}
|
||||
|
||||
showError(message: string) {
|
||||
this.showToast({title: "Error", content: message, delay: 10000})
|
||||
}
|
||||
|
||||
closeToast(toast: Toast) {
|
||||
let index = this.toasts.findIndex(t => t == toast)
|
||||
if (index > -1) {
|
||||
|
Reference in New Issue
Block a user