Added a method to retrieve filename on upload bitstream

This commit is contained in:
Giuseppe
2018-10-10 11:24:49 +02:00
parent a33513ef4b
commit bef48e6c44

View File

@@ -163,8 +163,7 @@ export class UploadSectionComponent extends SectionModelComponent implements OnI
fileList.forEach((file) => { fileList.forEach((file) => {
this.fileList.push(file); this.fileList.push(file);
this.fileIndexes.push(file.uuid); this.fileIndexes.push(file.uuid);
const fileName = file.metadata['dc.title'][0].display || file.uuid; this.fileNames.push(this.getFileName(file));
this.fileNames.push(fileName);
}); });
sectionStatus = true; sectionStatus = true;
} }
@@ -177,6 +176,18 @@ export class UploadSectionComponent extends SectionModelComponent implements OnI
); );
} }
private getFileName(fileData: any): string {
const metadataName: string = this.configMetadataForm.rows[0].fields[0].selectableMetadata[0].metadata;
let title: string;
if (isNotEmpty(fileData.metadata) && isNotEmpty(fileData.metadata[metadataName])) {
title = fileData.metadata[metadataName][0].display;
} else {
title = fileData.uuid;
}
return title;
}
/** /**
* Method provided by Angular. Invoked when the instance is destroyed. * Method provided by Angular. Invoked when the instance is destroyed.
*/ */