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
@@ -38,5 +38,63 @@ module RocketJobMissionControl
38
38
  json_string_options = {space: ' ', indent: ' ', array_nl: '<br />', object_nl: '<br />'}
39
39
  JSON.generate(arguments, json_string_options).html_safe
40
40
  end
41
+
42
+ # Returns [Array] list of inclusion values for this attribute.
43
+ # Returns nil when there are no inclusion values for this attribute.
44
+ def extract_inclusion_values(klass, attribute)
45
+ values = nil
46
+ klass.validators_on(attribute).each do |validator|
47
+ case validator
48
+ when ActiveModel::Validations::InclusionValidator
49
+ values = validator.options[:in]
50
+ end
51
+ end
52
+ values
53
+ end
54
+
55
+ # Returns the editable field as html for use in editing dynamic fields from a Job class.
56
+ def editable_field_html(klass, field_name, value, f, include_nil_selectors = false)
57
+ field = klass.fields[field_name.to_s]
58
+ return unless field && field.type
59
+
60
+ placeholder = field.default_val
61
+ placeholder = nil if placeholder.is_a?(Proc)
62
+
63
+ case field.type.name
64
+ when 'Symbol', 'String', 'Integer'
65
+ options = extract_inclusion_values(klass, field_name)
66
+ str = "[#{field.type.name}]\n".html_safe
67
+ if options
68
+ str + f.select(field_name, options, {include_blank: options.include?(nil) || include_nil_selectors, selected: value}, {class: 'form-control'})
69
+ else
70
+ if field.type.name == 'Integer'
71
+ str + f.number_field(field_name, value: value, class: 'form-control', placeholder: placeholder)
72
+ else
73
+ str + f.text_field(field_name, value: value, class: 'form-control', placeholder: placeholder)
74
+ end
75
+ end
76
+ when 'Hash'
77
+ "[JSON Hash]\n".html_safe +
78
+ f.text_field(field_name, value: value ? value.to_json : '', class: 'form-control', placeholder: '{"key1":"value1", "key2":"value2", "key3":"value3"}')
79
+ when 'Array'
80
+ options = Array(value)
81
+ "[Array]\n".html_safe +
82
+ f.select(field_name, options_for_select(options, options), {include_hidden: false}, {class: 'selectize', multiple: true})
83
+ when 'Mongoid::Boolean'
84
+ name = "#{field_name}_true".to_sym
85
+ str = '<div class="radio-buttons">'.html_safe
86
+ str << f.label(name, 'true')
87
+ str << f.radio_button(field_name, 'true', checked: value == 'true')
88
+ str << f.label(name, 'false')
89
+ str << f.radio_button(field_name, 'false', checked: value == 'false')
90
+ str << f.label(name, 'none')
91
+ str << f.radio_button(field_name, '', checked: value.blank?)
92
+ str << '</div>'.html_safe
93
+ else
94
+ "[#{field.type.name}]".html_safe +
95
+ f.text_field(field_name, value: value, class: 'form-control', placeholder: placeholder)
96
+ end
97
+ end
98
+
41
99
  end
42
100
  end
@@ -10,9 +10,21 @@ module RocketJobMissionControl
10
10
  state_icon(state)
11
11
  end
12
12
 
13
+ def job_states
14
+ @job_states ||= RocketJob::Job.aasm.states.map { |state| state.name.to_s }
15
+ end
16
+
17
+ def job_states_with_scheduled
18
+ @job_states_with_scheduled ||= ['scheduled'] + job_states
19
+ end
20
+
13
21
  def job_counts_by_state(state)
14
- state = 'queued_now' if state == 'queued'
15
- RocketJob::Job.counts_by_state.fetch(state.downcase.to_sym, 0)
22
+ @job_counts ||= begin
23
+ counts = RocketJob::Job.counts_by_state
24
+ counts[:queued] = counts[:queued_now] || 0
25
+ counts
26
+ end
27
+ @job_counts.fetch(state.downcase.to_sym, 0)
16
28
  end
17
29
 
18
30
  def job_action_link(action, path, http_method=:get)
@@ -20,16 +32,12 @@ module RocketJobMissionControl
20
32
  action,
21
33
  path,
22
34
  method: http_method,
23
- title: "#{action} job",
35
+ title: "#{action} job",
24
36
  class: 'btn btn-default',
25
37
  data: {confirm: t(:confirm, scope: [:job, :action], action: action)}
26
38
  )
27
39
  end
28
40
 
