diff --git a/booklore-ui/src/app/bookdrop/bookdrop-file-review-component/bookdrop-file-review.component.ts b/booklore-ui/src/app/bookdrop/bookdrop-file-review-component/bookdrop-file-review.component.ts index e91f8854b..34af2b821 100644 --- a/booklore-ui/src/app/bookdrop/bookdrop-file-review-component/bookdrop-file-review.component.ts +++ b/booklore-ui/src/app/bookdrop/bookdrop-file-review-component/bookdrop-file-review.component.ts @@ -75,7 +75,8 @@ export class BookdropFileReviewComponent implements OnInit { appSettings$: Observable = this.appSettingsService.appSettings$; uploadPattern = ''; - defaultLibraryId: string | null = null; + _defaultLibraryId: string | null = null; + defaultPathId: string | null = null; libraries: Library[] = []; bookdropFileUis: BookdropFileUI[] = []; @@ -108,6 +109,20 @@ export class BookdropFileReviewComponent implements OnInit { }); } + get defaultLibraryId() { + return this._defaultLibraryId; + } + + set defaultLibraryId(value: string | null) { + this._defaultLibraryId = value; + + const selected = this.libraries.find((lib) => lib?.id && String(lib.id) === value) + + if (selected && selected.paths.length ===1) { + this.defaultPathId = String(selected.paths[0].id) + } + } + get libraryOptions() { if (!this.libraries) return []; return this.libraries.map(lib => ({label: lib.name, value: String(lib.id ?? '')}));