[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.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.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", "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.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.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", "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 { FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { import {
@@ -232,8 +232,6 @@ export class GroupFormComponent implements OnInit, OnDestroy {
* @param groupId ID of group to set as active * @param groupId ID of group to set as active
*/ */
setActiveGroup(groupId: string) { setActiveGroup(groupId: string) {
this.groupDataService.getActiveGroup().pipe(take(1)).subscribe((activeGroup: Group) => {
if (activeGroup === null) {
this.groupDataService.cancelEditGroup(); this.groupDataService.cancelEditGroup();
this.groupDataService.findById(groupId) this.groupDataService.findById(groupId)
.pipe( .pipe(
@@ -241,8 +239,6 @@ export class GroupFormComponent implements OnInit, OnDestroy {
getRemoteDataPayload()) getRemoteDataPayload())
.subscribe((group: Group) => { .subscribe((group: Group) => {
this.groupDataService.editGroup(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 * Cancel the current edit when component is destroyed & unsub all subscriptions
*/ */
@HostListener('window:beforeunload')
ngOnDestroy(): void { ngOnDestroy(): void {
this.onCancel(); this.onCancel();
this.subs.filter((sub) => hasValue(sub)).forEach((sub) => sub.unsubscribe()); 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) { if (activeGroup != null) {
const response = this.groupDataService.addMemberToGroup(activeGroup, ePerson); const response = this.groupDataService.addMemberToGroup(activeGroup, ePerson);
this.showNotifications('addMember', response, ePerson.name, activeGroup); this.showNotifications('addMember', response, ePerson.name, activeGroup);
this.forceUpdateEPeople(activeGroup, ePerson);
} else { } else {
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup')); this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup'));
} }
}); });
this.forceUpdateEPeople(this.groupBeingEdited, ePerson);
} }
/** /**

View File

@@ -176,7 +176,6 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
if (activeGroup.uuid !== subgroup.uuid) { if (activeGroup.uuid !== subgroup.uuid) {
const response = this.groupDataService.addSubGroupToGroup(activeGroup, subgroup); const response = this.groupDataService.addSubGroupToGroup(activeGroup, subgroup);
this.showNotifications('addSubgroup', response, subgroup.name, activeGroup); this.showNotifications('addSubgroup', response, subgroup.name, activeGroup);
this.forceUpdateGroups(activeGroup);
} else { } else {
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.subgroupToAddIsActiveGroup')); 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.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup'));
} }
}); });
this.forceUpdateGroups(this.groupBeingEdited);
} }
/** /**