Skip to content

Commit cc01357

Browse files
authored
Merge branch 'main' into 252-add-mode-for-disconnected-liveview
2 parents 7d2b7bb + a15a313 commit cc01357

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

assets/js/hooks/trace_execution_time.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
function parseElapsedTime(ms) {
2+
if (ms < 1000) return ms + ' ms';
3+
return (ms / 1000).toFixed(2) + ' s';
4+
}
5+
16
const TraceExecutionTime = {
27
mounted() {
38
let start = Date.now();
@@ -6,7 +11,7 @@ const TraceExecutionTime = {
611

712
this.intervalId = setInterval(() => {
813
current = Date.now() - start;
9-
this.el.textContent = current + ' ms';
14+
this.el.textContent = parseElapsedTime(current);
1015
}, 16);
1116

1217
this.handleEvent('stop-timer', () => {

lib/live_debugger_web/components/traces.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ defmodule LiveDebuggerWeb.Components.Traces do
8282
phx-value-trace-id={@trace.id}
8383
>
8484
<:label>
85-
<div id={@id <> "-label"} class="w-[90%] grow flex items-center ml-2 gap-1.5">
85+
<div id={@id <> "-label"} class="w-[90%] grow flex items-center ml-2 gap-3">
8686
<p class="font-medium text-sm"><%= @callback_name %></p>
8787
<.short_trace_content trace={@trace} />
8888
<.trace_time_info id={@id} trace={@trace} from_tracing?={@from_tracing?} />
@@ -135,15 +135,15 @@ defmodule LiveDebuggerWeb.Components.Traces do
135135

136136
def trace_time_info(assigns) do
137137
~H"""
138-
<div class="max-w-24 text-xs font-normal text-secondary-text align-center">
139-
<.tooltip id={@id <> "-timestamp"} content="timestamp">
138+
<div class="flex text-xs font-normal text-secondary-text align-center">
139+
<.tooltip id={@id <> "-timestamp"} content="timestamp" class="min-w-24">
140140
<%= Parsers.parse_timestamp(@trace.timestamp) %>
141141
</.tooltip>
142-
143-
<.tooltip id={@id <> "-exec-time-tooltip"} content="execution time">
142+
<span class="mx-2 border-r border-default-border"></span>
143+
<.tooltip id={@id <> "-exec-time-tooltip"} content="execution time" class="min-w-11">
144144
<span
145145
id={@id <> "-exec-time"}
146-
class={get_threshold_class(@trace.execution_time)}
146+
class={["text-nowrap", get_threshold_class(@trace.execution_time)]}
147147
phx-hook={if @from_tracing?, do: "TraceExecutionTime"}
148148
>
149149
<%= Parsers.parse_elapsed_time(@trace.execution_time) %>

priv/static/app.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)