rocketjob_mission_control 3.0.0.rc1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +10 -6
  3. data/app/assets/javascripts/rocket_job_mission_control/application.js +4 -3
  4. data/app/assets/javascripts/rocket_job_mission_control/base.js +12 -0
  5. data/app/assets/javascripts/rocket_job_mission_control/datatable.js +40 -0
  6. data/app/assets/javascripts/rocket_job_mission_control/dirmon_entries.js +16 -0
  7. data/app/assets/javascripts/rocket_job_mission_control/selectize.js +6 -0
  8. data/app/controllers/rocket_job_mission_control/active_workers_controller.rb +16 -5
  9. data/app/controllers/rocket_job_mission_control/application_controller.rb +2 -0
  10. data/app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb +47 -67
  11. data/app/controllers/rocket_job_mission_control/jobs_controller.rb +113 -19
  12. data/app/controllers/rocket_job_mission_control/servers_controller.rb +71 -28
  13. data/app/datatables/rocket_job_mission_control/abstract_datatable.rb +3 -3
  14. data/app/datatables/rocket_job_mission_control/active_workers_datatable.rb +8 -14
  15. data/app/datatables/rocket_job_mission_control/dirmon_entries_datatable.rb +7 -15
  16. data/app/datatables/rocket_job_mission_control/jobs_datatable.rb +128 -13
  17. data/app/datatables/rocket_job_mission_control/servers_datatable.rb +13 -15
  18. data/app/helpers/rocket_job_mission_control/application_helper.rb +58 -0
  19. data/app/helpers/rocket_job_mission_control/jobs_helper.rb +15 -7
  20. data/app/helpers/rocket_job_mission_control/servers_helper.rb +1 -1
  21. data/app/models/rocket_job_mission_control/job_sanitizer.rb +47 -0
  22. data/app/models/rocket_job_mission_control/query.rb +24 -18
  23. data/app/views/layouts/rocket_job_mission_control/application.html.erb +43 -0
  24. data/app/views/layouts/rocket_job_mission_control/partials/_flash.html.erb +20 -0
  25. data/app/views/layouts/rocket_job_mission_control/partials/_header.html.erb +45 -0
  26. data/app/views/layouts/rocket_job_mission_control/partials/_sidebar.html.erb +12 -0
  27. data/app/views/rocket_job_mission_control/active_workers/index.html.erb +40 -0
  28. data/app/views/rocket_job_mission_control/dirmon_entries/_form.html.erb +60 -0
  29. data/app/views/rocket_job_mission_control/dirmon_entries/_sidebar.html.erb +38 -0
  30. data/app/views/rocket_job_mission_control/dirmon_entries/_status.html.erb +17 -0
  31. data/app/views/rocket_job_mission_control/dirmon_entries/edit.html.erb +4 -0
  32. data/app/views/rocket_job_mission_control/dirmon_entries/index.html.erb +33 -0
  33. data/app/views/rocket_job_mission_control/dirmon_entries/new.html.erb +8 -0
  34. data/app/views/rocket_job_mission_control/dirmon_entries/show.html.erb +29 -0
  35. data/app/views/rocket_job_mission_control/jobs/_pagination.html.erb +26 -0
  36. data/app/views/rocket_job_mission_control/jobs/_sidebar.html.erb +32 -0
  37. data/app/views/rocket_job_mission_control/jobs/_status.html.erb +42 -0
  38. data/app/views/rocket_job_mission_control/jobs/edit.html.erb +32 -0
  39. data/app/views/rocket_job_mission_control/jobs/exception.html.erb +19 -0
  40. data/app/views/rocket_job_mission_control/jobs/exceptions.html.erb +40 -0
  41. data/app/views/rocket_job_mission_control/jobs/index.html.erb +33 -0
  42. data/app/views/rocket_job_mission_control/jobs/show.html.erb +68 -0
  43. data/app/views/rocket_job_mission_control/servers/_sidebar.html.erb +31 -0
  44. data/app/views/rocket_job_mission_control/servers/index.html.erb +56 -0
  45. data/config/locales/en.yml +3 -10
  46. data/config/routes.rb +20 -17
  47. data/lib/rocket_job_mission_control/engine.rb +10 -0
  48. data/lib/rocket_job_mission_control/version.rb +1 -1
  49. data/test/compare_hashes.rb +17 -0
  50. data/test/controllers/rocket_job_mission_control/application_controller_test.rb +49 -0
  51. data/test/controllers/rocket_job_mission_control/dirmon_entries_controller_test.rb +417 -0
  52. data/test/controllers/rocket_job_mission_control/jobs_controller_test.rb +363 -0
  53. data/test/controllers/rocket_job_mission_control/servers_controller_test.rb +251 -0
  54. data/test/helpers/rocket_job_mission_control/application_helper_test.rb +54 -0
  55. data/test/helpers/rocket_job_mission_control/jobs_helper_test.rb +85 -0
  56. data/test/helpers/rocket_job_mission_control/pagination_helper_test.rb +23 -0
  57. data/test/helpers/rocket_job_mission_control/servers_helper_test.rb +64 -0
  58. data/test/helpers/rocket_job_mission_control/slices_helper_test.rb +30 -0
  59. data/test/models/rocket_job_mission_control/job_sanitizer_test.rb +92 -0
  60. data/test/models/rocket_job_mission_control/query_test.rb +136 -0
  61. data/test/test_helper.rb +23 -0
  62. metadata +75 -175
  63. data/app/assets/javascripts/rocket_job_mission_control/base.js.coffee +0 -11
  64. data/app/assets/javascripts/rocket_job_mission_control/datatable.js.coffee +0 -33
  65. data/app/assets/javascripts/rocket_job_mission_control/dirmon_entries.js.coffee +0 -13
  66. data/app/assets/javascripts/rocket_job_mission_control/selectize.js.coffee +0 -5
  67. data/app/assets/stylesheets/rocket_job_mission_control/jquery.bootstrap-touchspin.scss +0 -45
  68. data/app/controllers/rocket_job_mission_control/dirmon_entries/index_filters_controller.rb +0 -45
  69. data/app/controllers/rocket_job_mission_control/jobs/failures_controller.rb +0 -30
  70. data/app/controllers/rocket_job_mission_control/jobs/index_filters_controller.rb +0 -90
  71. data/app/controllers/rocket_job_mission_control/servers/index_filters_controller.rb +0 -49
  72. data/app/datatables/rocket_job_mission_control/completed_jobs_datatable.rb +0 -27
  73. data/app/datatables/rocket_job_mission_control/interrupted_jobs_datatable.rb +0 -26
  74. data/app/datatables/rocket_job_mission_control/queued_jobs_datatable.rb +0 -23
  75. data/app/datatables/rocket_job_mission_control/running_jobs_datatable.rb +0 -47
  76. data/app/datatables/rocket_job_mission_control/scheduled_jobs_datatable.rb +0 -31
  77. data/app/models/job_failures.rb +0 -20
  78. data/app/models/job_sanitizer.rb +0 -17
  79. data/app/views/layouts/rocket_job_mission_control/application.html.haml +0 -45
  80. data/app/views/layouts/rocket_job_mission_control/partials/_header.html.haml +0 -32
  81. data/app/views/layouts/rocket_job_mission_control/partials/_sidebar.html.haml +0 -11
  82. data/app/views/rocket_job_mission_control/active_workers/index.html.haml +0 -24
  83. data/app/views/rocket_job_mission_control/dirmon_entries/_form.html.haml +0 -37
  84. data/app/views/rocket_job_mission_control/dirmon_entries/_properties.html.haml +0 -30
  85. data/app/views/rocket_job_mission_control/dirmon_entries/_sidebar.html.haml +0 -27
  86. data/app/views/rocket_job_mission_control/dirmon_entries/_status.html.haml +0 -23
  87. data/app/views/rocket_job_mission_control/dirmon_entries/edit.html.haml +0 -4
  88. data/app/views/rocket_job_mission_control/dirmon_entries/index.html.haml +0 -18
  89. data/app/views/rocket_job_mission_control/dirmon_entries/index_filters/disabled.html.haml +0 -17
  90. data/app/views/rocket_job_mission_control/dirmon_entries/index_filters/enabled.html.haml +0 -17
  91. data/app/views/rocket_job_mission_control/dirmon_entries/index_filters/failed.html.haml +0 -17
  92. data/app/views/rocket_job_mission_control/dirmon_entries/index_filters/pending.html.haml +0 -17
  93. data/app/views/rocket_job_mission_control/dirmon_entries/new.html.haml +0 -6
  94. data/app/views/rocket_job_mission_control/dirmon_entries/show.html.haml +0 -23
  95. data/app/views/rocket_job_mission_control/jobs/_sidebar.html.haml +0 -28
  96. data/app/views/rocket_job_mission_control/jobs/_status.html.haml +0 -45
  97. data/app/views/rocket_job_mission_control/jobs/edit.html.haml +0 -34
  98. data/app/views/rocket_job_mission_control/jobs/exceptions.html.haml +0 -29
  99. data/app/views/rocket_job_mission_control/jobs/failures/_pagination.html.haml +0 -16
  100. data/app/views/rocket_job_mission_control/jobs/failures/index.html.haml +0 -32
  101. data/app/views/rocket_job_mission_control/jobs/index.html.haml +0 -25
  102. data/app/views/rocket_job_mission_control/jobs/index_filters/aborted.html.haml +0 -23
  103. data/app/views/rocket_job_mission_control/jobs/index_filters/completed.html.haml +0 -24
  104. data/app/views/rocket_job_mission_control/jobs/index_filters/failed.html.haml +0 -23
  105. data/app/views/rocket_job_mission_control/jobs/index_filters/paused.html.haml +0 -23
  106. data/app/views/rocket_job_mission_control/jobs/index_filters/queued.html.haml +0 -24
  107. data/app/views/rocket_job_mission_control/jobs/index_filters/running.html.haml +0 -25
  108. data/app/views/rocket_job_mission_control/jobs/index_filters/scheduled.html.haml +0 -24
  109. data/app/views/rocket_job_mission_control/jobs/show.html.haml +0 -51
  110. data/app/views/rocket_job_mission_control/servers/_actions.html.haml +0 -9
  111. data/app/views/rocket_job_mission_control/servers/_sidebar.html.haml +0 -20
  112. data/app/views/rocket_job_mission_control/servers/index.html.haml +0 -37
  113. data/app/views/rocket_job_mission_control/servers/index_filters/paused.html.haml +0 -37
  114. data/app/views/rocket_job_mission_control/servers/index_filters/running.html.haml +0 -37
  115. data/app/views/rocket_job_mission_control/servers/index_filters/starting.html.haml +0 -37
  116. data/app/views/rocket_job_mission_control/servers/index_filters/stopping.html.haml +0 -37
  117. data/spec/controllers/application_controller_spec.rb +0 -47
  118. data/spec/controllers/dirmon_entries/index_filters_controller_spec.rb +0 -77
  119. data/spec/controllers/dirmon_entries_controller_spec.rb +0 -383
  120. data/spec/controllers/jobs/failures_controller_spec.rb +0 -82
  121. data/spec/controllers/jobs/index_filters_controller_spec.rb +0 -66
  122. data/spec/controllers/jobs_controller_spec.rb +0 -172
  123. data/spec/controllers/workers/index_filters_controller_spec.rb +0 -59
  124. data/spec/controllers/workers_controller_spec.rb +0 -125
  125. data/spec/dummy/Rakefile +0 -7
  126. data/spec/dummy/config.ru +0 -4
  127. data/spec/dummy/config/application.rb +0 -26
  128. data/spec/dummy/config/boot.rb +0 -5
  129. data/spec/dummy/config/database.yml +0 -25
  130. data/spec/dummy/config/environment.rb +0 -5
  131. data/spec/dummy/config/environments/test.rb +0 -37
  132. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  133. data/spec/dummy/config/initializers/session_store.rb +0 -3
  134. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  135. data/spec/dummy/config/mongoid.yml +0 -88
  136. data/spec/dummy/config/routes.rb +0 -3
  137. data/spec/dummy/config/secrets.yml +0 -22
  138. data/spec/dummy/config/symmetric-encryption.yml +0 -8
  139. data/spec/dummy/db/test.sqlite3 +0 -0
  140. data/spec/dummy/log/development.log +0 -0
  141. data/spec/dummy/log/test.log +0 -118933
  142. data/spec/helpers/application_helper_spec.rb +0 -58
  143. data/spec/helpers/jobs_helper_spec.rb +0 -35
  144. data/spec/helpers/pagination_helper_spec.rb +0 -21
  145. data/spec/helpers/servers_helper_spec.rb +0 -16
  146. data/spec/helpers/slices_helper_spec.rb +0 -33
  147. data/spec/models/job_failures_spec.rb +0 -14
  148. data/spec/models/job_sanitizer_spec.rb +0 -16
  149. data/spec/rails_helper.rb +0 -47
  150. data/spec/spec_helper.rb +0 -84
  151. data/vendor/assets/javascripts/jquery.bootstrap-touchspin.js +0 -686
  152. data/vendor/assets/javascripts/prism.js +0 -6
  153. data/vendor/assets/stylesheets/jquery.bootstrap-touchspin.css +0 -45
  154. data/vendor/assets/stylesheets/prism.scss +0 -160
