Remove create hub feature flag, warn if using production servers in dev

This commit is contained in:
José Valim 2023-08-03 21:36:47 +02:00
parent aa0c70fc05
commit 8041d8ee9a
6 changed files with 22 additions and 54 deletions

View file

@ -16,11 +16,10 @@ config :livebook, LivebookWeb.Endpoint,
npm: ["run", "watch", cd: Path.expand("../assets", __DIR__)]
]
config :livebook, :iframe_port, 4001
config :livebook, :shutdown_callback, {System, :stop, []}
# Feature flags
config :livebook, :feature_flags, create_hub: true
config :livebook,
iframe_port: 4001,
shutdown_callback: {System, :stop, []},
warn_on_live_teams_server: true
# ## SSL Support
#

View file

@ -6,13 +6,14 @@ config :livebook, LivebookWeb.Endpoint,
http: [port: 4002],
server: false
config :livebook, :iframe_port, 4003
# Print only warnings and errors during test
config :logger, level: :warning
# Disable authentication mode during test
config :livebook, :authentication_mode, :disabled
config :livebook,
authentication_mode: :disabled,
check_completion_data_interval: 300,
iframe_port: 4003
data_path = Path.expand("tmp/livebook_data/test")
@ -23,14 +24,8 @@ end
config :livebook, :data_path, data_path
# Feature flags
config :livebook, :feature_flags, create_hub: true
# Use longnames when running tests in CI, so that no host resolution is required,
# see https://github.com/livebook-dev/livebook/pull/173#issuecomment-819468549
if System.get_env("CI") == "true" do
config :livebook, :node, {:longnames, :"livebook@127.0.0.1"}
end
# Teams
config :livebook, check_completion_data_interval: 300

View file

@ -126,7 +126,7 @@ defmodule Livebook do
end
if url = Livebook.Config.teams_url!("LIVEBOOK_TEAMS_URL") do
config :livebook, :teams_url, url
config :livebook, teams_url: url, warn_on_live_teams_server: false
end
if Livebook.Config.boolean!("LIVEBOOK_SHUTDOWN_ENABLED", false) do

View file

@ -312,6 +312,13 @@ defmodule Livebook.Config do
Application.fetch_env!(:livebook, :random_boot_id)
end
@doc """
If we should warn when using production servers.
"""
def warn_on_live_teams_server?() do
Application.get_env(:livebook, :warn_on_live_teams_server, false)
end
## Parsing
@doc """

View file

@ -49,7 +49,7 @@ defmodule Livebook.Teams.Org do
|> cast(attrs, @fields)
|> validate_required(@required_fields)
|> validate_format(:name, ~r/^[a-z0-9][a-z0-9\-]*$/,
message: "should only contain alphanumeric characters and dashes"
message: "should only contain lowercase alphanumeric characters and dashes"
)
end

View file

@ -15,13 +15,10 @@ defmodule LivebookWeb.Hub.NewLive do
@impl true
def mount(_params, _session, socket) do
enabled? = Livebook.Config.feature_flag_enabled?(:create_hub)
socket =
assign(socket,
selected_option: "new-org",
page_title: "Hub - Livebook",
enabled?: enabled?,
requested_code: false,
org: nil,
verification_uri: nil,
@ -36,44 +33,14 @@ defmodule LivebookWeb.Hub.NewLive do
end
@impl true
def render(%{enabled?: false} = assigns) do
~H"""
<LayoutHelpers.layout current_page="/hub" current_user={@current_user} saved_hubs={@saved_hubs}>
<div class="p-4 md:px-12 md:py-7 max-w-screen-md mx-auto space-y-6">
<div>
<LayoutHelpers.title text="Livebook Teams is coming soon!" />
<p class="mt-4 text-gray-700">
Livebook Teams will amplify Livebook with features designed for teams and businesses.
</p>
</div>
<p class="text-gray-700">
It will allow you to share notebooks, manage secrets, and deploy Livebook apps within your organization.
</p>
<p class="text-gray-700">
The product is still in development. We want to get feedback from beta users and understand
their use cases before the public launch.
</p>
<p class="text-gray-700">
<a
class="font-medium underline text-gray-900 hover:no-underline"
href="https://livebook.dev/teams?ref=LivebookApp"
target="_blank"
>
Learn more about Livebook Teams
</a>
and join the beta program.
</p>
<p class="text-gray-700">
- The Livebook crew
</p>
</div>
</LayoutHelpers.layout>
"""
end
def render(assigns) do
~H"""
<LayoutHelpers.layout current_page="/hub" current_user={@current_user} saved_hubs={@saved_hubs}>
<LayoutHelpers.topbar :if={Livebook.Config.warn_on_live_teams_server?()} variant={:warning}>
<strong>Beware!</strong>
You are running Livebook in development but this page communicates with production servers.
</LayoutHelpers.topbar>
<div class="flex flex-col p-4 md:px-12 md:py-7 max-w-screen-md mx-auto space-y-8">
<div>
<LayoutHelpers.title text="Add Hub" />