mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Added authorizations edit page for community
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="container">
|
||||||
|
<ds-resource-policies [resourceType]="'community'" [resourceUUID]="(dsoRD$ | async)?.payload?.id"></ds-resource-policies>
|
||||||
|
</div>
|
@@ -0,0 +1,71 @@
|
|||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
import { cold } from 'jasmine-marbles';
|
||||||
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
|
import { CommunityAuthorizationsComponent } from './community-authorizations.component';
|
||||||
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
|
|
||||||
|
describe('CommunityAuthorizationsComponent', () => {
|
||||||
|
let comp: CommunityAuthorizationsComponent<DSpaceObject>;
|
||||||
|
let fixture: ComponentFixture<CommunityAuthorizationsComponent<any>>;
|
||||||
|
|
||||||
|
const community = Object.assign(new Collection(), {
|
||||||
|
uuid: 'community',
|
||||||
|
id: 'community',
|
||||||
|
_links: {
|
||||||
|
self: { href: 'community-selflink' }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const communityRD = createSuccessfulRemoteDataObject(community);
|
||||||
|
|
||||||
|
const routeStub = {
|
||||||
|
parent: {
|
||||||
|
data: observableOf({
|
||||||
|
dso: communityRD
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule
|
||||||
|
],
|
||||||
|
declarations: [CommunityAuthorizationsComponent],
|
||||||
|
providers: [
|
||||||
|
{ provide: ActivatedRoute, useValue: routeStub },
|
||||||
|
ChangeDetectorRef,
|
||||||
|
CommunityAuthorizationsComponent,
|
||||||
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CommunityAuthorizationsComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
comp = null;
|
||||||
|
fixture.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(comp).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should init dso remote data properly', (done) => {
|
||||||
|
const expected = cold('(a|)', { a: communityRD });
|
||||||
|
expect(comp.dsoRD$).toBeObservable(expected);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,38 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { first, map } from 'rxjs/operators';
|
||||||
|
import { RemoteData } from 'src/app/core/data/remote-data';
|
||||||
|
import { DSpaceObject } from 'src/app/core/shared/dspace-object.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-community-authorizations',
|
||||||
|
templateUrl: './community-authorizations.component.html',
|
||||||
|
})
|
||||||
|
/**
|
||||||
|
* Component that handles the community Authorizations
|
||||||
|
*/
|
||||||
|
export class CommunityAuthorizationsComponent<TDomain extends DSpaceObject> implements OnInit {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The initial DSO object
|
||||||
|
*/
|
||||||
|
public dsoRD$: Observable<RemoteData<TDomain>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize instance variables
|
||||||
|
*
|
||||||
|
* @param {ActivatedRoute} route
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private route: ActivatedRoute
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the component, setting up the community
|
||||||
|
*/
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.dsoRD$ = this.route.parent.data.pipe(first(), map((data) => data.dso));
|
||||||
|
}
|
||||||
|
}
|
@@ -7,6 +7,7 @@ import { EditCommunityPageComponent } from './edit-community-page.component';
|
|||||||
import { CommunityCurateComponent } from './community-curate/community-curate.component';
|
import { CommunityCurateComponent } from './community-curate/community-curate.component';
|
||||||
import { CommunityMetadataComponent } from './community-metadata/community-metadata.component';
|
import { CommunityMetadataComponent } from './community-metadata/community-metadata.component';
|
||||||
import { CommunityRolesComponent } from './community-roles/community-roles.component';
|
import { CommunityRolesComponent } from './community-roles/community-roles.component';
|
||||||
|
import { CommunityAuthorizationsComponent } from './community-authorizations/community-authorizations.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module that contains all components related to the Edit Community page administrator functionality
|
* Module that contains all components related to the Edit Community page administrator functionality
|
||||||
@@ -22,7 +23,8 @@ import { CommunityRolesComponent } from './community-roles/community-roles.compo
|
|||||||
EditCommunityPageComponent,
|
EditCommunityPageComponent,
|
||||||
CommunityCurateComponent,
|
CommunityCurateComponent,
|
||||||
CommunityMetadataComponent,
|
CommunityMetadataComponent,
|
||||||
CommunityRolesComponent
|
CommunityRolesComponent,
|
||||||
|
CommunityAuthorizationsComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class EditCommunityPageModule {
|
export class EditCommunityPageModule {
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import { CommunityPageResolver } from '../community-page.resolver';
|
|
||||||
import { EditCommunityPageComponent } from './edit-community-page.component';
|
import { EditCommunityPageComponent } from './edit-community-page.component';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
@@ -6,6 +5,7 @@ import { CommunityMetadataComponent } from './community-metadata/community-metad
|
|||||||
import { CommunityRolesComponent } from './community-roles/community-roles.component';
|
import { CommunityRolesComponent } from './community-roles/community-roles.component';
|
||||||
import { CommunityCurateComponent } from './community-curate/community-curate.component';
|
import { CommunityCurateComponent } from './community-curate/community-curate.component';
|
||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { CommunityAuthorizationsComponent } from './community-authorizations/community-authorizations.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Routing module that handles the routing for the Edit Community page administrator functionality
|
* Routing module that handles the routing for the Edit Community page administrator functionality
|
||||||
@@ -44,6 +44,11 @@ import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.r
|
|||||||
path: 'curate',
|
path: 'curate',
|
||||||
component: CommunityCurateComponent,
|
component: CommunityCurateComponent,
|
||||||
data: { title: 'community.edit.tabs.curate.title', showBreadcrumbs: true }
|
data: { title: 'community.edit.tabs.curate.title', showBreadcrumbs: true }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'authorizations',
|
||||||
|
component: CommunityAuthorizationsComponent,
|
||||||
|
data: { title: 'community.edit.tabs.authorizations.title', showBreadcrumbs: true }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user