rails_live_dashboard 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -2
  3. data/app/assets/builds/rails_live_dashboard/application.css +1 -1
  4. data/app/assets/builds/rails_live_dashboard/application.js +1 -1
  5. data/app/assets/builds/rails_live_dashboard/application.js.map +3 -3
  6. data/app/controllers/rails_live_dashboard/clean_controller.rb +1 -1
  7. data/app/models/rails_live_dashboard/query.rb +4 -0
  8. data/app/models/rails_live_dashboard/request.rb +3 -35
  9. data/app/views/layouts/rails_live_dashboard/application.html.erb +3 -0
  10. data/app/views/rails_live_dashboard/exceptions/index.html.erb +1 -1
  11. data/app/views/rails_live_dashboard/queries/_list.html.erb +3 -30
  12. data/app/views/rails_live_dashboard/queries/_query.html.erb +18 -0
  13. data/app/views/rails_live_dashboard/queries/index.html.erb +2 -0
  14. data/app/views/rails_live_dashboard/requests/_contents.html.erb +4 -4
  15. data/app/views/rails_live_dashboard/requests/_exceptions.html.erb +16 -16
  16. data/app/views/rails_live_dashboard/requests/_request.html.erb +17 -0
  17. data/app/views/rails_live_dashboard/requests/index.html.erb +4 -24
  18. data/app/views/rails_live_dashboard/requests/show.html.erb +6 -6
  19. data/app/views/rails_live_dashboard/shared/_header.html.erb +11 -11
  20. data/app/views/rails_live_dashboard/widgets/slowest_queries/_query.html.erb +25 -0
  21. data/app/views/rails_live_dashboard/widgets/slowest_queries/show.html.erb +2 -28
  22. data/app/views/rails_live_dashboard/widgets/slowest_requests/_request.html.erb +25 -0
  23. data/app/views/rails_live_dashboard/widgets/slowest_requests/show.html.erb +3 -29
  24. data/lib/rails_live_dashboard/version.rb +1 -1
  25. metadata +139 -9
@@ -3,7 +3,7 @@ module RailsLiveDashboard
3
3
  def destroy
4
4
  Entry.delete_all
5
5
 
6
- redirect_to dashboard_path, status: :see_other
6
+ redirect_back fallback_location: dashboard_path, status: :see_other
7
7
  end
8
8
  end
9
9
  end
@@ -1,5 +1,9 @@
1
1
  module RailsLiveDashboard
2
2
  class Query < Entry
3
3
  attribute :content, Types::QueryContent.new
4
+
5
+ after_create_commit lambda {
6
+ broadcast_prepend_later_to 'query_list', target: 'queries'
7
+ }
4
8
  end
5
9
  end
@@ -2,41 +2,9 @@ module RailsLiveDashboard
2
2
  class Request < Entry
3
3
  attribute :content, Types::RequestContent.new
4
4
 
5
- def method
6
- content.method
7
- end
8
-
9
- def path
10
- content.path
11
- end
12
-
13
- def status_code
14
- content.status
15
- end
16
-
17
- def controller
18
- content.controller
19
- end
20
-
21
- def controller_action
22
- content.action
23
- end
24
-
25
- def duration
26
- content.duration.round
27
- end
28
-
29
- def payload
30
- content.params
31
- end
32
-
33
- def headers
34
- content.headers
35
- end
36
-
37
- def body
38
- content.body
39
- end
5
+ after_create_commit lambda {
6
+ broadcast_prepend_later_to 'request_list', target: 'requests'
7
+ }
40
8
 
41
9
  def turbo_stream?
42
10
  content.format == 'turbo_stream'
@@ -5,6 +5,9 @@
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
 
8
+ <%= turbo_refresh_method_tag :morph %>
9
+ <%= turbo_refresh_scroll_tag :preserve %>
10
+
8
11
  <%= stylesheet_link_tag "rails_live_dashboard/application", data_turbo_track: 'reload', media: "all" %>
9
12
  <%= javascript_include_tag "rails_live_dashboard/application", data_turbo_track: 'reload', defer: true %>
10
13
  </head>
@@ -42,7 +42,7 @@
42
42
  <%= exception.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
43
43
  </td>
44
44
  <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
45
- <%= link_to 'Show', exception_path(exception), class: 'text-indigo-600 hover:text-indigo-900' %>
45
+ <%= link_to 'Show', rails_live_dashboard.exception_path(exception), class: 'text-indigo-600 hover:text-indigo-900' %>
46
46
  </td>
47
47
  </tr>
48
48
  <% end %>
@@ -10,34 +10,7 @@
10
10
  </th>
11
11
  </tr>
12
12
  </thead>
13
- <tbody class="divide-y divide-gray-200 bg-white">
14
- <% if @queries.empty? %>
15
- <tr>
16
- <td colspan="5">
17
- <p class="p-5 text-center">No queries registered</p>
18
- </td>
19
- </tr>
20
- <% end %>
21
-
22
- <% @queries.each do |query| %>
23
- <tr>
24
- <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-800">
25
- <%= query.content.name %>
26
- </td>
27
- <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
28
- <%= query.content.sql[0..80] %>
29
- <%= "..." if query.content.sql.size > 80 %>
30
- </td>
31
- <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
32
- <%= render RailsLiveDashboard::QueryDurationBadgeComponent.new(query.content.duration) %>
33
- </td>
34
- <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
35
- <%= query.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
36
- </td>
37
- <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
38
- <%= link_to 'Show', query_path(query), class: 'text-indigo-600 hover:text-indigo-900' %>
39
- </td>
40
- </tr>
41
- <% end %>
13
+ <tbody id="queries" class="divide-y divide-gray-200 bg-white">
14
+ <%= render @queries %>
42
15
  </tbody>
43
- </table>
16
+ </table>
@@ -0,0 +1,18 @@
1
+ <tr id="<%= dom_id query %>">
2
+ <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-800">
3
+ <%= query.content.name %>
4
+ </td>
5
+ <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
6
+ <%= query.content.sql[0..80] %>
7
+ <%= "..." if query.content.sql.size > 80 %>
8
+ </td>
9
+ <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
10
+ <%= render RailsLiveDashboard::QueryDurationBadgeComponent.new(query.content.duration) %>
11
+ </td>
12
+ <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
13
+ <%= query.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
14
+ </td>
15
+ <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
16
+ <%= link_to 'Show', rails_live_dashboard.query_path(query), class: 'text-indigo-600 hover:text-indigo-900' %>
17
+ </td>
18
+ </tr>
@@ -1,3 +1,5 @@
1
+ <%= turbo_stream_from "query_list" %>
2
+
1
3
  <div class="mt-10">
2
4
  <div class="mt-8 flow-root">
3
5
  <div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
@@ -12,15 +12,15 @@
12
12
 
13
13
  <div class="p-5 bg-gray-800 text-white">
14
14
  <div data-tabs-target="tab" id="tab_payload">
15
- <pre><%= JSON.pretty_generate(@request.payload || {}) %></pre>
15
+ <pre><%= JSON.pretty_generate(@request.content.params || {}) %></pre>
16
16
  </div>
17
17
 
18
18
  <div data-tabs-target="tab" id="tab_headers">
19
- <pre><%= JSON.pretty_generate(@request.headers || {}) %></pre>
19
+ <pre><%= JSON.pretty_generate(@request.content.headers || {}) %></pre>
20
20
  </div>
21
21
 
22
22
  <div data-tabs-target="tab" id="tab_body">
23
- <pre><%= @request.body || "No body" %></pre>
23
+ <pre><%= @request.content.body || "No body" %></pre>
24
24
  </div>
25
25
  </div>
26
- </div>
26
+ </div>
@@ -17,22 +17,22 @@
17
17
  <tbody class="divide-y divide-gray-200 bg-white">
18
18
  <% @exceptions.each do |exception| %>
19
19
  <tr>
