Fix some bugs from the actionable refactor

This commit is contained in:
Joseph Milazzo 2025-05-10 15:10:01 -05:00
parent ff12abfa99
commit 717d16deba
3 changed files with 11 additions and 10 deletions

View file

@ -43,8 +43,7 @@
[imageUrl]="getLibraryImage(navStream.library!)" [title]="navStream.library!.name" [imageUrl]="getLibraryImage(navStream.library!)" [title]="navStream.library!.name"
[comparisonMethod]="'startsWith'"> [comparisonMethod]="'startsWith'">
<ng-container actions> <ng-container actions>
<app-card-actionables [entity]="navStream" [inputActions]="actions" [labelBy]="navStream.name" iconClass="fa-ellipsis-v" <app-card-actionables [entity]="navStream.library" [inputActions]="actions" [labelBy]="navStream.name" iconClass="fa-ellipsis-v"></app-card-actionables>
(actionHandler)="performAction($event, navStream.library!)"></app-card-actionables>
</ng-container> </ng-container>
</app-side-nav-item> </app-side-nav-item>
} }

View file

@ -155,24 +155,25 @@ export class SideNavComponent implements OnInit {
} }
async handleAction(action: ActionItem<Library>, library: Library) { async handleAction(action: ActionItem<Library>, library: Library) {
const lib = library;
switch (action.action) { switch (action.action) {
case(Action.Scan): case(Action.Scan):
await this.actionService.scanLibrary(library); await this.actionService.scanLibrary(lib);
break; break;
case(Action.RefreshMetadata): case(Action.RefreshMetadata):
await this.actionService.refreshLibraryMetadata(library); await this.actionService.refreshLibraryMetadata(lib);
break; break;
case(Action.GenerateColorScape): case(Action.GenerateColorScape):
await this.actionService.refreshLibraryMetadata(library, undefined, false); await this.actionService.refreshLibraryMetadata(lib, undefined, false);
break; break;
case (Action.AnalyzeFiles): case (Action.AnalyzeFiles):
await this.actionService.analyzeFiles(library); await this.actionService.analyzeFiles(lib);
break; break;
case (Action.Delete): case (Action.Delete):
await this.actionService.deleteLibrary(library); await this.actionService.deleteLibrary(lib);
break; break;
case (Action.Edit): case (Action.Edit):
this.actionService.editLibrary(library, () => window.scrollTo(0, 0)); this.actionService.editLibrary(lib, () => window.scrollTo(0, 0));
break; break;
default: default:
break; break;
@ -191,6 +192,7 @@ export class SideNavComponent implements OnInit {
performAction(action: ActionItem<Library>, library: Library) { performAction(action: ActionItem<Library>, library: Library) {
if (typeof action.callback === 'function') { if (typeof action.callback === 'function') {
console.log('library: ', library)
action.callback(action, library); action.callback(action, library);
} }
} }

View file

@ -257,12 +257,12 @@ export class LibrarySettingsModalComponent implements OnInit {
// TODO: Refactor into FormArray // TODO: Refactor into FormArray
for(let fileTypeGroup of allFileTypeGroup) { for(let fileTypeGroup of allFileTypeGroup) {
this.libraryForm.addControl(fileTypeGroup + '', new FormControl(this.library.libraryFileTypes.includes(fileTypeGroup), [])); this.libraryForm.addControl(fileTypeGroup + '', new FormControl((this.library.libraryFileTypes || []).includes(fileTypeGroup), []));
} }
// TODO: Refactor into FormArray // TODO: Refactor into FormArray
for(let glob of this.library.excludePatterns) { for(let glob of this.library.excludePatterns) {
this.libraryForm.addControl('excludeGlob-' , new FormControl(glob, [])); this.libraryForm.addControl('excludeGlob-', new FormControl(glob, []));
} }
this.excludePatterns = this.library.excludePatterns; this.excludePatterns = this.library.excludePatterns;