mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 23:04:21 +00:00
🔧 Disable deleting a notebook while it's locked
This commit is contained in:
parent
477efeccc9
commit
35d0383389
2 changed files with 8 additions and 2 deletions
|
@ -31,6 +31,12 @@ export function NotebookDeleteButton({resource}: NotebookDeleteButtonProps): JSX
|
||||||
)) {
|
)) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
if(resource.value.is_running) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if(resource.value.locked_by) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafetyButton timeout={3} onClick={() => resource.destroy()} disabled={resource.busy}>
|
<SafetyButton timeout={3} onClick={() => resource.destroy()} disabled={resource.busy}>
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function NotebookResourcePanel({resource}: NotebookResourcePanelProps): J
|
||||||
const locked_by = cache?.getUserById(resource.value.locked_by)?.value.username
|
const locked_by = cache?.getUserById(resource.value.locked_by)?.value.username
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ResourcePanel>
|
<ResourcePanel builtinColor={locked_by ? "blue" : undefined}>
|
||||||
<ResourcePanel.Icon>
|
<ResourcePanel.Icon>
|
||||||
<FontAwesomeIcon icon={faBook}/>
|
<FontAwesomeIcon icon={faBook}/>
|
||||||
</ResourcePanel.Icon>
|
</ResourcePanel.Icon>
|
||||||
|
@ -43,11 +43,11 @@ export function NotebookResourcePanel({resource}: NotebookResourcePanelProps): J
|
||||||
}
|
}
|
||||||
</ResourcePanel.Text>
|
</ResourcePanel.Text>
|
||||||
<ResourcePanel.Buttons>
|
<ResourcePanel.Buttons>
|
||||||
|
<NotebookDeleteButton resource={resource}/>
|
||||||
<NotebookStopButton resource={resource}/>
|
<NotebookStopButton resource={resource}/>
|
||||||
<NotebookStartButton resource={resource}/>
|
<NotebookStartButton resource={resource}/>
|
||||||
<NotebookUnlockButton resource={resource}/>
|
<NotebookUnlockButton resource={resource}/>
|
||||||
<NotebookLockButton resource={resource}/>
|
<NotebookLockButton resource={resource}/>
|
||||||
<NotebookDeleteButton resource={resource}/>
|
|
||||||
</ResourcePanel.Buttons>
|
</ResourcePanel.Buttons>
|
||||||
</ResourcePanel>
|
</ResourcePanel>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue