mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
69111: Links to edit EPerson page and edit Group page from members list in edit group page
This commit is contained in:
@@ -192,9 +192,9 @@
|
|||||||
|
|
||||||
"admin.access-control.epeople.table.edit": "Edit",
|
"admin.access-control.epeople.table.edit": "Edit",
|
||||||
|
|
||||||
"item.access-control.epeople.table.edit.buttons.edit": "Edit",
|
"admin.access-control.epeople.table.edit.buttons.edit": "Edit",
|
||||||
|
|
||||||
"item.access-control.epeople.table.edit.buttons.remove": "Remove",
|
"admin.access-control.epeople.table.edit.buttons.remove": "Remove",
|
||||||
|
|
||||||
"admin.access-control.epeople.no-items": "No EPeople to show.",
|
"admin.access-control.epeople.no-items": "No EPeople to show.",
|
||||||
|
|
||||||
@@ -241,6 +241,7 @@
|
|||||||
"admin.access-control.epeople.notification.deleted.success": "Successfully deleted EPerson: \"{{name}}\"",
|
"admin.access-control.epeople.notification.deleted.success": "Successfully deleted EPerson: \"{{name}}\"",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"admin.access-control.groups.title": "DSpace Angular :: Groups",
|
"admin.access-control.groups.title": "DSpace Angular :: Groups",
|
||||||
|
|
||||||
"admin.access-control.groups.head": "Groups",
|
"admin.access-control.groups.head": "Groups",
|
||||||
@@ -276,8 +277,6 @@
|
|||||||
|
|
||||||
"admin.access-control.groups.form.groupDescription": "Description",
|
"admin.access-control.groups.form.groupDescription": "Description",
|
||||||
|
|
||||||
"admin.access-control.groups.form.button.return": "Return",
|
|
||||||
|
|
||||||
"admin.access-control.groups.form.notification.created.success": "Successfully created group \"{{name}}\"",
|
"admin.access-control.groups.form.notification.created.success": "Successfully created group \"{{name}}\"",
|
||||||
|
|
||||||
"admin.access-control.groups.form.notification.created.failure": "Failed to create group \"{{name}}\"",
|
"admin.access-control.groups.form.notification.created.failure": "Failed to create group \"{{name}}\"",
|
||||||
@@ -350,7 +349,7 @@
|
|||||||
|
|
||||||
"admin.access-control.groups.form.subgroups-list.button.see-all": "Search all",
|
"admin.access-control.groups.form.subgroups-list.button.see-all": "Search all",
|
||||||
|
|
||||||
"admin.access-control.groups.form.return": "Return",
|
"admin.access-control.groups.form.return": "Return to groups",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { Subscription } from 'rxjs/internal/Subscription';
|
||||||
import { map, take } from 'rxjs/operators';
|
import { map, take } from 'rxjs/operators';
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
@@ -19,7 +20,7 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio
|
|||||||
* A component used for managing all existing epeople within the repository.
|
* A component used for managing all existing epeople within the repository.
|
||||||
* The admin can create, edit or delete epeople here.
|
* The admin can create, edit or delete epeople here.
|
||||||
*/
|
*/
|
||||||
export class EPeopleRegistryComponent {
|
export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
labelPrefix = 'admin.access-control.epeople.';
|
labelPrefix = 'admin.access-control.epeople.';
|
||||||
|
|
||||||
@@ -45,15 +46,28 @@ export class EPeopleRegistryComponent {
|
|||||||
// The search form
|
// The search form
|
||||||
searchForm;
|
searchForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of subscriptions
|
||||||
|
*/
|
||||||
|
subs: Subscription[] = [];
|
||||||
|
|
||||||
constructor(private epersonService: EPersonDataService,
|
constructor(private epersonService: EPersonDataService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private formBuilder: FormBuilder) {
|
private formBuilder: FormBuilder) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.isEPersonFormShown = false;
|
||||||
this.updateEPeople({
|
this.updateEPeople({
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
elementsPerPage: this.config.pageSize
|
elementsPerPage: this.config.pageSize
|
||||||
});
|
});
|
||||||
this.isEPersonFormShown = false;
|
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
|
||||||
|
if (eperson != null && eperson.id) {
|
||||||
|
this.isEPersonFormShown = true;
|
||||||
|
}
|
||||||
|
}));
|
||||||
this.searchForm = this.formBuilder.group(({
|
this.searchForm = this.formBuilder.group(({
|
||||||
scope: 'metadata',
|
scope: 'metadata',
|
||||||
query: '',
|
query: '',
|
||||||
@@ -151,6 +165,13 @@ export class EPeopleRegistryComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsub all subscriptions
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.subs.filter((sub) => hasValue(sub)).forEach((sub) => sub.unsubscribe());
|
||||||
|
}
|
||||||
|
|
||||||
scrollToTop() {
|
scrollToTop() {
|
||||||
(function smoothscroll() {
|
(function smoothscroll() {
|
||||||
const currentScroll = document.documentElement.scrollTop || document.body.scrollTop;
|
const currentScroll = document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
|
@@ -39,7 +39,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let group of (groups | async)?.payload?.page">
|
<tr *ngFor="let group of (groups | async)?.payload?.page">
|
||||||
<td>{{group.id}}</td>
|
<td>{{group.id}}</td>
|
||||||
<td><a [routerLink]="[groupsDataService.getGroupEditPageRouterLink(group.id)]">{{group.name}}</a></td>
|
<td><a (click)="groupsDataService.startEditingNewGroup(group)"
|
||||||
|
[routerLink]="[groupsDataService.getGroupEditPageRouterLink(group)]">{{group.name}}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@@ -134,7 +134,6 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
|||||||
onCancel() {
|
onCancel() {
|
||||||
this.groupDataService.cancelEditGroup();
|
this.groupDataService.cancelEditGroup();
|
||||||
this.cancelForm.emit();
|
this.cancelForm.emit();
|
||||||
this.router.navigate([this.groupDataService.getGroupRegistryRouterLink()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -41,7 +41,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let ePerson of (ePeople | async)?.payload?.page">
|
<tr *ngFor="let ePerson of (ePeople | async)?.payload?.page">
|
||||||
<td>{{ePerson.id}}</td>
|
<td>{{ePerson.id}}</td>
|
||||||
<td>{{ePerson.name}}</td>
|
<td><a (click)="ePersonDataService.startEditingNewEPerson(ePerson)"
|
||||||
|
[routerLink]="[ePersonDataService.getEPeoplePageRouterLink()]">{{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="(isMemberOfGroup(ePerson) | async)"
|
||||||
@@ -66,12 +67,15 @@
|
|||||||
|
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(ePeople | async)?.payload.totalElements == 0 && !searchDone" class="alert alert-info w-100 mb-2" role="alert">
|
<div *ngIf="(ePeople | async)?.payload.totalElements == 0 && !searchDone" class="alert alert-info w-100 mb-2"
|
||||||
|
role="alert">
|
||||||
{{messagePrefix + '.no-members-yet' | translate}}
|
{{messagePrefix + '.no-members-yet' | translate}}
|
||||||
<button (click)="search({query: ''})" class="btn btn-primary">{{messagePrefix + '.button.see-all' | translate}}</button>
|
<button (click)="search({query: ''})"
|
||||||
|
class="btn btn-primary">{{messagePrefix + '.button.see-all' | translate}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="(ePeople | async)?.payload.totalElements == 0 && searchDone" class="alert alert-info w-100 mb-2" role="alert">
|
<div *ngIf="(ePeople | async)?.payload.totalElements == 0 && searchDone" class="alert alert-info w-100 mb-2"
|
||||||
|
role="alert">
|
||||||
{{messagePrefix + '.no-items' | translate}}
|
{{messagePrefix + '.no-items' | translate}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
searchDone: boolean;
|
searchDone: boolean;
|
||||||
|
|
||||||
constructor(private groupDataService: GroupDataService,
|
constructor(private groupDataService: GroupDataService,
|
||||||
private ePersonDataService: EPersonDataService,
|
public ePersonDataService: EPersonDataService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private formBuilder: FormBuilder) {
|
private formBuilder: FormBuilder) {
|
||||||
|
@@ -35,7 +35,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let group of (groups | async)?.payload?.page">
|
<tr *ngFor="let group of (groups | async)?.payload?.page">
|
||||||
<td>{{group.id}}</td>
|
<td>{{group.id}}</td>
|
||||||
<td>{{group.name}}</td>
|
<td><a (click)="groupDataService.startEditingNewGroup(group)"
|
||||||
|
[routerLink]="[groupDataService.getGroupEditPageRouterLink(group)]">{{group.name}}</a></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group edit-field">
|
<div class="btn-group edit-field">
|
||||||
<button *ngIf="(isSubgroupOfGroup(group) | async)"
|
<button *ngIf="(isSubgroupOfGroup(group) | async)"
|
||||||
@@ -60,12 +61,15 @@
|
|||||||
|
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
|
||||||
<div *ngIf="(groups | async)?.payload.totalElements == 0 && !searchDone" class="alert alert-info w-100 mb-2" role="alert">
|
<div *ngIf="(groups | async)?.payload.totalElements == 0 && !searchDone" class="alert alert-info w-100 mb-2"
|
||||||
|
role="alert">
|
||||||
{{messagePrefix + '.no-subgroups-yet' | translate}}
|
{{messagePrefix + '.no-subgroups-yet' | translate}}
|
||||||
<button (click)="search({query: ''})" class="btn btn-primary">{{messagePrefix + '.button.see-all' | translate}}</button>
|
<button (click)="search({query: ''})"
|
||||||
|
class="btn btn-primary">{{messagePrefix + '.button.see-all' | translate}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="(groups | async)?.payload.totalElements == 0 && searchDone" class="alert alert-info w-100 mb-2" role="alert">
|
<div *ngIf="(groups | async)?.payload.totalElements == 0 && searchDone" class="alert alert-info w-100 mb-2"
|
||||||
|
role="alert">
|
||||||
{{messagePrefix + '.no-items' | translate}}
|
{{messagePrefix + '.no-items' | translate}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@
|
|||||||
<!-- <td>{{getOptionalComColFromName(group.name)}}</td>-->
|
<!-- <td>{{getOptionalComColFromName(group.name)}}</td>-->
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group edit-field">
|
<div class="btn-group edit-field">
|
||||||
<button [routerLink]="[group.id]" class="btn btn-outline-primary btn-sm"
|
<button [routerLink]="groupService.getGroupEditPageRouterLink(group)" class="btn btn-outline-primary btn-sm"
|
||||||
title="{{messagePrefix + 'table.edit.buttons.edit' | translate}}">
|
title="{{messagePrefix + 'table.edit.buttons.edit' | translate}}">
|
||||||
<i class="fas fa-edit fa-fw"></i>
|
<i class="fas fa-edit fa-fw"></i>
|
||||||
</button>
|
</button>
|
||||||
|
@@ -219,4 +219,27 @@ export class EPersonDataService extends DataService<EPerson> {
|
|||||||
return this.delete(ePerson.id);
|
return this.delete(ePerson.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change which ePerson is being edited and return the link for EPeople edit page
|
||||||
|
* @param ePerson New EPerson to edit
|
||||||
|
*/
|
||||||
|
public startEditingNewEPerson(ePerson: EPerson): string {
|
||||||
|
this.getActiveEPerson().pipe(take(1)).subscribe((activeEPerson: EPerson) => {
|
||||||
|
if (ePerson === activeEPerson) {
|
||||||
|
this.cancelEditEPerson();
|
||||||
|
} else {
|
||||||
|
this.editEPerson(ePerson);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return '/admin/access-control/epeople';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get EPeople admin page
|
||||||
|
* @param ePerson New EPerson to edit
|
||||||
|
*/
|
||||||
|
public getEPeoplePageRouterLink(): string {
|
||||||
|
return '/admin/access-control/epeople';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -259,8 +259,27 @@ export class GroupDataService extends DataService<Group> {
|
|||||||
return '/admin/access-control/groups';
|
return '/admin/access-control/groups';
|
||||||
}
|
}
|
||||||
|
|
||||||
public getGroupEditPageRouterLink(groupId: string): string {
|
/**
|
||||||
return '/admin/access-control/groups/' + groupId;
|
* Change which group is being edited and return the link for the edit page of the new group being edited
|
||||||
|
* @param newGroup New group to edit
|
||||||
|
*/
|
||||||
|
public startEditingNewGroup(newGroup: Group): string {
|
||||||
|
this.getActiveGroup().pipe(take(1)).subscribe((activeGroup: Group) => {
|
||||||
|
if (newGroup === activeGroup) {
|
||||||
|
this.cancelEditGroup()
|
||||||
|
} else {
|
||||||
|
this.editGroup(newGroup)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return '/admin/access-control/groups/' + newGroup.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Edit page of group
|
||||||
|
* @param group Group we want edit page for
|
||||||
|
*/
|
||||||
|
public getGroupEditPageRouterLink(group: Group): string {
|
||||||
|
return '/admin/access-control/groups/' + group.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user