From 42ada7eb9b4cb0d05dfa1b25d2a808d4442b4379 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Fri, 26 Jan 2024 08:42:30 -0800 Subject: [PATCH 1/4] Remove regenerated pipeline files --- src/renderer/src/progress/index.js | 4 ++-- src/renderer/src/stories/pages/settings/SettingsPage.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/progress/index.js b/src/renderer/src/progress/index.js index 190933eca..fe1084e43 100644 --- a/src/renderer/src/progress/index.js +++ b/src/renderer/src/progress/index.js @@ -193,8 +193,8 @@ export function resume(name) { return commandToResume; } -export const remove = async (name) => { - const result = await Swal.fire({ +export const remove = async (name, force = false) => { + const result = force ? { isConfirmed: true} : await Swal.fire({ title: `Are you sure you would like to delete this conversion pipeline?`, html: `All related files will be deleted permanently, and existing progress will be lost.`, icon: "warning", diff --git a/src/renderer/src/stories/pages/settings/SettingsPage.js b/src/renderer/src/stories/pages/settings/SettingsPage.js index 3cd3ae357..a7395dce7 100644 --- a/src/renderer/src/stories/pages/settings/SettingsPage.js +++ b/src/renderer/src/stories/pages/settings/SettingsPage.js @@ -9,7 +9,7 @@ import developerGlobalSchema from "../../../../../../schemas/json/developer/glob import { validateDANDIApiKey } from "../../../validation/dandi"; import { Button } from "../../Button.js"; -import { global, save } from "../../../progress/index.js"; +import { global, remove, save } from "../../../progress/index.js"; import { merge, setUndefinedIfNotDeclared } from "../utils.js"; import { notyf } from "../../../dependencies/globals.js"; @@ -34,6 +34,8 @@ function saveNewPipelineFromYaml(name, sourceData, rootFolder) { }); }); + remove(name, true) + save({ info: { globalState: { From 9338a92f3d17d5a1ad975394fd1f65b4f7198075 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:45:30 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/renderer/src/progress/index.js | 26 ++++++++++--------- .../stories/pages/settings/SettingsPage.js | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/renderer/src/progress/index.js b/src/renderer/src/progress/index.js index fe1084e43..ed7af181c 100644 --- a/src/renderer/src/progress/index.js +++ b/src/renderer/src/progress/index.js @@ -194,18 +194,20 @@ export function resume(name) { } export const remove = async (name, force = false) => { - const result = force ? { isConfirmed: true} : await Swal.fire({ - title: `Are you sure you would like to delete this conversion pipeline?`, - html: `All related files will be deleted permanently, and existing progress will be lost.`, - icon: "warning", - heightAuto: false, - showCancelButton: true, - confirmButtonColor: "#3085d6", - cancelButtonColor: "#d33", - confirmButtonText: `Delete ${name}`, - cancelButtonText: "Cancel", - focusCancel: true, - }); + const result = force + ? { isConfirmed: true } + : await Swal.fire({ + title: `Are you sure you would like to delete this conversion pipeline?`, + html: `All related files will be deleted permanently, and existing progress will be lost.`, + icon: "warning", + heightAuto: false, + showCancelButton: true, + confirmButtonColor: "#3085d6", + cancelButtonColor: "#d33", + confirmButtonText: `Delete ${name}`, + cancelButtonText: "Cancel", + focusCancel: true, + }); if (result.isConfirmed) return operations.remove(name); diff --git a/src/renderer/src/stories/pages/settings/SettingsPage.js b/src/renderer/src/stories/pages/settings/SettingsPage.js index a7395dce7..81def9871 100644 --- a/src/renderer/src/stories/pages/settings/SettingsPage.js +++ b/src/renderer/src/stories/pages/settings/SettingsPage.js @@ -34,7 +34,7 @@ function saveNewPipelineFromYaml(name, sourceData, rootFolder) { }); }); - remove(name, true) + remove(name, true); save({ info: { From 6d44847f706a5e8cf623e6d7aa97156a2af80a3c Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Mon, 29 Jan 2024 09:21:38 -0800 Subject: [PATCH 3/4] Use updated name for creation and deletion --- src/renderer/src/progress/operations.js | 7 ++++++- src/renderer/src/stories/pages/settings/SettingsPage.js | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/progress/operations.js b/src/renderer/src/progress/operations.js index 3e0e70fa4..e3dc25444 100644 --- a/src/renderer/src/progress/operations.js +++ b/src/renderer/src/progress/operations.js @@ -7,10 +7,15 @@ export const remove = (name) => { const progressFilePathToDelete = joinPath(guidedProgressFilePath, name + ".json"); //delete the progress file - if (fs) fs.unlinkSync(progressFilePathToDelete); + if (fs) { + if (fs.existsSync(progressFilePathToDelete)) fs.unlinkSync(progressFilePathToDelete); + } else localStorage.removeItem(progressFilePathToDelete); if (fs) { + + console.log(previewSaveFolderPath, conversionSaveFolderPath, name) + // delete default preview location fs.rmSync(joinPath(previewSaveFolderPath, name), { recursive: true, force: true }); diff --git a/src/renderer/src/stories/pages/settings/SettingsPage.js b/src/renderer/src/stories/pages/settings/SettingsPage.js index 3f78615e4..5abd8ba0d 100644 --- a/src/renderer/src/stories/pages/settings/SettingsPage.js +++ b/src/renderer/src/stories/pages/settings/SettingsPage.js @@ -34,13 +34,15 @@ function saveNewPipelineFromYaml(name, sourceData, rootFolder) { }); }); - remove(name, true); + const updatedName = header(name) + + remove(updatedName, true); save({ info: { globalState: { project: { - name: header(name), + name: updatedName, initialized: true, }, From fd83d76ae55b01c1de05700430ce67d472d1af69 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:21:55 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/renderer/src/progress/operations.js | 6 ++---- src/renderer/src/stories/pages/settings/SettingsPage.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/progress/operations.js b/src/renderer/src/progress/operations.js index e3dc25444..10e25e533 100644 --- a/src/renderer/src/progress/operations.js +++ b/src/renderer/src/progress/operations.js @@ -9,12 +9,10 @@ export const remove = (name) => { //delete the progress file if (fs) { if (fs.existsSync(progressFilePathToDelete)) fs.unlinkSync(progressFilePathToDelete); - } - else localStorage.removeItem(progressFilePathToDelete); + } else localStorage.removeItem(progressFilePathToDelete); if (fs) { - - console.log(previewSaveFolderPath, conversionSaveFolderPath, name) + console.log(previewSaveFolderPath, conversionSaveFolderPath, name); // delete default preview location fs.rmSync(joinPath(previewSaveFolderPath, name), { recursive: true, force: true }); diff --git a/src/renderer/src/stories/pages/settings/SettingsPage.js b/src/renderer/src/stories/pages/settings/SettingsPage.js index 5abd8ba0d..4bc7354c9 100644 --- a/src/renderer/src/stories/pages/settings/SettingsPage.js +++ b/src/renderer/src/stories/pages/settings/SettingsPage.js @@ -34,7 +34,7 @@ function saveNewPipelineFromYaml(name, sourceData, rootFolder) { }); }); - const updatedName = header(name) + const updatedName = header(name); remove(updatedName, true);