Added more comments

This commit is contained in:
Giuseppe Digilio
2019-03-20 19:57:07 +01:00
parent 825464bb9c
commit 6335d61dda
26 changed files with 1505 additions and 123 deletions

View File

@@ -5,17 +5,42 @@ import { isNotEmpty } from '../../../../../shared/empty.util';
import { Metadata } from '../../../../../core/shared/metadata.utils';
import { MetadataMap, MetadataValue } from '../../../../../core/shared/metadata.models';
/**
* This component allow to show bitstream's metadata
*/
@Component({
selector: 'ds-submission-upload-section-file-view',
templateUrl: './section-upload-file-view.component.html',
})
export class UploadSectionFileViewComponent implements OnInit {
/**
* The bitstream's metadata data
* @type {WorkspaceitemSectionUploadFileObject}
*/
@Input() fileData: WorkspaceitemSectionUploadFileObject;
/**
* The [[MetadataMap]] object
* @type {MetadataMap}
*/
public metadata: MetadataMap = Object.create({});
/**
* The bitstream's title key
* @type {string}
*/
public fileTitleKey = 'Title';
/**
* The bitstream's description key
* @type {string}
*/
public fileDescrKey = 'Description';
/**
* Initialize instance variables
*/
ngOnInit() {
if (isNotEmpty(this.fileData.metadata)) {
this.metadata[this.fileTitleKey] = Metadata.all(this.fileData.metadata, 'dc.title');
@@ -23,7 +48,15 @@ export class UploadSectionFileViewComponent implements OnInit {
}
}
getAllMetadataValue(metadataKey): MetadataValue[] {
/**
* Gets all matching metadata in the map(s)
*
* @param metadataKey
* The metadata key(s) in scope
* @returns {MetadataValue[]}
* The matching values
*/
getAllMetadataValue(metadataKey: string): MetadataValue[] {
return Metadata.all(this.metadata, metadataKey);
}
}