diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index 18ba85ce4..dec952685 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -726,7 +726,7 @@ src/app/components/manage/mail/mail.component.html - 105 + 137 src/app/components/manage/management-list/management-list.component.html @@ -1092,11 +1092,19 @@ src/app/components/manage/mail/mail.component.html - 39 + 41 src/app/components/manage/mail/mail.component.html - 85 + 51 + + + src/app/components/manage/mail/mail.component.html + 99 + + + src/app/components/manage/mail/mail.component.html + 111 src/app/components/manage/management-list/management-list.component.html @@ -1398,7 +1406,7 @@ src/app/components/manage/mail/mail.component.html - 69 + 81 src/app/components/manage/management-list/management-list.component.html @@ -1493,7 +1501,15 @@ src/app/components/manage/mail/mail.component.html - 88 + 54 + + + src/app/components/manage/mail/mail.component.html + 100 + + + src/app/components/manage/mail/mail.component.html + 114 src/app/components/manage/management-list/management-list.component.html @@ -1549,7 +1565,11 @@ src/app/components/manage/workflows/workflows.component.html - 38 + 41 + + + src/app/components/manage/workflows/workflows.component.html + 52 @@ -1879,7 +1899,7 @@ src/app/components/manage/mail/mail.component.html - 66 + 78 src/app/components/manage/management-list/management-list.component.html @@ -2207,7 +2227,7 @@ src/app/components/manage/mail/mail.component.ts - 173 + 179 src/app/components/manage/management-list/management-list.component.ts @@ -2215,7 +2235,7 @@ src/app/components/manage/workflows/workflows.component.ts - 97 + 115 @@ -2402,11 +2422,19 @@ src/app/components/manage/mail/mail.component.html - 36 + 40 src/app/components/manage/mail/mail.component.html - 82 + 48 + + + src/app/components/manage/mail/mail.component.html + 98 + + + src/app/components/manage/mail/mail.component.html + 108 src/app/components/manage/management-list/management-list.component.html @@ -2442,7 +2470,11 @@ src/app/components/manage/workflows/workflows.component.html - 35 + 40 + + + src/app/components/manage/workflows/workflows.component.html + 49 @@ -2546,7 +2578,7 @@ src/app/components/manage/mail/mail.component.ts - 175 + 181 src/app/components/manage/management-list/management-list.component.ts @@ -2554,7 +2586,7 @@ src/app/components/manage/workflows/workflows.component.ts - 99 + 117 @@ -3665,7 +3697,7 @@ src/app/components/manage/mail/mail.component.html - 68 + 80 @@ -5025,6 +5057,22 @@ src/app/components/common/system-status-dialog/system-status-dialog.component.html 156 + + src/app/components/manage/mail/mail.component.html + 101 + + + src/app/components/manage/mail/mail.component.html + 119 + + + src/app/components/manage/workflows/workflows.component.html + 42 + + + src/app/components/manage/workflows/workflows.component.html + 57 + Regenerate auth token @@ -7420,35 +7468,35 @@ No mail accounts defined. src/app/components/manage/mail/mail.component.html - 50 + 62 Mail rules src/app/components/manage/mail/mail.component.html - 58 + 70 Add Rule src/app/components/manage/mail/mail.component.html - 60 + 72 Sort Order src/app/components/manage/mail/mail.component.html - 67 + 79 No mail rules defined. src/app/components/manage/mail/mail.component.html - 96 + 128 @@ -7511,56 +7559,56 @@ Saved rule "". src/app/components/manage/mail/mail.component.ts - 152 + 151 Error saving rule. src/app/components/manage/mail/mail.component.ts - 163 + 162 Confirm delete mail rule src/app/components/manage/mail/mail.component.ts - 171 + 177 This operation will permanently delete this mail rule. src/app/components/manage/mail/mail.component.ts - 172 + 178 Deleted mail rule src/app/components/manage/mail/mail.component.ts - 181 + 187 Error deleting mail rule. src/app/components/manage/mail/mail.component.ts - 190 + 196 Permissions updated src/app/components/manage/mail/mail.component.ts - 212 + 218 Error updating permissions src/app/components/manage/mail/mail.component.ts - 217 + 223 src/app/components/manage/management-list/management-list.component.ts @@ -7821,49 +7869,49 @@ No workflows defined. src/app/components/manage/workflows/workflows.component.html - 46 + 66 Saved workflow "". src/app/components/manage/workflows/workflows.component.ts - 79 + 78 Error saving workflow. src/app/components/manage/workflows/workflows.component.ts - 87 + 86 Confirm delete workflow src/app/components/manage/workflows/workflows.component.ts - 95 + 113 This operation will permanently delete this workflow. src/app/components/manage/workflows/workflows.component.ts - 96 + 114 Deleted workflow src/app/components/manage/workflows/workflows.component.ts - 105 + 123 Error deleting workflow. src/app/components/manage/workflows/workflows.component.ts - 110 + 128 diff --git a/src-ui/src/app/components/manage/mail/mail.component.html b/src-ui/src/app/components/manage/mail/mail.component.html index b804b0f2f..add5614c4 100644 --- a/src-ui/src/app/components/manage/mail/mail.component.html +++ b/src-ui/src/app/components/manage/mail/mail.component.html @@ -19,7 +19,7 @@
Name
Server
-
Username
+
Username
Actions
@@ -29,9 +29,21 @@
{{account.imap_server}}
-
{{account.username}}
+
{{account.username}}
-
+
+
+ +
+ + + +
+
+
+
@@ -64,7 +76,7 @@
  • Name
    -
    Sort Order
    +
    Sort Order
    Account
    Actions
    @@ -74,19 +86,39 @@
  • -
    {{rule.order}}
    +
    {{rule.order}}
    {{(mailAccountService.getCached(rule.account) | async)?.name}}
    -
    - - - +
    +
    + +
    + + + + +
    +
    +
    +
    diff --git a/src-ui/src/app/components/manage/mail/mail.component.scss b/src-ui/src/app/components/manage/mail/mail.component.scss index e69de29bb..0c1f432aa 100644 --- a/src-ui/src/app/components/manage/mail/mail.component.scss +++ b/src-ui/src/app/components/manage/mail/mail.component.scss @@ -0,0 +1,4 @@ +// hide caret on mobile dropdown +.d-block.d-sm-none .dropdown-toggle::after { + display: none; +} diff --git a/src-ui/src/app/components/manage/mail/mail.component.spec.ts b/src-ui/src/app/components/manage/mail/mail.component.spec.ts index e72b49b0f..4a134b880 100644 --- a/src-ui/src/app/components/manage/mail/mail.component.spec.ts +++ b/src-ui/src/app/components/manage/mail/mail.component.spec.ts @@ -226,6 +226,17 @@ describe('MailComponent', () => { component.editMailRule() }) + it('should support copy mail rule', () => { + completeSetup() + let modal: NgbModalRef + modalService.activeInstances.subscribe((refs) => (modal = refs[0])) + component.copyMailRule(mailRules[0] as MailRule) + const editDialog = modal.componentInstance as MailRuleEditDialogComponent + expect(editDialog.object.id).toBeNull() + expect(editDialog.object.name).toEqual(`${mailRules[0].name} (copy)`) + expect(editDialog.dialogMode).toEqual(EditDialogMode.CREATE) + }) + it('should support delete mail rule, show error if needed', () => { completeSetup() let modal: NgbModalRef diff --git a/src-ui/src/app/components/manage/mail/mail.component.ts b/src-ui/src/app/components/manage/mail/mail.component.ts index d8820ed38..5d00b6c13 100644 --- a/src-ui/src/app/components/manage/mail/mail.component.ts +++ b/src-ui/src/app/components/manage/mail/mail.component.ts @@ -137,14 +137,13 @@ export class MailComponent }) } - editMailRule(rule: MailRule = null) { + editMailRule(rule: MailRule = null, forceCreate = false) { const modal = this.modalService.open(MailRuleEditDialogComponent, { backdrop: 'static', size: 'xl', }) - modal.componentInstance.dialogMode = rule - ? EditDialogMode.EDIT - : EditDialogMode.CREATE + modal.componentInstance.dialogMode = + rule && !forceCreate ? EditDialogMode.EDIT : EditDialogMode.CREATE modal.componentInstance.object = rule modal.componentInstance.succeeded .pipe(takeUntil(this.unsubscribeNotifier)) @@ -164,6 +163,13 @@ export class MailComponent }) } + copyMailRule(rule: MailRule) { + const clone = { ...rule } + clone.id = null + clone.name = `${rule.name} (copy)` + this.editMailRule(clone, true) + } + deleteMailRule(rule: MailRule) { const modal = this.modalService.open(ConfirmDialogComponent, { backdrop: 'static', diff --git a/src-ui/src/app/components/manage/workflows/workflows.component.html b/src-ui/src/app/components/manage/workflows/workflows.component.html index d398b95b1..1e83efd36 100644 --- a/src-ui/src/app/components/manage/workflows/workflows.component.html +++ b/src-ui/src/app/components/manage/workflows/workflows.component.html @@ -15,9 +15,9 @@
  • Name
    -
    Sort order
    +
    Sort order
    Status
    -
    Triggers
    +
    Triggers
    Actions
  • @@ -26,17 +26,37 @@
  • -
    {{workflow.order}}
    +
    {{workflow.order}}
    @if(workflow.enabled) { Enabled } @else { Disabled }
    -
    {{getTypesList(workflow)}}
    +
    {{getTypesList(workflow)}}
    -
    - - + +
    +
    + +
    + + + +
    +
    +
    +
    diff --git a/src-ui/src/app/components/manage/workflows/workflows.component.scss b/src-ui/src/app/components/manage/workflows/workflows.component.scss index e69de29bb..0c1f432aa 100644 --- a/src-ui/src/app/components/manage/workflows/workflows.component.scss +++ b/src-ui/src/app/components/manage/workflows/workflows.component.scss @@ -0,0 +1,4 @@ +// hide caret on mobile dropdown +.d-block.d-sm-none .dropdown-toggle::after { + display: none; +} diff --git a/src-ui/src/app/components/manage/workflows/workflows.component.spec.ts b/src-ui/src/app/components/manage/workflows/workflows.component.spec.ts index 5a73b07b0..0bccbad2d 100644 --- a/src-ui/src/app/components/manage/workflows/workflows.component.spec.ts +++ b/src-ui/src/app/components/manage/workflows/workflows.component.spec.ts @@ -26,6 +26,7 @@ import { import { WorkflowActionType } from 'src/app/data/workflow-action' import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons' import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http' +import { EditDialogMode } from '../../common/edit-dialog/edit-dialog.component' const workflows: Workflow[] = [ { @@ -173,6 +174,19 @@ describe('WorkflowsComponent', () => { expect(reloadSpy).toHaveBeenCalled() }) + it('should support copy', () => { + let modal: NgbModalRef + modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1])) + + const copyButton = fixture.debugElement.queryAll(By.css('button'))[6] + copyButton.triggerEventHandler('click') + + expect(modal).not.toBeUndefined() + const editDialog = modal.componentInstance as WorkflowEditDialogComponent + expect(editDialog.object.name).toEqual(workflows[0].name + ' (copy)') + expect(editDialog.dialogMode).toEqual(EditDialogMode.CREATE) + }) + it('should support delete, show notification on error / success', () => { let modal: NgbModalRef modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1])) @@ -180,7 +194,7 @@ describe('WorkflowsComponent', () => { const deleteSpy = jest.spyOn(workflowService, 'delete') const reloadSpy = jest.spyOn(component, 'reload') - const deleteButton = fixture.debugElement.queryAll(By.css('button'))[4] + const deleteButton = fixture.debugElement.queryAll(By.css('button'))[5] deleteButton.triggerEventHandler('click') expect(modal).not.toBeUndefined() diff --git a/src-ui/src/app/components/manage/workflows/workflows.component.ts b/src-ui/src/app/components/manage/workflows/workflows.component.ts index a80f03577..92b421e9f 100644 --- a/src-ui/src/app/components/manage/workflows/workflows.component.ts +++ b/src-ui/src/app/components/manage/workflows/workflows.component.ts @@ -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',