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
3,351 changes: 2,263 additions & 1,088 deletions dist/3rdpartylicenses.txt

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/4703.3328b0e1ef6dcef5.js

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/8441.0e4f357edf0c8a6e.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

32 changes: 31 additions & 1 deletion src/app/adf-roles/df-role-details/df-role-details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class DfRoleDetailsComponent implements OnInit {
showAlert = false;
alertType: AlertType = 'error';
visibilityArray: boolean[] = [];
originalLookupKeyIds: number[] = [];

constructor(
@Inject(ROLE_SERVICE_TOKEN)
Expand Down Expand Up @@ -141,8 +142,13 @@ export class DfRoleDetailsComponent implements OnInit {

if (data.lookupByRoleId.length > 0) {
data.lookupByRoleId.forEach((item: any) => {
// Track original lookup key IDs for deletion detection
if (item.id) {
this.originalLookupKeyIds.push(item.id);
}
(this.roleForm.controls['lookupKeys'] as FormArray).push(
new FormGroup({
id: new FormControl(item.id),
name: new FormControl(item.name, [Validators.required]),
value: new FormControl(item.value),
private: new FormControl(item.private),
Expand Down Expand Up @@ -240,7 +246,7 @@ export class DfRoleDetailsComponent implements OnInit {
};
}
),
lookupByRoleId: formValue.lookupKeys,
lookupByRoleId: this.getLookupKeysWithDeletions(formValue),
};
const createPayload = {
resource: [payload],
Expand Down Expand Up @@ -278,6 +284,30 @@ export class DfRoleDetailsComponent implements OnInit {
}
}

getLookupKeysWithDeletions(formValue: any) {
const currentLookupKeys = formValue.lookupKeys;
const result = [...currentLookupKeys];

// Find IDs that were deleted (present in original but not in current)
const currentIds = currentLookupKeys
.map((lk: any) => lk.id)
.filter((id: any) => id);

const deletedIds = this.originalLookupKeyIds.filter(
(id: number) => !currentIds.includes(id)
);

// Add deleted lookup keys with role_id set to null to trigger deletion
deletedIds.forEach((id: number) => {
result.push({
id: id,
role_id: null,
});
});

return result;
}

goBack() {
this.router.navigate(['../'], { relativeTo: this.activatedRoute });
}
Expand Down