mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-13 10:03:49 -05:00
Fix edit dialog error surfacing
This commit is contained in:
parent
f56ccec77f
commit
c5a21a3b0e
File diff suppressed because it is too large
Load Diff
@ -102,6 +102,7 @@ export abstract class EditDialogComponent<
|
|||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
|
this.error = null
|
||||||
const formValues = Object.assign({}, this.objectForm.value)
|
const formValues = Object.assign({}, this.objectForm.value)
|
||||||
const permissionsObject: PermissionsFormObject =
|
const permissionsObject: PermissionsFormObject =
|
||||||
this.objectForm.get('permissions_form')?.value
|
this.objectForm.get('permissions_form')?.value
|
||||||
@ -131,7 +132,7 @@ export abstract class EditDialogComponent<
|
|||||||
error: (error) => {
|
error: (error) => {
|
||||||
this.error = error.error
|
this.error = error.error
|
||||||
this.networkActive = false
|
this.networkActive = false
|
||||||
this.succeeded.error(error)
|
this.succeeded.next(error)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import {
|
|||||||
import { AbstractNameFilterService } from 'src/app/services/rest/abstract-name-filter-service'
|
import { AbstractNameFilterService } from 'src/app/services/rest/abstract-name-filter-service'
|
||||||
import { ToastService } from 'src/app/services/toast.service'
|
import { ToastService } from 'src/app/services/toast.service'
|
||||||
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
|
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
|
||||||
|
import { EditDialogComponent } from '../../common/edit-dialog/edit-dialog.component'
|
||||||
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
import { ComponentWithPermissions } from '../../with-permissions/with-permissions.component'
|
||||||
|
|
||||||
export interface ManagementListColumn {
|
export interface ManagementListColumn {
|
||||||
@ -136,16 +137,22 @@ export abstract class ManagementListComponent<T extends ObjectWithId>
|
|||||||
activeModal.componentInstance.dialogMode = 'create'
|
activeModal.componentInstance.dialogMode = 'create'
|
||||||
activeModal.componentInstance.succeeded.subscribe({
|
activeModal.componentInstance.succeeded.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
|
if (activeModal.componentInstance.error) {
|
||||||
|
this.toastService.showInfo(
|
||||||
|
$localize`Error occurred while creating ${this.typeName} : ${activeModal.componentInstance.error}.`
|
||||||
|
)
|
||||||
|
} else {
|
||||||
this.reloadData()
|
this.reloadData()
|
||||||
this.toastService.showInfo(
|
this.toastService.showInfo(
|
||||||
$localize`Successfully created ${this.typeName}.`
|
$localize`Successfully created ${this.typeName}.`
|
||||||
)
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: (e) => {
|
error: (e) => {
|
||||||
this.toastService.showInfo(
|
this.toastService.showInfo(
|
||||||
$localize`Error occurred while creating ${
|
$localize`Error occurred while creating ${this.typeName} : ${
|
||||||
this.typeName
|
e.error ?? e.message ?? e.toString()
|
||||||
} : ${e.toString()}.`
|
}.`
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -159,10 +166,16 @@ export abstract class ManagementListComponent<T extends ObjectWithId>
|
|||||||
activeModal.componentInstance.dialogMode = 'edit'
|
activeModal.componentInstance.dialogMode = 'edit'
|
||||||
activeModal.componentInstance.succeeded.subscribe({
|
activeModal.componentInstance.succeeded.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
|
if (activeModal.componentInstance.error) {
|
||||||
|
this.toastService.showInfo(
|
||||||
|
$localize`Error occurred while saving ${this.typeName} : ${activeModal.componentInstance.error}.`
|
||||||
|
)
|
||||||
|
} else {
|
||||||
this.reloadData()
|
this.reloadData()
|
||||||
this.toastService.showInfo(
|
this.toastService.showInfo(
|
||||||
$localize`Successfully updated ${this.typeName}.`
|
$localize`Successfully updated ${this.typeName}.`
|
||||||
)
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: (e) => {
|
error: (e) => {
|
||||||
this.toastService.showInfo(
|
this.toastService.showInfo(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user