mission_control-jobs 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +51 -2
  3. data/app/assets/stylesheets/mission_control/jobs/bulma.min.css +3 -0
  4. data/app/controllers/concerns/mission_control/jobs/basic_authentication.rb +33 -0
  5. data/app/controllers/concerns/mission_control/jobs/job_filters.rb +16 -1
  6. data/app/controllers/mission_control/jobs/application_controller.rb +20 -0
  7. data/app/controllers/mission_control/jobs/jobs_controller.rb +0 -1
  8. data/app/controllers/mission_control/jobs/recurring_tasks_controller.rb +8 -1
  9. data/app/helpers/mission_control/jobs/dates_helper.rb +16 -2
  10. data/app/helpers/mission_control/jobs/jobs_helper.rb +10 -5
  11. data/app/models/mission_control/jobs/recurring_task.rb +4 -0
  12. data/app/views/layouts/mission_control/jobs/application.html.erb +2 -1
  13. data/app/views/mission_control/jobs/jobs/_filters.html.erb +11 -1
  14. data/app/views/mission_control/jobs/jobs/_general_information.html.erb +4 -4
  15. data/app/views/mission_control/jobs/jobs/_job.html.erb +1 -1
  16. data/app/views/mission_control/jobs/jobs/blocked/_job.html.erb +1 -1
  17. data/app/views/mission_control/jobs/jobs/failed/_job.html.erb +1 -1
  18. data/app/views/mission_control/jobs/jobs/finished/_job.html.erb +1 -1
  19. data/app/views/mission_control/jobs/jobs/in_progress/_job.html.erb +1 -1
  20. data/app/views/mission_control/jobs/jobs/scheduled/_job.html.erb +1 -1
  21. data/app/views/mission_control/jobs/queues/_job.html.erb +1 -1
  22. data/app/views/mission_control/jobs/recurring_tasks/_actions.html.erb +3 -1
  23. data/app/views/mission_control/jobs/recurring_tasks/_recurring_task.html.erb +2 -2
  24. data/app/views/mission_control/jobs/shared/_job.html.erb +3 -3
  25. data/app/views/mission_control/jobs/workers/_worker.html.erb +1 -1
  26. data/lib/active_job/jobs_relation.rb +7 -5
  27. data/lib/active_job/queue_adapters/solid_queue_ext/recurring_tasks.rb +6 -0
  28. data/lib/active_job/queue_adapters/solid_queue_ext.rb +7 -2
  29. data/lib/mission_control/jobs/authentication.rb +67 -0
  30. data/lib/mission_control/jobs/engine.rb +17 -0
  31. data/lib/mission_control/jobs/i18n_config.rb +5 -0
  32. data/lib/mission_control/jobs/tasks.rb +8 -0
  33. data/lib/mission_control/jobs/version.rb +1 -1
  34. data/lib/mission_control/jobs.rb +13 -3
  35. metadata +13 -5
  36. data/lib/tasks/mission_control/jobs_tasks.rake +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cae6550d727f9f26c6b5c0f1259a03c7a3f802abe8eb025973fab559b8a8f73
4
- data.tar.gz: 98a0bea82a4f3b9c3a3d338719f419508eef9ae05dbfc356314f142d053a4d11
3
+ metadata.gz: 8afd612ead034dc5c0f4b3798f62943bf021a557e4af5d7a5a565e50bfe5d647
4
+ data.tar.gz: 077c09bbff77e7f73de506600c447a05f7cb08b8ee266a1b107395ac393338e9
5
5
  SHA512:
6
- metadata.gz: 223fb6d226ef1511e88cac89f0b1176e5db6bd01899b49279012d1ed94e607c28491f4ec770c96848291d84748e6f2b3956812ee0a4f25a3b7a814557f3de259
7
- data.tar.gz: 52e763ce4e3b3bb7d59881d284f1a136474b46b3cffba722db96f333e63538e7647f638fe5b67c427e5fb6bbdf96452f0dc7b216e04300ffd690d8197302161b
6
+ metadata.gz: 99c16735667988a38b3b9f356406f8aec967044cf17f0f81cc05f8b6bb5fb2a85965ad34c30cf537ad95c43935cd0cc6e5f3ec7185ec661f06ec3579a8e73ab2
7
+ data.tar.gz: af8726be9391650a8f27c0ba855ecd633dd5bb23d9d0be78a8d5d5f4fdb9949d8d65f95ee638aebcede5fa863fa20c76ea054b8e7a3d7021bd0408ec0877c26e
data/README.md CHANGED
@@ -30,10 +30,55 @@ And that's it. With this alone, you should be able to access Mission Control Job
30
30
 
