mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-14 10:36:58 +01:00
Feature: copy workflows and mail rules, improve layout (#7727)
This commit is contained in:
parent
8aa35540b5
commit
6192c15c4d
9 changed files with 227 additions and 70 deletions
|
|
@ -57,14 +57,13 @@ export class WorkflowsComponent
|
|||
.join(', ')
|
||||
}
|
||||
|
||||
editWorkflow(workflow: Workflow) {
|
||||
editWorkflow(workflow: Workflow, forceCreate: boolean = false) {
|
||||
const modal = this.modalService.open(WorkflowEditDialogComponent, {
|
||||
backdrop: 'static',
|
||||
size: 'xl',
|
||||
})
|
||||
modal.componentInstance.dialogMode = workflow
|
||||
? EditDialogMode.EDIT
|
||||
: EditDialogMode.CREATE
|
||||
modal.componentInstance.dialogMode =
|
||||
workflow && !forceCreate ? EditDialogMode.EDIT : EditDialogMode.CREATE
|
||||
if (workflow) {
|
||||
// quick "deep" clone so original doesn't get modified
|
||||
const clone = Object.assign({}, workflow)
|
||||
|
|
@ -88,6 +87,25 @@ export class WorkflowsComponent
|
|||
})
|
||||
}
|
||||
|
||||
copyWorkflow(workflow: Workflow) {
|
||||
const clone = Object.assign({}, workflow)
|
||||
clone.id = null
|
||||
clone.name = `${workflow.name} (copy)`
|
||||
clone.actions = [
|
||||
...workflow.actions.map((a) => {
|
||||
a.id = null
|
||||
return a
|
||||
}),
|
||||
]
|
||||
clone.triggers = [
|
||||
...workflow.triggers.map((t) => {
|
||||
t.id = null
|
||||
return t
|
||||
}),
|
||||
]
|
||||
this.editWorkflow(clone, true)
|
||||
}
|
||||
|
||||
deleteWorkflow(workflow: Workflow) {
|
||||
const modal = this.modalService.open(ConfirmDialogComponent, {
|
||||
backdrop: 'static',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue