data_pact 0.1.2 → 0.1.21

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70cc442650880adb3b16dfc6850796590544c20c2e6dddddff7fa0ea7904e533
4
- data.tar.gz: 2520a6195b1b9b3ad402a155bc99416ee8fe86693fbc59e870732763c140ac89
3
+ metadata.gz: bd60138d89edaccd6d3af12e2707466f902fa8fd829ac0519ebea8a8d729ea05
4
+ data.tar.gz: a83694196765d57ad7f50e5e14ddd9a07a63117f689ce2ccea1306a473520381
5
5
  SHA512:
6
- metadata.gz: 5dd1e478cf376f3f692b82bd5224b7c3ffb93dda68c9202b480da40ec2de7834a078f0fb9ade965affbc653e5d17bb70d42073ba6ef8c96d80be4370c2258fed
7
- data.tar.gz: 8d83a2a956f296e735fcfedbea5dd8318348724b61daa0a9cb940ca7d406761a16c5948446a3e95943d37aca7a2b8d18987ccd3cb855b4f42b39a5f659e6f97a
6
+ metadata.gz: 5f545d3f23194fcf52f573e70692e97699f53bef28aa40fb004b7048b9fdf13975324eb0f84452ad0c25caf83b2ed1a6512cfd2fa728f82071ebe9d73ce800f9
7
+ data.tar.gz: 3f4159c8d145bce31816ee7cdf3992c007054ea69dab7659d1178c1b25c112f1995797a7835fff5bed7ce4340a970e4a710788a286556a3445373f3db3d0c437
@@ -1,5 +1,10 @@
1
1
  module DataPact
2
2
  class ApplicationController < ActionController::Base
3
+
4
+ def index
5
+ redirect_to routes_path
6
+ end
7
+
3
8
  def routes
4
9
  @routes = Rails.application.routes.routes.map do |route|
5
10
  {
@@ -10,9 +15,19 @@ module DataPact
10
15
  controller_action: [route.defaults[:controller], '#', route.defaults[:action]].join,
11
16
  }
12
17
  end
18
+
19
+ respond_to do |format|
20
+ format.html
21
+ format.json do
22
+ end
23
+ end
13
24
  end
14
25
 
15
26
  def settings
16
27
  end
28
+
29
+ def jobs
30
+ @jobs = Sidekiq::Queue.all.flat_map(&:to_a).sort_by(&:enqueued_at)
31
+ end
17
32
  end
18
33
  end
@@ -0,0 +1,24 @@
1
+ <div class="px-4">
2
+ <div class="overflow-x-auto">
3
+ <table class="table table-sm">
4
+ <thead>
5
+ <tr>
6
+ <th>Enqueued At</th>
7
+ <th>Class</th>
8
+ <th>Queue</th>
9
+ <th>Args</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <% @jobs.each do |job| %>
14
+ <tr>
15
+ <td class="whitespace-nowrap"><%= Time.at(job['enqueued_at']).strftime('%b %d %H:%M') %></td>
16
+ <td><%= job['class'] %></td>
17
+ <td><%= job['queue'] %></td>
18
+ <td><%= job['args'] %></td>
19
+ </tr>
20
+ <% end %>
21
+ </tbody>
22
+ </table>
23
+ </div>
24
+ </div>
@@ -1,7 +1,9 @@
1
- <div class="flex flex-col gap-y-2">
1
+ <div x-data="routes" class="flex flex-col gap-y-2">
2
+ <div class="form-control w-1/2">
3
+ <input x-model="searchTerm" type="text" placeholder="Search" class="input input-bordered w-24 md:w-auto"/>
4
+ </div>
2
5
  <% @routes.each do |route_data| %>
3
- <div class="collapse collapse-arrow bg-base-200">
4
- <input type="radio" name="my-accordion-2" checked="checked"/>
6
+ <div x-show="showRoute($el)" class="collapse collapse-arrow bg-base-200" data-route="<%= route_data.inspect %>">
5
7
  <div class="collapse-title text-xl font-medium flex items-center">
6
8
  <div class="flex items-center gap-6 flex-1">
7
9
  <%= tag.div route_data.fetch(:verb), class: 'badge badge-neutral badge-lg' if route_data[:verb].present? %>
@@ -14,4 +16,33 @@
14
16
  </div>
15
17
  </div>
16
18
  <% end %>
17
- </div>
19
+ </div>
20
+
21
+ <script type="text/javascript" charset="utf-8">
22
+ document.addEventListener('alpine:init', () => {
23
+ Alpine.data('routes', () => ({
24
+ searchTerm: '',
25
+ showRoute(e) {
26
+ if (this.searchTerm === '') return true
27
+
28
+
29
+
30
+ // fetch('/routes', {
31
+ // headers: {
32
+ // 'Content-Type': 'application/json'
33
+ // },
34
+ // body: JSON.stringify({search_term: this.searchTerm})
35
+ // })
36
+ // .then(response => response.json())
37
+ // .then(data => {
38
+ // console/.log(data)
39
+ // })
40
+ // .catch(error => console.error(error)
41
+ // )
42
+ // let string = e.dataset.route
43
+ // let regex = new RegExp(this.searchTerm, 'i')
44
+ // return regex.test(string)
45
+ }
46
+ }))
47
+ })
48
+ </script>
@@ -19,18 +19,19 @@
19
19
  })();
20
20
  </script>
21
21
 
22
- <div class="h-screen w-screen">
22
+ <div class="min-h-screen w-screen">
23
23
  <div class="navbar bg-base-100 border-b border-base-200">
24
24
  <div class="flex-1">
25
25
  <div class="btn btn-ghost normal-case text-xl">DataPact</div>
26
26
  <%= link_to 'Routes', routes_path, class: 'btn btn-ghost normal-case text-lg font-medium' %>
27
27
  <%= link_to 'Session Data', session_data_path, class: 'btn btn-ghost normal-case text-lg font-medium' %>
28
+ <%= link_to 'Jobs', jobs_path, class: 'btn btn-ghost normal-case text-lg font-medium' %>
28
29
  <%= link_to 'Settings', settings_path, class: 'btn btn-ghost normal-case text-lg font-medium' %>
29
30
  </div>
30
31
  <div class="flex-none gap-2">
31
- <div class="form-control">
32
- <input type="text" placeholder="Search" class="input input-bordered w-24 md:w-auto"/>
33
- </div>
32
+ <!-- <div class="form-control">-->
33
+ <!-- <input type="text" placeholder="Search" class="input input-bordered w-24 md:w-auto"/>-->
34
+ <!-- </div>-->
34
35
  </div>
35
36
  </div>
36
37
  <div class="my-3 mx-6">
data/config/routes.rb CHANGED
@@ -5,6 +5,7 @@ DataPact::Engine.routes.draw do
5
5
  end
6
6
  get 'routes', to: 'application#routes'
7
7
  get 'settings', to: 'application#settings'
8
+ get 'jobs', to: 'application#jobs'
8
9
  root to: 'application#index'
9
10
 
10
11
  end
@@ -1,3 +1,3 @@
1
1
  module DataPact
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.21"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_pact
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Shyman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-06 00:00:00.000000000 Z
11
+ date: 2023-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -49,6 +49,7 @@ files:
49
49
  - app/mailers/data_pact/application_mailer.rb
50
50
  - app/models/data_pact/application_record.rb
51
51
  - app/views/application/index.html.erb
52
+ - app/views/data_pact/application/jobs.html.erb
52
53
  - app/views/data_pact/application/routes.html.erb
53
54
  - app/views/data_pact/application/settings.html.erb
54
55
  - app/views/data_pact/session_data/index.html.erb