31
31
  ![Failed jobs tab in a simple app](docs/images/failed-jobs-simple.png)
32
32
 
33
+ ### API-only apps or apps using `vite_rails` and other asset pipelines outside Rails
33
34
 
34
- ### Authentication and base controller class
35
+ If you want to use this gem with an [API-only Rails app](https://guides.rubyonrails.org/api_app.html) or an app that's using `vite_ruby`/`vite_rails`, or some other custom asset pipeline different from Sprockets and Propshaft, you need one more thing: configure an asset pipeline so you can serve the JavaScript and CSS included in this gem. We recommend to use [`Propshaft`](https://github.com/rails/propshaft). You simply need to add this line to your application's Gemfile:
35
36
 
36
- By default, Mission Control's controllers will extend the host app's `ApplicationController`. If no authentication is enforced, `/jobs` will be available to everyone. You might want to implement some kind of authentication for this in your app. To make this easier, you can specify a different controller as the base class for Mission Control's controllers:
37
+ ```ruby
38
+ gem "propshaft"
39
+ ```
40
+
41
+ Then execute
42
+ ```bash
43
+ $ bundle install
44
+ ```
45
+
46
+ Then, make sure you add a step to your deployment pipeline to precompile assets:
47
+ ```
48
+ RAILS_ENV=production rails assets:precompile
49
+ ```
50
+
51
+ For example, if you're using the Dockerfile generated by Rails with an API-only app or having skipped the assets pipeline, re-add:
52
+ ```
53
+ # Precompiling assets for production without requiring secret RAILS_MASTER_KEY
54
+ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
55
+ ```
56
+
57
+ *Note: Legacy CSS bundlers `sass-rails` and `sassc-rails` may fail to compile some of the CSS vendored into this library from [Bulma](https://github.com/jgthms/bulma), which was created in [Dart SASS](https://sass-lang.com/dart-sass/). You will therefore need to upgrade to `dartsass-rails` or some library that relies on it, like `cssbundling-rails`.*
58
+
59
+ ### Authentication
60
+
61
+ Mission Control comes with **HTTP basic authentication enabled and closed** by default. Credentials are stored in [Rails's credentials](https://edgeguides.rubyonrails.org/security.html#custom-credentials) like this:
62
+ ```yml
63
+ mission_control:
64
+ http_basic_auth_user: dev
65
+ http_basic_auth_password: secret
66
+ ```
67
+
68
+ If no credentials are configured, Mission Control won't be accessible. To set these up, you can run the generator provided like this:
69
+
70
+ ```
71
+ bin/rails mission_control:jobs:authentication:configure
72
+ ```
73
+
74
+ To set them up for different environments you can use the `RAILS_ENV` environment variable, like this:
75
+ ```
76
+ RAILS_ENV=production bin/rails mission_control:jobs:authentication:configure
77
+ ```
78
+
79
+ #### Custom authentication
80
+
81
+ You can provide your own authentication mechanism, for example, if you have a certain type of admin user in your app that can access Mission Control. To make this easier, you can specify a different controller as the base class for Mission Control's controllers. By default, Mission Control's controllers will extend the host app's `ApplicationController`, but you can change this easily:
37
82
 
38
83
  ```ruby
39
84
  Rails.application.configure do
@@ -44,7 +89,11 @@ end
44
89
  Or, in your environment config or `application.rb`:
45
90
  ```ruby
46
91
  config.mission_control.jobs.base_controller_class = "AdminController"
92
+ ```
47
93
 
94
+ If you do this, you can disable the default HTTP Basic Authentication using the following option:
95
+ ```ruby
96
+ config.mission_control.jobs.http_basic_auth_enabled = false
48
97
  ```
49
98
 
50
99
  ### Other configuration settings