diff --git a/src/app/shared/resource-policies/resource-policies.component.html b/src/app/shared/resource-policies/resource-policies.component.html index dbcf3a45e7..ecf810fbf8 100644 --- a/src/app/shared/resource-policies/resource-policies.component.html +++ b/src/app/shared/resource-policies/resource-policies.component.html @@ -2,10 +2,10 @@
+ |
{{ 'resource-policies.table.headers.title.for.' + resourceKey | translate }} {{resourceUUID}} - @@ -15,6 +15,7 @@ | {{'resource-policies.table.headers.id' | translate}} | {{'resource-policies.table.headers.name' | translate}} | {{'resource-policies.table.headers.action' | translate}} | +{{'resource-policies.table.headers.eperson' | translate}} | {{'resource-policies.table.headers.group' | translate}} | {{'resource-policies.table.headers.date.start' | translate}} | {{'resource-policies.table.headers.date.end' | translate}} | @@ -22,13 +23,22 @@|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{policy.id}} | +
+ {{policy.id}}
+ |
{{policy.name}} | {{policy.action}} | ++ {{getEPersonName(policy) | async}} + | +
{{getGroupName(policy) | async}}
|
diff --git a/src/app/shared/resource-policies/resource-policies.component.ts b/src/app/shared/resource-policies/resource-policies.component.ts index 0596dba586..1f33437bfd 100644 --- a/src/app/shared/resource-policies/resource-policies.component.ts +++ b/src/app/shared/resource-policies/resource-policies.component.ts @@ -1,5 +1,5 @@ -import { Component, Input, OnDestroy, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; +import { ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; import { Observable, Subscription } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -13,6 +13,8 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { Group } from '../../core/eperson/models/group.model'; import { GroupDataService } from '../../core/eperson/group-data.service'; import { hasValue, isNotEmpty } from '../empty.util'; +import { EPerson } from '../../core/eperson/models/eperson.model'; +import { EPersonDataService } from '../../core/eperson/eperson-data.service'; @Component({ selector: 'ds-resource-policies', @@ -51,15 +53,21 @@ export class ResourcePoliciesComponent implements OnInit, OnDestroy { /** * Initialize instance variables * + * @param {ChangeDetectorRef} cdr * @param {DSONameService} dsoNameService + * @param {EPersonDataService} ePersonService * @param {GroupDataService} groupService * @param {ResourcePolicyService} resourcePolicyService + * @param {ActivatedRoute} route * @param {Router} router */ constructor( + private cdr: ChangeDetectorRef, private dsoNameService: DSONameService, + private ePersonService: EPersonDataService, private groupService: GroupDataService, private resourcePolicyService: ResourcePolicyService, + private route: ActivatedRoute, private router: Router ) { } @@ -74,6 +82,34 @@ export class ResourcePoliciesComponent implements OnInit, OnDestroy { } + /** + * Redirect to resource policy creation page + */ + createResourcePolicy(): void { + this.router.navigate([`../${this.resourceUUID}/create`], { relativeTo: this.route }) + } + + /** + * Redirect to resource policy editing page + * + * @param policy The resource policy + */ + editResourcePolicy(policy: ResourcePolicy): void { + this.router.navigate([`../${this.resourceUUID}/${policy.id}/edit`], { relativeTo: this.route }) + } + + /** + * Return the ePerson's name which the given policy is linked to + * + * @param policy The resource policy + */ + getEPersonName(policy: ResourcePolicy): Observable |