From e3d3feca23d2bd2e1d4b061f0ace9de7292fdee9 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 8 Feb 2026 23:47:06 -0800 Subject: [PATCH] Sonar --- .../custom-fields/custom-fields.component.ts | 16 ++++++------ .../document-attributes.component.ts | 2 +- .../correspondent-list.component.ts | 2 +- .../management-list.component.html | 24 +++++++++--------- .../management-list.component.spec.ts | 4 +-- .../management-list.component.ts | 25 ++++++++----------- .../tag-list/tag-list.component.spec.ts | 4 +-- 7 files changed, 37 insertions(+), 40 deletions(-) diff --git a/src-ui/src/app/components/manage/document-attributes/custom-fields/custom-fields.component.ts b/src-ui/src/app/components/manage/document-attributes/custom-fields/custom-fields.component.ts index 1560d1e19..9b9eb98bf 100644 --- a/src-ui/src/app/components/manage/document-attributes/custom-fields/custom-fields.component.ts +++ b/src-ui/src/app/components/manage/document-attributes/custom-fields/custom-fields.component.ts @@ -42,14 +42,14 @@ export class CustomFieldsComponent extends LoadingComponentWithPermissions implements OnInit { - private customFieldsService = inject(CustomFieldsService) - permissionsService = inject(PermissionsService) - private modalService = inject(NgbModal) - private toastService = inject(ToastService) - private documentListViewService = inject(DocumentListViewService) - private settingsService = inject(SettingsService) - private documentService = inject(DocumentService) - private savedViewService = inject(SavedViewService) + private readonly customFieldsService = inject(CustomFieldsService) + public readonly permissionsService = inject(PermissionsService) + private readonly modalService = inject(NgbModal) + private readonly toastService = inject(ToastService) + private readonly documentListViewService = inject(DocumentListViewService) + private readonly settingsService = inject(SettingsService) + private readonly documentService = inject(DocumentService) + private readonly savedViewService = inject(SavedViewService) public fields: CustomField[] = [] diff --git a/src-ui/src/app/components/manage/document-attributes/document-attributes.component.ts b/src-ui/src/app/components/manage/document-attributes/document-attributes.component.ts index 33b20f31e..5048ce836 100644 --- a/src-ui/src/app/components/manage/document-attributes/document-attributes.component.ts +++ b/src-ui/src/app/components/manage/document-attributes/document-attributes.component.ts @@ -136,7 +136,7 @@ export class DocumentAttributesComponent ] @ViewChild('activeOutlet', { read: NgComponentOutlet }) - private activeOutlet?: NgComponentOutlet + private readonly activeOutlet?: NgComponentOutlet private lastHeaderLoading: boolean diff --git a/src-ui/src/app/components/manage/document-attributes/management-list/correspondent-list/correspondent-list.component.ts b/src-ui/src/app/components/manage/document-attributes/management-list/correspondent-list/correspondent-list.component.ts index e021efe51..8f12aaf7a 100644 --- a/src-ui/src/app/components/manage/document-attributes/management-list/correspondent-list/correspondent-list.component.ts +++ b/src-ui/src/app/components/manage/document-attributes/management-list/correspondent-list/correspondent-list.component.ts @@ -36,7 +36,7 @@ import { ManagementListComponent } from '../management-list.component' ], }) export class CorrespondentListComponent extends ManagementListComponent { - private datePipe = inject(CustomDatePipe) + private readonly datePipe = inject(CustomDatePipe) constructor() { super() diff --git a/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.html b/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.html index c35366736..fcec43bb8 100644 --- a/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.html +++ b/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.html @@ -29,19 +29,19 @@ - - - - + + + @for (column of extraColumns; track column) { - + } - + @@ -84,16 +84,16 @@ - - - + + @for (column of extraColumns; track column) { -
+
- +
NameMatchingDocument countNameMatchingDocument count{{column.name}}{{column.name}}ActionsActions
+ @if (depth > 0) {
}
{{ getMatching(object) }}{{ getDocumentCount(object) }}{{ getMatching(object) }}{{ getDocumentCount(object) }} + @if (column.badgeFn) { } - +
diff --git a/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.spec.ts b/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.spec.ts index 125e6b206..48b567752 100644 --- a/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.spec.ts +++ b/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.spec.ts @@ -304,12 +304,12 @@ describe('ManagementListComponent', () => { }) it('selectPage should select current page items or clear selection', () => { - component.selectPage(true) + component.selectPage() expect(component.selectedObjects).toEqual(new Set(tags.map((t) => t.id))) expect(component.togggleAll).toBe(true) component.togggleAll = true - component.selectPage(false) + component.clearSelection() expect(component.selectedObjects.size).toBe(0) expect(component.togggleAll).toBe(false) }) diff --git a/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.ts b/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.ts index 10d027f92..e53664520 100644 --- a/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.ts +++ b/src-ui/src/app/components/manage/document-attributes/management-list/management-list.component.ts @@ -69,13 +69,14 @@ export abstract class ManagementListComponent implements OnInit, OnDestroy { protected service: AbstractNameFilterService - private modalService: NgbModal = inject(NgbModal) + private readonly modalService: NgbModal = inject(NgbModal) protected editDialogComponent: any - private toastService: ToastService = inject(ToastService) - private documentListViewService: DocumentListViewService = inject( + private readonly toastService: ToastService = inject(ToastService) + private readonly documentListViewService: DocumentListViewService = inject( DocumentListViewService ) - private permissionsService: PermissionsService = inject(PermissionsService) + private readonly permissionsService: PermissionsService = + inject(PermissionsService) protected filterRuleType: number public typeName: string public typeNamePlural: string @@ -196,7 +197,7 @@ export abstract class ManagementListComponent } openCreateDialog() { - var activeModal = this.modalService.open(this.editDialogComponent, { + const activeModal = this.modalService.open(this.editDialogComponent, { backdrop: 'static', }) activeModal.componentInstance.dialogMode = EditDialogMode.CREATE @@ -215,7 +216,7 @@ export abstract class ManagementListComponent } openEditDialog(object: T) { - var activeModal = this.modalService.open(this.editDialogComponent, { + const activeModal = this.modalService.open(this.editDialogComponent, { backdrop: 'static', }) activeModal.componentInstance.object = object @@ -243,7 +244,7 @@ export abstract class ManagementListComponent } openDeleteDialog(object: T) { - var activeModal = this.modalService.open(ConfirmDialogComponent, { + const activeModal = this.modalService.open(ConfirmDialogComponent, { backdrop: 'static', }) activeModal.componentInstance.title = $localize`Confirm delete` @@ -343,13 +344,9 @@ export abstract class ManagementListComponent this.clearSelection() } - selectPage(select: boolean) { - if (select) { - this.selectedObjects = new Set(this.getSelectableIDs(this.data)) - this.togggleAll = this.areAllPageItemsSelected() - } else { - this.clearSelection() - } + selectPage() { + this.selectedObjects = new Set(this.getSelectableIDs(this.data)) + this.togggleAll = this.areAllPageItemsSelected() } selectAll() { diff --git a/src-ui/src/app/components/manage/document-attributes/management-list/tag-list/tag-list.component.spec.ts b/src-ui/src/app/components/manage/document-attributes/management-list/tag-list/tag-list.component.spec.ts index ff5d4713d..526da6c9e 100644 --- a/src-ui/src/app/components/manage/document-attributes/management-list/tag-list/tag-list.component.spec.ts +++ b/src-ui/src/app/components/manage/document-attributes/management-list/tag-list/tag-list.component.spec.ts @@ -138,12 +138,12 @@ describe('TagListComponent', () => { } component.data = [parent as any] - component.selectPage(true) + component.selectPage() expect(component.selectedObjects.has(10)).toBe(true) expect(component.selectedObjects.has(11)).toBe(true) - component.selectPage(false) + component.clearSelection() expect(component.selectedObjects.size).toBe(0) }) })