20
- <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
21
- <div class="min-w-0 flex-auto">
22
- <p class="text-sm font-semibold leading-6 text-gray-900">
23
- <%= exception.class_name %>
24
- </p>
25
- <p class="mt-1 truncate text-xs leading-5 text-gray-500">
26
- <%= exception.message %>
27
- </p>
28
- </div>
29
- </td>
30
- <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
31
- <%= exception.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
32
- </td>
33
- <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
34
- <%= link_to 'Show', exception_path(exception), class: 'text-indigo-600 hover:text-indigo-900' %>
20
+ <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
21
+ <div class="min-w-0 flex-auto">
22
+ <p class="text-sm font-semibold leading-6 text-gray-900">
23
+ <%= exception.class_name %>
24
+ </p>
25
+ <p class="mt-1 truncate text-xs leading-5 text-gray-500">
26
+ <%= exception.message %>
27
+ </p>
28
+ </div>
29
+ </td>
30
+ <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
31
+ <%= exception.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
35
32
  </td>
33
+ <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
34
+ <%= link_to 'Show', rails_live_dashboard.exception_path(exception), class: 'text-indigo-600 hover:text-indigo-900' %>
35
+ </td>
36
36
  </tr>
37
37
  <% end %>
38
38
  </tbody>
@@ -40,4 +40,4 @@
40
40
  </div>
41
41
  </div>
42
42
  </div>
43
- <% end %>
43
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <tr id="<%= dom_id request %>">
2
+ <td class="whitespace-nowrap py-4 pl-4 pr-3 sm:pl-6">
3
+ <%= render RailsLiveDashboard::RequestMethodBadgeComponent.new(request.content.method) %>
4
+ </td>
5
+ <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
6
+ <%= request.content.path %>
7
+ </td>
8
+ <td class="whitespace-nowrap px-3 py-4">
9
+ <%= render RailsLiveDashboard::RequestStatusBadgeComponent.new(request.content.status) %>
10
+ </td>
11
+ <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
12
+ <%= request.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
13
+ </td>
14
+ <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
15
+ <%= link_to 'Show', rails_live_dashboard.request_path(request), class: 'text-indigo-600 hover:text-indigo-900' %>
16
+ </td>
17
+ </tr>
@@ -1,3 +1,5 @@
1
+ <%= turbo_stream_from "request_list" %>
2
+
1
3
  <div class="mt-10">
2
4
  <div class="mt-8 flow-root">
3
5
  <div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
@@ -15,30 +17,8 @@
15
17
  </th>
16
18
  </tr>
17
19
  </thead>
18
- <tbody class="divide-y divide-gray-200 bg-white">
19
- <% if @requests.empty? %>
20
- <tr>
21
- <td colspan="5">
22
- <p class="p-5 text-center">No request registered</p>
23
- </td>
24
- </tr>
25
- <% end %>
26
-
27
- <% @requests.each do |req| %>
28
- <tr>
29
- <td class="whitespace-nowrap py-4 pl-4 pr-3 sm:pl-6">
30
- <%= render RailsLiveDashboard::RequestMethodBadgeComponent.new(req.method) %>
31
- </td>
32
- <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"><%= req.path %></td>
33
- <td class="whitespace-nowrap px-3 py-4">
34
- <%= render RailsLiveDashboard::RequestStatusBadgeComponent.new(req.status_code) %>
35
- </td>
36
- <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"><%= req.created_at.strftime("%Y-%m-%d %H:%M:%S") %></td>
37
- <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
38
- <%= link_to 'Show', request_path(req), class: 'text-indigo-600 hover:text-indigo-900' %>
39
- </td>
40
- </tr>
41
- <% end %>
20
+ <tbody id="requests" class="divide-y divide-gray-200 bg-white">
21
+ <%= render @requests %>
42
22
  </tbody>
43
23
  </table>
44
24
  </div>
@@ -12,30 +12,30 @@
12
12
  <div class="p-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
13
13
  <dt class="text-sm font-medium text-gray-900">Method</dt>
14
14
  <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0">
15
- <%= render RailsLiveDashboard::RequestMethodBadgeComponent.new(@request.method, turbo_stream: @request.turbo_stream?) %>
15
+ <%= render RailsLiveDashboard::RequestMethodBadgeComponent.new(@request.content.method, turbo_stream: @request.turbo_stream?) %>
16
16
  </dd>
17
17
  </div>
18
18
  <div class="p-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
