Skip to content

Commit

Permalink
feat: show msg when change-node node succeed
Browse files Browse the repository at this point in the history
  • Loading branch information
feng19 committed Jan 31, 2024
1 parent d06bda9 commit 5aac7fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/x_trace_web/controllers/trace_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ defmodule XTraceWeb.TraceLive do
socket =
try do
map = node |> String.to_existing_atom() |> update_node()

assign(socket, map)
|> put_flash(:info, "Connect to #{node} succeed!")
catch
_, _ -> put_flash(socket, :error, "bad node: #{node}")
end
Expand Down
9 changes: 5 additions & 4 deletions lib/x_trace_web/controllers/trace_live.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
<div class="grid grid-cols-2 gap-4">
<.input field={f[:connect_node]} label="Node to connect" placeholder="name@domain" />
<.input field={f[:connect_cookie]} label="Cookie" />
<.button type="button" class="w-full" phx-click="connect-node">Connect</.button>
<.button type="button" class="w-full" phx-click="connect-node"
disabled={is_nil(f[:connect_node].value) || f[:connect_node].value == ""}>Connect</.button>
<.button type="button" class="w-full" phx-click="reset-node">Reset node</.button>
</div>
<% else %>
Expand Down Expand Up @@ -217,9 +218,9 @@
<div class="space-y-4">
<div>
<span class="cursor-pointer text-xl font-bold" phx-click="set-tab" phx-value-tab="node">Node:</span><br/>
self node: <%= @self? %><br/>
code server mode: <%= @code_server_mode %><br/>
trace node: <span class="select-all"><%= @node %></span>
Is Self Node: <%= @self? %><br/>
Code Server mode: <%= @code_server_mode %><br/>
Trace Node: <span class="select-all font-bold"><%= @node %></span>
</div>

<div>
Expand Down

0 comments on commit 5aac7fe

Please sign in to comment.