Call it copy cause thats less weird

This commit is contained in:
shamoon 2024-09-16 21:35:55 -07:00
parent e26944eb0a
commit cb5b42a2a2
7 changed files with 35 additions and 38 deletions

View File

@ -5057,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">118</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>
@ -7476,25 +7492,6 @@
<context context-type="linenumber">79</context>
</context-group>
</trans-unit>
<trans-unit id="5834780181397311898" datatype="html">
<source>Clone</source>
<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">118</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="6751234988479444294" datatype="html">
<source>No mail rules defined.</source>
<context-group purpose="location">

View File

@ -98,7 +98,7 @@
<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)="cloneMailRule(rule)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" ngbDropdownItem i18n>Clone</button>
<button (click)="copyMailrule(rule)" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.MailRule }" ngbDropdownItem i18n>Copy</button>
</div>
</div>
</div>
@ -114,8 +114,8 @@
</button>
</div>
<div class="btn-group ms-2 d-none d-sm-inline-block">
<button *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" class="btn btn-sm btn-outline-secondary" type="button" (click)="cloneMailRule(rule)">
<i-bs width="1em" height="1em" name="files"></i-bs>&nbsp;<ng-container i18n>Clone</ng-container>
<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>&nbsp;<ng-container i18n>Copy</ng-container>
</button>
</div>
</div>

View File

@ -226,14 +226,14 @@ describe('MailComponent', () => {
component.editMailRule()
})
it('should support clone mail rule', () => {
it('should support copy mail rule', () => {
completeSetup()
let modal: NgbModalRef
modalService.activeInstances.subscribe((refs) => (modal = refs[0]))
component.cloneMailRule(mailRules[0] as MailRule)
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} (clone)`)
expect(editDialog.object.name).toEqual(`${mailRules[0].name} (copy)`)
expect(editDialog.dialogMode).toEqual(EditDialogMode.CREATE)
})

View File

@ -137,13 +137,13 @@ export class MailComponent
})
}
editMailRule(rule: MailRule = null, clone = false) {
editMailRule(rule: MailRule = null, forceCreate = false) {
const modal = this.modalService.open(MailRuleEditDialogComponent, {
backdrop: 'static',
size: 'xl',
})
modal.componentInstance.dialogMode =
rule && !clone ? EditDialogMode.EDIT : EditDialogMode.CREATE
rule && !forceCreate ? EditDialogMode.EDIT : EditDialogMode.CREATE
modal.componentInstance.object = rule
modal.componentInstance.succeeded
.pipe(takeUntil(this.unsubscribeNotifier))
@ -163,10 +163,10 @@ export class MailComponent
})
}
cloneMailRule(rule: MailRule) {
copyMailRule(rule: MailRule) {
const clone = { ...rule }
clone.id = null
clone.name = `${rule.name} (clone)`
clone.name = `${rule.name} (copy)`
this.editMailRule(clone, true)
}

View File

@ -39,7 +39,7 @@
<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)="cloneWorkflow(workflow)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Workflow }" ngbDropdownItem i18n>Clone</button>
<button (click)="copyWorkflow(workflow)" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.Workflow }" ngbDropdownItem i18n>Copy</button>
</div>
</div>
</div>
@ -53,8 +53,8 @@
</button>
</div>
<div class="btn-group ms-2 d-none d-sm-block">
<button *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Workflow }" class="btn btn-sm btn-outline-secondary" type="button" (click)="cloneWorkflow(workflow)">
<i-bs width="1em" height="1em" name="files"></i-bs>&nbsp;<ng-container i18n>Clone</ng-container>
<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>&nbsp;<ng-container i18n>Copy</ng-container>
</button>
</div>
</div>

View File

@ -174,12 +174,12 @@ describe('WorkflowsComponent', () => {
expect(reloadSpy).toHaveBeenCalled()
})
it('should support clone', () => {
it('should support copy', () => {
let modal: NgbModalRef
modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1]))
const cloneButton = fixture.debugElement.queryAll(By.css('button'))[6]
cloneButton.triggerEventHandler('click')
const copyButton = fixture.debugElement.queryAll(By.css('button'))[6]
copyButton.triggerEventHandler('click')
expect(modal).not.toBeUndefined()
const editDialog = modal.componentInstance as WorkflowEditDialogComponent

View File

@ -57,13 +57,13 @@ export class WorkflowsComponent
.join(', ')
}
editWorkflow(workflow: Workflow, clone: boolean = false) {
editWorkflow(workflow: Workflow, forceCreate: boolean = false) {
const modal = this.modalService.open(WorkflowEditDialogComponent, {
backdrop: 'static',
size: 'xl',
})
modal.componentInstance.dialogMode =
workflow && !clone ? EditDialogMode.EDIT : EditDialogMode.CREATE
workflow && !forceCreate ? EditDialogMode.EDIT : EditDialogMode.CREATE
if (workflow) {
// quick "deep" clone so original doesn't get modified
const clone = Object.assign({}, workflow)
@ -87,7 +87,7 @@ export class WorkflowsComponent
})
}
cloneWorkflow(workflow: Workflow) {
copyWorkflow(workflow: Workflow) {
const clone = Object.assign({}, workflow)
clone.id = null
clone.name = `${workflow.name} (copy)`