19
19
  <dt class="text-sm font-medium text-gray-900">Controller</dt>
20
- <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"><%= @request.controller %></dd>
20
+ <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"><%= @request.content.controller %></dd>
21
21
  </div>
22
22
  <div class="p-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
23
23
  <dt class="text-sm font-medium text-gray-900">Action</dt>
24
- <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"><%= @request.controller_action %></dd>
24
+ <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"><%= @request.content.action %></dd>
25
25
  </div>
26
26
  <div class="p-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
27
27
  <dt class="text-sm font-medium text-gray-900">Path</dt>
28
- <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"><%= @request.path %></dd>
28
+ <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"><%= @request.content.path %></dd>
29
29
  </div>
30
30
  <div class="p-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
31
31
  <dt class="text-sm font-medium text-gray-900">Status</dt>
32
32
  <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0">
33
- <%= render RailsLiveDashboard::RequestStatusBadgeComponent.new(@request.status_code) %>
33
+ <%= render RailsLiveDashboard::RequestStatusBadgeComponent.new(@request.content.status) %>
34
34
  </dd>
35
35
  </div>
36
36
  <div class="p-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
37
37
  <dt class="text-sm font-medium text-gray-900">Duration</dt>
38
- <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"><%= @request.duration %> ms</dd>
38
+ <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"><%= @request.content.duration %> ms</dd>
39
39
  </div>
40
40
  </dl>
41
41
  </div>
@@ -13,7 +13,7 @@
13
13
  </button>
14
14
  </div>
15
15
  <div class="hidden lg:relative lg:z-10 lg:ml-4 lg:flex lg:items-center">
16
- <%= link_to clean_path, title: 'Clear all data', data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' }, class: 'relative inline-flex items-center justify-center rounded-md p-2 text-gray-400 hover:bg-gray-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white' do %>
16
+ <%= link_to rails_live_dashboard.clean_path, title: 'Clear all data', data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' }, class: 'relative inline-flex items-center justify-center rounded-md p-2 text-gray-400 hover:bg-gray-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white' do %>
17
17
  <span class="sr-only">Clear records</span>
18
18
  <%= lucide_icon('trash', class: 'h-6 w-6') %>
19
19
  <% end %>
@@ -21,23 +21,23 @@
21
21
  </div>
22
22
 
23
23
  <nav class="hidden lg:flex lg:space-x-8 lg:py-2" aria-label="Global">
24
- <%= link_to 'Dashboard', dashboard_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white inline-flex items-center rounded-md py-2 px-3 text-sm font-medium', 'bg-gray-900 text-white': current_page?(dashboard_path)) %>
25
- <%= link_to 'Requests', requests_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white inline-flex items-center rounded-md py-2 px-3 text-sm font-medium', 'bg-gray-900 text-white': current_page?(requests_path)) %>
26
- <%= link_to 'Exceptions', exceptions_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white inline-flex items-center rounded-md py-2 px-3 text-sm font-medium', 'bg-gray-900 text-white': current_page?(exceptions_path)) %>
27
- <%= link_to 'Queries', queries_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white inline-flex items-center rounded-md py-2 px-3 text-sm font-medium', 'bg-gray-900 text-white': current_page?(queries_path)) %>
24
+ <%= link_to 'Dashboard', rails_live_dashboard.dashboard_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white inline-flex items-center rounded-md py-2 px-3 text-sm font-medium', 'bg-gray-900 text-white': current_page?(dashboard_path)) %>
25
+ <%= link_to 'Requests', rails_live_dashboard.requests_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white inline-flex items-center rounded-md py-2 px-3 text-sm font-medium', 'bg-gray-900 text-white': current_page?(requests_path)) %>
26
+ <%= link_to 'Exceptions', rails_live_dashboard.exceptions_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white inline-flex items-center rounded-md py-2 px-3 text-sm font-medium', 'bg-gray-900 text-white': current_page?(exceptions_path)) %>
27
+ <%= link_to 'Queries', rails_live_dashboard.queries_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white inline-flex items-center rounded-md py-2 px-3 text-sm font-medium', 'bg-gray-900 text-white': current_page?(queries_path)) %>
28
28
  </nav>
