Skip to content
Snippets Groups Projects
Commit bef48e6c authored by Giuseppe's avatar Giuseppe
Browse files

Added a method to retrieve filename on upload bitstream

parent a33513ef
No related branches found
No related tags found
No related merge requests found
......@@ -163,8 +163,7 @@ export class UploadSectionComponent extends SectionModelComponent implements OnI
fileList.forEach((file) => {
this.fileList.push(file);
this.fileIndexes.push(file.uuid);
const fileName = file.metadata['dc.title'][0].display || file.uuid;
this.fileNames.push(fileName);
this.fileNames.push(this.getFileName(file));
});
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.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment