@@ -527,7 +527,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
527527 this . updateFormatModel ( ) ;
528528
529529 if ( this . isIIIF ) {
530- this . appendFormWIthIiifFields ( ) ;
530+ this . appendFormWithIiifFields ( ) ;
531531 }
532532 }
533533
@@ -543,7 +543,6 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
543543 */
544544 updateForm ( ) {
545545 const bitstream = this . bitstream ;
546- const format = this . bitstreamFormat ;
547546
548547 this . formGroup . patchValue ( {
549548 fileNamePrimaryContainer : {
@@ -574,7 +573,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
574573 } ) ;
575574 }
576575
577- this . bitstreamFormat = format ;
576+ const format = this . bitstreamFormat ;
578577 this . formGroup . patchValue ( {
579578 formatContainer : {
580579 selectedFormat : format . id
@@ -661,6 +660,9 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
661660 ) ;
662661 }
663662
663+ /**
664+ * Collects all observables that update the different parts of the bitstream.
665+ */
664666 getUpdateObservables ( updatedValues : any ) : ObservablesDictionary < UpdateResult > {
665667 return {
666668 metadataUpdateRD : this . updateBitstreamMetadataRD$ ( updatedValues ) ,
@@ -669,6 +671,9 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
669671 } ;
670672 }
671673
674+ /**
675+ * Creates and returns an observable that updates the bitstream metadata according to the data in the form.
676+ */
672677 updateBitstreamMetadataRD$ ( updatedValues : any ) : Observable < RemoteData < Bitstream > > {
673678 const updatedBitstream = this . formToBitstream ( updatedValues ) ;
674679
@@ -776,6 +781,11 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
776781 return updatedBitstream ;
777782 }
778783
784+ /**
785+ * Handle the update result by checking for errors.
786+ * When there are no errors, the user is redirected to the edit-bitstreams page.
787+ * When there are errors, a notification is shown.
788+ */
779789 handleUpdateResult ( updateResult : UpdateResult ) {
780790 let errorWhileSaving = false ;
781791
@@ -846,7 +856,10 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
846856 return isImage && isIIIFBundle && isEnabled ;
847857 }
848858
849- appendFormWIthIiifFields ( ) : void {
859+ /**
860+ * Extend the form with IIIF fields
861+ */
862+ appendFormWithIiifFields ( ) : void {
850863 this . inputModels . push ( this . iiifLabelModel ) ;
851864 this . formModel . push ( this . iiifLabelContainer ) ;
852865 this . inputModels . push ( this . iiifTocModel ) ;
0 commit comments