Added type doc and test

This commit is contained in:
lotte
2019-03-29 16:39:25 +01:00
parent 030709aef1
commit 950bfb6381
11 changed files with 410 additions and 65 deletions

View File

@@ -6,13 +6,24 @@ import { PaginatedList } from '../../../core/data/paginated-list';
import { BitstreamFormat } from '../../../core/registry/mock-bitstream-format.model';
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
/**
* This component renders a list of bitstream formats
*/
@Component({
selector: 'ds-bitstream-formats',
templateUrl: './bitstream-formats.component.html'
})
export class BitstreamFormatsComponent {
/**
* A paginated list of bitstream formats to be shown on the page
*/
bitstreamFormats: Observable<RemoteData<PaginatedList<BitstreamFormat>>>;
/**
* The current pagination configuration for the page
* Currently simply renders all bitstream formats
*/
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
id: 'registry-bitstreamformats-pagination',
pageSize: 10000
@@ -22,11 +33,18 @@ export class BitstreamFormatsComponent {
this.updateFormats();
}
/**
* When the page is changed, make sure to update the list of bitstreams to match the new page
* @param event The page change event
*/
onPageChange(event) {
this.config.currentPage = event;
this.updateFormats();
}
/**
* Method to update the bitstream formats that are shown
*/
private updateFormats() {
this.bitstreamFormats = this.registryService.getBitstreamFormats(this.config);
}