diff --git a/mediarepo-ui/src-tauri/Cargo.lock b/mediarepo-ui/src-tauri/Cargo.lock index ee664f1..ef10d76 100644 --- a/mediarepo-ui/src-tauri/Cargo.lock +++ b/mediarepo-ui/src-tauri/Cargo.lock @@ -1473,8 +1473,8 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "mediarepo-api" -version = "0.11.0" -source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=8f19fe419203842e3e7bff130d52be90de733504#8f19fe419203842e3e7bff130d52be90de733504" +version = "0.11.1" +source = "git+https://github.com/Trivernis/mediarepo-api.git?rev=d56e2c7406e9b8b15b22bc2714eebff00f63d778#d56e2c7406e9b8b15b22bc2714eebff00f63d778" dependencies = [ "async-trait", "chrono", diff --git a/mediarepo-ui/src-tauri/Cargo.toml b/mediarepo-ui/src-tauri/Cargo.toml index b83001a..6e040b8 100644 --- a/mediarepo-ui/src-tauri/Cargo.toml +++ b/mediarepo-ui/src-tauri/Cargo.toml @@ -30,7 +30,7 @@ features = ["env-filter"] [dependencies.mediarepo-api] git = "https://github.com/Trivernis/mediarepo-api.git" -rev = "8f19fe419203842e3e7bff130d52be90de733504" +rev = "d56e2c7406e9b8b15b22bc2714eebff00f63d778" features = ["tauri-plugin"] [features] diff --git a/mediarepo-ui/src/app/components/context-menu/context-menu.component.html b/mediarepo-ui/src/app/components/context-menu/context-menu.component.html index d75ee99..4bc536f 100644 --- a/mediarepo-ui/src/app/components/context-menu/context-menu.component.html +++ b/mediarepo-ui/src/app/components/context-menu/context-menu.component.html @@ -1,5 +1,4 @@ - diff --git a/mediarepo-ui/src/app/components/context-menu/file-context-menu/file-context-menu.component.html b/mediarepo-ui/src/app/components/context-menu/file-context-menu/file-context-menu.component.html index 009d9b3..cdfd11c 100644 --- a/mediarepo-ui/src/app/components/context-menu/file-context-menu/file-context-menu.component.html +++ b/mediarepo-ui/src/app/components/context-menu/file-context-menu/file-context-menu.component.html @@ -1,5 +1,5 @@ - + diff --git a/mediarepo-ui/src/app/components/file-grid/file-grid.component.html b/mediarepo-ui/src/app/components/file-grid/file-grid.component.html index 7dbb8e9..a7d1dac 100644 --- a/mediarepo-ui/src/app/components/file-grid/file-grid.component.html +++ b/mediarepo-ui/src/app/components/file-grid/file-grid.component.html @@ -13,4 +13,6 @@ - + + + diff --git a/mediarepo-ui/src/app/components/file-grid/file-grid.component.ts b/mediarepo-ui/src/app/components/file-grid/file-grid.component.ts index 3e2e606..29df5c0 100644 --- a/mediarepo-ui/src/app/components/file-grid/file-grid.component.ts +++ b/mediarepo-ui/src/app/components/file-grid/file-grid.component.ts @@ -15,6 +15,7 @@ import {FileGridEntryComponent} from "./file-grid-entry/file-grid-entry.componen import {GridEntry} from "./file-grid-entry/GridEntry"; import {CdkVirtualScrollViewport} from "@angular/cdk/scrolling"; import {TabService} from "../../services/tab/tab.service"; +import {FileService} from "../../services/file/file.service"; @Component({ selector: 'app-file-grid', @@ -39,7 +40,10 @@ export class FileGridComponent implements OnChanges, OnInit { private ctrlClicked = false; private gridEntries: GridEntry[] = [] - constructor(private tabService: TabService) { + constructor( + private tabService: TabService, + private fileService: FileService, + ) { tabService.selectedTab.subscribe(() => this.adjustElementSizes()); } @@ -189,4 +193,8 @@ export class FileGridComponent implements OnChanges, OnInit { this.virtualScroll.checkViewportSize(); } } + + public async regenerateThumbnail(file: File) { + await this.fileService.deleteThumbnails(file); + } } diff --git a/mediarepo-ui/src/app/services/file/file.service.ts b/mediarepo-ui/src/app/services/file/file.service.ts index e69b9da..274b6d4 100644 --- a/mediarepo-ui/src/app/services/file/file.service.ts +++ b/mediarepo-ui/src/app/services/file/file.service.ts @@ -61,7 +61,22 @@ export class FileService { return this.sanitizer.bypassSecurityTrustResourceUrl(`content://${file.hash}`) } + /** + * Saves a file locally + * @param {File} file + * @param {string} targetPath + * @returns {Promise} + */ public async saveFile(file: File, targetPath: string) { await invoke("plugin:mediarepo|save_file_locally", {id: file.id, path: targetPath}) } + + /** + * Deletes all thumbnails of a file + * @param {File} file + * @returns {Promise} + */ + public async deleteThumbnails(file: File) { + await invoke("plugin:mediarepo|delete_thumbnails", {id: file.id}); + } }