Fix some bugs from the actionable refactor
This commit is contained in:
parent
ff12abfa99
commit
717d16deba
3 changed files with 11 additions and 10 deletions
|
|
@ -43,8 +43,7 @@
|
|||
[imageUrl]="getLibraryImage(navStream.library!)" [title]="navStream.library!.name"
|
||||
[comparisonMethod]="'startsWith'">
|
||||
<ng-container actions>
|
||||
<app-card-actionables [entity]="navStream" [inputActions]="actions" [labelBy]="navStream.name" iconClass="fa-ellipsis-v"
|
||||
(actionHandler)="performAction($event, navStream.library!)"></app-card-actionables>
|
||||
<app-card-actionables [entity]="navStream.library" [inputActions]="actions" [labelBy]="navStream.name" iconClass="fa-ellipsis-v"></app-card-actionables>
|
||||
</ng-container>
|
||||
</app-side-nav-item>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,24 +155,25 @@ export class SideNavComponent implements OnInit {
|
|||
}
|
||||
|
||||
async handleAction(action: ActionItem<Library>, library: Library) {
|
||||
const lib = library;
|
||||
switch (action.action) {
|
||||
case(Action.Scan):
|
||||
await this.actionService.scanLibrary(library);
|
||||
await this.actionService.scanLibrary(lib);
|
||||
break;
|
||||
case(Action.RefreshMetadata):
|
||||
await this.actionService.refreshLibraryMetadata(library);
|
||||
await this.actionService.refreshLibraryMetadata(lib);
|
||||
break;
|
||||
case(Action.GenerateColorScape):
|
||||
await this.actionService.refreshLibraryMetadata(library, undefined, false);
|
||||
await this.actionService.refreshLibraryMetadata(lib, undefined, false);
|
||||
break;
|
||||
case (Action.AnalyzeFiles):
|
||||
await this.actionService.analyzeFiles(library);
|
||||
await this.actionService.analyzeFiles(lib);
|
||||
break;
|
||||
case (Action.Delete):
|
||||
await this.actionService.deleteLibrary(library);
|
||||
await this.actionService.deleteLibrary(lib);
|
||||
break;
|
||||
case (Action.Edit):
|
||||
this.actionService.editLibrary(library, () => window.scrollTo(0, 0));
|
||||
this.actionService.editLibrary(lib, () => window.scrollTo(0, 0));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -191,6 +192,7 @@ export class SideNavComponent implements OnInit {
|
|||
|
||||
performAction(action: ActionItem<Library>, library: Library) {
|
||||
if (typeof action.callback === 'function') {
|
||||
console.log('library: ', library)
|
||||
action.callback(action, library);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ export class LibrarySettingsModalComponent implements OnInit {
|
|||
|
||||
// TODO: Refactor into FormArray
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue