web47core 0.1.11 → 0.3.0
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 +4 -4
- data/README.md +29 -27
- data/{lib/app → app}/helpers/core_helper.rb +25 -9
- data/{lib/app → app}/helpers/core_link_helper.rb +3 -1
- data/app/views/admin/cron/edit.html.haml +1 -0
- data/app/views/admin/cron/index.html.haml +1 -0
- data/app/views/admin/delayed_jobs/index.html.haml +1 -0
- data/app/views/admin/delayed_jobs/show.html.haml +1 -0
- data/app/views/admin/system_configurations/edit.html.haml +1 -0
- data/app/views/admin/system_configurations/show.html.haml +1 -0
- data/app/views/common/_form_actions.html.haml +11 -0
- data/app/views/cron/_edit.html.haml +21 -0
- data/app/views/cron/_index.html.haml +70 -0
- data/app/views/cron/edit.html.haml +1 -0
- data/app/views/cron/index.html.haml +1 -0
- data/app/views/delayed_jobs/_index.html.haml +54 -0
- data/app/views/delayed_jobs/_show.html.haml +58 -0
- data/app/views/delayed_jobs/index.html.haml +1 -0
- data/app/views/delayed_jobs/show.html.haml +1 -0
- data/app/views/stack/cron/edit.html.haml +1 -0
- data/app/views/stack/cron/index.html.haml +1 -0
- data/app/views/stack/system_configurations/edit.html.haml +5 -0
- data/app/views/stack/system_configurations/show.html.haml +3 -0
- data/{lib/app/views/system_configurations/edit.html.haml → app/views/system_configurations/_edit.html.haml} +2 -10
- data/{lib/app/views/system_configurations/show.html.haml → app/views/system_configurations/_show.html.haml} +3 -3
- data/app/views/system_configurations/edit.html.haml +1 -0
- data/app/views/system_configurations/show.html.haml +1 -0
- data/config/locales/en.yml +75 -2
- data/config/routes.rb +1 -1
- data/lib/app/controllers/concerns/core_controller.rb +22 -0
- data/lib/app/controllers/concerns/core_cron_controller.rb +79 -0
- data/lib/app/controllers/concerns/core_delayed_jobs_controller.rb +87 -0
- data/lib/app/controllers/concerns/core_system_configuration_controller.rb +3 -3
- data/lib/app/jobs/cron/command.rb +5 -2
- data/lib/app/jobs/cron/job_tab.rb +4 -6
- data/lib/app/jobs/cron/server.rb +6 -3
- data/lib/app/jobs/cron/switchboard_sync_models.rb +1 -1
- data/lib/app/jobs/cron/tab.rb +3 -3
- data/lib/app/models/concerns/core_account.rb +1 -10
- data/lib/app/models/concerns/core_system_configuration.rb +13 -13
- data/lib/app/models/delayed_job.rb +1 -1
- data/lib/app/models/email_notification.rb +6 -6
- data/lib/app/models/email_template.rb +4 -1
- data/lib/app/models/notification.rb +12 -11
- data/lib/app/models/redis_configuration.rb +1 -1
- data/lib/app/models/template.rb +1 -1
- data/lib/templates/slack/error_message.liquid +3 -1
- data/lib/web47core/config.rb +4 -6
- data/lib/web47core/engine.rb +1 -1
- data/lib/web47core/version.rb +1 -1
- data/lib/web47core.rb +4 -5
- metadata +50 -12
- /data/{lib/app → app}/helpers/core_form_helper.rb +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9277a478e22eb055bc53439108edc99fd0f22aeed984da1932b335886543ea1f
         | 
| 4 | 
            +
              data.tar.gz: 69fc02cbf9cd65be915a4d54dfc00b6d29b60418e96a542071277cd217874656
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 430e5440a9e0555d49f9cb6dd24c130d0a082570a06d427fb2303e90a2d2c8047f357f338d34f69c77a3f5f0c67c12b69dbf8d097bf96ede43f30d2cbe1d6c35
         | 
| 7 | 
            +
              data.tar.gz: f6b56d7b989c4e6b858040575fab9b312d11ce0c0bf613edc53040bc5d7064cb75697593b8b5d0b9e3137e5983188263ba3876e2aa7bdaad84379218869f80e0
         | 
    
        data/README.md
    CHANGED
    
    | @@ -3,8 +3,10 @@ Core components used commonly among all web apps for both App47 and RedMonocle | |
| 3 3 |  | 
| 4 4 | 
             
            ## We don't need no sticking badges
         | 
| 5 5 |  | 
| 6 | 
            -
            * | 
| 7 | 
            -
            * | 
| 6 | 
            +
            * [](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=App47/web47core&utm_campaign=Badge_Grade)
         | 
| 7 | 
            +
            * [](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=App47/web47core&utm_campaign=Badge_Coverage)
         | 
