Show read-only mode warning on all admin pages

This commit is contained in:
Alexandre de Souza 2025-03-14 13:01:06 -03:00
parent f4d96043b5
commit 9180e493a7
No known key found for this signature in database
GPG key ID: E39228FFBA346545
2 changed files with 27 additions and 0 deletions

View file

@ -23,6 +23,10 @@ defmodule LivebookWeb.LayoutComponents do
<.sidebar current_page={@current_page} current_user={@current_user} saved_hubs={@saved_hubs} />
</div>
<div class="grow overflow-y-auto">
<.topbar :if={Livebook.Config.teams_auth?()} variant="warning">
This Livebook instance has been configured for notebook deployment and is in read-only mode.
</.topbar>
<div class="md:hidden sticky flex items-center justify-between h-14 px-4 top-0 left-0 z-[500] bg-white border-b border-gray-200">
<div class="pt-1 text-xl text-gray-400 hover:text-gray-600 focus:text-gray-600">
<button

View file

@ -0,0 +1,23 @@
defmodule LivebookWeb.Integration.AdminLiveTest do
# Not async, because we alter global config (app server instance)
use Livebook.TeamsIntegrationCase, async: false
import Phoenix.LiveViewTest
setup do
Application.put_env(:livebook, :teams_auth?, true)
on_exit(fn -> Application.put_env(:livebook, :teams_auth?, false) end)
:ok
end
for page <- ["/", "/settings", "/learn", "/hub", "/apps-dashboard"] do
@tag page: page
test "GET #{page} shows the app server topbar warning", %{conn: conn, page: page} do
{:ok, view, _} = live(conn, page)
assert render(view) =~
"This Livebook instance has been configured for notebook deployment and is in read-only mode."
end
end
end