DeleteAll updated

modify deleteAll to only delete the images listed in the drawer
This commit is contained in:
Silversith 2023-04-11 10:25:23 +02:00
parent 0b829dc4d4
commit a95f4e9757
3 changed files with 7 additions and 6 deletions

View File

@ -187,8 +187,8 @@ class PromptServer():
if not os.path.exists(output_dir):
return web.json_response({"message": "Output directory does not exist."}, status=404)
try:
if (filename == "all"):
for file_name in os.listdir(output_dir):
if isinstance(filename, list):
for file_name in filename: #os.listdir(output_dir):
file_path = os.path.join(output_dir, file_name)
if os.path.isfile(file_path):
os.remove(file_path)

View File

@ -210,9 +210,10 @@ app.registerExtension({
right: "5px",
});
deleteAllButton.onclick = () => {
const confirmDelete = confirm("Are you sure you want to delete all images?");
const confirmDelete = confirm("Are you sure you want to delete all images in the drawer?");
if (confirmDelete) {
api.deleteAllImages();
debugger;
api.deleteAllImages(allImages.map(item => item.filename));
allImages = []
imageList.replaceChildren(menu, resizeHandle);
}

View File

@ -117,8 +117,8 @@ class ComfyApi extends EventTarget {
return await resp.json();
}
async deleteAllImages() {
await this.#postItem("delete", { delete: "all" })
async deleteAllImages(filenames) {
await this.#postItem("delete", { delete: filenames })
}
async deleteImage(filename) {
await this.#postItem("delete", { delete: filename })