Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run build --if-present

Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ export class DfRoleDetailsComponent implements OnInit {
});

serviceAccess.controls.forEach((control, index) => {
console.log(`ServiceAccess[${index}] valid:`, control.valid, 'visibility:', this.visibilityArray[index]);
if (control.invalid) {
console.log(`ServiceAccess[${index}] errors:`, control.errors);
console.log(`ServiceAccess[${index}] controls errors:`, {
Expand Down
47 changes: 37 additions & 10 deletions src/app/adf-roles/df-roles-access/df-roles-access.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
>{{ option.name }}</mat-option
>
</mat-select>
<mat-error *ngIf="formArray.controls[getFormArrayIndex(i)]?.get('service')?.hasError('required')">
<mat-error
*ngIf="
formArray.controls[getFormArrayIndex(i)]
?.get('service')
?.hasError('required')
">
Service is required
</mat-error>
</mat-form-field>
Expand All @@ -57,14 +62,24 @@
<mat-label>{{
'roles.accessOverview.tableHeadings.component' | transloco
}}</mat-label>
<mat-select formControlName="component" panelWdith="null" required>
<mat-select
formControlName="component"
panelWdith="null"
required>
<mat-option
*ngFor="let option of getComponentArray(getFormArrayIndex(i))"
*ngFor="
let option of getComponentArray(getFormArrayIndex(i))
"
[value]="option"
>{{ option }}</mat-option
>
</mat-select>
<mat-error *ngIf="formArray.controls[getFormArrayIndex(i)]?.get('component')?.hasError('required')">
<mat-error
*ngIf="
formArray.controls[getFormArrayIndex(i)]
?.get('component')
?.hasError('required')
">
Component is required
</mat-error>
</mat-form-field>
Expand All @@ -87,7 +102,9 @@
formControlName="access"
multiple
panelWidth="null"
(selectionChange)="accessChange(getFormArrayIndex(i), $event.value)"
(selectionChange)="
accessChange(getFormArrayIndex(i), $event.value)
"
required>
<mat-option
*ngFor="let option of accessOptions"
Expand All @@ -96,20 +113,28 @@
<span
class="example-additional-selection"
*ngIf="
(formArray.controls[getFormArrayIndex(i)]?.value.access.length || 0) > 1
(formArray.controls[getFormArrayIndex(i)]?.value.access
.length || 0) > 1
">
(+{{
(formArray.controls[getFormArrayIndex(i)]?.value.access.length || 0) - 1
(formArray.controls[getFormArrayIndex(i)]?.value.access
.length || 0) - 1
}}
{{
formArray.controls[getFormArrayIndex(i)]?.value.access.length === 2
formArray.controls[getFormArrayIndex(i)]?.value.access
.length === 2
? 'other'
: 'others'
}})
</span>
</mat-option>
</mat-select>
<mat-error *ngIf="formArray.controls[getFormArrayIndex(i)]?.get('access')?.hasError('required')">
<mat-error
*ngIf="
formArray.controls[getFormArrayIndex(i)]
?.get('access')
?.hasError('required')
">
Access is required
</mat-error>
</mat-form-field>
Expand Down Expand Up @@ -197,7 +222,9 @@
">
<ng-container
*ngFor="
let advancedFilter of getAdvancedFilters(getFormArrayIndex(i)).controls;
let advancedFilter of getAdvancedFilters(
getFormArrayIndex(i)
).controls;
let j = index
">
<div [formArrayName]="j" class="expandedItems">
Expand Down
17 changes: 13 additions & 4 deletions src/app/adf-roles/df-roles-access/df-roles-access.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ export class DfRolesAccessComponent implements OnInit {
})
);
this.visible.push(true);
console.log('FormArray after add:', this.formArray.value, 'Visible:', this.visible);
this.updateDataSource();
}

Expand Down Expand Up @@ -337,7 +336,9 @@ export class DfRolesAccessComponent implements OnInit {
}

remove(index: number) {
console.log('Remove called with index:', index, 'Visible array before:', [...this.visible]);
console.log('Remove called with index:', index, 'Visible array before:', [
...this.visible,
]);
if (index >= 0 && index < this.formArray.length) {
// Find the actual form array index for the nth visible item BEFORE updating visible array
let visibleCount = 0;
Expand All @@ -358,7 +359,10 @@ export class DfRolesAccessComponent implements OnInit {
// Clear validators for the hidden item
if (actualIndex !== -1 && actualIndex < this.formArray.length) {
const formGroup = this.formArray.at(actualIndex);
console.log('Clearing validators for form group at index:', actualIndex);
console.log(
'Clearing validators for form group at index:',
actualIndex
);
formGroup.get('service')?.clearValidators();
formGroup.get('component')?.clearValidators();
formGroup.get('access')?.clearValidators();
Expand All @@ -370,7 +374,12 @@ export class DfRolesAccessComponent implements OnInit {
console.log('Form group validity after clearing:', formGroup.valid);
}
}
console.log('FormArray after remove:', this.formArray.value, 'Visible:', this.visible);
console.log(
'FormArray after remove:',
this.formArray.value,
'Visible:',
this.visible
);
this.updateDataSource();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export abstract class DfUserDetailsBaseComponent<T> implements OnInit {
) {
this.userForm = this.fb.group({
profileDetailsGroup: this.fb.group({
username: ['', Validators.minLength(16)],
username: ['', Validators.minLength(6)],
email: ['', Validators.email],
firstName: [''],
lastName: [''],
Expand Down