Button working now

pull/184/head
Alex 2 years ago
parent e7bd9b6323
commit 3e98f9e6bd

@ -410,8 +410,11 @@ def delete_old():
if dirs[0] not in ['indexes', 'vectors']: if dirs[0] not in ['indexes', 'vectors']:
return {"status": 'error'} return {"status": 'error'}
path_clean = '/'.join(dirs) path_clean = '/'.join(dirs)
shutil.rmtree(path)
vectors_collection.delete_one({'location': path}) vectors_collection.delete_one({'location': path})
try:
shutil.rmtree(path_clean)
except FileNotFoundError:
pass
return {"status": 'ok'} return {"status": 'ok'}
# handling CORS # handling CORS

@ -63,7 +63,8 @@ export default function Navigation({
const imageElement = document.querySelector( const imageElement = document.querySelector(
`#img-${index}`, `#img-${index}`,
) as HTMLElement; ) as HTMLElement;
imageElement.parentNode?.removeChild(imageElement); const parentElement = imageElement.parentNode as HTMLElement;
parentElement.parentNode?.removeChild(parentElement);
}) })
.catch((error) => console.error(error)); .catch((error) => console.error(error));
}; };
@ -173,13 +174,18 @@ export default function Navigation({
<p className="ml-5 flex-1 overflow-hidden overflow-ellipsis whitespace-nowrap py-3"> <p className="ml-5 flex-1 overflow-hidden overflow-ellipsis whitespace-nowrap py-3">
{doc.name} {doc.version} {doc.name} {doc.version}
</p> </p>
<img {doc.location === 'local' ? (
src={Exit} <img
alt="Exit" src={Exit}
className="mr-4 h-3 w-3 cursor-pointer" alt="Exit"
id={`img-${index}`} className="mr-4 h-3 w-3 cursor-pointer hover:opacity-50"
onClick={() => handleDeleteClick(index, doc)} id={`img-${index}`}
/> onClick={(event) => {
event.stopPropagation();
handleDeleteClick(index, doc);
}}
/>
) : null}
</div> </div>
); );
} }
@ -189,6 +195,7 @@ export default function Navigation({
<p className="ml-5 py-3">No default documentation.</p> <p className="ml-5 py-3">No default documentation.</p>
</div> </div>
)} )}
)
</div> </div>
)} )}
</div> </div>

Loading…
Cancel
Save