diff --git a/src/app/access-control/group-registry/group-form/group-form.component.ts b/src/app/access-control/group-registry/group-form/group-form.component.ts index 7e0329f54f..be64c275b7 100644 --- a/src/app/access-control/group-registry/group-form/group-form.component.ts +++ b/src/app/access-control/group-registry/group-form/group-form.component.ts @@ -65,6 +65,7 @@ export class GroupFormComponent implements OnInit, OnDestroy { * Dynamic models for the inputs of form */ groupName: DynamicInputModel; + groupCommunity: DynamicInputModel; groupDescription: DynamicTextAreaModel; /** @@ -160,8 +161,9 @@ export class GroupFormComponent implements OnInit, OnDestroy { ); observableCombineLatest( this.translateService.get(`${this.messagePrefix}.groupName`), + this.translateService.get(`${this.messagePrefix}.groupCommunity`), this.translateService.get(`${this.messagePrefix}.groupDescription`) - ).subscribe(([groupName, groupDescription]) => { + ).subscribe(([groupName, groupCommunity, groupDescription]) => { this.groupName = new DynamicInputModel({ id: 'groupName', label: groupName, @@ -171,6 +173,13 @@ export class GroupFormComponent implements OnInit, OnDestroy { }, required: true, }); + this.groupCommunity = new DynamicInputModel({ + id: 'groupCommunity', + label: groupCommunity, + name: 'groupCommunity', + required: false, + readOnly: true, + }); this.groupDescription = new DynamicTextAreaModel({ id: 'groupDescription', label: groupDescription, @@ -179,6 +188,7 @@ export class GroupFormComponent implements OnInit, OnDestroy { }); this.formModel = [ this.groupName, + this.groupCommunity, this.groupDescription, ]; this.formGroup = this.formBuilderService.createFormGroup(this.formModel); @@ -189,13 +199,27 @@ export class GroupFormComponent implements OnInit, OnDestroy { ).subscribe(([activeGroup, canEdit]) => { if (activeGroup != null) { this.groupBeingEdited = activeGroup; - this.formGroup.patchValue({ - groupName: activeGroup != null ? activeGroup.name : '', - groupDescription: activeGroup != null ? activeGroup.firstMetadataValue('dc.description') : '', + this.getLinkedDSO(activeGroup).subscribe((res) => { + if (res?.payload?.name) { + this.formGroup.patchValue({ + groupName: activeGroup != null ? activeGroup.name : '', + groupCommunity: res?.payload?.name ?? '', + groupDescription: activeGroup != null ? activeGroup.firstMetadataValue('dc.description') : '', + }); + } else { + this.formModel = [ + this.groupName, + this.groupDescription, + ]; + this.formGroup.patchValue({ + groupName: activeGroup != null ? activeGroup.name : '', + groupDescription: activeGroup != null ? activeGroup.firstMetadataValue('dc.description') : '', + }); + } + if (!canEdit || activeGroup.permanent) { + this.formGroup.disable(); + } }); - if (!canEdit || activeGroup.permanent) { - this.formGroup.disable(); - } } }) ); diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 5d6cd7fc9e..bf84d709c6 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -350,6 +350,8 @@ "admin.access-control.groups.form.groupName": "Group name", + "admin.access-control.groups.form.groupCommunity": "Community or Collection", + "admin.access-control.groups.form.groupDescription": "Description", "admin.access-control.groups.form.notification.created.success": "Successfully created Group \"{{name}}\"",