A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix dyanmic disabling checkboxes in permissions select
shamoon75c5ccccecee
diff --git a/src-ui/src/app/components/common/permissions-select/permissions-select.component.html b/src-ui/src/app/components/common/permissions-select/permissions-select.component.htmlindex 1907f4e3f..f3e85a543 100644--- a/src-ui/src/app/components/common/permissions-select/permissions-select.component.html+++ b/src-ui/src/app/components/common/permissions-select/permissions-select.component.html@@ -18,7 +18,7 @@</div><div *ngFor="let action of PermissionAction | keyvalue" class="col form-check form-check-inline" [ngbPopover]="inheritedWarning" [disablePopover]="!isInherited(type.key, action.key)" placement="left" triggers="mouseenter:mouseleave">- <input type="checkbox" class="form-check-input" id="{{type.key}}_{{action.key}}" formControlName="{{action.key}}" [attr.disabled]="isDisabled(type.key, action.key)">+ <input type="checkbox" class="form-check-input" id="{{type.key}}_{{action.key}}" formControlName="{{action.key}}"><label class="form-check-label visually-hidden" for="{{type.key}}_{{action.key}}" i18n>{{action.key}}</label></div></li>diff --git a/src-ui/src/app/components/common/permissions-select/permissions-select.component.ts b/src-ui/src/app/components/common/permissions-select/permissions-select.component.tsindex fa97a3b55..4b968f6e5 100644--- a/src-ui/src/app/components/common/permissions-select/permissions-select.component.ts+++ b/src-ui/src/app/components/common/permissions-select/permissions-select.component.ts@@ -1,5 +1,6 @@import { Component, forwardRef, Input, OnInit } from '@angular/core'import {+ AbstractControl,ControlValueAccessor,FormControl,FormGroup,@@ -54,6 +55,8 @@ export class PermissionsSelectComponentthis._inheritedPermissions = newInheritedPermissionsthis.writeValue(this.permissions) // updates visual checks etc.}++ this.updateDisabledStates()}inheritedWarning: string = $localize`Inerhited from group`@@ -98,6 +101,8 @@ export class PermissionsSelectComponentthis.typesWithAllActions.delete(type)}})++ this.updateDisabledStates()}onChange = (newValue: string[]) => {}@@ -185,12 +190,16 @@ export class PermissionsSelectComponent}}- // if checkbox is disabled either because "All", inhereted or entire component disabled- isDisabled(typeKey: string, actionKey: string) {- return this.typesWithAllActions.has(typeKey) ||- this.isInherited(typeKey, actionKey) ||- this.disabled- ? true- : null+ updateDisabledStates() {+ for (const type in PermissionType) {+ const control = this.form.get(type)+ let actionControl: AbstractControl+ for (const action in PermissionAction) {+ actionControl = control.get(action)+ this.isInherited(type, action) || this.disabled+ ? actionControl.disable()+ : actionControl.enable()+ }+ }}}