mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-11-13 07:31:37 +08:00
Disable add menu if file system is not writable
This commit is contained in:
parent
82b7432da5
commit
79cb0e1132
2 changed files with 4 additions and 2 deletions
|
|
@ -40,6 +40,7 @@ defmodule LivebookWeb.FileSelectComponent do
|
||||||
# Component default attribute values
|
# Component default attribute values
|
||||||
inner_block: nil,
|
inner_block: nil,
|
||||||
file_system_select_disabled: false,
|
file_system_select_disabled: false,
|
||||||
|
writable: true,
|
||||||
on_submit: nil,
|
on_submit: nil,
|
||||||
# State
|
# State
|
||||||
current_dir: nil,
|
current_dir: nil,
|
||||||
|
|
@ -119,11 +120,11 @@ defmodule LivebookWeb.FileSelectComponent do
|
||||||
</div>
|
</div>
|
||||||
<.menu
|
<.menu
|
||||||
id={"#{@id}-new-item-menu"}
|
id={"#{@id}-new-item-menu"}
|
||||||
disabled={@file_system_select_disabled}
|
disabled={@file_system_select_disabled or not @writable}
|
||||||
position="bottom-right"
|
position="bottom-right"
|
||||||
>
|
>
|
||||||
<:toggle>
|
<:toggle>
|
||||||
<.icon_button tabindex="-1" aria-label="add">
|
<.icon_button disabled={not @writable} tabindex="-1" aria-label="add">
|
||||||
<.remix_icon icon="add-line" />
|
<.remix_icon icon="add-line" />
|
||||||
</.icon_button>
|
</.icon_button>
|
||||||
</:toggle>
|
</:toggle>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ defmodule LivebookWeb.OpenLive.FileComponent do
|
||||||
file={@file}
|
file={@file}
|
||||||
extnames={[LiveMarkdown.extension()]}
|
extnames={[LiveMarkdown.extension()]}
|
||||||
running_files={files(@sessions)}
|
running_files={files(@sessions)}
|
||||||
|
writable={writable?(@file_info)}
|
||||||
target={{__MODULE__, @id}}
|
target={{__MODULE__, @id}}
|
||||||
>
|
>
|
||||||
<div class="flex justify-end space-x-2">
|
<div class="flex justify-end space-x-2">
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue