From 97a52e1ad84ea468831b42e57b0e2cd50253eb51 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Thu, 9 Jul 2026 07:01:58 -0700
Subject: [PATCH] Permissions dialog, management lists, saved views, workflow
edit
---
.../workflow-edit-dialog.component.html | 20 +--
.../workflow-edit-dialog.component.spec.ts | 14 +-
.../workflow-edit-dialog.component.ts | 165 +++++-------------
.../permissions-dialog.component.html | 14 +-
.../permissions-dialog.component.spec.ts | 2 +-
.../permissions-dialog.component.ts | 53 ++----
.../bulk-editor/bulk-editor.component.ts | 2 +-
.../management-list.component.html | 26 +--
.../management-list.component.spec.ts | 48 ++---
.../management-list.component.ts | 134 ++++----------
.../tag-list/tag-list.component.spec.ts | 2 +-
.../components/manage/mail/mail.component.ts | 2 +-
.../saved-views/saved-views.component.spec.ts | 4 +-
.../saved-views/saved-views.component.ts | 6 +-
14 files changed, 158 insertions(+), 334 deletions(-)
diff --git a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html
index 51b8a2a5d..9dce30891 100644
--- a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html
+++ b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html
@@ -140,7 +140,7 @@
@if (formGroup.get('schedule_date_field').value === 'custom_field') {
}
@@ -162,7 +162,7 @@
@if (formGroup.get('type').value === WorkflowTriggerType.Consumption) {
-
+
}
@if (formGroup.get('type').value === WorkflowTriggerType.DocumentAdded || formGroup.get('type').value === WorkflowTriggerType.DocumentUpdated || formGroup.get('type').value === WorkflowTriggerType.Scheduled) {
@@ -262,10 +262,10 @@
diff --git a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts
index 936b3708e..2c7b56149 100644
--- a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts
+++ b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts
@@ -771,25 +771,21 @@ describe('WorkflowEditDialogComponent', () => {
false
)
- component.correspondents = [{ id: 1, name: 'C1' } as any]
- component.documentTypes = [{ id: 2, name: 'DT' } as any]
- component.storagePaths = [{ id: 3, name: 'SP' } as any]
-
expect(
component.getFilterSelectItems(TriggerFilterType.CorrespondentIs)
- ).toEqual(component.correspondents)
+ ).toEqual(component.correspondents())
expect(
component.getFilterSelectItems(TriggerFilterType.DocumentTypeIs)
- ).toEqual(component.documentTypes)
+ ).toEqual(component.documentTypes())
expect(
component.getFilterSelectItems(TriggerFilterType.DocumentTypeAny)
- ).toEqual(component.documentTypes)
+ ).toEqual(component.documentTypes())
expect(
component.getFilterSelectItems(TriggerFilterType.StoragePathIs)
- ).toEqual(component.storagePaths)
+ ).toEqual(component.storagePaths())
expect(
component.getFilterSelectItems(TriggerFilterType.StoragePathAny)
- ).toEqual(component.storagePaths)
+ ).toEqual(component.storagePaths())
expect(component.getFilterSelectItems(TriggerFilterType.TagsAll)).toEqual(
[]
)
diff --git a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts
index f379ed3ae..57603e412 100644
--- a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts
+++ b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts
@@ -4,7 +4,8 @@ import {
moveItemInArray,
} from '@angular/cdk/drag-drop'
import { NgTemplateOutlet } from '@angular/common'
-import { Component, OnInit, inject, signal } from '@angular/core'
+import { Component, OnInit, computed, inject, signal } from '@angular/core'
+import { toSignal } from '@angular/core/rxjs-interop'
import {
AbstractControl,
FormArray,
@@ -15,7 +16,7 @@ import {
} from '@angular/forms'
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap'
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
-import { Subscription, first, takeUntil } from 'rxjs'
+import { Subscription, map, takeUntil } from 'rxjs'
import { Correspondent } from 'src/app/data/correspondent'
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
import { DocumentType } from 'src/app/data/document-type'
@@ -470,79 +471,40 @@ export class WorkflowEditDialogComponent
public TriggerFilterType = TriggerFilterType
public filterDefinitions = TRIGGER_FILTER_DEFINITIONS
- private correspondentService: CorrespondentService
- private documentTypeService: DocumentTypeService
- private storagePathService: StoragePathService
- private mailRuleService: MailRuleService
- private customFieldsService: CustomFieldsService
+ private correspondentService = inject(CorrespondentService)
+ private documentTypeService = inject(DocumentTypeService)
+ private storagePathService = inject(StoragePathService)
+ private mailRuleService = inject(MailRuleService)
+ private customFieldsService = inject(CustomFieldsService)
- private templatesSignal = signal
(undefined)
- private correspondentsSignal = signal(undefined)
- private documentTypesSignal = signal(undefined)
- private storagePathsSignal = signal(undefined)
- private mailRulesSignal = signal(undefined)
- private customFieldsSignal = signal(undefined)
- private dateCustomFieldsSignal = signal(undefined)
-
- get templates(): Workflow[] {
- return this.templatesSignal()
- }
-
- set templates(templates: Workflow[]) {
- this.templatesSignal.set(templates)
- }
-
- get correspondents(): Correspondent[] {
- return this.correspondentsSignal()
- }
-
- set correspondents(correspondents: Correspondent[]) {
- this.correspondentsSignal.set(correspondents)
- }
-
- get documentTypes(): DocumentType[] {
- return this.documentTypesSignal()
- }
-
- set documentTypes(documentTypes: DocumentType[]) {
- this.documentTypesSignal.set(documentTypes)
- }
-
- get storagePaths(): StoragePath[] {
- return this.storagePathsSignal()
- }
-
- set storagePaths(storagePaths: StoragePath[]) {
- this.storagePathsSignal.set(storagePaths)
- }
-
- get mailRules(): MailRule[] {
- return this.mailRulesSignal()
- }
-
- set mailRules(mailRules: MailRule[]) {
- this.mailRulesSignal.set(mailRules)
- }
-
- get customFields(): CustomField[] {
- return this.customFieldsSignal()
- }
-
- set customFields(customFields: CustomField[]) {
- this.customFieldsSignal.set(customFields)
- }
-
- get dateCustomFields(): CustomField[] {
- return this.dateCustomFieldsSignal()
- }
-
- set dateCustomFields(dateCustomFields: CustomField[]) {
- this.dateCustomFieldsSignal.set(dateCustomFields)
- }
+ readonly templates = signal(undefined)
+ readonly correspondents = toSignal(
+ this.correspondentService.listAll().pipe(map((result) => result.results)),
+ { initialValue: undefined as Correspondent[] }
+ )
+ readonly documentTypes = toSignal(
+ this.documentTypeService.listAll().pipe(map((result) => result.results)),
+ { initialValue: undefined as DocumentType[] }
+ )
+ readonly storagePaths = toSignal(
+ this.storagePathService.listAll().pipe(map((result) => result.results)),
+ { initialValue: undefined as StoragePath[] }
+ )
+ readonly mailRules = toSignal(
+ this.mailRuleService.listAll().pipe(map((result) => result.results)),
+ { initialValue: undefined as MailRule[] }
+ )
+ readonly customFields = toSignal(
+ this.customFieldsService.listAll().pipe(map((result) => result.results)),
+ { initialValue: undefined as CustomField[] }
+ )
+ readonly dateCustomFields = computed(() =>
+ this.customFields()?.filter((f) => f.data_type === CustomFieldDataType.Date)
+ )
expandedItem: number = null
- private allowedActionTypesSignal = signal([])
+ readonly allowedActionTypes = signal([])
private readonly triggerFilterOptionsMap = new WeakMap<
FormArray,
@@ -552,43 +514,8 @@ export class WorkflowEditDialogComponent
constructor() {
super()
this.service = inject(WorkflowService)
- this.correspondentService = inject(CorrespondentService)
- this.documentTypeService = inject(DocumentTypeService)
- this.storagePathService = inject(StoragePathService)
- this.mailRuleService = inject(MailRuleService)
this.userService = inject(UserService)
this.settingsService = inject(SettingsService)
- this.customFieldsService = inject(CustomFieldsService)
-
- this.correspondentService
- .listAll()
- .pipe(first())
- .subscribe((result) => (this.correspondents = result.results))
-
- this.documentTypeService
- .listAll()
- .pipe(first())
- .subscribe((result) => (this.documentTypes = result.results))
-
- this.storagePathService
- .listAll()
- .pipe(first())
- .subscribe((result) => (this.storagePaths = result.results))
-
- this.mailRuleService
- .listAll()
- .pipe(first())
- .subscribe((result) => (this.mailRules = result.results))
-
- this.customFieldsService
- .listAll()
- .pipe(first())
- .subscribe((result) => {
- this.customFields = result.results
- this.dateCustomFields = this.customFields?.filter(
- (f) => f.data_type === CustomFieldDataType.Date
- )
- })
}
getCreateTitle() {
@@ -621,11 +548,13 @@ export class WorkflowEditDialogComponent
this.checkRemovalActionFields.bind(this)
)
this.checkRemovalActionFields(this.objectForm.value)
- this.allowedActionTypes = this.settingsService.get(
- SETTINGS_KEYS.EMAIL_ENABLED
+ this.allowedActionTypes.set(
+ this.settingsService.get(SETTINGS_KEYS.EMAIL_ENABLED)
+ ? WORKFLOW_ACTION_OPTIONS
+ : WORKFLOW_ACTION_OPTIONS.filter(
+ (a) => a.id !== WorkflowActionType.Email
+ )
)
- ? WORKFLOW_ACTION_OPTIONS
- : WORKFLOW_ACTION_OPTIONS.filter((a) => a.id !== WorkflowActionType.Email)
}
private checkRemovalActionFields(formWorkflow: Workflow) {
@@ -1010,11 +939,11 @@ export class WorkflowEditDialogComponent
switch (definition.selectItems) {
case 'correspondents':
- return this.correspondents
+ return this.correspondents()
case 'documentTypes':
- return this.documentTypes
+ return this.documentTypes()
case 'storagePaths':
- return this.storagePaths
+ return this.storagePaths()
default:
return []
}
@@ -1351,15 +1280,7 @@ export class WorkflowEditDialogComponent
get actionTypeOptions() {
this.settingsService.trackChanges()
- return this.allowedActionTypes
- }
-
- get allowedActionTypes() {
- return this.allowedActionTypesSignal()
- }
-
- set allowedActionTypes(allowedActionTypes) {
- this.allowedActionTypesSignal.set(allowedActionTypes)
+ return this.allowedActionTypes()
}
getActionTypeOptionName(type: WorkflowActionType): string {
diff --git a/src-ui/src/app/components/common/permissions-dialog/permissions-dialog.component.html b/src-ui/src/app/components/common/permissions-dialog/permissions-dialog.component.html
index f11fc9760..7ac84c6cc 100644
--- a/src-ui/src/app/components/common/permissions-dialog/permissions-dialog.component.html
+++ b/src-ui/src/app/components/common/permissions-dialog/permissions-dialog.component.html
@@ -1,5 +1,5 @@
@@ -7,7 +7,7 @@
-
+
@@ -31,21 +31,21 @@
|
-
+
|
- Name |
- Matching |
- Document count |
+ Name |
+ Matching |
+ Document count |
@for (column of extraColumns; track column) {
- {{column.name}} |
+ {{column.name}} |
}
Actions |
- @if (loading && data.length === 0) {
+ @if (loading() && data().length === 0) {
|
@@ -53,25 +53,25 @@
|
}
- @for (object of data; track object) {
+ @for (object of data(); track object) {
}
-@if (!loading || data.length > 0) {
+@if (!loading() || data().length > 0) {
- @if (displayCollectionSize > 0) {
+ @if (displayCollectionSize() > 0) {
- {displayCollectionSize, plural, =1 {One {{typeName}}} other {{{displayCollectionSize || 0}} total {{typeNamePlural}}}}
+ {displayCollectionSize(), plural, =1 {One {{typeName}}} other {{{displayCollectionSize() || 0}} total {{typeNamePlural}}}}
@if (hasSelection) {
({{selectedCount}} selected)
}
}
- @if (collectionSize > 20) {
-
+ @if (collectionSize() > 20) {
+
}
}
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 cfc087ba4..1e8fb3f7c 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
@@ -147,7 +147,7 @@ describe('ManagementListComponent', () => {
component.nameFilter = 'foo' // subject normally triggered by ngModel
tick(400) // debounce
fixture.detectChanges()
- expect(component.data).toEqual([tags[0]])
+ expect(component.data()).toEqual([tags[0]])
nameFilterInput.nativeElement.dispatchEvent(
new KeyboardEvent('keyup', { code: 'Escape' })
@@ -155,7 +155,7 @@ describe('ManagementListComponent', () => {
tick(400) // debounce
fixture.detectChanges()
expect(component.nameFilter).toBeNull()
- expect(component.data).toEqual(tags)
+ expect(component.data()).toEqual(tags)
tick(100) // load
}))
@@ -242,8 +242,8 @@ describe('ManagementListComponent', () => {
component.reloadData()
tick(100)
- expect(component.collectionSize).toBe(1)
- expect(component.displayCollectionSize).toBe(3)
+ expect(component.collectionSize()).toBe(1)
+ expect(component.displayCollectionSize()).toBe(3)
}))
it('should support quick filter for objects', () => {
@@ -275,9 +275,9 @@ describe('ManagementListComponent', () => {
})
)
)
- component.page = 2
+ component.page.set(2)
component.reloadData()
- expect(component.page).toEqual(1)
+ expect(component.page()).toEqual(1)
})
it('should support toggle select page in vew', () => {
@@ -295,28 +295,28 @@ describe('ManagementListComponent', () => {
it('selectNone should clear selection and reset toggle flag', () => {
component.selectedObjects = new Set([tags[0].id, tags[1].id])
- component.togggleAll = true
+ component.togggleAll.set(true)
component.selectNone()
expect(component.selectedObjects.size).toBe(0)
- expect(component.togggleAll).toBe(false)
+ expect(component.togggleAll()).toBe(false)
})
it('selectPage should select current page items or clear selection', () => {
component.selectPage()
expect(component.selectedObjects).toEqual(new Set(tags.map((t) => t.id)))
- expect(component.togggleAll).toBe(true)
+ expect(component.togggleAll()).toBe(true)
- component.togggleAll = true
+ component.togggleAll.set(true)
component.clearSelection()
expect(component.selectedObjects.size).toBe(0)
- expect(component.togggleAll).toBe(false)
+ expect(component.togggleAll()).toBe(false)
})
it('selectAll should activate all-selection mode', () => {
;(tagService.listFiltered as jest.Mock).mockClear()
- component.collectionSize = tags.length
+ component.collectionSize.set(tags.length)
component.selectAll()
@@ -325,41 +325,41 @@ describe('ManagementListComponent', () => {
expect((component as any).allSelectionActive).toBe(true)
expect(component.hasSelection).toBe(true)
expect(component.selectedCount).toBe(tags.length)
- expect(component.togggleAll).toBe(true)
+ expect(component.togggleAll()).toBe(true)
})
it('selectAll should clear selection when collection size is zero', () => {
component.selectedObjects = new Set([1])
- component.collectionSize = 0
- component.togggleAll = true
+ component.collectionSize.set(0)
+ component.togggleAll.set(true)
component.selectAll()
expect(component.selectedObjects.size).toBe(0)
- expect(component.togggleAll).toBe(false)
+ expect(component.togggleAll()).toBe(false)
})
it('toggleSelected should toggle object selection and update toggle state', () => {
component.toggleSelected(tags[0])
expect(component.selectedObjects.has(tags[0].id)).toBe(true)
- expect(component.togggleAll).toBe(false)
+ expect(component.togggleAll()).toBe(false)
component.toggleSelected(tags[1])
component.toggleSelected(tags[2])
- expect(component.togggleAll).toBe(true)
+ expect(component.togggleAll()).toBe(true)
component.toggleSelected(tags[1])
expect(component.selectedObjects.has(tags[1].id)).toBe(false)
- expect(component.togggleAll).toBe(false)
+ expect(component.togggleAll()).toBe(false)
})
it('areAllPageItemsSelected should return false when page has no selectable items', () => {
- component.data = []
+ component.data.set([])
component.selectedObjects.clear()
expect((component as any).areAllPageItemsSelected()).toBe(false)
- component.data = tags
+ component.data.set(tags)
})
it('should support bulk edit permissions', () => {
@@ -498,7 +498,7 @@ describe('ManagementListComponent', () => {
document_count: 10,
parent: 1,
}
- component['unfilteredData'].push(childTag)
+ component['unfilteredData'].update((data) => [...data, childTag])
const original = component.getOriginalObject({ id: 4 } as Tag)
expect(original).toEqual(childTag)
})
@@ -536,7 +536,7 @@ describe('ManagementListComponent', () => {
.mockReturnValue(of({ success: true }))
component.typeNamePlural = 'tags'
- component.page = 2
+ component.page.set(2)
component.pageSize = 100
tick()
@@ -545,7 +545,7 @@ describe('ManagementListComponent', () => {
SETTINGS_KEYS.OBJECT_LIST_SIZES,
{ tags: 100 }
)
- expect(component.page).toBe(1)
+ expect(component.page()).toBe(1)
expect(reloadSpy).toHaveBeenCalled()
expect(toastErrorSpy).not.toHaveBeenCalled()
}))
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 a49e5a84e..b385df69f 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
@@ -88,89 +88,25 @@ export abstract class ManagementListComponent
@ViewChildren(SortableDirective) headers: QueryList
- private dataSignal = signal([])
- private unfilteredDataSignal = signal([])
+ readonly data = signal([])
+ private readonly unfilteredData = signal([])
private currentExtraParams: { [key: string]: any } = null
private allSelectionActive = false
- private pageSignal = signal(1)
+ readonly page = signal(1)
- private collectionSizeSignal = signal(0)
- private displayCollectionSizeSignal = signal(0)
+ readonly collectionSize = signal(0)
+ readonly displayCollectionSize = signal(0)
- private sortFieldSignal = signal(undefined)
- private sortReverseSignal = signal(undefined)
+ readonly sortField = signal(undefined)
+ readonly sortReverse = signal(undefined)
private nameFilterDebounce: Subject
protected unsubscribeNotifier: Subject = new Subject()
protected _nameFilter: string
public selectedObjects: Set = new Set()
- private togggleAllSignal = signal(false)
-
- public get data(): T[] {
- return this.dataSignal()
- }
-
- public set data(data: T[]) {
- this.dataSignal.set(data)
- }
-
- private get unfilteredData(): T[] {
- return this.unfilteredDataSignal()
- }
-
- private set unfilteredData(data: T[]) {
- this.unfilteredDataSignal.set(data)
- }
-
- public get page(): number {
- return this.pageSignal()
- }
-
- public set page(page: number) {
- this.pageSignal.set(page)
- }
-
- public get collectionSize(): number {
- return this.collectionSizeSignal()
- }
-
- public set collectionSize(collectionSize: number) {
- this.collectionSizeSignal.set(collectionSize)
- }
-
- public get displayCollectionSize(): number {
- return this.displayCollectionSizeSignal()
- }
-
- public set displayCollectionSize(displayCollectionSize: number) {
- this.displayCollectionSizeSignal.set(displayCollectionSize)
- }
-
- public get sortField(): string {
- return this.sortFieldSignal()
- }
-
- public set sortField(sortField: string) {
- this.sortFieldSignal.set(sortField)
- }
-
- public get sortReverse(): boolean {
- return this.sortReverseSignal()
- }
-
- public set sortReverse(sortReverse: boolean) {
- this.sortReverseSignal.set(sortReverse)
- }
-
- public get togggleAll(): boolean {
- return this.togggleAllSignal()
- }
-
- public set togggleAll(togggleAll: boolean) {
- this.togggleAllSignal.set(togggleAll)
- }
+ readonly togggleAll = signal(false)
public get hasSelection(): boolean {
return this.selectedObjects.size > 0 || this.allSelectionActive
@@ -178,7 +114,7 @@ export abstract class ManagementListComponent
public get selectedCount(): number {
return this.allSelectionActive
- ? this.displayCollectionSize
+ ? this.displayCollectionSize()
: this.selectedObjects.size
}
@@ -195,7 +131,7 @@ export abstract class ManagementListComponent
)
.subscribe((title) => {
this._nameFilter = title
- this.page = 1
+ this.page.set(1)
this.reloadData()
})
}
@@ -215,8 +151,8 @@ export abstract class ManagementListComponent
}
onSort(event: SortEvent) {
- this.sortField = event.column
- this.sortReverse = event.reverse
+ this.sortField.set(event.column)
+ this.sortReverse.set(event.reverse)
this.reloadData()
}
@@ -235,13 +171,13 @@ export abstract class ManagementListComponent
getDocumentCount(object: MatchingModel): number {
return (
object.document_count ??
- this.unfilteredData.find((d) => d.id == object.id)?.document_count ??
+ this.unfilteredData().find((d) => d.id == object.id)?.document_count ??
0
)
}
public getOriginalObject(object: T): T {
- return this.unfilteredData.find((d) => d?.id == object?.id) || object
+ return this.unfilteredData().find((d) => d?.id == object?.id) || object
}
reloadData(extraParams: { [key: string]: any } = null) {
@@ -250,10 +186,10 @@ export abstract class ManagementListComponent
this.clearSelection()
this.service
.listFiltered(
- this.page,
+ this.page(),
this.pageSize,
- this.sortField,
- this.sortReverse,
+ this.sortField(),
+ this.sortReverse(),
this._nameFilter,
true,
extraParams
@@ -261,16 +197,16 @@ export abstract class ManagementListComponent
.pipe(
takeUntil(this.unsubscribeNotifier),
tap((c) => {
- this.unfilteredData = c.results
- this.data = this.filterData(c.results)
- this.collectionSize = this.getCollectionSize(c)
- this.displayCollectionSize = this.getDisplayCollectionSize(c)
+ this.unfilteredData.set(c.results)
+ this.data.set(this.filterData(c.results))
+ this.collectionSize.set(this.getCollectionSize(c))
+ this.displayCollectionSize.set(this.getDisplayCollectionSize(c))
})
)
.subscribe({
error: (error: HttpErrorResponse) => {
if (error.error?.detail?.includes('Invalid page')) {
- this.page = 1
+ this.page.set(1)
this.reloadData()
}
},
@@ -385,7 +321,7 @@ export abstract class ManagementListComponent
})
this.settingsService.storeSettings().subscribe({
next: () => {
- this.page = 1
+ this.page.set(1)
this.reloadData()
},
error: (error) => {
@@ -409,7 +345,7 @@ export abstract class ManagementListComponent
if (!this.permissionsService.currentUserCan(action, this.permissionType))
return false
let ownsAll: boolean = true
- const objects = this.data.filter((o) => this.selectedObjects.has(o.id))
+ const objects = this.data().filter((o) => this.selectedObjects.has(o.id))
ownsAll = objects.every((o) =>
this.permissionsService.currentUserOwnsObject(o)
)
@@ -430,7 +366,7 @@ export abstract class ManagementListComponent
clearSelection() {
this.allSelectionActive = false
- this.togggleAll = false
+ this.togggleAll.set(false)
this.selectedObjects.clear()
}
@@ -440,19 +376,19 @@ export abstract class ManagementListComponent
selectPage() {
this.allSelectionActive = false
- this.selectedObjects = new Set(this.getSelectableIDs(this.data))
- this.togggleAll = this.areAllPageItemsSelected()
+ this.selectedObjects = new Set(this.getSelectableIDs(this.data()))
+ this.togggleAll.set(this.areAllPageItemsSelected())
}
selectAll() {
- if (!this.collectionSize) {
+ if (!this.collectionSize()) {
this.clearSelection()
return
}
this.allSelectionActive = true
- this.selectedObjects = new Set(this.getSelectableIDs(this.data))
- this.togggleAll = this.areAllPageItemsSelected()
+ this.selectedObjects = new Set(this.getSelectableIDs(this.data()))
+ this.togggleAll.set(this.areAllPageItemsSelected())
}
toggleSelected(object) {
@@ -462,14 +398,14 @@ export abstract class ManagementListComponent
this.selectedObjects.has(object.id)
? this.selectedObjects.delete(object.id)
: this.selectedObjects.add(object.id)
- this.togggleAll = this.areAllPageItemsSelected()
+ this.togggleAll.set(this.areAllPageItemsSelected())
}
protected areAllPageItemsSelected(): boolean {
if (this.allSelectionActive) {
- return this.data.length > 0
+ return this.data().length > 0
}
- const ids = this.getSelectableIDs(this.data)
+ const ids = this.getSelectableIDs(this.data())
return ids.length > 0 && ids.every((id) => this.selectedObjects.has(id))
}
@@ -479,7 +415,7 @@ export abstract class ManagementListComponent
})
modal.componentInstance.confirmClicked.subscribe(
({ permissions, merge }) => {
- modal.componentInstance.buttonsEnabled = false
+ modal.componentInstance.buttonsEnabled.set(false)
this.service
.bulk_edit_objects(
this.allSelectionActive ? [] : Array.from(this.selectedObjects),
@@ -498,7 +434,7 @@ export abstract class ManagementListComponent
this.reloadData()
},
error: (error) => {
- modal.componentInstance.buttonsEnabled = true
+ modal.componentInstance.buttonsEnabled.set(true)
this.toastService.showError(
$localize`Error updating permissions`,
error
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 dab6a5809..d30408a22 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
@@ -136,7 +136,7 @@ describe('TagListComponent', () => {
],
}
- component.data = [parent as any]
+ component.data.set([parent as any])
component.selectPage()
expect(component.selectedObjects.has(10)).toBe(true)
diff --git a/src-ui/src/app/components/manage/mail/mail.component.ts b/src-ui/src/app/components/manage/mail/mail.component.ts
index 54dcd72b0..06a6030fd 100644
--- a/src-ui/src/app/components/manage/mail/mail.component.ts
+++ b/src-ui/src/app/components/manage/mail/mail.component.ts
@@ -330,7 +330,7 @@ export class MailComponent
dialog.object = object
modal.componentInstance.confirmClicked.subscribe(
({ permissions, merge }) => {
- modal.componentInstance.buttonsEnabled = false
+ modal.componentInstance.buttonsEnabled.set(false)
const service: AbstractPaperlessService =
'account' in object ? this.mailRuleService : this.mailAccountService
object.owner = permissions['owner']
diff --git a/src-ui/src/app/components/manage/saved-views/saved-views.component.spec.ts b/src-ui/src/app/components/manage/saved-views/saved-views.component.spec.ts
index de6c88f9a..735e5abf4 100644
--- a/src-ui/src/app/components/manage/saved-views/saved-views.component.spec.ts
+++ b/src-ui/src/app/components/manage/saved-views/saved-views.component.spec.ts
@@ -1,6 +1,7 @@
import { DragDropModule } from '@angular/cdk/drag-drop'
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
import { provideHttpClientTesting } from '@angular/common/http/testing'
+import { signal } from '@angular/core'
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { NgbModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'
@@ -226,7 +227,8 @@ describe('SavedViewsComponent', () => {
const modalRef = {
componentInstance: {
confirmClicked,
- buttonsEnabled: true,
+ buttonsEnabled: signal(true),
+ note: signal(null),
},
close: jest.fn(),
} as any
diff --git a/src-ui/src/app/components/manage/saved-views/saved-views.component.ts b/src-ui/src/app/components/manage/saved-views/saved-views.component.ts
index cbbb884bc..3d9ee84dd 100644
--- a/src-ui/src/app/components/manage/saved-views/saved-views.component.ts
+++ b/src-ui/src/app/components/manage/saved-views/saved-views.component.ts
@@ -256,10 +256,12 @@ export class SavedViewsComponent
})
const dialog = modal.componentInstance as PermissionsDialogComponent
dialog.object = savedView
- dialog.note = $localize`Note: Sharing saved views does not share the underlying documents.`
+ dialog.note.set(
+ $localize`Note: Sharing saved views does not share the underlying documents.`
+ )
modal.componentInstance.confirmClicked.subscribe(({ permissions }) => {
- modal.componentInstance.buttonsEnabled = false
+ modal.componentInstance.buttonsEnabled.set(false)
const view = {
id: savedView.id,
owner: permissions.owner,