Feature: copy workflows and mail rules, improve layout (#7727)

This commit is contained in:
shamoon 2024-09-16 22:02:51 -07:00 committed by GitHub
parent 8aa35540b5
commit 6192c15c4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 227 additions and 70 deletions

View file

@ -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',