web47core 3.2.8 → 3.2.12

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/core_breadcrumb_helper.rb +11 -0
  3. data/app/helpers/core_card_nav_items_helper.rb +60 -0
  4. data/app/helpers/core_dropdown_helper.rb +89 -0
  5. data/app/helpers/core_floating_action_button_helper.rb +82 -0
  6. data/app/helpers/core_html5_form_helper.rb +163 -0
  7. data/app/helpers/core_job_state_helper.rb +21 -0
  8. data/app/helpers/core_remix_icon_helper.rb +23 -0
  9. data/app/helpers/core_select_two_helper.rb +73 -0
  10. data/app/helpers/model_modal_helper.rb +1 -1
  11. data/app/views/cron_servers/index.html.haml +28 -0
  12. data/app/views/cron_tabs/edit.html.haml +17 -0
  13. data/app/views/cron_tabs/index.html.haml +35 -0
  14. data/app/views/delayed_job_metrics/index.html.haml +22 -1
  15. data/app/views/delayed_job_workers/index.html.haml +30 -1
  16. data/app/views/delayed_jobs/index.html.haml +28 -1
  17. data/app/views/delayed_jobs/show.html.haml +55 -1
  18. data/app/views/system_configurations/edit.html.haml +14 -1
  19. data/app/views/system_configurations/show.html.haml +18 -1
  20. data/lib/app/controllers/concerns/core_controller.rb +14 -0
  21. data/lib/app/controllers/concerns/core_cron_servers_controller.rb +31 -0
  22. data/lib/app/controllers/concerns/core_cron_tabs_controller.rb +41 -0
  23. data/lib/app/controllers/concerns/core_delayed_job_metrics_controller.rb +2 -2
  24. data/lib/app/jobs/cron/trim_command_jobs.rb +1 -1
  25. data/lib/app/models/concerns/class_name.rb +26 -0
  26. data/lib/app/models/concerns/tag_able.rb +34 -0
  27. data/lib/app/models/redis_configuration.rb +1 -1
  28. data/lib/app/models/tag.rb +21 -0
  29. data/lib/app/models/user_audit_log.rb +2 -2
  30. data/lib/web47core/version.rb +1 -1
  31. data/lib/web47core.rb +5 -1
  32. metadata +32 -39
  33. data/app/views/admin/cron/edit.html.haml +0 -1
  34. data/app/views/admin/cron/index.html.haml +0 -1
  35. data/app/views/admin/delayed_jobs/index.html.haml +0 -1
  36. data/app/views/admin/delayed_jobs/show.html.haml +0 -1
  37. data/app/views/admin/system_configurations/edit.html.haml +0 -1
  38. data/app/views/admin/system_configurations/show.html.haml +0 -1
  39. data/app/views/cron/_edit.html.haml +0 -19
  40. data/app/views/cron/_index.html.haml +0 -77
  41. data/app/views/cron/edit.html.haml +0 -1
  42. data/app/views/cron/index.html.haml +0 -1
  43. data/app/views/delayed_job_metrics/_index.html.haml +0 -27
  44. data/app/views/delayed_job_workers/_index.html.haml +0 -27
  45. data/app/views/delayed_jobs/_index.html.haml +0 -49
  46. data/app/views/delayed_jobs/_show.html.haml +0 -60
  47. data/app/views/stack/cron/edit.html.haml +0 -1
  48. data/app/views/stack/cron/index.html.haml +0 -1
  49. data/app/views/stack/delayed_jobs/index.html.haml +0 -1
  50. data/app/views/stack/delayed_jobs/show.html.haml +0 -1
  51. data/app/views/stack/system_configurations/edit.html.haml +0 -1
  52. data/app/views/stack/system_configurations/show.html.haml +0 -1
  53. data/app/views/system_configurations/_edit.html.haml +0 -15
  54. data/app/views/system_configurations/_show.html.haml +0 -22
  55. data/lib/app/controllers/concerns/core_cron_controller.rb +0 -79
