Skip to content

Commit

Permalink
Merge pull request #1807 from fdm-monster/fix/delete-files-should-hav…
Browse files Browse the repository at this point in the history
…e-confirmation

fix: delete all files should have a confirmation dialog
  • Loading branch information
davidzwa authored Dec 25, 2024
2 parents 4135688 + 4bf79fd commit 7c2d4b8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release notes

Fixes

- Delete files on printer details (sidenav) should be protected by a confirmation dialog.

## Client 25/12/2024 1.8.7

Fixes
Expand Down
10 changes: 7 additions & 3 deletions src/components/Generic/FileExplorerSideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
link
v-bind="attrs"
v-on="on"
@click.prevent.stop="clickClearFiles()"
@click.prevent.stop="clickDeleteAllFiles()"
>
<v-list-item-avatar>
<v-icon>delete</v-icon>
Expand Down Expand Up @@ -681,10 +681,14 @@ async function clickResumePrint() {
await PrinterJobService.resumePrintJob(printerId.value);
}
async function clickClearFiles() {
async function clickDeleteAllFiles() {
if (!printerId.value) return;
if (!confirm("Are you sure to delete all files for this printer?")) {
return;
}
loading.value = true;
await printersStore.clearPrinterFiles(printerId.value);
await printersStore.deletePrinterFiles(printerId.value);
loading.value = false;
shownFileCache.value = printersStore.printerFiles(printerId.value);
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/printer.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const usePrinterStore = defineStore("Printers", {
console.warn("Printer was not purged as it did not occur in state", printerId);
}
},
async clearPrinterFiles(printerId: IdType) {
async deletePrinterFiles(printerId: IdType) {
if (!printerId) {
throw new Error("No printerId was provided");
}
Expand Down

0 comments on commit 7c2d4b8

Please sign in to comment.