| 8 | 
            +
            * Develop - [](https://circleci.com/gh/App47/web47core/tree/develop)
         | 
| 9 | 
            +
            * Master - [](https://circleci.com/gh/App47/web47core/tree/master)
         | 
| 8 10 |  | 
| 9 11 | 
             
            ## Requirements
         | 
| 10 12 |  | 
| @@ -16,18 +18,18 @@ This project manages Ruby versions via [RVM](http://rvm.beginrescueend.com/) and | |
| 16 18 |  | 
| 17 19 | 
             
            You must first [install RVM](http://rvm.beginrescueend.com/rvm/install/).
         | 
| 18 20 | 
             
            Then install Ruby 2.4.1 ([version 2.4.1-p111](http://rvm.beginrescueend.com/interpreters/ruby/)) via RVM. 
         | 
| 19 | 
            -
            ``` 
         | 
| 21 | 
            +
            ``` shell script
         | 
| 20 22 | 
             
            rvm install 2.4.1
         | 
| 21 23 | 
             
            ```
         | 
| 22 24 | 
             
            You'll now notice that this project (as well as other App47 ones) contains a .rvmc file, which is executed upon opening the project's root directory in a terminal (and IDE's like RubyMine). The .rvmc file simply states `rvm ruby-2.4.1` which tells RVM to ensure the Ruby version to use for this project is 2.4.1. 
         | 
| 23 25 |  | 
| 24 26 | 
             
            Please note, your Ruby `2.4.1` version might need bundler installed:
         | 
| 25 | 
            -
            ``` 
         | 
| 27 | 
            +
            ``` shell script
         | 
| 26 28 | 
             
            gem install bundler -v 1.17.3
         | 
| 27 29 | 
             
            ``` 
         | 
| 28 30 |  | 
| 29 31 | 
             
            To set up this project's dependencies, which are defined in the file, `Gemfile`, you should first run
         | 
| 30 | 
            -
            ``` 
         | 
| 32 | 
            +
            ``` shell script
         | 
| 31 33 | 
             
            bundle install --path vendor
         | 
| 32 34 | 
             
            ```
         | 
| 33 35 | 
             
            The `--path vendor` simply puts all gem files in a `vendor` directory. 
         | 
| @@ -35,7 +37,7 @@ The `--path vendor` simply puts all gem files in a `vendor` directory. | |
| 35 37 | 
             
            ## Development
         | 
| 36 38 |  | 
| 37 39 | 
             
            Your `RubyMine` environment should be setup now, however to verify all is well, please run the test suite
         | 
| 38 | 
            -
            ``` 
         | 
| 40 | 
            +
            ``` shell script
         | 
| 39 41 | 
             
            bundle exec rake test
         | 
| 40 42 | 
             
            ```
         | 
| 41 43 |  | 
| @@ -67,25 +69,25 @@ gem 'web47core', git: 'git@github.com:App47/web47core.git', branch: :develop | |
| 67 69 | 
             
            _Please do not ship to production code using the git repo, as the production servers will not have keys to pull from the web47core repo_
         | 
| 68 70 |  | 
| 69 71 | 
             
            ### Remove the following files
         | 
| 70 | 
            -
            1. | 
| 71 | 
            -
            2. | 
| 72 | 
            -
            3. | 
| 73 | 
            -
            4. | 
| 74 | 
            -
            5. | 
| 75 | 
            -
            6. | 
| 76 | 
            -
            7. | 
| 77 | 
            -
            8. | 
| 78 | 
            -
            9. | 
| 79 | 
            -
            10. | 
| 80 | 
            -
            11. | 
| 81 | 
            -
            12. | 
| 82 | 
            -
            13. | 
| 83 | 
            -
            14. | 
| 84 | 
            -
            15. | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 72 | 
            +
            1. `StandardModel` - Includes the common set of includes, Mongoid, Auditable, AutoClearCache, etc.
         | 
| 73 | 
            +
            2. `CdnUrl` - Provide CDN URLs of your classes URLs when cdn_url is configured in system configuration
         | 
| 74 | 
            +
            3. `AutoClearCache` - Clears your objects cache out of Rails.cache using the object's id
         | 
| 75 | 
            +
            4. `Formable` - Consolidated into StandardModel, was used to provide common form operations for mongoid documents
         | 
| 76 | 
            +
            5. `EmailNotification` 
         | 
| 77 | 
            +
            6. `EmailTemplate` 
         | 
| 78 | 
            +
            7. `Notification` 
         | 
| 79 | 
            +
            8. `NotificationTemplate` 
         | 
| 80 | 
            +
            9. `SlackNotification` 
         | 
| 81 | 
            +
            10. `SmsNotification`
         | 
| 82 | 
            +
            11. `Template` 
         | 
| 83 | 
            +
            12. `App47Logger` and `App47LoggerTest`
         | 
| 84 | 
            +
            13. `Emailable` or `EmailAble` and `EamailbleTest`, be sure to change `Emailable` to `EmailAble`
         | 
| 85 | 
            +
            14. `RedisConfiguration` and `RedisConfgurationTest`
         | 
| 86 | 
            +
            15. `Searchable` and `SearchableTest`, be sure to change `Searchable` to `SearchAble`
         | 
| 87 | 
            +
            16. `TimezoneAble` and `TimezoneAbleTest`
         | 
| 88 | 
            +
            17. `CronJobServer` and `CronJobServerTest`
         | 
| 89 | 
            +
            18. `JobCronTab` and `JobCronTabTest`
         | 
| 90 | 
            +
            19. `CronTab` 
         | 
| 89 91 |  | 
| 90 92 | 
             
            #### Models
         | 
| 91 93 | 
             
            ##### Concerns 
         | 
| @@ -137,9 +139,9 @@ Allowed values of cron_tab_entry are | |
| 137 139 | 
             
            * :daily - run every day
         | 
| 138 140 | 
             
            * :weekly - run every week on Sunday
         | 
| 139 141 | 
             
            * :monthly - run every month on the first day of the month
         | 
| 140 | 
            -
            * '*/5 1,3 * 2 *' - Run according to unix crontab entry format. This would run every tuesday on the 1st and 3rd hour, for any minute  | 
| 142 | 
            +
            * '*/5 1,3 * 2 *' - Run according to unix crontab entry format. This would run every tuesday on the 1st and 3rd hour, for any minute divisible by 5, so 0, 5, 10, 15, etc..
         | 
| 141 143 |  | 
| 142 | 
            -
             | 
| 144 | 
            +
            1. Before starting the server, you need to run the database command 
         | 
| 143 145 | 
             
            ```mongo
         | 
| 144 146 | 
             
            db.cron_tabs.updateMany({_type: 'JobCronTab'}, {$set: {_type: 'Cron::JobTab'}});
         | 
| 145 147 | 
             
            ``` 
         | 
| @@ -11,14 +11,6 @@ module CoreHelper | |
| 11 11 | 
             
                content_for(:title) { page_title }
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 | 
            -
              def system_configuration_path
         | 
| 15 | 
            -
                '/' + [Web47core.config.system_configuration_namespace, 'system_configuration'].join('/')
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
              def edit_system_configuration_path
         | 
| 19 | 
            -
                [system_configuration_path, 'edit'].join('/')
         | 
| 20 | 
            -
              end
         | 
| 21 | 
            -
             | 
| 22 14 | 
             
              #
         | 
| 23 15 | 
             
              # Pull the value from system configuration and mask the ones that match the given strings
         | 
| 24 16 | 
             
              #
         | 
| @@ -28,7 +20,7 @@ module CoreHelper | |
| 28 20 | 
             
                  should_mask |= field.include?(mask)
         | 
| 29 21 | 
             
                end
         | 
| 30 22 | 
             
                value = SystemConfiguration.send(field)
         | 
| 31 | 
            -
                should_mask ? mask_value(value, default: ' | 
| 23 | 
            +
                should_mask ? mask_value(value, default: 'Not Set') : value
         | 
| 32 24 | 
             
              end
         | 
| 33 25 |  | 
| 34 26 | 
             
              #
         | 
| @@ -49,4 +41,28 @@ module CoreHelper | |
| 49 41 | 
             
                  "#{value[0..2]}**********#{value[-3..-1]}"
         | 
| 50 42 | 
             
                end
         | 
| 51 43 | 
             
              end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
              def index_path
         | 
| 46 | 
            +
                "/#{controller_path}"
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
              def model_path(model)
         | 
| 50 | 
            +
                [index_path, model.id.to_s].join('/')
         | 
| 51 | 
            +
              end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
              def model_action_path(model, action, query = nil)
         | 
| 54 | 
            +
                [[model_path(model), action].join('/'), query&.to_query].compact.join('?')
         | 
| 55 | 
            +
              end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
              def class_action_path(action, query = nil)
         | 
| 58 | 
            +
                [[index_path, action].join('/'), query&.to_query].compact.join('?')
         | 
| 59 | 
            +
              end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
              def edit_model_path(model)
         | 
| 62 | 
            +
                model_action_path(model, :edit)
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
              def current_user
         | 
| 66 | 
            +
                User.new
         | 
| 67 | 
            +
              end
         | 
| 52 68 | 
             
            end
         | 
| @@ -99,7 +99,9 @@ module CoreLinkHelper | |
| 99 99 | 
             
                return unless can? :edit, obj
         | 
| 100 100 |  | 
| 101 101 | 
             
                icon_name = options[:icon_name] || 'replay'
         | 
| 102 | 
            -
                 | 
| 102 | 
            +
                data = {}
         | 
| 103 | 
            +
                data[:confirm] = options[:confirm] if options[:confirm].present?
         | 
| 104 | 
            +
                content_tag(:a, href: path, data: data) do
         | 
| 103 105 | 
             
                  concat(content_tag(:i, class: 'material-icons') do
         | 
| 104 106 | 
             
                    icon_name
         | 
| 105 107 | 
             
                  end)
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            =render '/cron/edit'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            =render '/cron/index'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            =render '/delayed_jobs/index'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            =render '/delayed_jobs/show'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            = render '/system_configurations/edit'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            = render '/system_configurations/show'
         | 
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            .row
         | 
| 2 | 
            +
              .col.s6.center-align
         | 
| 3 | 
            +
                %a.btn-large.waves-effect.waves-light.grey{href: form_cancel_path}
         | 
| 4 | 
            +
                  = t('forms.actions.cancel')
         | 
| 5 | 
            +
                  %i.material-icons.right
         | 
| 6 | 
            +
                    cancel
         | 
| 7 | 
            +
              .col.s6.center-align
         | 
| 8 | 
            +
                %button.btn-large.waves-effect.waves-light{type: :submit}
         | 
| 9 | 
            +
                  = t('forms.actions.update')
         | 
| 10 | 
            +
                  %i.material-icons.right
         | 
| 11 | 
            +
                    save
         | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            - title t('.title', name: @cron_tab.name)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            - content_for :breadcrumbs do
         | 
| 4 | 
            +
              %a.breadcrumb{href: index_path}= t('cron.index.title')
         | 
| 5 | 
            +
              %a.breadcrumb{href: '#'}= t('.title', name: @cron_tab.name)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            .container
         | 
| 8 | 
            +
              %form{action: model_path(@cron_tab), method: :post}
         | 
| 9 | 
            +
                %input{type: :hidden, value: form_authenticity_token, name: 'authenticity_token'}
         | 
| 10 | 
            +
                %input{type: :hidden, name: '_method', value: 'put'}
         | 
| 11 | 
            +
                .row
         | 
| 12 | 
            +
                  .col.s12
         | 
| 13 | 
            +
                    %h1=@cron_tab.name.titleize
         | 
| 14 | 
            +
                .row
         | 
| 15 | 
            +
                  = form_text_field(@cron_tab, :min)
         | 
| 16 | 
            +
                  = form_text_field(@cron_tab, :hour)
         | 
| 17 | 
            +
                  = form_text_field(@cron_tab, :mday)
         | 
| 18 | 
            +
                  = form_text_field(@cron_tab, :month)
         | 
| 19 | 
            +
                  = form_text_field(@cron_tab, :wday)
         | 
| 20 | 
            +
                  = form_checkbox(@cron_tab, :enabled)
         | 
| 21 | 
            +
                = render 'common/form_actions', form_cancel_path: index_path
         | 
| @@ -0,0 +1,70 @@ | |
| 1 | 
            +
            - title t('.title')
         | 
| 2 | 
            +
            .container
         | 
| 3 | 
            +
              .row
         | 
| 4 | 
            +
                .col.s12
         | 
| 5 | 
            +
                  %ul.tabs#stack_cron
         | 
| 6 | 
            +
                    %li.tab.col.s6
         | 
| 7 | 
            +
                      %a{href: '#cron_job_servers'}='Cron Servers'
         | 
| 8 | 
            +
                    %li.tab.col.s6
         | 
| 9 | 
            +
                      %a{href: '#job_cron_tabs'}='Cron Jobs'
         | 
| 10 | 
            +
              .row
         | 
| 11 | 
            +
                .col.s12
         | 
| 12 | 
            +
                  #cron_job_servers.col.s12{data: {cache: 'stack_cron'}}
         | 
| 13 | 
            +
                    %table.highlight.bordered.extended
         | 
| 14 | 
            +
                      %thead
         | 
| 15 | 
            +
                        %tr
         | 
| 16 | 
            +
                          %th.center-align= t('.host')
         | 
| 17 | 
            +
                          %th.center-align= t('.state')
         | 
| 18 | 
            +
                          %th.center-align= t('.last_check_in_at')
         | 
| 19 | 
            +
                          %th.center-align= t('.actions')
         | 
| 20 | 
            +
                      %tbody.white-text
         | 
| 21 | 
            +
                        - Cron::Server.all.each do |server|
         | 
| 22 | 
            +
                          %tr{class: server.alive? ? 'green lighten-1' : 'red lighten-1'}
         | 
| 23 | 
            +
                            %td="#{server.host_name}:#{server.pid}"
         | 
| 24 | 
            +
                            %td.center-align
         | 
| 25 | 
            +
                              - if server.primary?
         | 
| 26 | 
            +
                                %i.material-icons.white-text
         | 
| 27 | 
            +
                                  grade
         | 
| 28 | 
            +
                              - else
         | 
| 29 | 
            +
                                 
         | 
| 30 | 
            +
                            %td=l(server.last_check_in_at, format: :medium)
         | 
| 31 | 
            +
                            %td.center-align
         | 
| 32 | 
            +
                              - if can? :manage, server
         | 
| 33 | 
            +
                                .actions
         | 
| 34 | 
            +
                                  - if server.primary?
         | 
| 35 | 
            +
                                    = action_link_tag(can?(:manage, Cron::Server), model_action_path(server, :demote), icon_name: 'thumb_down' )
         | 
| 36 | 
            +
                                  - else
         | 
| 37 | 
            +
                                    = delete_link_tag(server, model_path(server))
         | 
| 38 | 
            +
                  #job_cron_tabs.col.s12{data: {cache: 'stack_cron'}}
         | 
| 39 | 
            +
                    %table.highlight.bordered.extended
         | 
| 40 | 
            +
                      %thead
         | 
| 41 | 
            +
                        %tr
         | 
| 42 | 
            +
                          %th=t('.name')
         | 
| 43 | 
            +
                          %th=t('.last_run_at')
         | 
| 44 | 
            +
                          %th=t('.min')
         | 
| 45 | 
            +
                          %th=t('.hour')
         | 
| 46 | 
            +
                          %th=t('.mday')
         | 
| 47 | 
            +
                          %th=t('.month')
         | 
| 48 | 
            +
                          %th=t('.wday')
         | 
| 49 | 
            +
                          %th=t('.enabled')
         | 
| 50 | 
            +
                          %th=t('.actions')
         | 
| 51 | 
            +
                      %tbody
         | 
| 52 | 
            +
                        - Cron::JobTab.matching_search_text(params[:search]).each do |cron_tab|
         | 
| 53 | 
            +
                          %tr
         | 
| 54 | 
            +
                            %td.name=cron_tab.name.humanize
         | 
| 55 | 
            +
                            %td=current_user.local_time(cron_tab.last_run_at)
         | 
| 56 | 
            +
                            %td=cron_tab.min
         | 
| 57 | 
            +
                            %td=cron_tab.hour
         | 
| 58 | 
            +
                            %td=cron_tab.mday
         | 
| 59 | 
            +
                            %td=cron_tab.month
         | 
| 60 | 
            +
                            %td=cron_tab.wday
         | 
| 61 | 
            +
                            %td
         | 
| 62 | 
            +
                              - if cron_tab.valid_environment?
         | 
| 63 | 
            +
                                %i.material-icons.green-text
         | 
| 64 | 
            +
                                  check
         | 
| 65 | 
            +
                              - else
         | 
| 66 | 
            +
                                %nbsp
         | 
| 67 | 
            +
                            %td.actions
         | 
| 68 | 
            +
                              = edit_link_tag(cron_tab, edit_model_path(cron_tab))
         | 
| 69 | 
            +
                              - if cron_tab.valid_environment?
         | 
| 70 | 
            +
                                = replay_link_tag(cron_tab, model_action_path(cron_tab, :run_now), icon_name: 'directions_run', confirm: t('.confirm'))
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            = render 'edit'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            = render 'index'
         | 
| @@ -0,0 +1,54 @@ | |
| 1 | 
            +
            - title t('.title')
         | 
| 2 | 
            +
            - if can?(:manage, Delayed::Backend::Mongoid::Job)
         | 
| 3 | 
            +
              .fixed-action-btn.horizontal
         | 
| 4 | 
            +
                %a.btn-floating.btn-large{style: 'padding: 0;margin: 15px 15px' }
         | 
| 5 | 
            +
                  %i.material-icons replay
         | 
| 6 | 
            +
                %ul
         | 
| 7 | 
            +
                  %li
         | 
| 8 | 
            +
                    %a.btn-floating.yellow{href: class_action_path(:destroy_all, failed_only:true),
         | 
| 9 | 
            +
                      title: t('.destroy_all'),
         | 
| 10 | 
            +
                      data: {confirm: t('.confirm_destroy_all')}}
         | 
| 11 | 
            +
                      %i.material-icons
         | 
| 12 | 
            +
                        delete
         | 
| 13 | 
            +
                  %li
         | 
| 14 | 
            +
                    %a.btn-floating.red{href: class_action_path(:destroy_all, failed_only:false),
         | 
| 15 | 
            +
                      title: t('.destroy_all'),
         | 
| 16 | 
            +
                      data: {confirm: t('.confirm_destroy_all')}}
         | 
| 17 | 
            +
                      %i.material-icons
         | 
| 18 | 
            +
                        delete
         | 
| 19 | 
            +
                  %li
         | 
| 20 | 
            +
                    %a.btn-floating.yellow.darken-3{href: class_action_path(:resbumit_all, failed_only:true),
         | 
| 21 | 
            +
                      title: t('.resubmit_failed'),
         | 
| 22 | 
            +
                      data: {confirm: t('.confirm_resubmit_failed')}}
         | 
| 23 | 
            +
                      %i.material-icons
         | 
| 24 | 
            +
                        restore
         | 
| 25 | 
            +
                  %li
         | 
| 26 | 
            +
                    %a.btn-floating.red{href: class_action_path(:resbumit_all, failed_only:false),
         | 
| 27 | 
            +
                      title: t('.resubmit_all'),
         | 
| 28 | 
            +
                      data: {confirm: t('.confirm_resubmit_all')}}
         | 
| 29 | 
            +
                      %i.material-icons
         | 
| 30 | 
            +
                        restore
         | 
| 31 | 
            +
            - if @delayed_jobs.blank?
         | 
| 32 | 
            +
              %h2.center-align.grey-text=t('.no_data_found')
         | 
| 33 | 
            +
            - else
         | 
| 34 | 
            +
              .container
         | 
| 35 | 
            +
                .row
         | 
| 36 | 
            +
                  .col.s12
         | 
| 37 | 
            +
                    %table.highlighted.bordered.extended{data: {sort: {column: 'Run At,Priority', direction: 'desc,asc'}}}
         | 
| 38 | 
            +
                      %thead
         | 
| 39 | 
            +
                        %tr
         | 
| 40 | 
            +
                          %th=t('.run_at')
         | 
| 41 | 
            +
                          %th=t('.name')
         | 
| 42 | 
            +
                          %th=t('.priority')
         | 
| 43 | 
            +
                          %th=t('.status')
         | 
| 44 | 
            +
                          %th=t('.actions')
         | 
| 45 | 
            +
                      %tbody
         | 
| 46 | 
            +
                        - @delayed_jobs.each do |delayed_job|
         | 
| 47 | 
            +
                          %tr
         | 
| 48 | 
            +
                            %td=current_user.local_time(delayed_job.created_at)
         | 
| 49 | 
            +
                            %td.name=link_to(delayed_job.display_name, model_path(delayed_job))
         | 
| 50 | 
            +
                            %td=delayed_job.priority
         | 
| 51 | 
            +
                            %td=delayed_job.status_description
         | 
| 52 | 
            +
                            %td.actions
         | 
| 53 | 
            +
                              = replay_link_tag(delayed_job, model_action_path(delayed_job, :resubmit), confirm: 'Are you sure you want to restart this job?')
         | 
| 54 | 
            +
                              = delete_link_tag(delayed_job, model_path(delayed_job))
         | 
| @@ -0,0 +1,58 @@ | |
| 1 | 
            +
            - title t('.title')
         | 
| 2 | 
            +
            - content_for :breadcrumbs do
         | 
| 3 | 
            +
              %a.breadcrumb{href: index_path}=t('admin.delayed_jobs.index.title')
         | 
| 4 | 
            +
              %a.breadcrumb{href: '#'}=t('.title')
         | 
| 5 | 
            +
            .container
         | 
| 6 | 
            +
              .row
         | 
| 7 | 
            +
                .col.s12
         | 
| 8 | 
            +
                  .mod
         | 
| 9 | 
            +
                    .mod-body.no-padding
         | 
| 10 | 
            +
                      %table#info{class: 'bordered'}
         | 
| 11 | 
            +
                        %tr
         | 
| 12 | 
            +
                          %th=t('.name_label')
         | 
| 13 | 
            +
                          %td=@delayed_job.name
         | 
| 14 | 
            +
                        %tr
         | 
| 15 | 
            +
                          %th=t('.queue_label')
         | 
| 16 | 
            +
                          %td=@delayed_job.queue&.titleize
         | 
| 17 | 
            +
                        %tr
         | 
| 18 | 
            +
                          %th=t('.priority_label')
         | 
| 19 | 
            +
                          %td=@delayed_job.priority
         | 
| 20 | 
            +
                        %tr
         | 
| 21 | 
            +
                          %th=t('.attempts_label')
         | 
| 22 | 
            +
                          %td=@delayed_job.attempts
         | 
| 23 | 
            +
                        %tr
         | 
| 24 | 
            +
                          %th=t('.run_at_label')
         | 
| 25 | 
            +
                          %td=current_user.local_time(@delayed_job.run_at)
         | 
| 26 | 
            +
                        %tr
         | 
| 27 | 
            +
                          %th=t('.locked_at_label')
         | 
| 28 | 
            +
                          %td=current_user.local_time(@delayed_job.locked_at)
         | 
| 29 | 
            +
                        %tr
         | 
| 30 | 
            +
                          %th=t('.locked_by_label')
         | 
| 31 | 
            +
                          %td=@delayed_job.locked_by.presence || 'N/A'
         | 
| 32 | 
            +
                        %tr
         | 
| 33 | 
            +
                          %th=t('.handler_label')
         | 
| 34 | 
            +
                          %td=@delayed_job.job_payload
         | 
| 35 | 
            +
                        -if @delayed_job.failed?
         | 
| 36 | 
            +
                          %tr
         | 
| 37 | 
            +
                            %th=t('delayed_jobs.show.failed_at_label')
         | 
| 38 | 
            +
                            %td=current_user.local_time(@delayed_job.failed_at)
         | 
| 39 | 
            +
                          %tr
         | 
| 40 | 
            +
                            %th=t('delayed_jobs.show.failed_object')
         | 
| 41 | 
            +
                            %td=@delayed_job.failed_object.inspect
         | 
| 42 | 
            +
                          %tr
         | 
| 43 | 
            +
                            %th=t('delayed_jobs.show.failed_method')
         | 
| 44 | 
            +
                            %td=@delayed_job.failed_method_name
         | 
| 45 | 
            +
                          %tr
         | 
| 46 | 
            +
                            %th=t('delayed_jobs.show.failed_args')
         | 
| 47 | 
            +
                            %td=@delayed_job.failed_args
         | 
| 48 | 
            +
                        -if @delayed_job.last_error.present?
         | 
| 49 | 
            +
                          %tr
         | 
| 50 | 
            +
                            %th=t('delayed_jobs.show.last_error_label')
         | 
| 51 | 
            +
                            %td=@delayed_job.last_errorr
         | 
| 52 | 
            +
             | 
| 53 | 
            +
              - if can? :manage, @delayed_job
         | 
| 54 | 
            +
                .row
         | 
| 55 | 
            +
                  .col.s6.center-align
         | 
| 56 | 
            +
                    = link_to "Delete", model_path(@delayed_job), class: 'button delete', method: :delete, data: {confirm: "Are you sure you want to delete this job?"}
         | 
| 57 | 
            +
                  .col.s6.center-align
         | 
| 58 | 
            +
                    = link_to "Resubmit", model_action_path(@delayed_job, :resubmit), class: 'button action', data: {confirm: 'Are you sure you want to resubmit this job?'}
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            =render 'index'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            = render 'show'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            =render '/cron/edit'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            =render '/cron/index'
         | 
| @@ -0,0 +1,5 @@ | |
| 1 | 
            +
            - title t('.title', name: SystemConfiguration.environment.titleize)
         | 
| 2 | 
            +
            .container
         | 
| 3 | 
            +
              %form{action: stack_system_configuration_path, method: :post}
         | 
| 4 | 
            +
                = render '/system_configurations/form', system_configuration: @system_configuration
         | 
| 5 | 
            +
                = render '/common/form_actions', form_cancel_path: admin_system_configuration_path
         | 
| @@ -1,18 +1,10 @@ | |
| 1 1 | 
             
            - title t('.title', name: SystemConfiguration.environment.titleize)
         | 
| 2 2 | 
             
            .container
         | 
| 3 | 
            -
              %form{action:  | 
| 3 | 
            +
              %form{action: index_path, method: :post}
         | 
| 4 4 | 
             
                %input{type: :hidden, value: form_authenticity_token, name: 'authenticity_token'}
         | 
| 5 5 | 
             
                %input{type: :hidden, name: '_method', value: 'put'}
         | 
| 6 6 | 
             
                .row
         | 
| 7 7 | 
             
                  = form_text_field(@system_configuration, :switchboard_base_url, classes: %w[s12 m4])
         | 
| 8 8 | 
             
                  = form_text_field(@system_configuration, :switchboard_stack_id, classes: %w[s12 m4])
         | 
| 9 9 | 
             
                  = form_password(@system_configuration, :switchboard_stack_api_token, classes: %w[s12 m4])
         | 
| 10 | 
            -
                 | 
| 11 | 
            -
                  .col.s6.center-align
         | 
| 12 | 
            -
                    %a.btn-large.waves-effect.waves-light{href: system_configuration_path}= t(':cancel')
         | 
| 13 | 
            -
                      %i.material-icons.right
         | 
| 14 | 
            -
                        cancel
         | 
| 15 | 
            -
                  .col.s6.center-align
         | 
| 16 | 
            -
                    %button.btn-large.waves-effect.waves-light{type: :submit}= t(':update')
         | 
| 17 | 
            -
                      %i.material-icons.right
         | 
| 18 | 
            -
                        save
         | 
| 10 | 
            +
                = render '/common/form_actions', form_cancel_path: index_path
         | 
| @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            - title t('.title', name: SystemConfiguration.environment.titleize)
         | 
| 2 | 
            -
            = edit_class_link_tag(SystemConfiguration,  | 
| 2 | 
            +
            = edit_class_link_tag(SystemConfiguration, class_action_path(:edit))
         | 
| 3 3 | 
             
            .container
         | 
| 4 4 | 
             
              .row
         | 
| 5 5 | 
             
                .s12
         | 
| 6 | 
            -
                  %table.highlight.striped
         | 
| 6 | 
            +
                  %table.highlight.striped.extended
         | 
| 7 7 | 
             
                    %thead
         | 
| 8 8 | 
             
                      %tr
         | 
| 9 9 | 
             
                        %th.center-align=t('.field_header')
         | 
| @@ -11,5 +11,5 @@ | |
| 11 11 | 
             
                    %tbody
         | 
| 12 12 | 
             
                      - SystemConfiguration.allowed_param_names.sort.each do |field|
         | 
| 13 13 | 
             
                        %tr
         | 
| 14 | 
            -
                          %td.right-align=field
         | 
| 14 | 
            +
                          %td.right-align=field.titleize
         | 
| 15 15 | 
             
                          %td.left-align=mask_system_configuration(field)
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            = render 'edit'
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            =render 'show'
         | 
    
        data/config/locales/en.yml
    CHANGED
    
    | @@ -1,6 +1,11 @@ | |
| 1 1 | 
             
            en:
         | 
| 2 | 
            -
               | 
| 3 | 
            -
             | 
| 2 | 
            +
              links:
         | 
| 3 | 
            +
                deletion_confirmation: 'Are you sure you want to delete this %{name}?'
         | 
| 4 | 
            +
              invalid_access: 'Unauthorized access attempting to access %{action} / %{name}'
         | 
| 5 | 
            +
              forms:
         | 
| 6 | 
            +
                actions:
         | 
| 7 | 
            +
                  update: Update
         | 
| 8 | 
            +
                  cancel: Cancel
         | 
| 4 9 | 
             
              time:
         | 
| 5 10 | 
             
                formats:
         | 
| 6 11 | 
             
                  long: '%Y-%m-%d %H:%M:%ss (%Z)'
         | 
| @@ -12,6 +17,17 @@ en: | |
| 12 17 | 
             
                  medium: '%b %d, %Y'
         | 
| 13 18 | 
             
                  short: '%m/%d/%Y'
         | 
| 14 19 | 
             
              ui_form:
         | 
| 20 | 
            +
                actions:
         | 
| 21 | 
            +
                  reset: Reset
         | 
| 22 | 
            +
                  cancel: Cancel
         | 
| 23 | 
            +
                  update: Update
         | 
| 24 | 
            +
                  add: Add
         | 
| 25 | 
            +
                  save: Save
         | 
| 26 | 
            +
                  create: Create
         | 
| 27 | 
            +
                  edit: Edit
         | 
| 28 | 
            +
                  delete: Delete
         | 
| 29 | 
            +
                  info: View
         | 
| 30 | 
            +
                  replay: Restart
         | 
| 15 31 | 
             
                system_configuration:
         | 
| 16 32 | 
             
                  placeholders:
         | 
| 17 33 | 
             
                    switchboard_base_url: https://switchboard.app47.com
         | 
| @@ -27,7 +43,64 @@ en: | |
| 27 43 | 
             
              system_configurations:
         | 
| 28 44 | 
             
                show:
         | 
| 29 45 | 
             
                  title: "%{name} System Configuration"
         | 
| 46 | 
            +
                table:
         | 
| 30 47 | 
             
                  field_header: Field
         | 
| 31 48 | 
             
                  value_header: Value
         | 
| 32 49 | 
             
                edit:
         | 
| 33 50 | 
             
                  title: Edit %{name} System Configuration
         | 
| 51 | 
            +
              admin:
         | 
| 52 | 
            +
                system_configurations:
         | 
| 53 | 
            +
                  show:
         | 
| 54 | 
            +
                    title: "%{name} System Configuration"
         | 
| 55 | 
            +
                  edit:
         | 
| 56 | 
            +
                    title: Edit %{name} System Configuration
         | 
| 57 | 
            +
              cron:
         | 
| 58 | 
            +
                edit:
         | 
| 59 | 
            +
                  title: Edit Cron Tab %{name}
         | 
| 60 | 
            +
                index:
         | 
| 61 | 
            +
                  title: Cron Tabs
         | 
| 62 | 
            +
                  no_data_found: No Cron tabs Found
         | 
| 63 | 
            +
                  name: Name
         | 
| 64 | 
            +
                  stack: Stack
         | 
| 65 | 
            +
                  environment: Environment
         | 
| 66 | 
            +
                  min: Minute
         | 
| 67 | 
            +
                  hour: Hour
         | 
| 68 | 
            +
                  mday: Month Day
         | 
| 69 | 
            +
                  month: Month
         | 
| 70 | 
            +
                  wday: Week Day
         | 
| 71 | 
            +
                  enabled: Enabled?
         | 
| 72 | 
            +
                  actions: Actions
         | 
| 73 | 
            +
                  host: Host
         | 
| 74 | 
            +
                  state: State
         | 
| 75 | 
            +
                  last_run_at: Last Run At
         | 
| 76 | 
            +
              delayed_jobs:
         | 
| 77 | 
            +
                index:
         | 
| 78 | 
            +
                  title: "Delayed Jobs"
         | 
| 79 | 
            +
                  resubmit_all: Resubmit All Jobs
         | 
| 80 | 
            +
                  resubmit_failed: Resubmit Failed Jobs
         | 
| 81 | 
            +
                  confirm_resubmit_all: Are you sure you want to resubmit all jobs?
         | 
| 82 | 
            +
                  confirm_resubmit_failed: Are you sure you want to resbmit failed jobs?
         | 
| 83 | 
            +
                  destroy_all: Destroy All Jobs
         | 
| 84 | 
            +
                  destroy_failed: Destroy Failed Jobs
         | 
| 85 | 
            +
                  confirm_destroy_all: Are you sure you want to destroy all jobs?
         | 
| 86 | 
            +
                  confirm_destroy_failed: Are you sure you want to destroy failed jobs?
         | 
| 87 | 
            +
                  no_data_found: "No Delayed Jobs found"
         | 
| 88 | 
            +
                  created: "Created"
         | 
| 89 | 
            +
                  run_at: Run At
         | 
| 90 | 
            +
                  priority: Priority
         | 
| 91 | 
            +
                  name: "Name"
         | 
| 92 | 
            +
                  queue: "Queue"
         | 
| 93 | 
            +
                  status: "Status"
         | 
| 94 | 
            +
                  actions: "Actions"
         | 
| 95 | 
            +
                show:
         | 
| 96 | 
            +
                  title: 'Delayed Job'
         | 
| 97 | 
            +
                  name_label: "Name"
         | 
| 98 | 
            +
                  queue_label: "Queue"
         | 
| 99 | 
            +
                  priority_label: "Priority"
         | 
| 100 | 
            +
                  attempts_label: "Attempts"
         | 
| 101 | 
            +
                  run_at_label: "Run at"
         | 
| 102 | 
            +
                  locked_at_label: "Locked at"
         | 
| 103 | 
            +
                  locked_by_label: "Locked by"
         | 
| 104 | 
            +
                  handler_label: "Handler"
         | 
| 105 | 
            +
                  failed_at_label: "Failed at"
         | 
| 106 | 
            +
                  last_error_label: "Last Error"
         | 
    
        data/config/routes.rb
    CHANGED
    
    
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Manage cron job servers
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            module CoreController
         | 
| 7 | 
            +
              extend ActiveSupport::Concern
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              private
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              def index_path
         | 
| 12 | 
            +
                "/#{controller_path}"
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              #
         | 
| 16 | 
            +
              # Handle a document not being found, as this may happen
         | 
| 17 | 
            +
              #
         | 
| 18 | 
            +
              def document_not_found_error
         | 
| 19 | 
            +
                flash.now[:error] = 'Document not found'
         | 
| 20 | 
            +
                redirect_to index_path
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
            end
         |