<context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.html</context>
<context context-type="linenumber">96</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">208</context>
+ </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-group>
<context-group purpose="location">
<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 purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</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">306</context>
+ <context context-type="linenumber">322</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</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">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>
</trans-unit>
<trans-unit id="5382975254277698192" datatype="html">
</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">289</context>
+ <context context-type="linenumber">305</context>
</context-group>
</trans-unit>
<trans-unit id="4010735610815226758" datatype="html">
<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 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 purpose="location">
<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 purpose="location">
<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 purpose="location">
<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>
</trans-unit>
<trans-unit id="810888510148304696" datatype="html">
<source>Automatic</source>
<context-group purpose="location">
<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 purpose="location">
<context context-type="sourcefile">src/app/data/matching-model.ts</context>
<source>None</source>
<context-group purpose="location">
<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 purpose="location">
<context context-type="sourcefile">src/app/data/matching-model.ts</context>
<source>Successfully created <x id="PH" equiv-text="this.typeName"/>.</source>
<context-group purpose="location">
<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>
</trans-unit>
<trans-unit id="3928835053823658072" datatype="html">
<source>Error occurred while creating <x id="PH" equiv-text="this.typeName"/>.</source>
<context-group purpose="location">
<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>
</trans-unit>
<trans-unit id="2541368547549828690" datatype="html">
<source>Successfully updated <x id="PH" equiv-text="this.typeName"/>.</source>
<context-group purpose="location">
<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>
</trans-unit>
<trans-unit id="6442673774206210733" datatype="html">
<source>Error occurred while saving <x id="PH" equiv-text="this.typeName"/>.</source>
<context-group purpose="location">
<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>
</trans-unit>
<trans-unit id="6639207128255974941" datatype="html">
<source>Error while deleting element</source>
<context-group purpose="location">
<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>
</trans-unit>
<trans-unit id="4863024195229581844" datatype="html">
<source>Permissions updated successfully</source>
<context-group purpose="location">
<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>
</trans-unit>
<trans-unit id="1464476612812630086" datatype="html">
<source>This operation will permanently delete all objects.</source>
<context-group purpose="location">
<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>
</trans-unit>
<trans-unit id="5897787932098828336" datatype="html">
<source>Objects deleted successfully</source>
<context-group purpose="location">
<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>
</trans-unit>
<trans-unit id="8273353839648035634" datatype="html">
<source>Error deleting objects</source>
<context-group purpose="location">
<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>
</trans-unit>
<trans-unit id="5101757640976222639" datatype="html">
<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 }">
<i-bs width="1em" height="1em" name="filter"></i-bs> <ng-container i18n>Documents</ng-container>
- </button>
- <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>
- </button>
- <pngx-confirm-button
- label="Delete"
- i18n-label
- (confirm)="deleteObject(object)"
- *pngxIfPermissions="{ action: PermissionAction.Delete, type: permissionType }"
- [disabled]="!userCanDelete(object)"
- buttonClasses=" btn-sm btn-outline-danger"
- iconName="trash">
- </pngx-confirm-button>
+ </button>
+ <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>
+ </button>
+ <button class="btn btn-sm btn-outline-danger" (click)="openDeleteDialog(object); $event.stopPropagation();" *pngxIfPermissions="{ action: PermissionAction.Delete, type: permissionType }" [disabled]="!userCanDelete(object)">
+ <i-bs width="1em" height="1em" name="trash"></i-bs> <ng-container i18n>Delete</ng-container>
+ </button>
+ </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>
- </td>
- </tr>
+ }
+ @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>
}
- </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>
- }
- @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>
- }
NgbModalModule,
NgbModalRef,
NgbPaginationModule,
- NgbPopoverModule,
} from '@ng-bootstrap/ng-bootstrap'
import { of, throwError } from 'rxjs'
import { Tag } from 'src/app/data/tag'
import { MATCH_LITERAL } from 'src/app/data/matching-model'
import { PermissionsDialogComponent } from '../../common/permissions-dialog/permissions-dialog.component'
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'
const tags: Tag[] = [
SafeHtmlPipe,
ConfirmDialogComponent,
PermissionsDialogComponent,
- ConfirmButtonComponent,
],
providers: [
{
NgbModalModule,
RouterTestingModule.withRoutes(routes),
NgxBootstrapIconsModule.pick(allIcons),
- NgbPopoverModule,
],
}).compileComponents()
})
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 deleteSpy = jest.spyOn(tagService, 'delete')
const reloadSpy = jest.spyOn(component, 'reloadData')
- const deleteButton = fixture.debugElement.query(
- By.directive(ConfirmButtonComponent)
- )
+ const deleteButton = fixture.debugElement.queryAll(By.css('button'))[8]
+ deleteButton.triggerEventHandler('click')
+
+ expect(modal).not.toBeUndefined()
+ const editDialog = modal.componentInstance as ConfirmDialogComponent
// fail first
deleteSpy.mockReturnValueOnce(throwError(() => new Error('error deleting')))
- deleteButton.nativeElement.dispatchEvent(new Event('confirm'))
+ editDialog.confirmClicked.emit()
expect(toastErrorSpy).toHaveBeenCalled()
expect(reloadSpy).not.toHaveBeenCalled()
// succeed
deleteSpy.mockReturnValueOnce(of(true))
- deleteButton.nativeElement.dispatchEvent(new Event('confirm'))
+ editDialog.confirmClicked.emit()
expect(reloadSpy).toHaveBeenCalled()
})