solid_queue_ui 0.0.1

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 (35) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +42 -0
  4. data/Rakefile +3 -0
  5. data/lib/solid_queue_ui/config.rb +26 -0
  6. data/lib/solid_queue_ui/rails.rb +11 -0
  7. data/lib/solid_queue_ui/railtie.rb +4 -0
  8. data/lib/solid_queue_ui/version.rb +3 -0
  9. data/lib/solid_queue_ui/web/action.rb +93 -0
  10. data/lib/solid_queue_ui/web/application.rb +126 -0
  11. data/lib/solid_queue_ui/web/csrf_protection.rb +180 -0
  12. data/lib/solid_queue_ui/web/database.rb +17 -0
  13. data/lib/solid_queue_ui/web/helpers.rb +201 -0
  14. data/lib/solid_queue_ui/web/router.rb +102 -0
  15. data/lib/solid_queue_ui/web.rb +145 -0
  16. data/lib/solid_queue_ui.rb +22 -0
  17. data/lib/tasks/solid_queue_ui_tasks.rake +4 -0
  18. data/solid_queue_ui.gemspec +42 -0
  19. data/web/assets/javascripts/application.js +177 -0
  20. data/web/assets/javascripts/chart.min.js +13 -0
  21. data/web/assets/stylesheets/application.css +37 -0
  22. data/web/assets/stylesheets/application.css.scss +15 -0
  23. data/web/views/_footer.html.erb +1 -0
  24. data/web/views/_nav.html.erb +11 -0
  25. data/web/views/dashboard.html.erb +33 -0
  26. data/web/views/jobs.html.erb +41 -0
  27. data/web/views/layout.html.erb +32 -0
  28. data/web/views/solid_queue_ui/application/_flashes.html.erb +8 -0
  29. data/web/views/solid_queue_ui/application/_index_header.html.erb +28 -0
  30. data/web/views/solid_queue_ui/application/_javascript.html.erb +13 -0
  31. data/web/views/solid_queue_ui/application/_navigation.html.erb +11 -0
  32. data/web/views/solid_queue_ui/application/_stylesheet.html.erb +5 -0
  33. data/web/views/solid_queue_ui/application/index.html.erb +21 -0
  34. data/web/views/solid_queue_ui/application/show.html.erb +57 -0
  35. metadata +127 -0
