mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 13:03:04 +00:00
[groups/epeople admin pages] hide add epeople/groups on new group page, redirect after group creation to add them
This commit is contained in:
@@ -20,8 +20,8 @@
|
|||||||
(submitForm)="onSubmit()">
|
(submitForm)="onSubmit()">
|
||||||
</ds-form>
|
</ds-form>
|
||||||
|
|
||||||
<ds-members-list [messagePrefix]="messagePrefix + '.members-list'"></ds-members-list>
|
<ds-members-list *ngIf="groupBeingEdited != null" [messagePrefix]="messagePrefix + '.members-list'"></ds-members-list>
|
||||||
<ds-subgroups-list [messagePrefix]="messagePrefix + '.subgroups-list'"></ds-subgroups-list>
|
<ds-subgroups-list *ngIf="groupBeingEdited != null" [messagePrefix]="messagePrefix + '.subgroups-list'"></ds-subgroups-list>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button [routerLink]="[this.groupDataService.getGroupRegistryRouterLink()]"
|
<button [routerLink]="[this.groupDataService.getGroupRegistryRouterLink()]"
|
||||||
|
@@ -84,6 +84,11 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
subs: Subscription[] = [];
|
subs: Subscription[] = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Group currently being edited
|
||||||
|
*/
|
||||||
|
groupBeingEdited: Group;
|
||||||
|
|
||||||
constructor(public groupDataService: GroupDataService,
|
constructor(public groupDataService: GroupDataService,
|
||||||
private ePersonDataService: EPersonDataService,
|
private ePersonDataService: EPersonDataService,
|
||||||
private formBuilderService: FormBuilderService,
|
private formBuilderService: FormBuilderService,
|
||||||
@@ -123,6 +128,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||||
this.subs.push(this.groupDataService.getActiveGroup().subscribe((activeGroup: Group) => {
|
this.subs.push(this.groupDataService.getActiveGroup().subscribe((activeGroup: Group) => {
|
||||||
if (activeGroup != null) {
|
if (activeGroup != null) {
|
||||||
|
this.groupBeingEdited = activeGroup;
|
||||||
this.formGroup.patchValue({
|
this.formGroup.patchValue({
|
||||||
groupName: activeGroup != null ? activeGroup.name : '',
|
groupName: activeGroup != null ? activeGroup.name : '',
|
||||||
groupDescription: activeGroup != null ? activeGroup.firstMetadataValue('dc.description') : '',
|
groupDescription: activeGroup != null ? activeGroup.firstMetadataValue('dc.description') : '',
|
||||||
@@ -185,7 +191,9 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
this.submitForm.emit(groupToCreate);
|
this.submitForm.emit(groupToCreate);
|
||||||
const resp: any = restResponse;
|
const resp: any = restResponse;
|
||||||
if (isNotEmpty(resp.resourceSelfLinks)) {
|
if (isNotEmpty(resp.resourceSelfLinks)) {
|
||||||
this.setActiveGroupWithLink(resp.resourceSelfLinks[0]);
|
const groupSelfLink = resp.resourceSelfLinks[0];
|
||||||
|
this.setActiveGroupWithLink(groupSelfLink);
|
||||||
|
this.router.navigateByUrl(this.groupDataService.getGroupEditPageRouterLinkWithID(this.groupDataService.getUUIDFromString(groupSelfLink)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.created.failure', { name: groupToCreate.name }));
|
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.created.failure', { name: groupToCreate.name }));
|
||||||
|
@@ -149,11 +149,6 @@ export class GroupsRegistryComponent implements OnInit {
|
|||||||
* @param groupName
|
* @param groupName
|
||||||
*/
|
*/
|
||||||
getOptionalComColFromName(groupName: string): string {
|
getOptionalComColFromName(groupName: string): string {
|
||||||
let optionalComColName = '';
|
return this.groupService.getUUIDFromString(groupName);
|
||||||
const uuidMatches = groupName.match(/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/g);
|
|
||||||
if (uuidMatches != null) {
|
|
||||||
optionalComColName = uuidMatches[0];
|
|
||||||
}
|
|
||||||
return optionalComColName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -277,7 +277,7 @@ export class GroupDataService extends DataService<Group> {
|
|||||||
this.editGroup(newGroup)
|
this.editGroup(newGroup)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return '/admin/access-control/groups/' + newGroup.id;
|
return this.getGroupEditPageRouterLinkWithID(newGroup.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -285,7 +285,28 @@ export class GroupDataService extends DataService<Group> {
|
|||||||
* @param group Group we want edit page for
|
* @param group Group we want edit page for
|
||||||
*/
|
*/
|
||||||
public getGroupEditPageRouterLink(group: Group): string {
|
public getGroupEditPageRouterLink(group: Group): string {
|
||||||
return '/admin/access-control/groups/' + group.id;
|
return this.getGroupEditPageRouterLinkWithID(group.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Edit page of group
|
||||||
|
* @param groupID Group ID we want edit page for
|
||||||
|
*/
|
||||||
|
public getGroupEditPageRouterLinkWithID(groupId: string): string {
|
||||||
|
return '/admin/access-control/groups/' + groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract optional UUID from a string
|
||||||
|
* @param stringWithUUID String with possible UUID
|
||||||
|
*/
|
||||||
|
public getUUIDFromString(stringWithUUID: string): string {
|
||||||
|
let foundUUID = '';
|
||||||
|
const uuidMatches = stringWithUUID.match(/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/g);
|
||||||
|
if (uuidMatches != null) {
|
||||||
|
foundUUID = uuidMatches[0];
|
||||||
|
}
|
||||||
|
return foundUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user