-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathshow.html.heex
More file actions
154 lines (137 loc) · 5.59 KB
/
show.html.heex
File metadata and controls
154 lines (137 loc) · 5.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<div class="my-6">
<.link navigate={dashboard_path(@socket, @search)}>
<.icon name="arrow-left" /> Back to the dashboard
</.link>
</div>
<div id="header">
<p class="text-sm uppercase font-semibold text-gray-400">
Error #{@error.id} @ {format_datetime(@occurrence.inserted_at)}
</p>
<h1 class="my-1 text-2xl w-full font-semibold whitespace-nowrap text-ellipsis overflow-hidden">
({sanitize_module(@error.kind)}) {@error.reason
|> String.replace("\n", " ")
|> String.trim()}
</h1>
</div>
<div class="grid grid-cols-1 md:grid-cols-4 md:space-x-3 mt-6 gap-2">
<div class="md:col-span-3 md:border-r md:border-gray-600 space-y-8 pr-5">
<.section title="Full message">
<pre class="overflow-auto p-4 rounded-lg bg-gray-300/10 border border-gray-900"><%= @occurrence.reason %></pre>
</.section>
<.section :if={ErrorTracker.Error.has_source_info?(@error)} title="Source">
<pre class="overflow-auto text-sm p-4 rounded-lg bg-gray-300/10 border border-gray-900">
<%= sanitize_module(@error.source_function) %>
<%= @error.source_line %></pre>
</.section>
<.section :if={@occurrence.breadcrumbs != []} title="Bread crumbs">
<div class="relative overflow-x-auto shadow-md sm:rounded-lg ring-1 ring-gray-900">
<table class="w-full text-sm text-gray-400 table-fixed">
<tr
:for={
{breadcrumb, index} <-
@occurrence.breadcrumbs |> Enum.reverse() |> Enum.with_index()
}
class="border-b bg-gray-400/10 border-gray-900 last:border-b-0"
>
<td class="w-11 pl-2 py-4 font-medium text-white relative text-right">
{length(@occurrence.breadcrumbs) - index}.
</td>
<td class="px-2 py-4 font-medium text-white relative">{breadcrumb}</td>
</tr>
</table>
</div>
</.section>
<.section :if={@occurrence.stacktrace.lines != []} title="Stacktrace">
<div class="p-4 bg-gray-300/10 border border-gray-900 rounded-lg">
<div class="w-full mb-4">
<label class="flex justify-end">
<input
type="checkbox"
id="show-app-frames"
class="ml-2 mr-2 mb-1 mt-1 inline-block text-sky-600 rounded focus:ring-sky-600 ring-offset-gray-800 focus:ring-2 bg-gray-700 border-gray-600"
phx-click={JS.toggle(to: "#stacktrace tr:not([data-app=#{@app}])")}
/>
<span class="text-md inline-block">
Show only app frames
</span>
</label>
</div>
<div class="overflow-auto">
<table class="w-100 text-sm" id="stacktrace">
<tbody>
<tr :for={line <- @occurrence.stacktrace.lines} data-app={line.application || @app}>
<td class="px-2 align-top"><pre>(<%= line.application || @app %>)</pre></td>
<td>
<pre><%= "#{sanitize_module(line.module)}.#{line.function}/#{line.arity}" %>
<%= if line.line, do: "#{line.file}:#{line.line}", else: "(nofile)" %></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</.section>
<.section title="Context">
<pre class="overflow-auto text-sm p-4 rounded-lg bg-gray-300/10 border border-gray-900"><%= Jason.encode!(@occurrence.context, pretty: true) %></pre>
</.section>
</div>
<div class="px-3 md:pl-0 space-y-8">
<.section title={"Occurrence (#{@total_occurrences} total)"}>
<form phx-change="occurrence_navigation">
<select
name="occurrence_id"
class="w-full border text-sm rounded-lg block p-2.5 bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:ring-blue-500 focus:border-blue-500"
>
<option
:for={occurrence <- @occurrences}
value={occurrence.id}
selected={occurrence.id == @occurrence.id}
>
{format_datetime(occurrence.inserted_at)}
</option>
</select>
</form>
<nav class="grid grid-cols-2 gap-2 mt-2">
<div class="text-left">
<.link :if={@prev} patch={occurrence_path(@socket, @prev, @search)}>
<.icon name="arrow-left" /> Prev
</.link>
</div>
<div class="text-right">
<.link :if={@next} patch={occurrence_path(@socket, @next, @search)}>
Next <.icon name="arrow-right" />
</.link>
</div>
</nav>
</.section>
<.section title="Error kind">
<pre><%= sanitize_module(@error.kind) %></pre>
</.section>
<.section title="Last seen">
<pre><%= format_datetime(@error.last_occurrence_at) %></pre>
</.section>
<.section title="First seen">
<pre><%= format_datetime(@error.inserted_at) %></pre>
</.section>
<.section title="Status" title_class="mb-3">
<.badge :if={@error.status == :resolved} color={:green}>Resolved</.badge>
<.badge :if={@error.status == :unresolved} color={:red}>Unresolved</.badge>
</.section>
<.section>
<div class="flex flex-col gap-y-4">
<.button :if={@error.status == :unresolved} phx-click="resolve">
Mark as resolved
</.button>
<.button :if={@error.status == :resolved} phx-click="unresolve">
Mark as unresolved
</.button>
<.button :if={!@error.muted} phx-click="mute" type="link">
<.icon name="bell-slash" /> Mute
</.button>
<.button :if={@error.muted} phx-click="unmute" type="link">
<.icon name="bell" /> Unmute
</.button>
</div>
</.section>
</div>
</div>