1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 06:44:21 +00:00

🔧 Disable deleting a notebook while it's locked

This commit is contained in:
Steffo 2021-10-15 17:03:24 +02:00 committed by Stefano Pigozzi
parent e58c8d80e9
commit b9651b270b
2 changed files with 8 additions and 2 deletions

View file

@ -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 (
<SafetyButton timeout={3} onClick={() => resource.destroy()} disabled={resource.busy}>

View file

@ -24,7 +24,7 @@ export function NotebookResourcePanel({resource}: NotebookResourcePanelProps): J
const locked_by = cache?.getUserById(resource.value.locked_by)?.value.username
return (
<ResourcePanel>
<ResourcePanel builtinColor={locked_by ? "blue" : undefined}>
<ResourcePanel.Icon>
<FontAwesomeIcon icon={faBook}/>
</ResourcePanel.Icon>
@ -43,11 +43,11 @@ export function NotebookResourcePanel({resource}: NotebookResourcePanelProps): J
}
</ResourcePanel.Text>
<ResourcePanel.Buttons>
<NotebookDeleteButton resource={resource}/>
<NotebookStopButton resource={resource}/>
<NotebookStartButton resource={resource}/>
<NotebookUnlockButton resource={resource}/>
<NotebookLockButton resource={resource}/>
<NotebookDeleteButton resource={resource}/>
</ResourcePanel.Buttons>
</ResourcePanel>
)