forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into DSpace#1171
- Loading branch information
Showing
158 changed files
with
2,667 additions
and
1,202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/app/+bitstream-page/bitstream-authorizations/bitstream-authorizations.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="container"> | ||
<ds-resource-policies [resourceType]="'bitstream'" [resourceUUID]="(dsoRD$ | async)?.payload?.id"></ds-resource-policies> | ||
<div class="button-row bottom"> | ||
<div class="text-right"> | ||
<a [routerLink]="['/bitstreams', (dsoRD$ | async)?.payload?.id, 'edit']" role="button" class="btn btn-outline-secondary mr-1"> | ||
<i class="fas fa-arrow-left"></i> {{'bitstream.edit.return' | translate}} | ||
</a> | ||
</div> | ||
</div> | ||
</div> |
84 changes: 84 additions & 0 deletions
84
src/app/+bitstream-page/bitstream-authorizations/bitstream-authorizations.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core'; | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
|
||
import { cold } from 'jasmine-marbles'; | ||
import { of as observableOf } from 'rxjs'; | ||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; | ||
|
||
import { DSpaceObject } from '../../core/shared/dspace-object.model'; | ||
import { BitstreamAuthorizationsComponent } from './bitstream-authorizations.component'; | ||
import { Bitstream } from '../../core/shared/bitstream.model'; | ||
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils'; | ||
import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock'; | ||
|
||
describe('BitstreamAuthorizationsComponent', () => { | ||
let comp: BitstreamAuthorizationsComponent<DSpaceObject>; | ||
let fixture: ComponentFixture<BitstreamAuthorizationsComponent<any>>; | ||
|
||
const bitstream = Object.assign(new Bitstream(), { | ||
sizeBytes: 10000, | ||
metadata: { | ||
'dc.title': [ | ||
{ | ||
value: 'file name', | ||
language: null | ||
} | ||
] | ||
}, | ||
_links: { | ||
content: { href: 'file-selflink' } | ||
} | ||
}); | ||
|
||
const bitstreamRD = createSuccessfulRemoteDataObject(bitstream); | ||
|
||
const routeStub = { | ||
data: observableOf({ | ||
bitstream: bitstreamRD | ||
}) | ||
}; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
CommonModule, | ||
TranslateModule.forRoot({ | ||
loader: { | ||
provide: TranslateLoader, | ||
useClass: TranslateLoaderMock | ||
} | ||
}) | ||
], | ||
declarations: [BitstreamAuthorizationsComponent], | ||
providers: [ | ||
{ provide: ActivatedRoute, useValue: routeStub }, | ||
ChangeDetectorRef, | ||
BitstreamAuthorizationsComponent, | ||
], | ||
schemas: [NO_ERRORS_SCHEMA], | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(BitstreamAuthorizationsComponent); | ||
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: bitstreamRD }); | ||
expect(comp.dsoRD$).toBeObservable(expected); | ||
done(); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
src/app/+bitstream-page/bitstream-authorizations/bitstream-authorizations.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
|
||
import { Observable } from 'rxjs'; | ||
import { first, map } from 'rxjs/operators'; | ||
|
||
import { RemoteData } from '../../core/data/remote-data'; | ||
import { DSpaceObject } from '../../core/shared/dspace-object.model'; | ||
|
||
@Component({ | ||
selector: 'ds-collection-authorizations', | ||
templateUrl: './bitstream-authorizations.component.html', | ||
}) | ||
/** | ||
* Component that handles the Collection Authorizations | ||
*/ | ||
export class BitstreamAuthorizationsComponent<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 collection | ||
*/ | ||
ngOnInit(): void { | ||
this.dsoRD$ = this.route.data.pipe(first(), map((data) => data.bitstream)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.