Skip to content

Commit 2365db4

Browse files
authored
Add info to the remaining node inspector sections (#969)
* add info to the remaining sections * refactor * move temporary assigns info to the left section
1 parent 63ff70f commit 2365db4

5 files changed

Lines changed: 57 additions & 19 deletions

File tree

lib/live_debugger/app/debugger/async_jobs/web/async_jobs_live.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,15 @@ defmodule LiveDebugger.App.Debugger.AsyncJobs.Web.AsyncJobsLive do
8484
inner_class="mx-0 p-4"
8585
class="flex-1"
8686
save_state_in_browser={true}
87+
title_class="flex flex-row justify-between min-w-max gap-2"
8788
>
89+
<:title_sub_panel>
90+
<.section_info_tooltip
91+
id="async-jobs-info"
92+
content="Background operations spawned via start_async or assign_async"
93+
/>
94+
</:title_sub_panel>
95+
8896
<div class="w-full h-full flex flex-col gap-2">
8997
<.async_result :let={async_jobs} assign={@async_jobs}>
9098
<:failed>

lib/live_debugger/app/debugger/callback_tracing/web/node_traces_live.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ defmodule LiveDebugger.App.Debugger.CallbackTracing.Web.NodeTracesLive do
102102
~H"""
103103
<div class="max-w-full @container/traces flex flex-1">
104104
<.section title="Callback traces" id="traces" inner_class="mx-0 my-4 px-4" class="flex-1">
105+
<:title_sub_panel>
106+
<.section_info_tooltip
107+
id="traces-info"
108+
content="Records the execution of LiveView/LiveComponent lifecycle callbacks and handlers"
109+
/>
110+
</:title_sub_panel>
105111
<:right_panel>
106112
<div class="flex gap-2 !h-7">
107113
<HookComponents.SearchInput.render

lib/live_debugger/app/debugger/node_state/web/components.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,16 @@ defmodule LiveDebugger.App.Debugger.NodeState.Web.Components do
116116
attr(:icon, :string, default: nil)
117117

118118
slot(:right)
119+
slot(:subtitle)
119120

120121
defp section_title(assigns) do
121122
~H"""
122123
<div class="bg-surface-1-bg flex items-center justify-between h-10 gap-2 p-4 border-b border-default-border font-semibold text-secondary-text w-full">
123124
<div class="flex items-center gap-2">
124125
<.icon :if={@icon} name={@icon} class="h-4 w-4" />
125126
<p><%= @name %></p>
127+
128+
<%= render_slot(@subtitle) %>
126129
</div>
127130
<div :if={@right != []} class="flex items-center gap-2">
128131
<%= render_slot(@right) %>
@@ -199,14 +202,16 @@ defmodule LiveDebugger.App.Debugger.NodeState.Web.Components do
199202
name={if(@temporary_assigns.result, do: "Temporary assigns", else: "No temporary assigns")}
200203
icon="icon-clock-3"
201204
>
202-
<:right :if={@has_temporary_assigns}>
205+
<:subtitle :if={@has_temporary_assigns}>
203206
<.tooltip
204207
id={@id <> "-tooltip"}
205208
content="Values shown are the last recorded before reset"
206209
position="top-center"
207210
>
208211
<.icon name="icon-info" class="w-4 h-4 bg-button-secondary-content" />
209212
</.tooltip>
213+
</:subtitle>
214+
<:right :if={@has_temporary_assigns}>
210215
<div class="flex">
211216
<.copy_button
212217
id={"temporary-assigns-copy-button" <> "-" <> @id}

lib/live_debugger/app/debugger/streams/web/components.ex

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ defmodule LiveDebugger.App.Debugger.Streams.Web.Components do
3838
class="h-max overflow-y-hidden"
3939
title="Streams"
4040
save_state_in_browser={true}
41+
title_class="flex flex-row justify-between min-w-max gap-2"
4142
>
42-
<:right_panel>
43-
<.streams_info_tooltip id="stream-info" />
44-
</:right_panel>
43+
<:title_sub_panel>
44+
<.section_info_tooltip
45+
id="stream-info"
46+
content="Streams are reconstructed from render traces. If traces are garbage collected, the stream may be incomplete."
47+
/>
48+
</:title_sub_panel>
4549
<%= render_slot(@display) %>
4650
</.collapsible_section>
4751
"""
@@ -131,20 +135,6 @@ defmodule LiveDebugger.App.Debugger.Streams.Web.Components do
131135
"""
132136
end
133137

134-
attr(:id, :string, required: true)
135-
136-
def streams_info_tooltip(assigns) do
137-
~H"""
138-
<.tooltip
139-
id={@id <> "-tooltip"}
140-
content="Streams are reconstructed from render traces. If traces are garbage collected, the stream may be incomplete."
141-
position="top-center"
142-
>
143-
<.icon name="icon-info" class="w-4 h-4 bg-button-secondary-content" />
144-
</.tooltip>
145-
"""
146-
end
147-
148138
@doc """
149139
Displays the fullscreen of the stream element.
150140
"""

lib/live_debugger/app/web/components.ex

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ defmodule LiveDebugger.App.Web.Components do
533533
attr(:inner_class, :any, default: nil)
534534

535535
slot(:right_panel)
536+
slot(:title_sub_panel)
536537
slot(:inner_block)
537538

538539
def collapsible_section(assigns) do
@@ -549,7 +550,13 @@ defmodule LiveDebugger.App.Web.Components do
549550
>
550551
<:label>
551552
<div class="ml-1 flex justify-between items-center w-full gap-2">
552-
<div class={["font-medium text-sm min-w-26" | List.wrap(@title_class)]}><%= @title %></div>
553+
<div class={[
554+
"font-medium text-sm min-w-26 flex items-center gap-2"
555+
| List.wrap(@title_class)
556+
]}>
557+
<p><%= @title %></p>
558+
<%= render_slot(@title_sub_panel) %>
559+
</div>
553560
<div class="w-max">
554561
<%= render_slot(@right_panel) %>
555562
</div>
@@ -564,6 +571,28 @@ defmodule LiveDebugger.App.Web.Components do
564571
"""
565572
end
566573

574+
@doc """
575+
Info tooltip for sections
576+
"""
577+
578+
attr(:id, :string, required: true)
579+
attr(:content, :string, required: true)
580+
attr(:position, :string, default: "top-center")
581+
582+
def section_info_tooltip(assigns) do
583+
~H"""
584+
<.tooltip
585+
id={@id <> "-tooltip"}
586+
content={@content}
587+
position={@position}
588+
>
589+
<span class="flex items-center justify-center h-full">
590+
<.icon name="icon-info" class="w-4 h-4 bg-button-secondary-content" />
591+
</span>
592+
</.tooltip>
593+
"""
594+
end
595+
567596
@doc """
568597
Typography component to render headings.
569598
"""

0 commit comments

Comments
 (0)