Skip to content

Commit fe2be64

Browse files
ipweblabVidas P
authored andcommitted
Make agent logs and messages links to modal with details
1 parent c7e6a1b commit fe2be64

File tree

6 files changed

+57
-34
lines changed

6 files changed

+57
-34
lines changed

app/assets/javascripts/components/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
const { title, body, onHide } = param;
5656
$("body").append(`\
5757
<div class="modal fade" tabindex="-1" id='dynamic-modal' role="dialog" aria-labelledby="dynamic-modal-label" aria-hidden="true">
58-
<div class="modal-dialog modal-lg">
58+
<div class="modal-dialog modal-xl">
5959
<div class="modal-content">
6060
<div class="modal-header">
6161
<h4 class="modal-title" id="dynamic-modal-label"></h4>

app/assets/stylesheets/agent.scss

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,40 @@ li.issues {
234234
}
235235
}
236236

237+
.message-payload {
238+
@extend .text-monospace;
239+
padding: 10px;
240+
border-radius: 2px;
241+
background: #fff;
242+
color: #000;
243+
244+
&.truncated {
245+
overflow: hidden;
246+
white-space: nowrap;
247+
text-overflow: ellipsis;
248+
word-wrap: normal;
249+
width: 10rem;
250+
@include media-breakpoint-up(md) {
251+
width: 15rem;
252+
}
253+
@include media-breakpoint-up(lg) {
254+
width: 29rem;
255+
}
256+
@include media-breakpoint-up(xl) {
257+
max-width: 619px;
258+
}
259+
260+
&:hover {
261+
cursor: pointer;
262+
background: $gray-300;
263+
}
264+
}
265+
}
266+
267+
body.agents .modal pre {
268+
white-space:normal;
269+
}
270+
237271
// Nav
238272

239273
.agents-top-nav {

app/assets/stylesheets/general.scss

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
.flash.alert:empty {
1212
display: none;
1313
}
14-
1514
// Fix Firefox and Chrome outlines on focused navs.
16-
nav .nav-item .nav-link:focus,
17-
.dropdown-menu .dropdown-item:focus
18-
{
15+
.dropdown-menu .dropdown-item:focus,
16+
nav .nav-item .nav-link:focus {
1917
outline: none;
2018
}
2119

@@ -59,33 +57,6 @@ nav .nav-item .nav-link:focus,
5957
display: none;
6058
}
6159

62-
.message-payload {
63-
@extend .text-monospace;
64-
padding: 0em 1em;
65-
@extend .rounded;
66-
background: #fff;
67-
color: #000;
68-
69-
&.truncated {
70-
height: 2rem;
71-
overflow: hidden;
72-
white-space: nowrap;
73-
text-overflow: ellipsis;
74-
word-wrap: normal;
75-
76-
width: 10rem;
77-
@include media-breakpoint-up(md){
78-
width: 20rem;
79-
}
80-
@include media-breakpoint-up(lg){
81-
width: 30rem;
82-
}
83-
@include media-breakpoint-up(xl){
84-
width: 40rem;
85-
}
86-
}
87-
}
88-
8960
.ace_editor {
9061
height: 10rem;
9162
@extend .rounded;
@@ -105,6 +76,11 @@ nav .nav-item .nav-link:focus,
10576
#error_explanation {
10677
@extend .alert;
10778
@extend .alert-danger;
79+
80+
li {
81+
line-height: 1.2;
82+
margin-bottom: 5px;
83+
}
10884
}
10985

11086
.field_with_errors .form-control {

app/assets/stylesheets/tables.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ table.table {
5959
border-bottom-width: 0 !important;
6060
}
6161

62+
a.btn.btn-primary {
63+
white-space: nowrap;
64+
}
65+
66+
a:not(.btn) {
67+
cursor: pointer;
6268
}
6369
}
6470

app/views/logs/index.html.erb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414

1515
<% @logs.each do |log| %>
1616
<tr>
17-
<td><%= truncate log.message, :length => 200, :omission => "..." %></td>
17+
<td>
18+
<a class="show-log-details" data-toggle="modal" data-modal-content="<%= log.message %>" data-modal-title="<%= log.level >= 4 ? 'Error' : 'Info' %>">
19+
<%= truncate log.message, :length => 200, :omission => "..." %></td>
20+
</a>
1821
<td data-order="<%= relative_time(log.created_at, true) %>"><%= time_ago_in_words log.created_at %> ago</td>
1922

2023
<td>

app/views/messages/index.html.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
<% next unless message.agent %>
1717
<%= content_tag :tr, class: (highlighted?(message.id) ? 'hl' : nil) do %>
1818
<td data-order="<%= relative_time(message.created_at, true) %>" title="<%= message.created_at %>"><%= time_ago_in_words message.created_at %> ago</td>
19-
<td><div class="message-payload truncated"><%= truncate message.payload.to_json, :length => 200, :omission => "" %></div></td>
19+
<td>
20+
<div class="message-payload truncated message-show" data-url="<%= agent_message_path(@agent, message) %>">
21+
<%= truncate message.payload.to_json, :length => 200, :omission => "" %>
22+
</div>
23+
</td>
2024
<td>
2125
<div class="btn-group btn-group-sm">
2226
<%= link_to 'Show', '#', class: 'btn btn-primary message-show', data: { url: agent_message_path(@agent, message) }%>

0 commit comments

Comments
 (0)