Skip to content

Commit 6002f76

Browse files
committed
115491: Add doc comments & apply minor fixes
1 parent ce3e2c7 commit 6002f76

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

src/app/shared/utils/observables-dictionary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export type ObservablesDictionary<T extends { [key: string]: any }> = {
2929
}
3030
3131
Now the input for the 'combineLatest' should be of type ObservablesDictionary<MyData>.
32-
In essence ObservablesDictionary<T> creates a copy of the defined interface T, while making observables of all T's
32+
In essence ObservablesDictionary<T> creates a copy of the defined interface T, while making observables of all of T's
3333
fields. ObservablesDictionary<T> also applies the additional constraint that all the keys of T must be strings, which
3434
is required for objects used in 'combineLatest'.
3535
@@ -55,7 +55,7 @@ export type ObservablesDictionary<T extends { [key: string]: any }> = {
5555
5656
5757
An example of this type in action can be found in the edit-bitstream-page component (as of writing this explainer).
58-
The edit-bitstream-page has the following interface with that contains the required data:
58+
The edit-bitstream-page has the following interface that contains the required data:
5959
6060
interface DataObjects {
6161
bitstream: Bitstream,

0 commit comments

Comments
 (0)