29
- def job_states
30
- @job_states ||= RocketJob::Job.aasm.states.map { |state| state.name.to_s }
31
- end
32
-
33
41
  def job_selected_class(job, selected_job)
34
42
  if selected_job.present? && job.id == selected_job.id
35
43
  'selected'
@@ -1,7 +1,7 @@
1
1
  module RocketJobMissionControl
2
2
  module ServersHelper
3
3
  def server_counts_by_state(state)
4
- RocketJob::Server.counts_by_state.fetch(state.downcase.to_sym, 0)
4
+ @server_counts.fetch(state.downcase.to_sym, 0)
5
5
  end
6
6
 
7
7
  def server_icon(server)
@@ -0,0 +1,47 @@
1
+ module RocketJobMissionControl
2
+ module JobSanitizer
3
+
4
+ # Returns [Hash] the permissible params for the specified job class, after sanitizing.
5
+ # Parameters
6
+ # properties [Hash]
7
+ # Parameters to extract the values from.
8
+ #
9
+ # job_class [RocketJob::Job]
10
+ # Job class from which the user editable fields and types will be retrieved.
11
+ #
12
+ # target [ActiveModel::Base]
13
+ # Model to set the errors on.
14
+ #
15
+ # nil_blank [Boolean]
16
+ # true: Nil out blank fields.
17
+ # false: Do not return blank fields.
18
+ # Default: true
19
+ def self.sanitize(properties, job_class, target, nil_blank = true)
20
+ permissible_params = {}
21
+ job_class.user_editable_fields.each do |field_name|
22
+ if value = properties[field_name]
23
+ field = job_class.fields[field_name.to_s]
24
+ next unless field && field.type
25
+
26
+ case field.type.name
27
+ when 'Hash'
28
+ begin
29
+ value = value.blank? ? nil : JSON.parse(value)
30
+ rescue JSON::ParserError => e
31
+ target.errors.add(:properties, e.message)
32
+ end
33
+ end
34
+
35
+ if value.blank? && !value.is_a?(Hash)
36
+ permissible_params[field_name] = nil if nil_blank
37
+ else
38
+ permissible_params[field_name] = value
39
+ end
40
+
41
+ end
42
+ end
43
+ permissible_params
44
+ end
45
+
46
+ end
47
+ end
@@ -1,16 +1,36 @@
1
1
  module RocketJobMissionControl
2
2
  class Query
3
- attr_reader :scope, :default_order
4
- attr_accessor :search_term, :order_by, :search_term, :start, :page_size,
3
+ attr_reader :scope
4
+ attr_accessor :search_term, :order_by, :start, :page_size,
5
5
  :search_columns, :display_columns
6
6
 
7
- def initialize(scope, default_order = {})
7
+ def initialize(scope, order_by = nil)
8
8
  @scope = scope
9
- @order_by = @default_order = default_order
9
+ @order_by = order_by
10
10
  @search_columns = []
11
11
  @display_columns = []
12
12
  end
13
13
 
14
+ # Returns the filtered query expression with the sort applied
15
+ def query
16
+ # Sort must be applied last
17
+ order_by ? unsorted_query.sort(order_by) : unsorted_query
18
+ end
19
+
20
+ # Count after applying search_term.
21
+ # Pagination settings do not affect this count.
22
+ def count
23
+ unsorted_query.count
24
+ end
25
+
26
+ # Count before applying search term
27
+ # Pagination settings do not affect this count.
28
+ def unfiltered_count
29
+ scope.count
30
+ end
31
+
32
+ private
33
+
14
34
  # Returns the filtered query expression
15
35
  def unsorted_query
16
36
  records = scope
@@ -33,19 +53,5 @@ module RocketJobMissionControl
33
53
  records
34
54
  end
35
55
 
36
- # Returns the filtered query expression with the sort applied
37
- def query
38
- # Sort must be applied last
39
- order_by ? unsorted_query.sort(order_by) : unsorted_query
40
- end
41
-
42
- def count
43
- unsorted_query.count
44
- end
45
-
46
- def unfiltered_count
47
- scope.count
48
- end
49
-
50
56
  end