29
29
  </div>
30
30
 
31
31
  <nav class="hidden" aria-label="Global" id="mobile-menu" data-reveal-target="item">
32
32
  <div class="space-y-1 px-2 pb-3 pt-2">
33
- <%= link_to 'Clear all data', clean_path, title: 'Clear all data', data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' }, class: 'text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium' %>
33
+ <%= link_to 'Clear all data', rails_live_dashboard.clean_path, title: 'Clear all data', data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' }, class: 'text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium' %>
34
34
  </div>
35
35
  <hr class='my-2 border-gray-500' />
36
- <div class="space-y-1 px-2 pb-3 pt-2">
37
- <%= link_to 'Dashboard', dashboard_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium', 'bg-gray-900 text-white': current_page?(dashboard_path)) %>
38
- <%= link_to 'Requests', requests_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium', 'bg-gray-900 text-white': current_page?(requests_path)) %>
39
- <%= link_to 'Exceptions', exceptions_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium', 'bg-gray-900 text-white': current_page?(exceptions_path)) %>
40
- <%= link_to 'Queries', queries_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium', 'bg-gray-900 text-white': current_page?(queries_path)) %>
36
+ <div class="space-y-1 px-2 pb-3 pt-2">
37
+ <%= link_to 'Dashboard', rails_live_dashboard.dashboard_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium', 'bg-gray-900 text-white': current_page?(dashboard_path)) %>
38
+ <%= link_to 'Requests', rails_live_dashboard.requests_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium', 'bg-gray-900 text-white': current_page?(requests_path)) %>
39
+ <%= link_to 'Exceptions', rails_live_dashboard.exceptions_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium', 'bg-gray-900 text-white': current_page?(exceptions_path)) %>
40
+ <%= link_to 'Queries', rails_live_dashboard.queries_path, class: class_names('text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md py-2 px-3 text-base font-medium', 'bg-gray-900 text-white': current_page?(queries_path)) %>
41
41
  </div>
42
42
  </nav>
43
43
  </header>
@@ -0,0 +1,25 @@
1
+ <li>
2
+ <%= link_to rails_live_dashboard.query_path(query), 'data-turbo-frame': :_top, class: 'relative flex justify-between gap-x-6 px-4 py-5 hover:bg-gray-50 sm:px-6' do %>
3
+ <div class="flex min-w-0 gap-x-4">
4
+ <div class="min-w-0 flex-auto">
5
+ <p class="text-sm leading-6 font-semibold text-gray-900">
6
+ <%= query.content.name %>
7
+ </p>
8
+ <p class="mt-2 flex text-sm leading-6 text-gray-900">
9
+ <%= query.content.sql[0..40] %>...
10
+ </p>
11
+ </div>
12
+ </div>
13
+ <div class="flex shrink-0 items-center gap-x-4">
14
+ <div class="hidden sm:flex sm:flex-col sm:items-end">
15
+ <p class="text-sm leading-6 text-gray-900">
16
+ <%= render RailsLiveDashboard::QueryDurationBadgeComponent.new(query.content.duration) %>
17
+ </p>
18
+ <p class="mt-1 text-xs leading-5 text-gray-500">
19
+ <%= query.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
20
+ </p>
21
+ </div>
22
+ <%= lucide_icon('chevron-right', class: 'h-5 w-5 flex-none text-gray-400') %>
23
+ </div>
24
+ <% end %>
25
+ </li>
@@ -9,34 +9,8 @@
9
9
  <% end %>
10
10
 
11
11
  <% @queries.each do |query| %>
