mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
68346: bitstream edit bugfix
This commit is contained in:
@@ -429,7 +429,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
const updatedValues = this.formGroup.getRawValue();
|
const updatedValues = this.formGroup.getRawValue();
|
||||||
this.formToBitstream(updatedValues);
|
const updatedBitstream = this.formToBitstream(updatedValues);
|
||||||
const selectedFormat = this.formats.find((f: BitstreamFormat) => f.id === updatedValues.formatContainer.selectedFormat);
|
const selectedFormat = this.formats.find((f: BitstreamFormat) => f.id === updatedValues.formatContainer.selectedFormat);
|
||||||
const isNewFormat = selectedFormat.id !== this.originalFormat.id;
|
const isNewFormat = selectedFormat.id !== this.originalFormat.id;
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
bitstream$.pipe(
|
bitstream$.pipe(
|
||||||
switchMap(() => {
|
switchMap(() => {
|
||||||
return this.bitstreamService.update(this.bitstream).pipe(
|
return this.bitstreamService.update(updatedBitstream).pipe(
|
||||||
getFirstSucceededRemoteDataPayload()
|
getFirstSucceededRemoteDataPayload()
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@@ -473,8 +473,9 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
|
|||||||
* Parse form data to an updated bitstream object
|
* Parse form data to an updated bitstream object
|
||||||
* @param rawForm Raw form data
|
* @param rawForm Raw form data
|
||||||
*/
|
*/
|
||||||
formToBitstream(rawForm) {
|
formToBitstream(rawForm): Bitstream {
|
||||||
const newMetadata = cloneDeep(this.bitstream.metadata);
|
const updatedBitstream = cloneDeep(this.bitstream);
|
||||||
|
const newMetadata = updatedBitstream.metadata;
|
||||||
// TODO: Set bitstream to primary when supported
|
// TODO: Set bitstream to primary when supported
|
||||||
const primary = rawForm.fileNamePrimaryContainer.primaryBitstream;
|
const primary = rawForm.fileNamePrimaryContainer.primaryBitstream;
|
||||||
Metadata.setFirstValue(newMetadata, 'dc.title', rawForm.fileNamePrimaryContainer.fileName);
|
Metadata.setFirstValue(newMetadata, 'dc.title', rawForm.fileNamePrimaryContainer.fileName);
|
||||||
@@ -482,7 +483,8 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
|
|||||||
if (isNotEmpty(rawForm.formatContainer.newFormat)) {
|
if (isNotEmpty(rawForm.formatContainer.newFormat)) {
|
||||||
Metadata.setFirstValue(newMetadata, 'dc.format', rawForm.formatContainer.newFormat);
|
Metadata.setFirstValue(newMetadata, 'dc.format', rawForm.formatContainer.newFormat);
|
||||||
}
|
}
|
||||||
this.bitstream.metadata = newMetadata;
|
updatedBitstream.metadata = newMetadata;
|
||||||
|
return updatedBitstream;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user