51
57
  end
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= title %></title>
5
+
6
+ <link href="/assets/favicon.png" rel="icon" type="image/png">
7
+ <link href="/assets/apple-touch-icon.png" rel="apple-touch-icon-precomposed">
8
+
9
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
10
+ <meta content="text/javascript" http-equiv="Content-Script-Type">
11
+ <meta content="IE=edge" http-equiv="X-UA-Compatible">
12
+ <meta content="width=device-width, initial-scale=1" name="viewport">
13
+ <%= yield :meta %>
14
+
15
+ <%= stylesheet_link_tag "rocket_job_mission_control/application", :media => "all" %>
16
+ <%= javascript_include_tag "rocket_job_mission_control/application" %>
17
+
18
+ <%= csrf_meta_tag %>
19
+
20
+ <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
21
+ </head>
22
+
23
+ <body class="rocket_job">
24
+ <div id="wrapper">
25
+ <div class="container-fluid">
26
+ <div class="row row-offcanvas row-offcanvas-left">
27
+ <%= render partial: 'layouts/rocket_job_mission_control/partials/sidebar' %>
28
+
29
+ <div class="col-sm-10 col-xs-11 white-background" id="main">
30
+ <%= render partial: 'layouts/rocket_job_mission_control/partials/header' %>
31
+
32
+ <div id="content">
33
+ <%= render partial: 'layouts/rocket_job_mission_control/partials/flash' %>
34
+
35
+ <%= yield %>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+
42
+ </body>
43
+ </html>
@@ -0,0 +1,20 @@
1
+ <% if flash.present? %>
2
+ <div class="flash text-center">
3
+ <% flash.each do |key, msg| %>
4
+ <div class="alert alert-alert alert-dismissable" role="alert">
5
+ <button class="close" data-dismiss="alert">
6
+ <span>&times;</span>
7
+ </button>
8
+ <% if msg.kind_of? Array %>
9
+ <ul class="list-unstyled margin-bottom-0">
10
+ <% msg.each do |m| %>
11
+ <li><%= m.html_safe %></li>
12
+ <% end %>
13
+ </ul>
14
+ <% else %>
15
+ <%= msg.html_safe %>
16
+ <% end %>
17
+ </div>
18
+ <% end %>
19
+ </div>
20
+ <% end %>
@@ -0,0 +1,45 @@
1
+ <nav class="navbar navbar-default" id="header">
2
+ <div class="container-fluid">
3
+ <div class="navbar-header">
4
+ <button aria-expanded="false" class="navbar-toggle collapsed" data-target=".navbar-collapse" data-toggle="collapse" type="button">
5
+ <span class="sr-only">Toggle navigation</span>
6
+ <span class="icon-bar"></span>
7
+ <span class="icon-bar"></span>
8
+ <span class="icon-bar"></span>
9
+ </button>
10
+ <a class="navbar-brand brand" href="http://rocketjob.io" target="_blank">
11
+ <img src="/assets/rocket_job_mission_control/rocket-icon-64x64.png" alt="Rocket icon 64x64">
12
+ Rocket Job
13
+ </a>
14
+ </div>
15
+ <div class="navbar-collapse collapse">
16
+ <ul class="nav navbar-nav">
17
+ <li>
18
+ <%= link_to running_jobs_path, class: active_page(running_jobs_path) do %>
19
+ <i class="fa fa-home"></i> Jobs
20
+ <% end %>
21
+ </li>
22
+ <li>
23
+ <%= link_to servers_path, class: active_page(servers_path) do %>
24
+ <i class="fa fa-database"></i> Servers
25
+ <% end %>
26
+ </li>
27
+ <li>
28
+ <%= link_to active_workers_path, class: active_page(active_workers_path) do %>
29
+ <i class="fa fa-circle-o-notch"></i> Workers
30
+ <% end %>
31
+ </li>
32
+ <li>
33
+ <%= link_to enabled_dirmon_entries_path, class: active_page(enabled_dirmon_entries_path) do %>
34
+ <i class="fa fa-folder-o"></i> Directory Monitoring
35
+ <% end %>
36
+ </li>
37
+ </ul>
38
+ <ul class="nav navbar-nav navbar-right">
39
+ <li>
40
+ <a href="/">Home</a>
41
+ </li>
42
+ </ul>
43
+ </div>
44
+ </div>
45
+ </nav>
@@ -0,0 +1,12 @@
1
+ <div class="col-sm-2 col-xs-1 sidebar-offcanvas" id="sidebar">
2
+ <ul class="nav">
3
+ <li>
4
+ <a class="visible-xs" data-toggle="offcanvas" href="#">
5
+ <i class="fa fa-chevron-right"></i>
6
+ </a>
7
+ </li>
8
+ </ul>
9
+ <%= render partial: 'rocket_job_mission_control/jobs/sidebar' if @jobs_sidebar %>
10
+ <%= render partial: 'rocket_job_mission_control/dirmon_entries/sidebar' if @dirmon_sidebar %>
11
+ <%= render partial: 'rocket_job_mission_control/servers/sidebar' if @servers_sidebar %>
12
+ </div>
@@ -0,0 +1,40 @@
1
+ <div class="job-list">
2
+ <div class="list">
3
+ <div class="row">
4
+ <div class="col-sm-10">
5
+ <h2>Active Workers</h2>
6
+ <% if @server_name %>
7
+ <h4><%= " For Server: #{@server_name}" %></h4>
8
+ <% end %>
9
+ <% if @job %>
10
+ <h4> For Job: <%= link_to(@job.class.name, job_path(@job)) %> ID:<%= link_to(@job.id, job_path(@job)) %></h4>
11
+ <% end %>
12
+ </div>
13
+ <div class="col-sm-2">
14
+ <div class="btn btn-default pull-right dt-reload" data-behavior="reload">
15
+ <i class="fa fa-refresh"></i>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ <table class='table datatable active-workers-datatable' data-source='<%= active_workers_url(format: 'json') %>' style='width: 100%'>
20
+ <thead>
21
+ <tr>
22
+ <th>Worker Name</th>
23
+ <th>Class</th>
24
+ <th>Description</th>
25
+ <th>Started</th>
26
+ </tr>
27
+ </thead>
28
+ <tbody></tbody>
29
+ </table>
30
+ </div>
31
+ </div>
32
+
33
+ <script>
34
+ jQuery(function() {
35
+ new RjmcDatatable(
36
+ $('.active-workers-datatable'),
37
+ [{data: '0'}, {data: '1'}, {data: '2'}, {data: '3'}],
38
+ {ordering: false, searching: false});
39
+ });
40
+ </script>
@@ -0,0 +1,60 @@
1
+ <% action ||= :create %>
2
+ <% if @dirmon_entry.errors.present? %>
3
+ <div class="alert alert-alert">Invalid Dirmon entry!</div>
4
+ <% @dirmon_entry.errors.messages.each_pair do |field, message| %>
5
+ <div class="message"><%= field %>: <%= message %></div>
6
+ <% end %>
7
+ <% end %>
8
+ <%= form_for @dirmon_entry, url: {action: action} do |f| %>
9
+ <div class="row">
10
+ <div class="col-md-6">
11
+ <div class="name form-group">
12
+ <%= f.label :name %>
13
+ <%= f.text_field :name, class: 'form-control' %>
14
+ </div>
15
+ </div>
16
+ <div class="col-md-6">
17
+ <div class="job form-group">
18
+ <%= f.label :job_class_name %>
19
+ <%= f.text_field :job_class_name, class: 'form-control', disabled: action != :create %>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ <div class="path form-group">
24
+ <%= f.label :pattern %>
25
+ <%= f.text_field :pattern, class: 'form-control' %>
26
+ </div>
27
+ <div class="path form-group">
28
+ <%= f.label :archive_directory %>
29
+ <%= f.text_field :archive_directory, class: 'form-control' %>
30
+ </div>
31
+ <div class="row">
32
+ <div class="col-md-12">
33
+ <% if @dirmon_entry.job_class %>
34
+ <div class="lead">Job Properties</div>
35
+ <div class="arguments">
36
+ <div class="job_arguments form-group"></div>
37
+ <div class="form-group">
38
+ <%= f.fields_for :properties do |properties| %>
39
+ <% @dirmon_entry.job_class.user_editable_fields.each do |property_name| %>
40
+ <%= properties.label property_name.to_s %>
41
+ <%= editable_field_html(@dirmon_entry.job_class, property_name, @dirmon_entry.properties[property_name], properties, true) %>
42
+ <% end %>
43
+ <% end %>
44
+ </div>
45
+ </div>
46
+ <% end %>
47
+ <div class="buttons pull-right">
48
+ <%= f.submit action, class: 'btn btn-primary' %>
49
+ <%= link_to 'cancel', :back, class: 'btn btn-default' %>
50
+ </div>
51
+ <% if action == :create %>
52
+ <%= button_tag 'properties',
53
+ type: 'button',
54
+ class: 'btn btn-default',
55
+ id: 'properties',
56
+ data: {url: rocket_job_mission_control.new_dirmon_entry_path} %>
57
+ <% end %>
58
+ </div>
59
+ </div>
60
+ <% end %>