mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-10 05:25:57 +08:00
Make Hubs feature public and blocks the hub creation (#1756)
This commit is contained in:
parent
7c84fb4732
commit
1cdc5251dd
6 changed files with 15 additions and 8 deletions
|
@ -27,7 +27,7 @@ config :livebook, :iframe_port, 4001
|
||||||
config :livebook, :shutdown_callback, {System, :stop, []}
|
config :livebook, :shutdown_callback, {System, :stop, []}
|
||||||
|
|
||||||
# Feature flags
|
# Feature flags
|
||||||
config :livebook, :feature_flags, hub: true
|
config :livebook, :feature_flags, create_hub: true
|
||||||
|
|
||||||
# ## SSL Support
|
# ## SSL Support
|
||||||
#
|
#
|
||||||
|
|
|
@ -24,7 +24,7 @@ end
|
||||||
config :livebook, :data_path, data_path
|
config :livebook, :data_path, data_path
|
||||||
|
|
||||||
# Feature flags
|
# 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,
|
# 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
|
# 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()
|
@spec feature_flag_enabled?(atom()) :: boolean()
|
||||||
def feature_flag_enabled?(key) do
|
def feature_flag_enabled?(key) do
|
||||||
@feature_flags[key]
|
Keyword.get(@feature_flags, key, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -8,13 +8,20 @@ defmodule LivebookWeb.Hub.NewLive do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
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
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_params(_params, _url, socket), do: {:noreply, socket}
|
def handle_params(_params, _url, socket), do: {:noreply, socket}
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
def render(%{enabled?: false} = assigns) do
|
||||||
|
~H"""
|
||||||
|
TODO
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
|
||||||
def render(assigns) do
|
def render(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<LayoutHelpers.layout current_page="/hub" current_user={@current_user} saved_hubs={@saved_hubs}>
|
<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
|
defp hub_section(assigns) do
|
||||||
~H"""
|
~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="space-y-3">
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 relative leading-6 mb-2">
|
<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>
|
<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"
|
"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
|
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
|
else
|
||||||
[to: to, class: class]
|
[navigate: to, class: class]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ defmodule LivebookWeb.SessionLive.SecretsListComponent do
|
||||||
<span>New secret</span>
|
<span>New secret</span>
|
||||||
</.link>
|
</.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">
|
<h3 class="uppercase text-sm font-semibold text-gray-500">
|
||||||
<%= @hub.hub_emoji %> <%= @hub.hub_name %> secrets
|
<%= @hub.hub_emoji %> <%= @hub.hub_name %> secrets
|
||||||
</h3>
|
</h3>
|
||||||
|
|
Loading…
Add table
Reference in a new issue