@@ -1,77 +0,0 @@
1
- - title t('cron.index.title')
2
- .container
3
- .row
4
- .col.s12
5
- .card
6
- .card-content
7
- .card-title= t('cron.index.title')
8
- .card.section-data-tables
9
- .card-content
10
- %ul.tabs#stack_cron
11
- %li.tab.col.s6
12
- %a{href: '#cron_job_servers'}='Cron Servers'
13
- %li.tab.col.s6
14
- %a{href: '#job_cron_tabs'}='Cron Jobs'
15
- .container
16
- .row
17
- .col.s12
18
- #cron_job_servers{data: {cache: 'stack_cron'}}
19
- %table.highlight.data-table
20
- %thead
21
- %tr
22
- = table_header_tag :host
23
- = table_header_tag :state, priority: 3
24
- = table_header_tag :last_check_in_at, priority: 4
25
- = table_header_actions_tag
26
- %tbody.white-text
27
- - Cron::Server.all.each do |server|
28
- %tr{class: server.alive? ? 'green lighten-1' : 'red lighten-1'}
29
- %td="#{server.host_name}:#{server.pid}"
30
- %td.center-align
31
- - if server.primary?
32
- %i.material-icons.white-text
33
- grade
34
- - else
35
-  
36
- %td=current_user.local_time(server.last_check_in_at)
37
- %td.center-align
38
- - if can? :manage, server
39
- .actions
40
- - if server.primary?
41
- = action_link_tag(can?(:manage, Cron::Server), model_action_path(server, :demote), icon_name: 'thumb_down' )
42
- - else
43
- = delete_link_tag(server, model_path(server))
44
- .col.s12
45
- #job_cron_tabs{data: {cache: 'stack_cron'}}
46
- %table.highlight.data-table
47
- %thead
48
- %tr
49
- = table_header_tag :name
50
- = table_header_tag :last_run_at, priority: 4
51
- = table_header_tag :min, priority: 5
52
- = table_header_tag :hour, priority: 6
53
- = table_header_tag :mday, priority: 7
54
- = table_header_tag :month, priority: 8
55
- = table_header_tag :wday, priority: 9
56
- = table_header_tag :enabled, priority: 3
57
- = table_header_actions_tag
58
- %tbody
59
- - Cron::JobTab.matching_search_text(params[:search]).each do |cron_tab|
60
- %tr
61
- %td.name=cron_tab.name.humanize
62
- %td=current_user.local_time(cron_tab.last_run_at)
63
- %td=cron_tab.min
64
- %td=cron_tab.hour
65
- %td=cron_tab.mday
66
- %td=cron_tab.month
67
- %td=cron_tab.wday
68
- %td
69
- - if cron_tab.valid_environment?
70
- %i.material-icons.green-text
71
- check
72
- - else
73
- %nbsp
74
- %td.actions
75
- = edit_link_tag(cron_tab, edit_model_path(cron_tab))
76
- - if cron_tab.valid_environment?
77
- = replay_link_tag(cron_tab, model_action_path(cron_tab, :run_now), icon_name: 'directions_run', confirm: t('.confirm', name: cron_tab.name.humanize))
@@ -1 +0,0 @@
1
- = render 'edit'
@@ -1 +0,0 @@
1
- = render 'index'
@@ -1,27 +0,0 @@
1
- - title t('.title')
2
- .container
3
- .row
4
- .s12
5
- .card.section-data-tables
6
- .card-content
7
- %table.highlight.data-table
8
- %thead
9
- %tr
10
- =table_header_tag :name
11
- =table_header_tag :count, priority: 3
12
- =table_header_tag :min, priority: 5
13
- =table_header_tag :avg, priority: 5
14
- =table_header_tag :max, priority: 5
15
- =table_header_tag :last_run_at, priority: 4
16
- =table_header_actions_tag
17
- %tbody
18
- - @metrics.each do |metric|
19
- %tr
20
- %td=metric.name
21
- %td=metric.count
22
- %td=metric.min.round(3)
23
- %td=metric.avg.round(3)
24
- %td=metric.max.round(3)
25
- %td=current_user.local_time(metric.last_run_at)
26
- %td.actions
27
- = delete_link_tag(metric, model_path(metric))
@@ -1,27 +0,0 @@
1
- - title t('.title')
2
- .container
3
- .row
4
- .s12
5
- .card.section-data-tables
6
- .card-content
7
- %table.highlight.data-table
8
- %thead
9
- %tr
10
- =table_header_tag :host_name, priority: 3
11
- =table_header_tag :pid, priority: 3
12
- =table_header_tag :running, priority: 5
13
- =table_header_tag :alive, priority: 5
14
- =table_header_tag :last_check_in, priority: 4
15
- =table_header_tag :runs, priority: 4
16
- =table_header_actions_tag
17
- %tbody
18
- - @workers.each do |worker|
19
- %tr
20
- %td=worker.host_name
21
- %td=worker.pid
22
- %td=materialize_icon(worker.running? ? 'directions_run' : 'pending')
23
- %td=materialize_icon(worker.dead? ? 'do_disturb' : 'run_circle')
24
- %td=current_user.local_time(worker.last_check_in_at)
25
- %td=worker.runs.count
26
- %td.actions
27
- = delete_link_tag(worker, model_path(worker))
@@ -1,49 +0,0 @@
1
- - title t('.title')
2
- .container
3
- .row
4
- .s12
5
- .card
6
- .card-content
7
- .card-title Delayed Jobs
8
- - if can?(:manage, Delayed::Backend::Mongoid::Job)
9
- .card-tray
10
- %a.btn.yellow{href: class_action_path(:destroy_all, failed_only:true),
11
- title: t('.destroy_all'),
12
- data: {confirm: t('.confirm_destroy_failed')}}
13
- %i.material-icons
14
- delete
15
- %a.btn.red{href: class_action_path(:destroy_all, failed_only:false),
16
- title: t('.destroy_all'),
17
- data: {confirm: t('confirm_destroy_all')}}
18
- %i.material-icons
19
- delete
20
- %a.btn.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
- %a.btn.red{href: class_action_path(:resbumit_all, failed_only:false),
26
- title: t('.resubmit_all'),
27
- data: {confirm: t('.confirm_resubmit_all')}}
28
- %i.material-icons
29
- restore
30
- .card
31
- .card-content
32
- %table.highlight.data-table
33
- %thead
34
- %tr
35
- =table_header_tag :run_at, priority: 3
36
- =table_header_tag :name
37
- =table_header_tag :priority, priority: 5
38
- =table_header_tag :status, priority: 4
39
- =table_header_actions_tag
40
- %tbody
41
- - @delayed_jobs.each do |delayed_job|
42
- %tr
43
- %td=current_user.local_time(delayed_job.created_at)
44
- %td.name=link_to(delayed_job.display_name, model_path(delayed_job))
45
- %td=delayed_job.priority
46
- %td=delayed_job.status_description
47
- %td.actions
48
- = replay_link_tag(delayed_job, model_action_path(delayed_job, :resubmit), confirm: 'Are you sure you want to restart this job?')
49
- = delete_link_tag(delayed_job, model_path(delayed_job))
@@ -1,60 +0,0 @@
1
- - title @delayed_job.name
2
- .container
3
- .row
4
- .col.s12
5
- .card
6
- .card-content
7
- .card-title= @delayed_job.name
8
- - if can?(:manage, @delayed_job)
9
- .card-tray
10
- =delete_button_tag(@delayed_job, model_path(@delayed_job))
11
- =replay_button_tag(@delayed_job, model_path(@delayed_job))
12
- .card
13
- .card-content
14
- %table#info{class: 'bordered'}
15
- %tr
16
- %th=t('.name_label')
17
- %td=@delayed_job.name
18
- %tr
19
- %th=t('.queue_label')
20
- %td=@delayed_job.queue&.titleize
21
- %tr
22
- %th=t('.priority_label')
23
- %td=@delayed_job.priority
24
- %tr
25
- %th=t('.attempts_label')
26
- %td=@delayed_job.attempts
27
- %tr
28
- %th=t('.run_at_label')
29
- %td=current_user.local_time(@delayed_job.run_at)
30
- %tr
31
- %th=t('.locked_at_label')
32
- %td=current_user.local_time(@delayed_job.locked_at)
33
- %tr
34
- %th=t('.locked_by_label')
35
- %td=@delayed_job.locked_by.presence || 'N/A'
36
- %tr
37
- %th=t('.handler_label')
38
- %td=@delayed_job.job_payload
39
- -if @delayed_job.failed?
40
- %tr
41
- %th=t('delayed_jobs.show.failed_at_label')
42
- %td=current_user.local_time(@delayed_job.failed_at)
43
- %tr
44
- %th=t('delayed_jobs.show.failed_object')
45
- %td=@delayed_job.failed_object.inspect
46
- %tr
47
- %th=t('delayed_jobs.show.failed_method')
48
- %td=@delayed_job.failed_method_name
49
- %tr
50
- %th=t('delayed_jobs.show.failed_args')
51
- %td=@delayed_job.failed_args
52
- -if @delayed_job.last_error.present?
53
- %tr
54
- %th=t('delayed_jobs.show.last_error_label')
55
- %td=@delayed_job.last_error
56
- - if can? :manage, @delayed_job
57
- .card-action
58
- .row
59
- .col.s6.center-align= delete_button_tag(@delayed_job, model_path(@delayed_job))
60
- .col.s6.center-align= replay_button_tag(@delayed_job, model_path(@delayed_job))
@@ -1 +0,0 @@
1
- =render '/cron/edit'
@@ -1 +0,0 @@
1
- =render '/cron/index'
@@ -1 +0,0 @@
1
- =render '/delayed_jobs/index'
@@ -1 +0,0 @@
1
- =render '/delayed_jobs/show'
@@ -1 +0,0 @@
1
- = render '/system_configurations/edit'
@@ -1 +0,0 @@
1
- = render '/system_configurations/show'
@@ -1,15 +0,0 @@
1
- - title SystemConfiguration.environment.titleize
2
- %form{action: index_path, method: :post}
3
- %input{type: :hidden, value: form_authenticity_token, name: :authenticity_token}
4
- %input{type: :hidden, name: '_method', value: :put}
5
- .container
6
- .row
7
- .col.s12
8
- .card
9
- .card-content
10
- .card-title= SystemConfiguration.environment.titleize
11
- .row
12
- = form_text_field(@system_configuration, :switchboard_base_url, classes: %w[s12 m4])
13
- = form_text_field(@system_configuration, :switchboard_stack_id, classes: %w[s12 m4])
14
- = form_password(@system_configuration, :switchboard_stack_api_token, classes: %w[s12 m4])
15
- = render 'common/update_actions', form_cancel_path: index_path
@@ -1,22 +0,0 @@
1
- - title SystemConfiguration.environment.titleize
2
- .container
3
- .row
4
- .s12
5
- .card
6
- .card-content
7
- .card-title=SystemConfiguration.environment.titleize
8
- .card-tray
9
- = edit_link_tag(SystemConfiguration, class_action_path(:edit))
10
- = replay_link_tag(SystemConfiguration, class_action_path(:sync))
11
- .card
12
- .card-content.section-data-tables
13
- %table.highlight.striped.data-table
14
- %thead
15
- %tr
16
- =table_header_tag :field
17
- =table_header_tag :value
18
- %tbody
19
- - SystemConfiguration.allowed_param_names.sort.each do |field|
20
- %tr
21
- %td=field
22
- %td=mask_system_configuration(field)
@@ -1,79 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Manage cron job servers
5
- #
6
- module CoreCronController
7
- include CoreController
8
- #
9
- # Table to display cron job servers
10
- #
11
- def index
12
- authorize! :read, Cron::Server
13
- authorize! :read, Cron::Tab
14
- end
15
-
16
- #
17
- # Run the crontab entry now
18
- #
19
- def run_now
20
- authorize! :read, cron_tab
21
- cron_tab.run
22
- redirect_to index_path
23
- rescue StandardError => error
24
- log_controller_error error, true
25
- redirect_to index_path
26
- end
27
-
28
- #
29
- # Update a crontab entry
30
- #
31
- def update
32
- authorize! :update, cron_tab
33
- cron_tab.update! cron_tab_params
34
- redirect_to index_path
35
- rescue StandardError => error
36
- log_controller_error error
37
- render :edit
38
- end
39
-
40
- #
41
- # Demote a cron job server
42
- #
43
- def demote
44
- authorize! :edit, cron_server
45
- cron_server.become_secondary
46
- redirect_to index_path
47
- rescue StandardError => error
48
- log_controller_error error, true
49
- redirect_to index_path
50
- end
51
-
52
- #
53
- # Destroy a cron job server
54
- #
55
- def destroy
56
- authorize! :destroy, cron_server
57
- cron_server.destroy!
58
- redirect_to index_path
59
- rescue StandardError => error
60
- log_controller_error error, true
61
- redirect_to index_path
62
- end
63
-
64
- private
65
-
66
- def cron_tab
67
- @cron_tab ||= Cron::Tab.find(params[:id])
68
- end
69
-
70
- def cron_server
71
- @cron_server ||= Cron::Server.find(params[:id])
72
- end
73
-
74
- def cron_tab_params
75
- p = params['cron/job_tab']
76
- p[:enabled] ||= false
77
- p.permit(Cron::Tab.allowed_param_names)
78
- end
79
- end