12
- <li>
13
- <a href="<%= query_path(query) %>" target="_top" class="relative flex justify-between gap-x-6 px-4 py-5 hover:bg-gray-50 sm:px-6">
14
- <div class="flex min-w-0 gap-x-4">
15
- <div class="min-w-0 flex-auto">
16
- <p class="text-sm leading-6 font-semibold text-gray-900">
17
- <%= query.content.name %>
18
- </p>
19
- <p class="mt-2 flex text-sm leading-6 text-gray-900">
20
- <%= query.content.sql[0..40] %>...
21
- </p>
22
- </div>
23
- </div>
24
- <div class="flex shrink-0 items-center gap-x-4">
25
- <div class="hidden sm:flex sm:flex-col sm:items-end">
26
- <p class="text-sm leading-6 text-gray-900">
27
- <%= render RailsLiveDashboard::QueryDurationBadgeComponent.new(query.content.duration) %>
28
- </p>
29
- <p class="mt-1 text-xs leading-5 text-gray-500">
30
- <%= query.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
31
- </p>
32
- </div>
33
- <svg class="h-5 w-5 flex-none text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
34
- <path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
35
- </svg>
36
- </div>
37
- </a>
38
- </li>
12
+ <%= render partial: 'query', locals: { query: query } %>
39
13
  <%end %>
40
14
  </ul>
41
15
  </dl>
42
- </turbo-frame>
16
+ </turbo-frame>
@@ -0,0 +1,25 @@
1
+ <li>
2
+ <%= link_to rails_live_dashboard.request_path(request), 'data-turbo-frame': :_top, class: 'relative flex justify-between gap-x-6 px-4 py-5 hover:bg-gray-50 sm:px-6' do %>
3
+ <div class="flex min-w-0 gap-x-4">
4
+ <div class="min-w-0 flex-auto">
5
+ <p class="text-sm leading-6 text-gray-900">
6
+ <%= render RailsLiveDashboard::RequestMethodBadgeComponent.new(request.content.method) %>
7
+ </p>
8
+ <p class="mt-2 flex text-sm leading-6 text-gray-900">
9
+ <%= request.content.path %>
10
+ </p>
11
+ </div>
12
+ </div>
13
+ <div class="flex shrink-0 items-center gap-x-4">
14
+ <div class="hidden sm:flex sm:flex-col sm:items-end">
15
+ <p class="text-sm leading-6 text-gray-900">
16
+ <%= render RailsLiveDashboard::RequestDurationBadgeComponent.new(request.content.duration) %>
17
+ </p>
18
+ <p class="mt-1 text-xs leading-5 text-gray-500">
19
+ <%= request.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
20
+ </p>
21
+ </div>
22
+ <%= lucide_icon('chevron-right', class: 'h-5 w-5 flex-none text-gray-400') %>
23
+ </div>
24
+ <% end %>
25
+ </li>
@@ -8,35 +8,9 @@
8
8
  </li>
9
9
  <% end %>
10
10
 
11
- <% @requests.each do |req| %>
12
- <li>
13
- <a href="<%= request_path(req) %>" target="_top" class="relative flex justify-between gap-x-6 px-4 py-5 hover:bg-gray-50 sm:px-6">
14
- <div class="flex min-w-0 gap-x-4">
15
- <div class="min-w-0 flex-auto">
16
- <p class="text-sm leading-6 text-gray-900">
17
- <%= render RailsLiveDashboard::RequestMethodBadgeComponent.new(req.method) %>
18
- </p>
19
- <p class="mt-2 flex text-sm leading-6 text-gray-900">
20
- <%= req.content.path %>
21
- </p>
22
- </div>
23
- </div>
24
- <div class="flex shrink-0 items-center gap-x-4">
25
- <div class="hidden sm:flex sm:flex-col sm:items-end">
26
- <p class="text-sm leading-6 text-gray-900">
27
- <%= render RailsLiveDashboard::RequestDurationBadgeComponent.new(req.content.duration) %>
28
- </p>
29
- <p class="mt-1 text-xs leading-5 text-gray-500">
30
- <%= req.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
31
- </p>
32
- </div>
33
- <svg class="h-5 w-5 flex-none text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
34
- <path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
35
- </svg>
36
- </div>
37
- </a>
38
- </li>
11
+ <% @requests.each do |request| %>
12
+ <%= render partial: 'request', locals: { request: request } %>
39
13
  <%end %>
40
14
  </ul>
41
15
  </dl>
42
- </turbo-frame>
16
+ </turbo-frame>
@@ -1,3 +1,3 @@
1
1
  module RailsLiveDashboard
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.2'
3
3
  end