@@ -0,0 +1,33 @@
1
+ <h1>Jobs</h1>
2
+ <% if @sq_jobs.num_tuples.zero? %>
3
+ <p>No jobs found</p>
4
+ <% else %>
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <td><strong>Job ID</strong></td>
9
+ <td><strong>Queue Name</strong></td>
10
+ <td><strong>Class Name</strong></td>
11
+ <td><strong>Arguments</strong></td>
12
+ <td><strong>Priority</strong></td>
13
+ <td><strong>Active Job ID</strong></td>
14
+ <td><strong>Scheduled At</strong></td>
15
+ <td><strong>Finished At</strong></td>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <% @sq_jobs.each do |page| %>
20
+ <tr>
21
+ <td><p><%= page['id'] %> </p></td>
22
+ <td><p><%= page['queue_name'] %> </p></td>
23
+ <td><p><%= page['class_name'] %> </p></td>
24
+ <td><p><%= page['arguments'] %> </p></td>
25
+ <td><p><%= page['priority'] %> </p></td>
26
+ <td><p><%= page['active_job_id'] %> </p></td>
27
+ <td><p><%= page['scheduled_at'] %> </p></td>
28
+ <td><p><%= page['finished_at'] %> </p></td>
29
+ </tr>
30
+ <% end %>
31
+ </tbody>
32
+ </table>
33
+ <% end %>
@@ -0,0 +1,41 @@
1
+ <h1>Jobs</h1>
2
+ <% if @sq_jobs.num_tuples.zero? %>
3
+ <p>No jobs found</p>
4
+ <% else %>
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <td><p>id</p></td>
9
+ <td><p>site_id</p></td>
10
+ <td><p>local_url</p></td>
11
+ <td><p>external_url</p></td>
12
+ <td><p>created_at</p></td>
13
+ <td><p>updated_at</p></td>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <% @sq_jobs.each do |page| %>
18
+ <!--
19
+ <p>id: <%= page['id'] %> </p>
20
+ <p>queue_name: <%= page['queue_name'] %> </p>
21
+ <p>class_name: <%= page['class_name'] %> </p>
22
+ <p>arguments: <%= page['arguments'] %> </p>
23
+ <p>priority: <%= page['priority'] %> </p>
24
+ <p>active_job_id: <%= page['active_job_id'] %> </p>
25
+ <p>scheduled_at: <%= page['scheduled_at'] %> </p>
26
+ <p>finished_at: <%= page['finished_at'] %> </p>
27
+ -->
28
+ <tr>
29
+ <td><p><%= page['id'] %> </p></td>
30
+ <td><p><%= page['site_id'] %> </p></td>
31
+ <td><p><%= page['local_url'] %> </p></td>
32
+ <td><p><%= page['external_url'] %> </p></td>
33
+ <td><p><%= page['created_at'] %> </p></td>
34
+ <td><p><%= page['updated_at'] %> </p></td>
35
+ </tr>
36
+ <% end %>
37
+ </tbody>
38
+ </table>
39
+ <% end %>
40
+
41
+ <script type="text/javascript" src="<%= root_path %>javascripts/chart.min.js"></script>
@@ -0,0 +1,32 @@
1
+ <!doctype html>
2
+ <html dir="<%= text_direction %>">
3
+ <head>
4
+ <title><%= SolidQueueUi::NAME %></title>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
+
8
+ <link href="<%= root_path %>stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
9
+ <% if rtl? %>
10
+ <link href="<%= root_path %>stylesheets/application-rtl.css" media="screen" rel="stylesheet" type="text/css" />
11
+ <% end %>
12
+
13
+ <link rel="apple-touch-icon" href="<%= root_path %>images/apple-touch-icon.png">
14
+ <link rel="shortcut icon" type="image/ico" href="<%= root_path %>images/favicon.ico" />
15
+ <script type="text/javascript" src="<%= root_path %>javascripts/application.js"></script>
16
+ <meta name="google" content="notranslate" />
17
+ <%= display_custom_head %>
18
+ </head>
19
+ <body class="admin" data-locale="<%= locale %>">
20
+ <%= erb :_nav %>
21
+ <div id="page">
22
+ <div class="container">
23
+ <div class="row">
24
+ <div class="col-sm-12">
25
+ <%= yield %>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ <%= erb :_footer %>
31
+ </body>
32
+ </html>
@@ -0,0 +1,8 @@
1
+ <% if flash.any? %>
2
+ <div class="flashes">
3
+ <% flash.each do |key, value| -%>
4
+ <% next unless value.respond_to?(:html_safe) %>
5
+ <div class="flash flash-<%= key %>"><%= value.html_safe %></div>
6
+ <% end -%>
7
+ </div>
8
+ <% end %>
@@ -0,0 +1,28 @@
1
+ <% content_for(:title) do %>
2
+ <%= display_resource_name(page.resource_name) %>
3
+ <% end %>
4
+
5
+ <header class="main-content__header">
6
+ <h1 class="main-content__page-title" id="page-title">
7
+ <%= content_for(:title) %>
8
+ </h1>
9
+
10
+ <% if show_search_bar %>
11
+ <%= render(
12
+ "search",
13
+ search_term: search_term,
14
+ resource_name: display_resource_name(page.resource_name)
15
+ ) %>
16
+ <% end %>
17
+
18
+ <div>
19
+ <%= link_to(
20
+ t(
21
+ "solid_queue_ui.actions.new_resource",
22
+ name: display_resource_name(page.resource_name, singular: true).downcase
23
+ ),
24
+ [:new, namespace, page.resource_path.to_sym],
25
+ class: "button",
26
+ ) if accessible_action?(new_resource, :new) %>
27
+ </div>
28
+ </header>
@@ -0,0 +1,13 @@
1
+
2
+ <% SolidQueueUi::Engine.javascripts.each do |js_path| %>
3
+ <%= javascript_include_tag js_path %>
4
+ <% end %>
5
+
6
+ <%= yield :javascript %>
7
+
8
+ <% if Rails.env.test? %>
9
+ <%= javascript_tag do %>
10
+ $.fx.off = true;
11
+ $.ajaxSetup({ async: false });
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <nav class="navigation">
2
+ <%= link_to(t("solid_queue_ui.navigation.back_to_app"), root_url, class: "button button--alt button--nav") if defined?(root_url) %>
3
+
4
+ <% SolidQueueUi::Namespace.new(namespace).resources_with_index_route.each do |resource| %>
5
+ <%= link_to(
6
+ display_resource_name(resource),
7
+ resource_index_route(resource),
8
+ class: "navigation__link navigation__link--#{nav_link_state(resource)}"
9
+ ) if accessible_action?(model_from_resource(resource), :index) %>
10
+ <% end %>
11
+ </nav>
@@ -0,0 +1,5 @@
1
+ <% SolidQueueUi::Engine.stylesheets.each do |css_path| %>
2
+ <%= stylesheet_link_tag css_path %>
3
+ <% end %>
4
+
5
+ <%= yield :stylesheet %>
@@ -0,0 +1,21 @@
1
+ <%=
2
+ render("index_header",
3
+ resources: resources,
4
+ search_term: search_term,
5
+ page: page,
6
+ show_search_bar: show_search_bar,
7
+ )
8
+ %>
9
+
10
+ <section class="main-content__body main-content__body--flush">
11
+ <%= render(
12
+ "collection",
13
+ collection_presenter: page,
14
+ collection_field_name: resource_name,
15
+ page: page,
16
+ resources: resources,
17
+ table_title: "page-title"
18
+ ) %>
19
+
20
+ <%= render("pagination", resources: resources) %>
21
+ </section>
@@ -0,0 +1,57 @@
1
+ <%#
2
+ # Show
3
+
4
+ This view is the template for the show page.
5
+ It renders the attributes of a resource,
6
+ as well as a link to its edit page.
7
+
8
+ ## Local variables:
9
+
10
+ - `page`:
11
+ An instance of [SolidQueueUi::Page::Show][1].
12
+ Contains methods for accessing the resource to be displayed on the page,
13
+ as well as helpers for describing how each attribute of the resource
14
+ should be displayed.
15
+
16
+ [1]: http://www.rubydoc.info/gems/solid_queue_ui/solid_queue_ui/Page/Show
17
+ %>
18
+
19
+ <% content_for(:title) { t("solid_queue_ui.actions.show_resource", name: page.page_title) } %>
20
+
21
+ <header class="main-content__header">
22
+ <h1 class="main-content__page-title">
23
+ <%= content_for(:title) %>
24
+ </h1>
25
+
26
+ <div>
27
+ <%= link_to(
28
+ t("solid_queue_ui.actions.edit_resource", name: page.page_title),
29
+ [:edit, namespace, page.resource],
30
+ class: "button",
31
+ ) if accessible_action?(page.resource, :edit) %>
32
+
33
+ <%= link_to(
34
+ t("solid_queue_ui.actions.destroy"),
35
+ [namespace, page.resource],
36
+ class: "button button--danger",
37
+ method: :delete,
38
+ data: { confirm: t("solid_queue_ui.actions.confirm") }
39
+ ) if accessible_action?(page.resource, :destroy) %>
40
+ </div>
41
+ </header>
42
+
43
+ <section class="main-content__body">
44
+ <dl>
45
+ <% page.attributes.each do |attribute| %>
46
+ <dt class="attribute-label" id="<%= attribute.name %>">
47
+ <%= t(
48
+ "helpers.label.#{resource_name}.#{attribute.name}",
49
+ default: page.resource.class.human_attribute_name(attribute.name),
50
+ ) %>
51
+ </dt>
52
+
53
+ <dd class="attribute-data attribute-data--<%=attribute.html_class%>"
54
+ ><%= render_field attribute, page: page %></dd>
55
+ <% end %>
56
+ </dl>
57
+ </section>
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: solid_queue_ui
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Claude Ayitey
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-12-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: solid_queue
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activerecord
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '6.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '8.0'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '6.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '8.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: sassc-rails
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.1'
61
+ description: this plugin provides a user interface to the recently-released solid_queue
62
+ gem which is a backend for handing jobs in Rails apps.
63
+ email:
64
+ - code@ayitey.me
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - MIT-LICENSE
70
+ - README.md
71
+ - Rakefile
72
+ - lib/solid_queue_ui.rb
73
+ - lib/solid_queue_ui/config.rb
74
+ - lib/solid_queue_ui/rails.rb
75
+ - lib/solid_queue_ui/railtie.rb
76
+ - lib/solid_queue_ui/version.rb
77
+ - lib/solid_queue_ui/web.rb
78
+ - lib/solid_queue_ui/web/action.rb
79
+ - lib/solid_queue_ui/web/application.rb
80
+ - lib/solid_queue_ui/web/csrf_protection.rb
81
+ - lib/solid_queue_ui/web/database.rb
82
+ - lib/solid_queue_ui/web/helpers.rb
83
+ - lib/solid_queue_ui/web/router.rb
84
+ - lib/tasks/solid_queue_ui_tasks.rake
85
+ - solid_queue_ui.gemspec
86
+ - web/assets/javascripts/application.js
87
+ - web/assets/javascripts/chart.min.js
88
+ - web/assets/stylesheets/application.css
89
+ - web/assets/stylesheets/application.css.scss
90
+ - web/views/_footer.html.erb
91
+ - web/views/_nav.html.erb
92
+ - web/views/dashboard.html.erb
93
+ - web/views/jobs.html.erb
94
+ - web/views/layout.html.erb
95
+ - web/views/solid_queue_ui/application/_flashes.html.erb
96
+ - web/views/solid_queue_ui/application/_index_header.html.erb
97
+ - web/views/solid_queue_ui/application/_javascript.html.erb
98
+ - web/views/solid_queue_ui/application/_navigation.html.erb
99
+ - web/views/solid_queue_ui/application/_stylesheet.html.erb
100
+ - web/views/solid_queue_ui/application/index.html.erb
101
+ - web/views/solid_queue_ui/application/show.html.erb
102
+ homepage: https://github.com/claudey/solid_queue_ui
103
+ licenses:
104
+ - MIT
105
+ metadata:
106
+ source_code_uri: https://github.com/claudey/solid_queue_ui
107
+ changelog_uri: https://github.com/claudey/solid_queue_ui/changelog.md
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 2.6.0
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubygems_version: 3.4.22
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: A user interface for the solid_queue gem.
127
+ test_files: []