[groups/epeople admin pages] messages added, activeGroup reset after page refresh fix & clearcache/reload after add/delete member moved

This commit is contained in:
Marie Verdonck
2020-04-02 17:18:30 +02:00
parent 06c6ed18a6
commit cc402a0a02
4 changed files with 18 additions and 21 deletions

View File

@@ -293,11 +293,11 @@
"admin.access-control.groups.form.members-list.head": "EPeople",
"admin.access-control.groups.form.members-list.search.head": "Search EPeople",
"admin.access-control.groups.form.members-list.search.head": "Add EPeople",
"admin.access-control.groups.form.members-list.button.see-all": "Browse All",
"admin.access-control.groups.form.members-list.headMembers": "Browse Members",
"admin.access-control.groups.form.members-list.headMembers": "Current Members",
"admin.access-control.groups.form.members-list.search.scope.metadata": "Metadata",
@@ -331,11 +331,11 @@
"admin.access-control.groups.form.subgroups-list.head": "Groups",
"admin.access-control.groups.form.subgroups-list.search.head": "Search Groups",
"admin.access-control.groups.form.subgroups-list.search.head": "Add Subgroup",
"admin.access-control.groups.form.subgroups-list.button.see-all": "Browse All",
"admin.access-control.groups.form.subgroups-list.headSubgroups": "Browse Subgroups",
"admin.access-control.groups.form.subgroups-list.headSubgroups": "Current Subgroups",
"admin.access-control.groups.form.subgroups-list.search.button": "Search",

View File

@@ -1,4 +1,4 @@
import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, HostListener, OnDestroy, OnInit, Output } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import {
@@ -232,18 +232,14 @@ export class GroupFormComponent implements OnInit, OnDestroy {
* @param groupId ID of group to set as active
*/
setActiveGroup(groupId: string) {
this.groupDataService.getActiveGroup().pipe(take(1)).subscribe((activeGroup: Group) => {
if (activeGroup === null) {
this.groupDataService.cancelEditGroup();
this.groupDataService.findById(groupId)
.pipe(
getSucceededRemoteData(),
getRemoteDataPayload())
.subscribe((group: Group) => {
this.groupDataService.editGroup(group);
})
}
});
this.groupDataService.cancelEditGroup();
this.groupDataService.findById(groupId)
.pipe(
getSucceededRemoteData(),
getRemoteDataPayload())
.subscribe((group: Group) => {
this.groupDataService.editGroup(group);
});
}
/**
@@ -268,6 +264,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
/**
* Cancel the current edit when component is destroyed & unsub all subscriptions
*/
@HostListener('window:beforeunload')
ngOnDestroy(): void {
this.onCancel();
this.subs.filter((sub) => hasValue(sub)).forEach((sub) => sub.unsubscribe());

View File

@@ -140,11 +140,11 @@ export class MembersListComponent implements OnInit, OnDestroy {
if (activeGroup != null) {
const response = this.groupDataService.addMemberToGroup(activeGroup, ePerson);
this.showNotifications('addMember', response, ePerson.name, activeGroup);
this.forceUpdateEPeople(activeGroup, ePerson);
} else {
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup'));
}
});
this.forceUpdateEPeople(this.groupBeingEdited, ePerson);
}
/**

View File

@@ -130,7 +130,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
map((listTotalGroups: PaginatedList<Group>) => listTotalGroups.page.filter((groupInList: Group) => groupInList.id === possibleSubgroup.id)),
map((groups: Group[]) => groups.length > 0))
}
} else {
} else {
return observableOf(false);
}
}));
@@ -144,7 +144,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
return this.groupDataService.getActiveGroup().pipe(take(1),
mergeMap((activeGroup: Group) => {
if (activeGroup != null && activeGroup.uuid === group.uuid) {
return observableOf(true);
return observableOf(true);
}
return observableOf(false);
}));
@@ -176,7 +176,6 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
if (activeGroup.uuid !== subgroup.uuid) {
const response = this.groupDataService.addSubGroupToGroup(activeGroup, subgroup);
this.showNotifications('addSubgroup', response, subgroup.name, activeGroup);
this.forceUpdateGroups(activeGroup);
} else {
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.subgroupToAddIsActiveGroup'));
}
@@ -184,6 +183,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup'));
}
});
this.forceUpdateGroups(this.groupBeingEdited);
}
/**