mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
75832: Groups registry refactor
This commit is contained in:
@@ -143,7 +143,9 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
initialisePage() {
|
initialisePage() {
|
||||||
this.subs.push(this.route.params.subscribe((params) => {
|
this.subs.push(this.route.params.subscribe((params) => {
|
||||||
|
if (params.groupId !== 'newGroup') {
|
||||||
this.setActiveGroup(params.groupId);
|
this.setActiveGroup(params.groupId);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
this.canEdit$ = this.groupDataService.getActiveGroup().pipe(
|
this.canEdit$ = this.groupDataService.getActiveGroup().pipe(
|
||||||
hasValueOperator(),
|
hasValueOperator(),
|
||||||
@@ -225,14 +227,12 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
{
|
{
|
||||||
value: this.groupDescription.value
|
value: this.groupDescription.value
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (group === null) {
|
if (group === null) {
|
||||||
console.log('createNewGroup', values);
|
|
||||||
this.createNewGroup(values);
|
this.createNewGroup(values);
|
||||||
} else {
|
} else {
|
||||||
console.log('editGroup', group);
|
|
||||||
this.editGroup(group);
|
this.editGroup(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,10 +24,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<ds-pagination *ngIf="(searchResults$ | async)?.payload?.totalElements > 0"
|
<ds-pagination *ngIf="(ePeopleSearchDtos | async)?.totalElements > 0"
|
||||||
[paginationOptions]="configSearch"
|
[paginationOptions]="configSearch"
|
||||||
[pageInfoState]="(searchResults$ | async)?.payload"
|
[pageInfoState]="(ePeopleSearchDtos | async)"
|
||||||
[collectionSize]="(searchResults$ | async)?.payload?.totalElements"
|
[collectionSize]="(ePeopleSearchDtos | async)?.totalElements"
|
||||||
[hideGear]="true"
|
[hideGear]="true"
|
||||||
[hidePagerWhenSinglePage]="true"
|
[hidePagerWhenSinglePage]="true"
|
||||||
(pageChange)="onPageChangeSearch($event)">
|
(pageChange)="onPageChangeSearch($event)">
|
||||||
@@ -42,23 +42,23 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let ePerson of (searchResults$ | async)?.payload?.page">
|
<tr *ngFor="let ePerson of (ePeopleSearchDtos | async)?.page">
|
||||||
<td>{{ePerson.id}}</td>
|
<td>{{ePerson.eperson.id}}</td>
|
||||||
<td><a (click)="ePersonDataService.startEditingNewEPerson(ePerson)"
|
<td><a (click)="ePersonDataService.startEditingNewEPerson(ePerson.eperson)"
|
||||||
[routerLink]="[ePersonDataService.getEPeoplePageRouterLink()]">{{ePerson.name}}</a></td>
|
[routerLink]="[ePersonDataService.getEPeoplePageRouterLink()]">{{ePerson.eperson.name}}</a></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group edit-field">
|
<div class="btn-group edit-field">
|
||||||
<button *ngIf="(isMemberOfGroup(ePerson) | async)"
|
<button *ngIf="(ePerson.memberOfGroup)"
|
||||||
(click)="deleteMemberFromGroup(ePerson)"
|
(click)="deleteMemberFromGroup(ePerson)"
|
||||||
class="btn btn-outline-danger btn-sm"
|
class="btn btn-outline-danger btn-sm"
|
||||||
title="{{messagePrefix + '.table.edit.buttons.remove' | translate: {name: ePerson.name} }}">
|
title="{{messagePrefix + '.table.edit.buttons.remove' | translate: {name: ePerson.eperson.name} }}">
|
||||||
<i class="fas fa-trash-alt fa-fw"></i>
|
<i class="fas fa-trash-alt fa-fw"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button *ngIf="!(isMemberOfGroup(ePerson) | async)"
|
<button *ngIf="!(ePerson.memberOfGroup)"
|
||||||
(click)="addMemberToGroup(ePerson)"
|
(click)="addMemberToGroup(ePerson)"
|
||||||
class="btn btn-outline-primary btn-sm"
|
class="btn btn-outline-primary btn-sm"
|
||||||
title="{{messagePrefix + '.table.edit.buttons.add' | translate: {name: ePerson.name} }}">
|
title="{{messagePrefix + '.table.edit.buttons.add' | translate: {name: ePerson.eperson.name} }}">
|
||||||
<i class="fas fa-plus fa-fw"></i>
|
<i class="fas fa-plus fa-fw"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(searchResults$ | async)?.payload?.totalElements == 0 && searchDone"
|
<div *ngIf="(ePeopleSearchDtos | async)?.totalElements == 0 && searchDone"
|
||||||
class="alert alert-info w-100 mb-2"
|
class="alert alert-info w-100 mb-2"
|
||||||
role="alert">
|
role="alert">
|
||||||
{{messagePrefix + '.no-items' | translate}}
|
{{messagePrefix + '.no-items' | translate}}
|
||||||
@@ -78,10 +78,10 @@
|
|||||||
|
|
||||||
<h4>{{messagePrefix + '.headMembers' | translate}}</h4>
|
<h4>{{messagePrefix + '.headMembers' | translate}}</h4>
|
||||||
|
|
||||||
<ds-pagination *ngIf="(members$ | async)?.payload?.totalElements > 0"
|
<ds-pagination *ngIf="(ePeopleMembersOfGroupDtos | async)?.totalElements > 0"
|
||||||
[paginationOptions]="config"
|
[paginationOptions]="config"
|
||||||
[pageInfoState]="(members$ | async)?.payload"
|
[pageInfoState]="(ePeopleMembersOfGroupDtos | async)"
|
||||||
[collectionSize]="(members$ | async)?.payload?.totalElements"
|
[collectionSize]="(ePeopleMembersOfGroupDtos | async)?.totalElements"
|
||||||
[hideGear]="true"
|
[hideGear]="true"
|
||||||
[hidePagerWhenSinglePage]="true"
|
[hidePagerWhenSinglePage]="true"
|
||||||
(pageChange)="onPageChange($event)">
|
(pageChange)="onPageChange($event)">
|
||||||
@@ -96,15 +96,15 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let ePerson of (members$ | async)?.payload?.page">
|
<tr *ngFor="let ePerson of (ePeopleMembersOfGroupDtos | async)?.page">
|
||||||
<td>{{ePerson.id}}</td>
|
<td>{{ePerson.eperson.id}}</td>
|
||||||
<td><a (click)="ePersonDataService.startEditingNewEPerson(ePerson)"
|
<td><a (click)="ePersonDataService.startEditingNewEPerson(ePerson.eperson)"
|
||||||
[routerLink]="[ePersonDataService.getEPeoplePageRouterLink()]">{{ePerson.name}}</a></td>
|
[routerLink]="[ePersonDataService.getEPeoplePageRouterLink()]">{{ePerson.eperson.name}}</a></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group edit-field">
|
<div class="btn-group edit-field">
|
||||||
<button (click)="deleteMemberFromGroup(ePerson)"
|
<button (click)="deleteMemberFromGroup(ePerson)"
|
||||||
class="btn btn-outline-danger btn-sm"
|
class="btn btn-outline-danger btn-sm"
|
||||||
title="{{messagePrefix + '.table.edit.buttons.remove' | translate: {name: ePerson.name} }}">
|
title="{{messagePrefix + '.table.edit.buttons.remove' | translate: {name: ePerson.eperson.name} }}">
|
||||||
<i class="fas fa-trash-alt fa-fw"></i>
|
<i class="fas fa-trash-alt fa-fw"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
|
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(members$ | async)?.payload?.totalElements == 0" class="alert alert-info w-100 mb-2"
|
<div *ngIf="(ePeopleMembersOfGroupDtos | async) == undefined || (ePeopleMembersOfGroupDtos | async)?.totalElements == 0" class="alert alert-info w-100 mb-2"
|
||||||
role="alert">
|
role="alert">
|
||||||
{{messagePrefix + '.no-members-yet' | translate}}
|
{{messagePrefix + '.no-members-yet' | translate}}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -2,9 +2,9 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
|||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { Observable, of as observableOf, Subscription, BehaviorSubject } from 'rxjs';
|
import { Observable, of as observableOf, Subscription, BehaviorSubject, ObservedValueOf, combineLatest as observableCombineLatest} from 'rxjs';
|
||||||
import { map, mergeMap, take } from 'rxjs/operators';
|
import { map, mergeMap, take } from 'rxjs/operators';
|
||||||
import { PaginatedList } from '../../../../../core/data/paginated-list.model';
|
import {buildPaginatedList, PaginatedList} from '../../../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../../core/data/remote-data';
|
||||||
import { EPersonDataService } from '../../../../../core/eperson/eperson-data.service';
|
import { EPersonDataService } from '../../../../../core/eperson/eperson-data.service';
|
||||||
import { GroupDataService } from '../../../../../core/eperson/group-data.service';
|
import { GroupDataService } from '../../../../../core/eperson/group-data.service';
|
||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
} from '../../../../../core/shared/operators';
|
} from '../../../../../core/shared/operators';
|
||||||
import { NotificationsService } from '../../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../../shared/notifications/notifications.service';
|
||||||
import { PaginationComponentOptions } from '../../../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../../../shared/pagination/pagination-component-options.model';
|
||||||
|
import {EpersonDtoModel} from '../../../../../core/eperson/models/eperson-dto.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keys to keep track of specific subscriptions
|
* Keys to keep track of specific subscriptions
|
||||||
@@ -25,6 +26,8 @@ enum SubKey {
|
|||||||
Members,
|
Members,
|
||||||
ActiveGroup,
|
ActiveGroup,
|
||||||
SearchResults,
|
SearchResults,
|
||||||
|
MembersDTO,
|
||||||
|
SearchResultsDTO,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -43,10 +46,12 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
* EPeople being displayed in search result, initially all members, after search result of search
|
* EPeople being displayed in search result, initially all members, after search result of search
|
||||||
*/
|
*/
|
||||||
searchResults$: BehaviorSubject<RemoteData<PaginatedList<EPerson>>> = new BehaviorSubject(undefined);
|
searchResults$: BehaviorSubject<RemoteData<PaginatedList<EPerson>>> = new BehaviorSubject(undefined);
|
||||||
|
ePeopleSearchDtos: BehaviorSubject<PaginatedList<EpersonDtoModel>> = new BehaviorSubject<PaginatedList<EpersonDtoModel>>(undefined);
|
||||||
/**
|
/**
|
||||||
* List of EPeople members of currently active group being edited
|
* List of EPeople members of currently active group being edited
|
||||||
*/
|
*/
|
||||||
members$: BehaviorSubject<RemoteData<PaginatedList<EPerson>>> = new BehaviorSubject(undefined);
|
members$: BehaviorSubject<RemoteData<PaginatedList<EPerson>>> = new BehaviorSubject(undefined);
|
||||||
|
ePeopleMembersOfGroupDtos: BehaviorSubject<PaginatedList<EpersonDtoModel>> = new BehaviorSubject<PaginatedList<EpersonDtoModel>>(undefined);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pagination config used to display the list of EPeople that are result of EPeople search
|
* Pagination config used to display the list of EPeople that are result of EPeople search
|
||||||
@@ -139,6 +144,9 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
).subscribe((rd: RemoteData<PaginatedList<EPerson>>) => {
|
).subscribe((rd: RemoteData<PaginatedList<EPerson>>) => {
|
||||||
this.members$.next(rd);
|
this.members$.next(rd);
|
||||||
|
if (rd.payload !== undefined) {
|
||||||
|
this.setEpersonDTOsFromResult(rd, this.ePeopleMembersOfGroupDtos, SubKey.MembersDTO);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,11 +168,11 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
* Deletes a given EPerson from the members list of the group currently being edited
|
* Deletes a given EPerson from the members list of the group currently being edited
|
||||||
* @param ePerson EPerson we want to delete as member from group that is currently being edited
|
* @param ePerson EPerson we want to delete as member from group that is currently being edited
|
||||||
*/
|
*/
|
||||||
deleteMemberFromGroup(ePerson: EPerson) {
|
deleteMemberFromGroup(ePerson: EpersonDtoModel) {
|
||||||
this.groupDataService.getActiveGroup().pipe(take(1)).subscribe((activeGroup: Group) => {
|
this.groupDataService.getActiveGroup().pipe(take(1)).subscribe((activeGroup: Group) => {
|
||||||
if (activeGroup != null) {
|
if (activeGroup != null) {
|
||||||
const response = this.groupDataService.deleteMemberFromGroup(activeGroup, ePerson);
|
const response = this.groupDataService.deleteMemberFromGroup(activeGroup, ePerson.eperson);
|
||||||
this.showNotifications('deleteMember', response, ePerson.name, activeGroup);
|
this.showNotifications('deleteMember', response, ePerson.eperson.name, activeGroup);
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup'));
|
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup'));
|
||||||
}
|
}
|
||||||
@@ -175,11 +183,12 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
* Adds a given EPerson to the members list of the group currently being edited
|
* Adds a given EPerson to the members list of the group currently being edited
|
||||||
* @param ePerson EPerson we want to add as member to group that is currently being edited
|
* @param ePerson EPerson we want to add as member to group that is currently being edited
|
||||||
*/
|
*/
|
||||||
addMemberToGroup(ePerson: EPerson) {
|
addMemberToGroup(ePerson: EpersonDtoModel) {
|
||||||
|
ePerson.memberOfGroup = true;
|
||||||
this.groupDataService.getActiveGroup().pipe(take(1)).subscribe((activeGroup: Group) => {
|
this.groupDataService.getActiveGroup().pipe(take(1)).subscribe((activeGroup: Group) => {
|
||||||
if (activeGroup != null) {
|
if (activeGroup != null) {
|
||||||
const response = this.groupDataService.addMemberToGroup(activeGroup, ePerson);
|
const response = this.groupDataService.addMemberToGroup(activeGroup, ePerson.eperson);
|
||||||
this.showNotifications('addMember', response, ePerson.name, activeGroup);
|
this.showNotifications('addMember', response, ePerson.eperson.name, activeGroup);
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup'));
|
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup'));
|
||||||
}
|
}
|
||||||
@@ -234,9 +243,30 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
elementsPerPage: this.configSearch.pageSize
|
elementsPerPage: this.configSearch.pageSize
|
||||||
}).subscribe((rd: RemoteData<PaginatedList<EPerson>>) => {
|
}).subscribe((rd: RemoteData<PaginatedList<EPerson>>) => {
|
||||||
this.searchResults$.next(rd);
|
this.searchResults$.next(rd);
|
||||||
|
if (rd.payload !== undefined) {
|
||||||
|
this.setEpersonDTOsFromResult(rd, this.ePeopleSearchDtos, SubKey.SearchResultsDTO);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private setEpersonDTOsFromResult(rd: RemoteData<PaginatedList<EPerson>>, addTo: BehaviorSubject<PaginatedList<EpersonDtoModel>>, subkey) {
|
||||||
|
this.unsubFrom(subkey);
|
||||||
|
const dtos$ = observableCombineLatest(...rd.payload.page.map((member: EPerson) => {
|
||||||
|
const dto$: Observable<EpersonDtoModel> = observableCombineLatest(
|
||||||
|
this.isMemberOfGroup(member), (isMember: ObservedValueOf<Observable<boolean>>) => {
|
||||||
|
const epersonDtoModel: EpersonDtoModel = new EpersonDtoModel();
|
||||||
|
epersonDtoModel.eperson = member;
|
||||||
|
epersonDtoModel.memberOfGroup = isMember;
|
||||||
|
return epersonDtoModel;
|
||||||
|
});
|
||||||
|
return dto$;
|
||||||
|
}));
|
||||||
|
this.subs.set(subkey,dtos$.pipe(map((dtos: EpersonDtoModel[]) => {
|
||||||
|
const paginatedListOfDTOs = buildPaginatedList(rd.payload.pageInfo, dtos);
|
||||||
|
addTo.next(paginatedListOfDTOs);
|
||||||
|
})).subscribe());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unsub all subscriptions
|
* unsub all subscriptions
|
||||||
*/
|
*/
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<button class="mr-auto btn btn-success"
|
<button class="mr-auto btn btn-success"
|
||||||
[routerLink]="['newGroup']">
|
[routerLink]="['newGroup']">
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
<span class="d-none d-sm-inline"> {{messagePrefix + 'button.add' | translate}}</span>
|
<span class="d-none d-sm-inline">{{messagePrefix + 'button.add' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -45,7 +45,6 @@
|
|||||||
<th scope="col">{{messagePrefix + 'table.id' | translate}}</th>
|
<th scope="col">{{messagePrefix + 'table.id' | translate}}</th>
|
||||||
<th scope="col">{{messagePrefix + 'table.name' | translate}}</th>
|
<th scope="col">{{messagePrefix + 'table.name' | translate}}</th>
|
||||||
<th scope="col">{{messagePrefix + 'table.members' | translate}}</th>
|
<th scope="col">{{messagePrefix + 'table.members' | translate}}</th>
|
||||||
<!-- <th scope="col">{{messagePrefix + 'table.comcol' | translate}}</th>-->
|
|
||||||
<th>{{messagePrefix + 'table.edit' | translate}}</th>
|
<th>{{messagePrefix + 'table.edit' | translate}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -53,8 +52,7 @@
|
|||||||
<tr *ngFor="let groupDto of (groupsDto$ | async)?.page">
|
<tr *ngFor="let groupDto of (groupsDto$ | async)?.page">
|
||||||
<td>{{groupDto.group.id}}</td>
|
<td>{{groupDto.group.id}}</td>
|
||||||
<td>{{groupDto.group.name}}</td>
|
<td>{{groupDto.group.name}}</td>
|
||||||
<td>{{(getMembers(groupDto.group) | async)?.payload?.totalElements + (getSubgroups(groupDto.group) | async)?.payload?.totalElements}}</td>
|
<td>{{groupDto.epersons?.totalElements + groupDto.subgroups?.totalElements}}</td>
|
||||||
<!-- <td>{{getOptionalComColFromName(group.name)}}</td>-->
|
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group edit-field">
|
<div class="btn-group edit-field">
|
||||||
<button [routerLink]="groupService.getGroupEditPageRouterLink(groupDto.group)"
|
<button [routerLink]="groupService.getGroupEditPageRouterLink(groupDto.group)"
|
||||||
@@ -63,7 +61,7 @@
|
|||||||
<i class="fas fa-edit fa-fw"></i>
|
<i class="fas fa-edit fa-fw"></i>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="!groupDto.group?.permanent && groupDto.ableToDelete"
|
<button *ngIf="!groupDto.group?.permanent && groupDto.ableToDelete"
|
||||||
(click)="deleteGroup(groupDto.group)" class="btn btn-outline-danger btn-sm"
|
(click)="deleteGroup(groupDto)" class="btn btn-outline-danger btn-sm"
|
||||||
title="{{messagePrefix + 'table.edit.buttons.remove' | translate: {name: groupDto.group.name} }}">
|
title="{{messagePrefix + 'table.edit.buttons.remove' | translate: {name: groupDto.group.name} }}">
|
||||||
<i class="fas fa-trash-alt fa-fw"></i>
|
<i class="fas fa-trash-alt fa-fw"></i>
|
||||||
</button>
|
</button>
|
||||||
|
@@ -169,16 +169,16 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* Delete Group
|
* Delete Group
|
||||||
*/
|
*/
|
||||||
deleteGroup(group: Group) {
|
deleteGroup(group: GroupDtoModel) {
|
||||||
if (hasValue(group.id)) {
|
if (hasValue(group.group.id)) {
|
||||||
this.groupService.delete(group.id).pipe(getFirstCompletedRemoteData())
|
this.groupService.delete(group.group.id).pipe(getFirstCompletedRemoteData())
|
||||||
.subscribe((rd: RemoteData<NoContent>) => {
|
.subscribe((rd: RemoteData<NoContent>) => {
|
||||||
if (rd.hasSucceeded) {
|
if (rd.hasSucceeded) {
|
||||||
this.notificationsService.success(this.translateService.get(this.messagePrefix + 'notification.deleted.success', { name: group.name }));
|
this.notificationsService.success(this.translateService.get(this.messagePrefix + 'notification.deleted.success', { name: group.group.name }));
|
||||||
this.reset();
|
this.reset();
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(
|
this.notificationsService.error(
|
||||||
this.translateService.get(this.messagePrefix + 'notification.deleted.failure.title', { name: group.name }),
|
this.translateService.get(this.messagePrefix + 'notification.deleted.failure.title', { name: group.group.name }),
|
||||||
this.translateService.get(this.messagePrefix + 'notification.deleted.failure.content', { cause: rd.errorMessage }));
|
this.translateService.get(this.messagePrefix + 'notification.deleted.failure.content', { cause: rd.errorMessage }));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -233,15 +233,6 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
|||||||
this.search({ query: '' });
|
this.search({ query: '' });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract optional UUID from a group name => To be resolved to community or collection with link
|
|
||||||
* (Or will be resolved in backend and added to group object, tbd) //TODO
|
|
||||||
* @param groupName
|
|
||||||
*/
|
|
||||||
getOptionalComColFromName(groupName: string): string {
|
|
||||||
return this.groupService.getUUIDFromString(groupName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unsub all subscriptions
|
* Unsub all subscriptions
|
||||||
*/
|
*/
|
||||||
|
@@ -63,10 +63,10 @@ export class EPersonDataService extends DataService<EPerson> {
|
|||||||
* @param query Query of search
|
* @param query Query of search
|
||||||
* @param options Options of search request
|
* @param options Options of search request
|
||||||
*/
|
*/
|
||||||
public searchByScope(scope: string, query: string, options: FindListOptions = {}): Observable<RemoteData<PaginatedList<EPerson>>> {
|
public searchByScope(scope: string, query: string, options: FindListOptions = {}, useCachedVersionIfAvailable?: boolean): Observable<RemoteData<PaginatedList<EPerson>>> {
|
||||||
switch (scope) {
|
switch (scope) {
|
||||||
case 'metadata':
|
case 'metadata':
|
||||||
return this.getEpeopleByMetadata(query.trim(), options);
|
return this.getEpeopleByMetadata(query.trim(), options, useCachedVersionIfAvailable);
|
||||||
case 'email':
|
case 'email':
|
||||||
return this.getEPersonByEmail(query.trim()).pipe(
|
return this.getEPersonByEmail(query.trim()).pipe(
|
||||||
map((rd: RemoteData<EPerson | NoContent>) => {
|
map((rd: RemoteData<EPerson | NoContent>) => {
|
||||||
@@ -100,7 +100,7 @@ export class EPersonDataService extends DataService<EPerson> {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return this.getEpeopleByMetadata(query.trim(), options);
|
return this.getEpeopleByMetadata(query.trim(), options, useCachedVersionIfAvailable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,5 +13,9 @@ export class EpersonDtoModel {
|
|||||||
* Whether or not the linked EPerson is able to be deleted
|
* Whether or not the linked EPerson is able to be deleted
|
||||||
*/
|
*/
|
||||||
public ableToDelete: boolean;
|
public ableToDelete: boolean;
|
||||||
|
/**
|
||||||
|
* Whether or not this EPerson is member of group on page it is being used on
|
||||||
|
*/
|
||||||
|
public memberOfGroup: boolean;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
|
import { PaginatedList } from '../../data/paginated-list.model';
|
||||||
|
import { EPerson } from './eperson.model';
|
||||||
import { Group } from './group.model';
|
import { Group } from './group.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class serves as a Data Transfer Model that contains the Group and whether or not it's able to be deleted
|
* This class serves as a Data Transfer Model that contains the Group, whether or not it's able to be deleted and its members
|
||||||
*/
|
*/
|
||||||
export class GroupDtoModel {
|
export class GroupDtoModel {
|
||||||
|
|
||||||
@@ -9,9 +11,20 @@ export class GroupDtoModel {
|
|||||||
* The Group linked to this object
|
* The Group linked to this object
|
||||||
*/
|
*/
|
||||||
public group: Group;
|
public group: Group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the linked Group is able to be deleted
|
* Whether or not the linked Group is able to be deleted
|
||||||
*/
|
*/
|
||||||
public ableToDelete: boolean;
|
public ableToDelete: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of subgroups of this group
|
||||||
|
*/
|
||||||
|
public subgroups: PaginatedList<Group>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of members of this group
|
||||||
|
*/
|
||||||
|
public epersons: PaginatedList<EPerson>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
|
import { autoserialize, autoserializeAs, deserialize, inheritSerialization } from 'cerialize';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { link, typedObject } from '../../cache/builders/build-decorators';
|
import { link, typedObject } from '../../cache/builders/build-decorators';
|
||||||
import { PaginatedList } from '../../data/paginated-list.model';
|
import { PaginatedList } from '../../data/paginated-list.model';
|
||||||
@@ -10,12 +10,20 @@ import { HALLink } from '../../shared/hal-link.model';
|
|||||||
import { EPerson } from './eperson.model';
|
import { EPerson } from './eperson.model';
|
||||||
import { EPERSON } from './eperson.resource-type';
|
import { EPERSON } from './eperson.resource-type';
|
||||||
import { GROUP } from './group.resource-type';
|
import { GROUP } from './group.resource-type';
|
||||||
|
import { excludeFromEquals } from '../../utilities/equals.decorators';
|
||||||
|
|
||||||
@typedObject
|
@typedObject
|
||||||
@inheritSerialization(DSpaceObject)
|
@inheritSerialization(DSpaceObject)
|
||||||
export class Group extends DSpaceObject {
|
export class Group extends DSpaceObject {
|
||||||
static type = GROUP;
|
static type = GROUP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A string representing the unique name of this Group
|
||||||
|
*/
|
||||||
|
@excludeFromEquals
|
||||||
|
@autoserializeAs('name')
|
||||||
|
protected _name: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string representing the unique handle of this Group
|
* A string representing the unique handle of this Group
|
||||||
*/
|
*/
|
||||||
|
@@ -29,7 +29,7 @@ export class DSpaceObject extends ListableObject implements CacheableObject {
|
|||||||
|
|
||||||
@excludeFromEquals
|
@excludeFromEquals
|
||||||
@deserializeAs('name')
|
@deserializeAs('name')
|
||||||
private _name: string;
|
protected _name: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The human-readable identifier of this DSpaceObject
|
* The human-readable identifier of this DSpaceObject
|
||||||
|
@@ -308,8 +308,6 @@
|
|||||||
|
|
||||||
"admin.access-control.groups.table.members": "Members",
|
"admin.access-control.groups.table.members": "Members",
|
||||||
|
|
||||||
"admin.access-control.groups.table.comcol": "Community / Collection",
|
|
||||||
|
|
||||||
"admin.access-control.groups.table.edit": "Edit",
|
"admin.access-control.groups.table.edit": "Edit",
|
||||||
|
|
||||||
"admin.access-control.groups.table.edit.buttons.edit": "Edit \"{{name}}\"",
|
"admin.access-control.groups.table.edit.buttons.edit": "Edit \"{{name}}\"",
|
||||||
|
Reference in New Issue
Block a user