@@ -1,5 +0,0 @@
1
- $(document).on 'ready', ->
2
- $('select.selectize').selectize(
3
- create: true
4
- hideSelected: true
5
- )
@@ -1,45 +0,0 @@
1
- /*
2
- * Bootstrap TouchSpin - v3.0.1
3
- * A mobile and touch friendly input spinner component for Bootstrap 3.
4
- * http://www.virtuosoft.eu/code/bootstrap-touchspin/
5
- *
6
- * Made by István Ujj-Mészáros
7
- * Under Apache License v2.0 License
8
- */
9
-
10
- .bootstrap-touchspin .input-group-btn-vertical {
11
- position: relative;
12
- white-space: nowrap;
13
- width: 1%;
14
- vertical-align: middle;
15
- display: table-cell;
16
- }
17
-
18
- .bootstrap-touchspin .input-group-btn-vertical > .btn {
19
- display: block;
20
- float: none;
21
- width: 100%;
22
- max-width: 100%;
23
- padding: 8px 10px;
24
- margin-left: -1px;
25
- position: relative;
26
- }
27
-
28
- .bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-up {
29
- border-radius: 0;
30
- border-top-right-radius: 4px;
31
- }
32
-
33
- .bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-down {
34
- margin-top: -2px;
35
- border-radius: 0;
36
- border-bottom-right-radius: 4px;
37
- }
38
-
39
- .bootstrap-touchspin .input-group-btn-vertical i {
40
- position: absolute;
41
- top: 3px;
42
- left: 5px;
43
- font-size: 9px;
44
- font-weight: normal;
45
- }
@@ -1,45 +0,0 @@
1
- module RocketJobMissionControl
2
- module DirmonEntries
3
- class IndexFiltersController < RocketJobMissionControl::ApplicationController
4
- before_filter :show_sidebar
5
-
6
- def pending
7
- @query = RocketJobMissionControl::Query.new(RocketJob::DirmonEntry.pending, name: :asc)
8
- respond_to do |format|
9
- format.html
10
- format.json { render(json: DirmonEntriesDatatable.new(view_context, @query)) }
11
- end
12
- end
13
-
14
- def enabled
15
- @query = RocketJobMissionControl::Query.new(RocketJob::DirmonEntry.enabled, name: :asc)
16
- respond_to do |format|
17
- format.html
18
- format.json { render(json: DirmonEntriesDatatable.new(view_context, @query)) }
19
- end
20
- end
21
-
22
- def failed
23
- @query = RocketJobMissionControl::Query.new(RocketJob::DirmonEntry.failed, name: :asc)
24
- respond_to do |format|
25
- format.html
26
- format.json { render(json: DirmonEntriesDatatable.new(view_context, @query)) }
27
- end
28
- end
29
-
30
- def disabled
31
- @query = RocketJobMissionControl::Query.new(RocketJob::DirmonEntry.disabled, name: :asc)
32
- respond_to do |format|
33
- format.html
34
- format.json { render(json: DirmonEntriesDatatable.new(view_context, @query)) }
35
- end
36
- end
37
-
38
- private
39
-
40
- def show_sidebar
41
- @dirmon_sidebar = true
42
- end
43
- end
44
- end
45
- end
@@ -1,30 +0,0 @@
1
- module RocketJobMissionControl
2
- module Jobs
3
- class FailuresController < RocketJobMissionControl::ApplicationController
4
- def index
5
- job_failures = JobFailures.new(params[:job_id])
6
- if @job = job_failures.job
7
- @slice_errors = job_failures.list
8
-
9
- if @slice_errors.present?
10
- @error_type = params[:error_type] || @slice_errors.first.class_name
11
-
12
- offset = params.fetch(:offset, 0).to_i
13
- count = @slice_errors.find { |exception| exception.class_name == @error_type }.try!(:count) || 0
14
- current_failure = job_failures.for_error(@error_type, offset)
15
- @failure_exception = current_failure.try!(:exception)
16
-
17
- @pagination = {
18
- offset: offset,
19
- total: (count - 1),
20
- }
21
- else
22
- flash[:notice] = t(:no_errors, scope: [:job, :failures])
23
- end
24
- else
25
- redirect_to(job_path(params[:job_id]))
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,90 +0,0 @@
1
- module RocketJobMissionControl
2
- module Jobs
3
- class IndexFiltersController < RocketJobMissionControl::ApplicationController
4
- before_filter :show_sidebar
5
-
6
- COMMON_FIELDS = [:id, :_type, :description, :completed_at, :created_at, :started_at, :state].freeze
7
- RUNNING_FIELDS = COMMON_FIELDS + [:record_count, :collect_output, :input_categories, :output_categories, :encrypt, :compress, :slice_size, :priority, :sub_state, :percent_complete].freeze
8
- QUEUED_FIELDS = COMMON_FIELDS + [:run_at, :priority].freeze
9
- SCHEDULED_FIELDS = COMMON_FIELDS + [:run_at, :cron_schedule].freeze
10
-
11
- def running
12
- @jobs = RocketJob::Job.running.only(RUNNING_FIELDS)
13
- @query = RocketJobMissionControl::Query.new(@jobs, started_at: :desc)
14
- @query.display_columns = %w[_type description runs_in cron_schedule completed_at]
15
-
16
- respond_to do |format|
17
- format.html
18
- format.json { render(json: RunningJobsDatatable.new(view_context, @query)) }
19
- end
20
- end
21
-
22
- def paused
23
- @jobs = RocketJob::Job.paused.only(COMMON_FIELDS)
24
- @query = RocketJobMissionControl::Query.new(@jobs, completed_at: :desc)
25
- @query.display_columns = %w[_type description completed_at]
26
- respond_to do |format|
27
- format.html
28
- format.json { render(json: InterruptedJobsDatatable.new(view_context, @query)) }
29
- end
30
- end
31
-
32
- def completed
33
- @jobs = RocketJob::Job.completed.only(COMMON_FIELDS)
34
- @query = RocketJobMissionControl::Query.new(@jobs, completed_at: :desc)
35
- @query.display_columns = %w[_type description duration completed_at]
36
- respond_to do |format|
37
- format.html
38
- format.json { render(json: CompletedJobsDatatable.new(view_context, @query)) }
39
- end
40
- end
41
-
42
- def aborted
43
- @jobs = RocketJob::Job.aborted.only(COMMON_FIELDS)
44
- @query = RocketJobMissionControl::Query.new(@jobs, completed_at: :desc)
45
- @query.display_columns = %w[_type description completed_at]
46
- respond_to do |format|
47
- format.html
48
- format.json { render(json: InterruptedJobsDatatable.new(view_context, @query)) }
49
- end
50
- end
51
-
52
- def failed
53
- @jobs = RocketJob::Job.failed.only(COMMON_FIELDS)
54
- @query = RocketJobMissionControl::Query.new(@jobs, completed_at: :desc)
55
- @query.display_columns = %w[_type description completed_at]
56
- respond_to do |format|
57
- format.html
58
- format.json { render(json: InterruptedJobsDatatable.new(view_context, @query)) }
59
- end
60
- end
61
-
62
- def queued
63
- @jobs = RocketJob::Job.queued_now.only(QUEUED_FIELDS)
64
- @query = RocketJobMissionControl::Query.new(@jobs, completed_at: :desc)
65
- @query.display_columns = %w[_type description priority queued_for]
66
- respond_to do |format|
67
- format.html
68
- format.json { render(json: QueuedJobsDatatable.new(view_context, @query)) }
69
- end
70
- end
71
-
72
- def scheduled
73
- @jobs = RocketJob::Job.scheduled.only(SCHEDULED_FIELDS)
74
- @query = RocketJobMissionControl::Query.new(@jobs, run_at: :asc)
75
- @query.display_columns = %w[_type description runs_in cron_schedule]
76
- respond_to do |format|
77
- format.html
78
- format.json { render(json: ScheduledJobsDatatable.new(view_context, @query)) }
79
- end
80
- end
81
-
82
- private
83
-
84
- def show_sidebar
85
- @jobs_sidebar = true
86
- end
87
-
88
- end
89
- end
90
- end
@@ -1,49 +0,0 @@
1
- module RocketJobMissionControl
2
- module Servers
3
- class IndexFiltersController < RocketJobMissionControl::ApplicationController
4
- before_filter :show_sidebar
5
-
6
- def starting
7
- @servers = RocketJob::Server.starting
8
- @query = RocketJobMissionControl::Query.new(@servers, name: :asc)
9
- respond_to do |format|
10
- format.html
11
- format.json { render(json: ServersDatatable.new(view_context, @query)) }
12
- end
13
- end
14
-
15
- def running
16
- @servers = RocketJob::Server.running
17
- @query = RocketJobMissionControl::Query.new(@servers, name: :asc)
18
- respond_to do |format|
19
- format.html
20
- format.json { render(json: ServersDatatable.new(view_context, @query)) }
21
- end
22
- end
23
-
24
- def paused
25
- @servers = RocketJob::Server.paused
26
- @query = RocketJobMissionControl::Query.new(@servers, name: :asc)
27
- respond_to do |format|
28
- format.html
29
- format.json { render(json: ServersDatatable.new(view_context, @query)) }
30
- end
31
- end
32
-
33
- def stopping
34
- @servers = RocketJob::Server.stopping
35
- @query = RocketJobMissionControl::Query.new(@servers, name: :asc)
36
- respond_to do |format|
37
- format.html
38
- format.json { render(json: ServersDatatable.new(view_context, @query)) }
39
- end
40
- end
41
-
42
- private
43
-
44
- def show_sidebar
45
- @servers_sidebar = true
46
- end
47
- end
48
- end
49
- end
@@ -1,27 +0,0 @@
1
- module RocketJobMissionControl
2
- class CompletedJobsDatatable < JobsDatatable
3
- private
4
-
5
- def data(jobs)
6
- jobs.map do |job|
7
- {
8
- '0' => class_with_link(job),
9
- '1' => h(job.description.try(:truncate, 50)),
10
- '2' => h(job.duration),
11
- '3' => h(completed_ago(job)),
12
- '4' => action_buttons(job),
13
- 'DT_RowClass' => "card callout callout-#{job.state}"
14
- }
15
- end
16
- end
17
-
18
- def sort_column(index)
19
- columns = %w[_type description machine_duration completed_at]
20
- columns[index.to_i]
21
- end
22
-
23
- def completed_ago(job)
24
- "#{RocketJob.seconds_as_duration(Time.now - job.completed_at)} ago"
25
- end
26
- end
27
- end
@@ -1,26 +0,0 @@
1
- module RocketJobMissionControl
2
- class InterruptedJobsDatatable < JobsDatatable
3
- private
4
-
5
- def data(jobs)
6
- jobs.map do |job|
7
- {
8
- '0' => class_with_link(job),
9
- '1' => h(job.description.try(:truncate, 50)),
10
- '2' => h(interrupted_ago(job)),
11
- '3' => action_buttons(job),
12
- 'DT_RowClass' => "card callout callout-#{job.state}"
13
- }
14
- end
15
- end
16
-
17
- def sort_column(index)
18
- columns = %w[_type description completed_at]
19
- columns[index.to_i]
20
- end
21
-
22
- def interrupted_ago(job)
23
- "#{RocketJob.seconds_as_duration(Time.now - job.completed_at)} ago"
24
- end
25
- end
26
- end
@@ -1,23 +0,0 @@
1
- module RocketJobMissionControl
2
- class QueuedJobsDatatable < JobsDatatable
3
- private
4
-
5
- def data(jobs)
6
- jobs.map do |job|
7
- {
8
- '0' => class_with_link(job),
9
- '1' => h(job.description.try(:truncate, 50)),
10
- '2' => h(job.priority),
11
- '3' => h(job.duration),
12
- '4' => action_buttons(job),
13
- 'DT_RowClass' => "card callout callout-#{job.state}"
14
- }
15
- end
16
- end
17
-
18
- def sort_column(index)
19
- columns = %w[_type description priority duration]
20
- columns[index.to_i]
21
- end
22
- end
23
- end
@@ -1,47 +0,0 @@
1
- module RocketJobMissionControl
2
- class RunningJobsDatatable < JobsDatatable
3
- private
4
-
5
- def data(jobs)
6
- jobs.map do |job|
7
- {
8
- '0' => class_with_link(job),
9
- '1' => h(job.description.try(:truncate, 50)),
10
- '2' => progress(job),
11
- '3' => h(job.priority),
12
- '4' => h(started(job)),
13
- '5' => action_buttons(job),
14
- 'DT_RowClass' => "card callout callout-#{job.state}"
15
- }
16
- end
17
- end
18
-
19
- def sort_column(index)
20
- columns = %w[_type description percent_complete priority started_at]
21
- columns[index.to_i]
22
- end
23
-
24
- def progress(job)
25
- if (sub_state = job.attributes['sub_state']) && [:before, :after].include?(sub_state)
26
- <<-EOS
27
- <div class="job-status">
28
- <div class="job-state">
29
- <div class="left">Batch</div>
30
- <div class="right running">#{sub_state}</div>
31
- </div>
32
- </div>
33
- EOS
34
- else
35
- <<-EOS
36
- <div class='progress'>
37
- <div class='progress-bar' style="width: #{job.percent_complete}%;", title="#{job.percent_complete}% complete."></div>
38
- </div>
39
- EOS
40
- end
41
- end
42
-
43
- def started(job)
44
- "#{RocketJob.seconds_as_duration(Time.now - job.started_at)} ago" if job.started_at
45
- end
46
- end
47
- end
@@ -1,31 +0,0 @@
1
- module RocketJobMissionControl
2
- class ScheduledJobsDatatable < JobsDatatable
3
- private
4
-
5
- def data(jobs)
6
- jobs.map do |job|
7
- {
8
- '0' => class_with_link(job),
9
- '1' => h(job.description.try(:truncate, 50)),
10
- '2' => h(time_till_run(job)),
11
- '3' => h(cron_schedule(job)),
12
- '4' => action_buttons(job),
13
- 'DT_RowClass' => "card callout callout-#{job.state}"
14
- }
15
- end
16
- end
17
-
18
- def sort_column(index)
19
- columns = %w[_type description run_at cron_schedule]
20
- columns[index.to_i]
21
- end
22
-
23
- def time_till_run(job)
24
- RocketJob.seconds_as_duration(job.run_at - Time.now)
25
- end
26
-
27
- def cron_schedule(job)
28
- job.cron_schedule if job.respond_to?(:cron_schedule)
29
- end
30
- end
31
- end
@@ -1,20 +0,0 @@
1
- class JobFailures
2
- attr_reader :job_id
3
-
4
- def initialize(job_id)
5
- @job_id = job_id
6
- end
7
-
8
- def job
9
- @job ||= RocketJob::Job.find(job_id)
10
- end
11
-
12
- def list
13
- @slice_errors ||= job.input.group_exceptions
14
- end
15
-
16
- def for_error(error_type, page_offset=0)
17
- query = {'exception.class_name' => error_type}
18
- job.input.failed.where(query).limit(1).skip(page_offset).first
19
- end
20
- end