From b9651b270b65903fb231787872ec419c9468cc75 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 15 Oct 2021 17:03:24 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Disable=20deleting=20a=20noteboo?= =?UTF-8?q?k=20while=20it's=20locked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/notebook/NotebookDeleteButton.tsx | 6 ++++++ frontend/src/components/notebook/NotebookResourcePanel.tsx | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/notebook/NotebookDeleteButton.tsx b/frontend/src/components/notebook/NotebookDeleteButton.tsx index c279c86..dd9852a 100644 --- a/frontend/src/components/notebook/NotebookDeleteButton.tsx +++ b/frontend/src/components/notebook/NotebookDeleteButton.tsx @@ -31,6 +31,12 @@ export function NotebookDeleteButton({resource}: NotebookDeleteButtonProps): JSX )) { return null } + if(resource.value.is_running) { + return null + } + if(resource.value.locked_by) { + return null + } return ( resource.destroy()} disabled={resource.busy}> diff --git a/frontend/src/components/notebook/NotebookResourcePanel.tsx b/frontend/src/components/notebook/NotebookResourcePanel.tsx index 6fe1e8b..96fb6b4 100644 --- a/frontend/src/components/notebook/NotebookResourcePanel.tsx +++ b/frontend/src/components/notebook/NotebookResourcePanel.tsx @@ -24,7 +24,7 @@ export function NotebookResourcePanel({resource}: NotebookResourcePanelProps): J const locked_by = cache?.getUserById(resource.value.locked_by)?.value.username return ( - + @@ -43,11 +43,11 @@ export function NotebookResourcePanel({resource}: NotebookResourcePanelProps): J } + - )