mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-20 10:05:57 +08:00
Make Hubs feature public and blocks the hub creation (#1756)
This commit is contained in:
parent
7c84fb4732
commit
1cdc5251dd
|
@ -27,7 +27,7 @@ config :livebook, :iframe_port, 4001
|
|||
config :livebook, :shutdown_callback, {System, :stop, []}
|
||||
|
||||
# Feature flags
|
||||
config :livebook, :feature_flags, hub: true
|
||||
config :livebook, :feature_flags, create_hub: true
|
||||
|
||||
# ## SSL Support
|
||||
#
|
||||
|
|
|
@ -24,7 +24,7 @@ end
|
|||
config :livebook, :data_path, data_path
|
||||
|
||||
# Feature flags
|
||||
config :livebook, :feature_flags, hub: true
|
||||
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
|
||||
|
|
|
@ -222,7 +222,7 @@ defmodule Livebook.Config do
|
|||
"""
|
||||
@spec feature_flag_enabled?(atom()) :: boolean()
|
||||
def feature_flag_enabled?(key) do
|
||||
@feature_flags[key]
|
||||
Keyword.get(@feature_flags, key, false)
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
|
|
@ -8,13 +8,20 @@ defmodule LivebookWeb.Hub.NewLive do
|
|||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, assign(socket, selected_type: nil, page_title: "Livebook - Hub")}
|
||||
enabled? = Livebook.Config.feature_flag_enabled?(:create_hub)
|
||||
{:ok, assign(socket, selected_type: nil, page_title: "Livebook - Hub", enabled?: enabled?)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_params(_params, _url, socket), do: {:noreply, socket}
|
||||
|
||||
@impl true
|
||||
def render(%{enabled?: false} = assigns) do
|
||||
~H"""
|
||||
TODO
|
||||
"""
|
||||
end
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<LayoutHelpers.layout current_page="/hub" current_user={@current_user} saved_hubs={@saved_hubs}>
|
||||
|
|
|
@ -213,7 +213,7 @@ defmodule LivebookWeb.LayoutHelpers do
|
|||
|
||||
defp hub_section(assigns) do
|
||||
~H"""
|
||||
<div :if={Livebook.Config.feature_flag_enabled?(:hub)} id="hubs" class="flex flex-col mt-12">
|
||||
<div id="hubs" class="flex flex-col mt-12">
|
||||
<div class="space-y-3">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 relative leading-6 mb-2">
|
||||
<small class="ml-5 font-medium text-gray-300 cursor-default">HUBS</small>
|
||||
|
@ -247,9 +247,9 @@ defmodule LivebookWeb.LayoutHelpers do
|
|||
"h-7 flex items-center hover:text-white #{text_color} border-l-4 #{border_color} hover:border-white"
|
||||
|
||||
if tooltip = Provider.connection_error(hub) do
|
||||
[to: to, data_tooltip: tooltip, class: "tooltip right " <> class]
|
||||
[navigate: to, data_tooltip: tooltip, class: "tooltip right " <> class]
|
||||
else
|
||||
[to: to, class: class]
|
||||
[navigate: to, class: class]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ defmodule LivebookWeb.SessionLive.SecretsListComponent do
|
|||
<span>New secret</span>
|
||||
</.link>
|
||||
|
||||
<div :if={Livebook.Config.feature_flag_enabled?(:hub)} class="mt-16">
|
||||
<div class="mt-16">
|
||||
<h3 class="uppercase text-sm font-semibold text-gray-500">
|
||||
<%= @hub.hub_emoji %> <%= @hub.hub_name %> secrets
|
||||
</h3>
|
||||
|
|
Loading…
Reference in a new issue