mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-12-10 13:46:13 +08:00
Add a connection error for offline hubs (#2326)
This commit is contained in:
parent
90c3cfe3a7
commit
97f64b4af4
2 changed files with 11 additions and 4 deletions
|
|
@ -312,7 +312,7 @@ defmodule Livebook.Application do
|
|||
Livebook.Hubs.save_hub(%Livebook.Hubs.Team{
|
||||
id: "team-#{name}",
|
||||
hub_name: name,
|
||||
hub_emoji: "💡",
|
||||
hub_emoji: "⭐️",
|
||||
user_id: 0,
|
||||
org_id: 0,
|
||||
org_key_id: 0,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ defmodule Livebook.Hubs.Team do
|
|||
field :org_key_id, :integer
|
||||
field :teams_key, :string
|
||||
field :org_public_key, :string
|
||||
field :session_token, :string
|
||||
field :session_token, :string, redact: true
|
||||
field :hub_name, :string
|
||||
field :hub_emoji, :string
|
||||
|
||||
|
|
@ -137,8 +137,15 @@ defimpl Livebook.Hubs.Provider, for: Livebook.Hubs.Team do
|
|||
def delete_secret(team, secret), do: Teams.delete_secret(team, secret)
|
||||
|
||||
def connection_error(team) do
|
||||
if reason = TeamClient.get_connection_error(team.id) do
|
||||
cond do
|
||||
team.offline ->
|
||||
"You are running an offline Hub for deployment. You cannot modify its settings."
|
||||
|
||||
reason = TeamClient.get_connection_error(team.id) ->
|
||||
"Cannot connect to Hub: #{reason}.\nWill attempt to reconnect automatically..."
|
||||
|
||||
true ->
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue