A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Feature: copy workflows and mail rules, improve layout (#7727)
shamoon6192c15c4d9a
diff --git a/src-ui/messages.xlf b/src-ui/messages.xlfindex 18ba85ce4..dec952685 100644--- a/src-ui/messages.xlf+++ b/src-ui/messages.xlf@@ -726,7 +726,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">105</context>+ <context context-type="linenumber">137</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -1092,11 +1092,19 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">39</context>+ <context context-type="linenumber">41</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">85</context>+ <context context-type="linenumber">51</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">99</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">111</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -1398,7 +1406,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">69</context>+ <context context-type="linenumber">81</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -1493,7 +1501,15 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">88</context>+ <context context-type="linenumber">54</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">100</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">114</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -1549,7 +1565,11 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>- <context context-type="linenumber">38</context>+ <context context-type="linenumber">41</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>+ <context context-type="linenumber">52</context></context-group></trans-unit><trans-unit id="6338800642797811873" datatype="html">@@ -1879,7 +1899,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">66</context>+ <context context-type="linenumber">78</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -2207,7 +2227,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">173</context>+ <context context-type="linenumber">179</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>@@ -2215,7 +2235,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>- <context context-type="linenumber">97</context>+ <context context-type="linenumber">115</context></context-group></trans-unit><trans-unit id="1980187861066369604" datatype="html">@@ -2402,11 +2422,19 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">36</context>+ <context context-type="linenumber">40</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">82</context>+ <context context-type="linenumber">48</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">98</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">108</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>@@ -2442,7 +2470,11 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>- <context context-type="linenumber">35</context>+ <context context-type="linenumber">40</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>+ <context context-type="linenumber">49</context></context-group></trans-unit><trans-unit id="9124347207158517893" datatype="html">@@ -2546,7 +2578,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">175</context>+ <context context-type="linenumber">181</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>@@ -2554,7 +2586,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>- <context context-type="linenumber">99</context>+ <context context-type="linenumber">117</context></context-group></trans-unit><trans-unit id="857903183180440990" datatype="html">@@ -3665,7 +3697,7 @@</context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">68</context>+ <context context-type="linenumber">80</context></context-group></trans-unit><trans-unit id="4348351765075925931" datatype="html">@@ -5025,6 +5057,22 @@<context context-type="sourcefile">src/app/components/common/system-status-dialog/system-status-dialog.component.html</context><context context-type="linenumber">156</context></context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">101</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>+ <context context-type="linenumber">119</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>+ <context context-type="linenumber">42</context>+ </context-group>+ <context-group purpose="location">+ <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>+ <context context-type="linenumber">57</context>+ </context-group></trans-unit><trans-unit id="595732867213154214" datatype="html"><source>Regenerate auth token</source>@@ -7420,35 +7468,35 @@<source>No mail accounts defined.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">50</context>+ <context context-type="linenumber">62</context></context-group></trans-unit><trans-unit id="5364020217520256833" datatype="html"><source>Mail rules</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">58</context>+ <context context-type="linenumber">70</context></context-group></trans-unit><trans-unit id="1372022816709469401" datatype="html"><source>Add Rule</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">60</context>+ <context context-type="linenumber">72</context></context-group></trans-unit><trans-unit id="2535466903620876415" datatype="html"><source>Sort Order</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">67</context>+ <context context-type="linenumber">79</context></context-group></trans-unit><trans-unit id="6751234988479444294" datatype="html"><source>No mail rules defined.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.html</context>- <context context-type="linenumber">96</context>+ <context context-type="linenumber">128</context></context-group></trans-unit><trans-unit id="3178554336792037159" datatype="html">@@ -7511,56 +7559,56 @@<source>Saved rule "<x id="PH" equiv-text="newMailRule.name"/>".</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">152</context>+ <context context-type="linenumber">151</context></context-group></trans-unit><trans-unit id="8951124554918814321" datatype="html"><source>Error saving rule.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">163</context>+ <context context-type="linenumber">162</context></context-group></trans-unit><trans-unit id="3896080636020672118" datatype="html"><source>Confirm delete mail rule</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">171</context>+ <context context-type="linenumber">177</context></context-group></trans-unit><trans-unit id="2250372580580310337" datatype="html"><source>This operation will permanently delete this mail rule.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">172</context>+ <context context-type="linenumber">178</context></context-group></trans-unit><trans-unit id="9077981247971516916" datatype="html"><source>Deleted mail rule</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">181</context>+ <context context-type="linenumber">187</context></context-group></trans-unit><trans-unit id="2033194641751367552" datatype="html"><source>Error deleting mail rule.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">190</context>+ <context context-type="linenumber">196</context></context-group></trans-unit><trans-unit id="3061362835271417984" datatype="html"><source>Permissions updated</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">212</context>+ <context context-type="linenumber">218</context></context-group></trans-unit><trans-unit id="4639647950943944112" datatype="html"><source>Error updating permissions</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/mail/mail.component.ts</context>- <context context-type="linenumber">217</context>+ <context context-type="linenumber">223</context></context-group><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>@@ -7821,49 +7869,49 @@<source>No workflows defined.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>- <context context-type="linenumber">46</context>+ <context context-type="linenumber">66</context></context-group></trans-unit><trans-unit id="4200688335642457098" datatype="html"><source>Saved workflow "<x id="PH" equiv-text="newWorkflow.name"/>".</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>- <context context-type="linenumber">79</context>+ <context context-type="linenumber">78</context></context-group></trans-unit><trans-unit id="7593065565369163325" datatype="html"><source>Error saving workflow.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>- <context context-type="linenumber">87</context>+ <context context-type="linenumber">86</context></context-group></trans-unit><trans-unit id="563460864902055482" datatype="html"><source>Confirm delete workflow</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>- <context context-type="linenumber">95</context>+ <context context-type="linenumber">113</context></context-group></trans-unit><trans-unit id="6874008462443189248" datatype="html"><source>This operation will permanently delete this workflow.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>- <context context-type="linenumber">96</context>+ <context context-type="linenumber">114</context></context-group></trans-unit><trans-unit id="1848226135059921165" datatype="html"><source>Deleted workflow</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>- <context context-type="linenumber">105</context>+ <context context-type="linenumber">123</context></context-group></trans-unit><trans-unit id="3177411222429626224" datatype="html"><source>Error deleting workflow.</source><context-group purpose="location"><context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>- <context context-type="linenumber">110</context>+ <context context-type="linenumber">128</context></context-group></trans-unit><trans-unit id="2649252321173430744" datatype="html">diff --git a/src-ui/src/app/components/manage/mail/mail.component.html b/src-ui/src/app/components/manage/mail/mail.component.htmlindex 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 @@<div class="row"><div class="col" i18n>Name</div><div class="col" i18n>Server</div>- <div class="col" i18n>Username</div>+ <div class="col d-none d-sm-block" i18n>Username</div><div class="col" i18n>Actions</div></div></li>@@ -29,9 +29,21 @@<div class="row"><div class="col d-flex align-items-center"><button class="btn btn-link p-0 text-start" type="button" (click)="editMailAccount(account)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.MailAccount)">{{account.name}}</button></div><div class="col d-flex align-items-center">{{account.imap_server}}</div>- <div class="col d-flex align-items-center">{{account.username}}</div>+ <div class="col d-flex align-items-center d-none d-sm-block">{{account.username}}</div><div class="col">- <div class="btn-group">+ <div class="btn-group d-block d-sm-none">+ <div ngbDropdown container="body" class="d-inline-block">+ <button type="button" class="btn btn-link" id="actionsMenuMobile" (click)="$event.stopPropagation()" ngbDropdownToggle>+ <i-bs name="three-dots-vertical"></i-bs>+ </button>+ <div ngbDropdownMenu aria-labelledby="actionsMenuMobile">+ <button (click)="editMailAccount(account)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" ngbDropdownItem i18n>Edit</button>+ <button (click)="editPermissions(account)" *pngxIfOwner="account" ngbDropdownItem i18n>Permissions</button>+ <button (click)="deleteMailAccount(account)" *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.MailAccount }" ngbDropdownItem i18n>Delete</button>+ </div>+ </div>+ </div>+ <div class="btn-group d-none d-sm-block"><button *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" [disabled]="!userCanEdit(account)" class="btn btn-sm btn-outline-secondary" type="button" (click)="editMailAccount(account)"><i-bs width="1em" height="1em" name="pencil"></i-bs> <ng-container i18n>Edit</ng-container></button>@@ -64,7 +76,7 @@<li class="list-group-item"><div class="row"><div class="col" i18n>Name</div>- <div class="col" i18n>Sort Order</div>+ <div class="col d-none d-sm-block" i18n>Sort Order</div><div class="col" i18n>Account</div><div class="col" i18n>Actions</div></div>@@ -74,19 +86,39 @@<li class="list-group-item"><div class="row"><div class="col d-flex align-items-center"><button class="btn btn-link p-0 text-start" type="button" (click)="editMailRule(rule)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.MailRule)">{{rule.name}}</button></div>- <div class="col d-flex align-items-center">{{rule.order}}</div>+ <div class="col d-flex align-items-center d-none d-sm-block">{{rule.order}}</div><div class="col d-flex align-items-center">{{(mailAccountService.getCached(rule.account) | async)?.name}}</div><div class="col">- <div class="btn-group">- <button *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" [disabled]="!userCanEdit(rule)" class="btn btn-sm btn-outline-secondary" type="button" (click)="editMailRule(rule)">- <i-bs width="1em" height="1em" name="pencil"></i-bs> <ng-container i18n>Edit</ng-container>- </button>- <button *pngxIfOwner="rule" class="btn btn-sm btn-outline-secondary" type="button" (click)="editPermissions(rule)">- <i-bs width="1em" height="1em" name="person-lock"></i-bs> <ng-container i18n>Permissions</ng-container>- </button>- <button *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.MailRule }" [disabled]="!userIsOwner(rule)" class="btn btn-sm btn-outline-danger" type="button" (click)="deleteMailRule(rule)">- <i-bs width="1em" height="1em" name="trash"></i-bs> <ng-container i18n>Delete</ng-container>- </button>+ <div class="btn-group d-block d-sm-none">+ <div ngbDropdown container="body" class="d-inline-block">+ <button type="button" class="btn btn-link" id="actionsMenuMobile" (click)="$event.stopPropagation()" ngbDropdownToggle>+ <i-bs name="three-dots-vertical"></i-bs>+ </button>+ <div ngbDropdownMenu aria-labelledby="actionsMenuMobile">+ <button (click)="editMailRule(rule)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" ngbDropdownItem i18n>Edit</button>+ <button (click)="editPermissions(rule)" *pngxIfOwner="rule" ngbDropdownItem i18n>Permissions</button>+ <button (click)="deleteMailRule(rule)" *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.MailRule }" ngbDropdownItem i18n>Delete</button>+ <button (click)="copyMailRule(rule)" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.MailRule }" ngbDropdownItem i18n>Copy</button>+ </div>+ </div>+ </div>+ <div class="btn-toolbar d-none d-sm-flex gap-2" role="toolbar">+ <div class="btn-group">+ <button *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" [disabled]="!userCanEdit(rule)" class="btn btn-sm btn-outline-secondary" type="button" (click)="editMailRule(rule)">+ <i-bs width="1em" height="1em" name="pencil"></i-bs> <ng-container i18n>Edit</ng-container>+ </button>+ <button *pngxIfOwner="rule" class="btn btn-sm btn-outline-secondary" type="button" (click)="editPermissions(rule)">+ <i-bs width="1em" height="1em" name="person-lock"></i-bs> <ng-container i18n>Permissions</ng-container>+ </button>+ <button *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.MailRule }" [disabled]="!userIsOwner(rule)" class="btn btn-sm btn-outline-danger" type="button" (click)="deleteMailRule(rule)">+ <i-bs width="1em" height="1em" name="trash"></i-bs> <ng-container i18n>Delete</ng-container>+ </button>+ </div>+ <div class="btn-group">+ <button *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.MailRule }" class="btn btn-sm btn-outline-secondary" type="button" (click)="copyMailRule(rule)">+ <i-bs width="1em" height="1em" name="files"></i-bs> <ng-container i18n>Copy</ng-container>+ </button>+ </div></div></div></div>diff --git a/src-ui/src/app/components/manage/mail/mail.component.scss b/src-ui/src/app/components/manage/mail/mail.component.scssindex 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.tsindex 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: NgbModalRefdiff --git a/src-ui/src/app/components/manage/mail/mail.component.ts b/src-ui/src/app/components/manage/mail/mail.component.tsindex 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.CREATEmodal.componentInstance.object = rulemodal.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.htmlindex 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 @@<li class="list-group-item"><div class="row"><div class="col" i18n>Name</div>- <div class="col" i18n>Sort order</div>+ <div class="col d-none d-sm-block" i18n>Sort order</div><div class="col" i18n>Status</div>- <div class="col" i18n>Triggers</div>+ <div class="col d-none d-sm-block" i18n>Triggers</div><div class="col" i18n>Actions</div></div></li>@@ -26,17 +26,37 @@<li class="list-group-item"><div class="row"><div class="col d-flex align-items-center"><button class="btn btn-link p-0 text-start" type="button" (click)="editWorkflow(workflow)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.Workflow)">{{workflow.name}}</button></div>- <div class="col d-flex align-items-center"><code>{{workflow.order}}</code></div>+ <div class="col d-flex align-items-center d-none d-sm-block"><code>{{workflow.order}}</code></div><div class="col d-flex align-items-center"><code> @if(workflow.enabled) { <ng-container i18n>Enabled</ng-container> } @else { <span i18n class="text-muted">Disabled</span> }</code></div>- <div class="col d-flex align-items-center">{{getTypesList(workflow)}}</div>+ <div class="col d-flex align-items-center d-none d-sm-block">{{getTypesList(workflow)}}</div><div class="col">- <div class="btn-group">- <button *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Workflow }" class="btn btn-sm btn-outline-secondary" type="button" (click)="editWorkflow(workflow)">- <i-bs width="1em" height="1em" name="pencil"></i-bs> <ng-container i18n>Edit</ng-container>- </button>- <button *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.Workflow }" class="btn btn-sm btn-outline-danger" type="button" (click)="deleteWorkflow(workflow)">- <i-bs width="1em" height="1em" name="trash"></i-bs> <ng-container i18n>Delete</ng-container>- </button>++ <div class="btn-group d-block d-sm-none">+ <div ngbDropdown container="body" class="d-inline-block">+ <button type="button" class="btn btn-link" id="actionsMenuMobile" (click)="$event.stopPropagation()" ngbDropdownToggle>+ <i-bs name="three-dots-vertical"></i-bs>+ </button>+ <div ngbDropdownMenu aria-labelledby="actionsMenuMobile">+ <button (click)="editWorkflow(workflow)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Workflow }" ngbDropdownItem i18n>Edit</button>+ <button (click)="deleteWorkflow(workflow)" *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.Workflow }" ngbDropdownItem i18n>Delete</button>+ <button (click)="copyWorkflow(workflow)" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.Workflow }" ngbDropdownItem i18n>Copy</button>+ </div>+ </div>+ </div>+ <div class="btn-toolbar d-none d-sm-flex gap-2" role="toolbar">+ <div class="btn-group">+ <button *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Workflow }" class="btn btn-sm btn-outline-secondary" type="button" (click)="editWorkflow(workflow)">+ <i-bs width="1em" height="1em" name="pencil"></i-bs> <ng-container i18n>Edit</ng-container>+ </button>+ <button *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.Workflow }" class="btn btn-sm btn-outline-danger" type="button" (click)="deleteWorkflow(workflow)">+ <i-bs width="1em" height="1em" name="trash"></i-bs> <ng-container i18n>Delete</ng-container>+ </button>+ </div>+ <div class="btn-group">+ <button *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.Workflow }" class="btn btn-sm btn-outline-secondary" type="button" (click)="copyWorkflow(workflow)">+ <i-bs width="1em" height="1em" name="files"></i-bs> <ng-container i18n>Copy</ng-container>+ </button>+ </div></div></div></div>diff --git a/src-ui/src/app/components/manage/workflows/workflows.component.scss b/src-ui/src/app/components/manage/workflows/workflows.component.scssindex 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.tsindex 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: NgbModalRefmodalService.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.tsindex 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.CREATEif (workflow) {// quick "deep" clone so original doesn't get modifiedconst 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',