mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Fix: accidentally retained confirm button for management lists
This commit is contained in:
parent
8039ce3c2b
commit
ebc9ce17b5
@ -1491,6 +1491,10 @@
|
|||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
||||||
<context context-type="linenumber">96</context>
|
<context context-type="linenumber">96</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
|
<context-group purpose="location">
|
||||||
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
|
<context context-type="linenumber">208</context>
|
||||||
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
|
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
|
||||||
<context context-type="linenumber">38</context>
|
<context context-type="linenumber">38</context>
|
||||||
@ -2017,7 +2021,7 @@
|
|||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">304</context>
|
<context context-type="linenumber">320</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||||
@ -2056,7 +2060,7 @@
|
|||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">306</context>
|
<context context-type="linenumber">322</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
|
||||||
@ -5025,7 +5029,11 @@
|
|||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">302</context>
|
<context context-type="linenumber">204</context>
|
||||||
|
</context-group>
|
||||||
|
<context-group purpose="location">
|
||||||
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
|
<context context-type="linenumber">318</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="5382975254277698192" datatype="html">
|
<trans-unit id="5382975254277698192" datatype="html">
|
||||||
@ -6219,7 +6227,7 @@
|
|||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">289</context>
|
<context context-type="linenumber">305</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="4010735610815226758" datatype="html">
|
<trans-unit id="4010735610815226758" datatype="html">
|
||||||
@ -6302,26 +6310,26 @@
|
|||||||
<source>{VAR_PLURAL, plural, =1 {One <x id="INTERPOLATION"/>} other {<x id="INTERPOLATION_1"/> total <x id="INTERPOLATION_2"/>}}</source>
|
<source>{VAR_PLURAL, plural, =1 {One <x id="INTERPOLATION"/>} other {<x id="INTERPOLATION_1"/> total <x id="INTERPOLATION_2"/>}}</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
||||||
<context context-type="linenumber">116</context>
|
<context context-type="linenumber">110</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
||||||
<context context-type="linenumber">116</context>
|
<context context-type="linenumber">110</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
||||||
<context context-type="linenumber">116</context>
|
<context context-type="linenumber">110</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
|
||||||
<context context-type="linenumber">116</context>
|
<context context-type="linenumber">110</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="810888510148304696" datatype="html">
|
<trans-unit id="810888510148304696" datatype="html">
|
||||||
<source>Automatic</source>
|
<source>Automatic</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">113</context>
|
<context context-type="linenumber">116</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/data/matching-model.ts</context>
|
<context context-type="sourcefile">src/app/data/matching-model.ts</context>
|
||||||
@ -6332,7 +6340,7 @@
|
|||||||
<source>None</source>
|
<source>None</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">115</context>
|
<context context-type="linenumber">118</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/data/matching-model.ts</context>
|
<context context-type="sourcefile">src/app/data/matching-model.ts</context>
|
||||||
@ -6343,63 +6351,70 @@
|
|||||||
<source>Successfully created <x id="PH" equiv-text="this.typeName"/>.</source>
|
<source>Successfully created <x id="PH" equiv-text="this.typeName"/>.</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">158</context>
|
<context context-type="linenumber">161</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="3928835053823658072" datatype="html">
|
<trans-unit id="3928835053823658072" datatype="html">
|
||||||
<source>Error occurred while creating <x id="PH" equiv-text="this.typeName"/>.</source>
|
<source>Error occurred while creating <x id="PH" equiv-text="this.typeName"/>.</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">163</context>
|
<context context-type="linenumber">166</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="2541368547549828690" datatype="html">
|
<trans-unit id="2541368547549828690" datatype="html">
|
||||||
<source>Successfully updated <x id="PH" equiv-text="this.typeName"/>.</source>
|
<source>Successfully updated <x id="PH" equiv-text="this.typeName"/>.</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">178</context>
|
<context context-type="linenumber">181</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="6442673774206210733" datatype="html">
|
<trans-unit id="6442673774206210733" datatype="html">
|
||||||
<source>Error occurred while saving <x id="PH" equiv-text="this.typeName"/>.</source>
|
<source>Error occurred while saving <x id="PH" equiv-text="this.typeName"/>.</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">183</context>
|
<context context-type="linenumber">186</context>
|
||||||
|
</context-group>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="8371896857609524947" datatype="html">
|
||||||
|
<source>Associated documents will not be deleted.</source>
|
||||||
|
<context-group purpose="location">
|
||||||
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
|
<context context-type="linenumber">206</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="6639207128255974941" datatype="html">
|
<trans-unit id="6639207128255974941" datatype="html">
|
||||||
<source>Error while deleting element</source>
|
<source>Error while deleting element</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">207</context>
|
<context context-type="linenumber">222</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="4863024195229581844" datatype="html">
|
<trans-unit id="4863024195229581844" datatype="html">
|
||||||
<source>Permissions updated successfully</source>
|
<source>Permissions updated successfully</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">282</context>
|
<context context-type="linenumber">298</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="1464476612812630086" datatype="html">
|
<trans-unit id="1464476612812630086" datatype="html">
|
||||||
<source>This operation will permanently delete all objects.</source>
|
<source>This operation will permanently delete all objects.</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">303</context>
|
<context context-type="linenumber">319</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="5897787932098828336" datatype="html">
|
<trans-unit id="5897787932098828336" datatype="html">
|
||||||
<source>Objects deleted successfully</source>
|
<source>Objects deleted successfully</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">317</context>
|
<context context-type="linenumber">333</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="8273353839648035634" datatype="html">
|
<trans-unit id="8273353839648035634" datatype="html">
|
||||||
<source>Error deleting objects</source>
|
<source>Error deleting objects</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
|
||||||
<context context-type="linenumber">323</context>
|
<context context-type="linenumber">339</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="5101757640976222639" datatype="html">
|
<trans-unit id="5101757640976222639" datatype="html">
|
||||||
|
@ -88,39 +88,33 @@
|
|||||||
<div class="btn-group d-none d-sm-block">
|
<div class="btn-group d-none d-sm-block">
|
||||||
<button class="btn btn-sm btn-outline-secondary" (click)="filterDocuments(object); $event.stopPropagation();" *pngxIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }">
|
<button class="btn btn-sm btn-outline-secondary" (click)="filterDocuments(object); $event.stopPropagation();" *pngxIfPermissions="{ action: PermissionAction.View, type: PermissionType.Document }">
|
||||||
<i-bs width="1em" height="1em" name="filter"></i-bs> <ng-container i18n>Documents</ng-container>
|
<i-bs width="1em" height="1em" name="filter"></i-bs> <ng-container i18n>Documents</ng-container>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-outline-secondary" (click)="openEditDialog(object); $event.stopPropagation();" *pngxIfPermissions="{ action: PermissionAction.Change, type: permissionType }" [disabled]="!userCanEdit(object)">
|
<button class="btn btn-sm btn-outline-secondary" (click)="openEditDialog(object); $event.stopPropagation();" *pngxIfPermissions="{ action: PermissionAction.Change, type: permissionType }" [disabled]="!userCanEdit(object)">
|
||||||
<i-bs width="1em" height="1em" name="pencil"></i-bs> <ng-container i18n>Edit</ng-container>
|
<i-bs width="1em" height="1em" name="pencil"></i-bs> <ng-container i18n>Edit</ng-container>
|
||||||
</button>
|
</button>
|
||||||
<pngx-confirm-button
|
<button class="btn btn-sm btn-outline-danger" (click)="openDeleteDialog(object); $event.stopPropagation();" *pngxIfPermissions="{ action: PermissionAction.Delete, type: permissionType }" [disabled]="!userCanDelete(object)">
|
||||||
label="Delete"
|
<i-bs width="1em" height="1em" name="trash"></i-bs> <ng-container i18n>Delete</ng-container>
|
||||||
i18n-label
|
</button>
|
||||||
(confirm)="deleteObject(object)"
|
</div>
|
||||||
*pngxIfPermissions="{ action: PermissionAction.Delete, type: permissionType }"
|
</td>
|
||||||
[disabled]="!userCanDelete(object)"
|
</tr>
|
||||||
buttonClasses=" btn-sm btn-outline-danger"
|
}
|
||||||
iconName="trash">
|
</tbody>
|
||||||
</pngx-confirm-button>
|
</table>
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (!isLoading) {
|
|
||||||
<div class="d-flex mb-2">
|
|
||||||
@if (collectionSize > 0) {
|
|
||||||
<div>
|
|
||||||
<ng-container i18n>{collectionSize, plural, =1 {One {{typeName}}} other {{{collectionSize || 0}} total {{typeNamePlural}}}}</ng-container>
|
|
||||||
@if (selectedObjects.size > 0) {
|
|
||||||
({{selectedObjects.size}} selected)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
@if (collectionSize > 20) {
|
@if (!isLoading) {
|
||||||
<ngb-pagination class="ms-auto" [pageSize]="25" [collectionSize]="collectionSize" [(page)]="page" [maxSize]="5" (pageChange)="reloadData()" size="sm" aria-label="Pagination"></ngb-pagination>
|
<div class="d-flex mb-2">
|
||||||
}
|
@if (collectionSize > 0) {
|
||||||
</div>
|
<div>
|
||||||
}
|
<ng-container i18n>{collectionSize, plural, =1 {One {{typeName}}} other {{{collectionSize || 0}} total {{typeNamePlural}}}}</ng-container>
|
||||||
|
@if (selectedObjects.size > 0) {
|
||||||
|
({{selectedObjects.size}} selected)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (collectionSize > 20) {
|
||||||
|
<ngb-pagination class="ms-auto" [pageSize]="25" [collectionSize]="collectionSize" [(page)]="page" [maxSize]="5" (pageChange)="reloadData()" size="sm" aria-label="Pagination"></ngb-pagination>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@ -13,7 +13,6 @@ import {
|
|||||||
NgbModalModule,
|
NgbModalModule,
|
||||||
NgbModalRef,
|
NgbModalRef,
|
||||||
NgbPaginationModule,
|
NgbPaginationModule,
|
||||||
NgbPopoverModule,
|
|
||||||
} from '@ng-bootstrap/ng-bootstrap'
|
} from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { of, throwError } from 'rxjs'
|
import { of, throwError } from 'rxjs'
|
||||||
import { Tag } from 'src/app/data/tag'
|
import { Tag } from 'src/app/data/tag'
|
||||||
@ -38,7 +37,6 @@ import { MATCH_NONE } from 'src/app/data/matching-model'
|
|||||||
import { MATCH_LITERAL } from 'src/app/data/matching-model'
|
import { MATCH_LITERAL } from 'src/app/data/matching-model'
|
||||||
import { PermissionsDialogComponent } from '../../common/permissions-dialog/permissions-dialog.component'
|
import { PermissionsDialogComponent } from '../../common/permissions-dialog/permissions-dialog.component'
|
||||||
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
||||||
import { ConfirmButtonComponent } from '../../common/confirm-button/confirm-button.component'
|
|
||||||
import { BulkEditObjectOperation } from 'src/app/services/rest/abstract-name-filter-service'
|
import { BulkEditObjectOperation } from 'src/app/services/rest/abstract-name-filter-service'
|
||||||
|
|
||||||
const tags: Tag[] = [
|
const tags: Tag[] = [
|
||||||
@ -78,7 +76,6 @@ describe('ManagementListComponent', () => {
|
|||||||
SafeHtmlPipe,
|
SafeHtmlPipe,
|
||||||
ConfirmDialogComponent,
|
ConfirmDialogComponent,
|
||||||
PermissionsDialogComponent,
|
PermissionsDialogComponent,
|
||||||
ConfirmButtonComponent,
|
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
@ -100,7 +97,6 @@ describe('ManagementListComponent', () => {
|
|||||||
NgbModalModule,
|
NgbModalModule,
|
||||||
RouterTestingModule.withRoutes(routes),
|
RouterTestingModule.withRoutes(routes),
|
||||||
NgxBootstrapIconsModule.pick(allIcons),
|
NgxBootstrapIconsModule.pick(allIcons),
|
||||||
NgbPopoverModule,
|
|
||||||
],
|
],
|
||||||
}).compileComponents()
|
}).compileComponents()
|
||||||
|
|
||||||
@ -197,23 +193,27 @@ describe('ManagementListComponent', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should support delete, show notification on error / success', () => {
|
it('should support delete, show notification on error / success', () => {
|
||||||
|
let modal: NgbModalRef
|
||||||
|
modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1]))
|
||||||
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
||||||
const deleteSpy = jest.spyOn(tagService, 'delete')
|
const deleteSpy = jest.spyOn(tagService, 'delete')
|
||||||
const reloadSpy = jest.spyOn(component, 'reloadData')
|
const reloadSpy = jest.spyOn(component, 'reloadData')
|
||||||
|
|
||||||
const deleteButton = fixture.debugElement.query(
|
const deleteButton = fixture.debugElement.queryAll(By.css('button'))[8]
|
||||||
By.directive(ConfirmButtonComponent)
|
deleteButton.triggerEventHandler('click')
|
||||||
)
|
|
||||||
|
expect(modal).not.toBeUndefined()
|
||||||
|
const editDialog = modal.componentInstance as ConfirmDialogComponent
|
||||||
|
|
||||||
// fail first
|
// fail first
|
||||||
deleteSpy.mockReturnValueOnce(throwError(() => new Error('error deleting')))
|
deleteSpy.mockReturnValueOnce(throwError(() => new Error('error deleting')))
|
||||||
deleteButton.nativeElement.dispatchEvent(new Event('confirm'))
|
editDialog.confirmClicked.emit()
|
||||||
expect(toastErrorSpy).toHaveBeenCalled()
|
expect(toastErrorSpy).toHaveBeenCalled()
|
||||||
expect(reloadSpy).not.toHaveBeenCalled()
|
expect(reloadSpy).not.toHaveBeenCalled()
|
||||||
|
|
||||||
// succeed
|
// succeed
|
||||||
deleteSpy.mockReturnValueOnce(of(true))
|
deleteSpy.mockReturnValueOnce(of(true))
|
||||||
deleteButton.nativeElement.dispatchEvent(new Event('confirm'))
|
editDialog.confirmClicked.emit()
|
||||||
expect(reloadSpy).toHaveBeenCalled()
|
expect(reloadSpy).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -15,7 +15,10 @@ import {
|
|||||||
MATCH_NONE,
|
MATCH_NONE,
|
||||||
} from 'src/app/data/matching-model'
|
} from 'src/app/data/matching-model'
|
||||||
import { ObjectWithId } from 'src/app/data/object-with-id'
|
import { ObjectWithId } from 'src/app/data/object-with-id'
|
||||||
import { ObjectWithPermissions } from 'src/app/data/object-with-permissions'
|
import {
|
||||||
|
ObjectWithPermissions,
|
||||||
|
PermissionsObject,
|
||||||
|
} from 'src/app/data/object-with-permissions'
|
||||||
import {
|
import {
|
||||||
SortableDirective,
|
SortableDirective,
|
||||||
SortEvent,
|
SortEvent,
|
||||||
@ -194,21 +197,34 @@ export abstract class ManagementListComponent<T extends ObjectWithId>
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteObject(object: T) {
|
openDeleteDialog(object: T) {
|
||||||
this.service
|
var activeModal = this.modalService.open(ConfirmDialogComponent, {
|
||||||
.delete(object)
|
backdrop: 'static',
|
||||||
.pipe(takeUntil(this.unsubscribeNotifier))
|
})
|
||||||
.subscribe({
|
activeModal.componentInstance.title = $localize`Confirm delete`
|
||||||
next: () => {
|
activeModal.componentInstance.messageBold = this.getDeleteMessage(object)
|
||||||
this.reloadData()
|
activeModal.componentInstance.message = $localize`Associated documents will not be deleted.`
|
||||||
},
|
activeModal.componentInstance.btnClass = 'btn-danger'
|
||||||
error: (error) => {
|
activeModal.componentInstance.btnCaption = $localize`Delete`
|
||||||
this.toastService.showError(
|
activeModal.componentInstance.confirmClicked.subscribe(() => {
|
||||||
$localize`Error while deleting element`,
|
activeModal.componentInstance.buttonsEnabled = false
|
||||||
error
|
this.service
|
||||||
)
|
.delete(object)
|
||||||
},
|
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||||
})
|
.subscribe({
|
||||||
|
next: () => {
|
||||||
|
activeModal.close()
|
||||||
|
this.reloadData()
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
activeModal.componentInstance.buttonsEnabled = true
|
||||||
|
this.toastService.showError(
|
||||||
|
$localize`Error while deleting element`,
|
||||||
|
error
|
||||||
|
)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
get nameFilter() {
|
get nameFilter() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user