mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-21 20:00:17 +08:00
DeleteAll updated
modify deleteAll to only delete the images listed in the drawer
This commit is contained in:
parent
0b829dc4d4
commit
a95f4e9757
@ -187,8 +187,8 @@ class PromptServer():
|
|||||||
if not os.path.exists(output_dir):
|
if not os.path.exists(output_dir):
|
||||||
return web.json_response({"message": "Output directory does not exist."}, status=404)
|
return web.json_response({"message": "Output directory does not exist."}, status=404)
|
||||||
try:
|
try:
|
||||||
if (filename == "all"):
|
if isinstance(filename, list):
|
||||||
for file_name in os.listdir(output_dir):
|
for file_name in filename: #os.listdir(output_dir):
|
||||||
file_path = os.path.join(output_dir, file_name)
|
file_path = os.path.join(output_dir, file_name)
|
||||||
if os.path.isfile(file_path):
|
if os.path.isfile(file_path):
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
|
|||||||
@ -210,9 +210,10 @@ app.registerExtension({
|
|||||||
right: "5px",
|
right: "5px",
|
||||||
});
|
});
|
||||||
deleteAllButton.onclick = () => {
|
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) {
|
if (confirmDelete) {
|
||||||
api.deleteAllImages();
|
debugger;
|
||||||
|
api.deleteAllImages(allImages.map(item => item.filename));
|
||||||
allImages = []
|
allImages = []
|
||||||
imageList.replaceChildren(menu, resizeHandle);
|
imageList.replaceChildren(menu, resizeHandle);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,8 +117,8 @@ class ComfyApi extends EventTarget {
|
|||||||
return await resp.json();
|
return await resp.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteAllImages() {
|
async deleteAllImages(filenames) {
|
||||||
await this.#postItem("delete", { delete: "all" })
|
await this.#postItem("delete", { delete: filenames })
|
||||||
}
|
}
|
||||||
async deleteImage(filename) {
|
async deleteImage(filename) {
|
||||||
await this.#postItem("delete", { delete: filename })
|
await this.#postItem("delete", { delete: filename })
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user