Feature: copy workflows and mail rules, improve layout (#7727)
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user