rocketjob_mission_control 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ff7099675d3802372152b41b82769566fcf3df6
4
- data.tar.gz: d17f574159a6131d1d04205a95f18a489f73807d
3
+ metadata.gz: bf3f175879f9c5c41ad2605e8eb0aadf7b8d421f
4
+ data.tar.gz: b174ffaaea347559f3861637f8d12a0f8f036e67
5
5
  SHA512:
6
- metadata.gz: c33b38c9d1af21c2b95ef9bd07bdb44d214184d35e2e090e13644e805dd1790e5ae31e26d3cf75f26c01ae838af846872fec4f055ee912cc6b6be4fd0839b847
7
- data.tar.gz: ab1f2c52cca08f82134525b78197485a210b863005600ac62542c8ebc8d158ca297263e8e632dfea1ed71f6e80fdf4eda81f2a173d0e132a53dd6a07701464ea
6
+ metadata.gz: 0d3b9d611da368ba9cf1ae20d8f88dcf75bc6ca81e436d53a7de164e7ea7b893bf7d58f11d9c1920b5fd8fe1678481251ba8b811eebfd80e60cc24a5a91ad71a
7
+ data.tar.gz: 8162e76e4b9c41833cc848d68496156ad7128587754acbdb0eb778d6df7cb5532f221d1914fbbfa3aa747942e724d8fd566e34ecd239ef00578f8ba281cd4fae
@@ -8,8 +8,7 @@ $(document).on 'ready', ->
8
8
 
9
9
  if $('#properties').length
10
10
  $('#properties').on 'click', ->
11
- job_class_name = $('#rocket_job_dirmon_entry_job_class_name').val()
12
- perform_method = $('#rocket_job_dirmon_entry_perform_method').val()
13
- new_dirmon_path = $('#properties').data('url') + "?job_class_name=#{job_class_name}&perform_method=#{perform_method}"
11
+ params = $('#new_rocket_job_dirmon_entry').serialize()
12
+ new_dirmon_path = $('#properties').data('url') + "?#{params}"
14
13
  window.location = new_dirmon_path
15
14
 
@@ -12,12 +12,11 @@ module RocketJobMissionControl
12
12
  end
13
13
 
14
14
  def new
15
- job_class_name = params[:job_class_name]
16
- perform_method = params[:perform_method] || :perform
17
- @dirmon_entry = RocketJob::DirmonEntry.new(arguments: nil, job_class_name: job_class_name, perform: perform_method)
15
+ dirmon_params.reverse_merge!(perform_method: :perform)
16
+ @dirmon_entry = RocketJob::DirmonEntry.new(dirmon_params)
18
17
  @previous_job_class_names = RocketJob::DirmonEntry.distinct(:job_class_name)
19
18
 
20
- if job_class_name && !@dirmon_entry.job_class
19
+ if dirmon_params[:job_class_name] && !@dirmon_entry.job_class
21
20
  @dirmon_entry.errors.add(:job_class_name, 'Invalid Job Class')
22
21
  end
23
22
  end
@@ -163,9 +162,9 @@ module RocketJobMissionControl
163
162
 
164
163
  def dirmon_params
165
164
  params
166
- .require(:rocket_job_dirmon_entry)
165
+ .fetch(:rocket_job_dirmon_entry, {})
167
166
  .permit(:name, :archive_directory, :pattern, :job_class_name, :perform_method).tap do |whitelist|
168
- whitelist[:properties] = params[:rocket_job_dirmon_entry][:properties] if params[:rocket_job_dirmon_entry][:properties]
167
+ whitelist[:properties] = params[:rocket_job_dirmon_entry][:properties] if params.fetch(:rocket_job_dirmon_entry, {})[:properties]
169
168
  end
170
169
  end
171
170
 
@@ -4,7 +4,7 @@
4
4
  Menu
5
5
 
6
6
 
7
- = link_to main_app.root_path, class: 'btn btn-default btn-blank last' do
7
+ = link_to '..', class: 'btn btn-default btn-blank last' do
8
8
  %i.fa.fa-reply
9
9
  Back Home
10
10
 
@@ -14,7 +14,7 @@
14
14
  .info
15
15
  .progress
16
16
  .progress-bar{ style: "width: #{job.percent_complete}%; min-width: 1em;", title: "#{job.percent_complete}% percent complete."}
17
- - if job.kind_of?(RocketJob::SlicedJob)
17
+ - if defined?(RocketJob::SlicedJob) && job.kind_of?(RocketJob::SlicedJob)
18
18
  .slice_count
19
19
  %label Slices Running:
20
20
  = job.input.find_all { |s| s.state == :running }.count
@@ -24,7 +24,7 @@
24
24
  = job.worker_name
25
25
 
26
26
  = render partial: 'status', locals: { job: job }
27
- - if job.kind_of?(RocketJob::SlicedJob)
27
+ - if defined?(RocketJob::SlicedJob) && job.kind_of?(RocketJob::SlicedJob)
28
28
  %table.table
29
29
  %tr
30
30
  %th worker
@@ -46,7 +46,7 @@
46
46
  - if valid_events.include?(:retry)
47
47
  = job_action_link('retry', rocket_job_mission_control.retry_job_path(@job), :patch)
48
48
 
49
- - if @job.failed? && @job.kind_of?(RocketJob::SlicedJob) && @job.input.failed_count > 0
49
+ - if @job.failed? && defined?(RocketJob::SlicedJob) && @job.kind_of?(RocketJob::SlicedJob) && @job.input.failed_count > 0
50
50
  = link_to("view errors", job_failures_path(@job), class: 'btn btn-default')
51
51
 
52
52
  .clearfix
@@ -1,3 +1,3 @@
1
1
  module RocketJobMissionControl
2
- VERSION = '1.2.3'
2
+ VERSION = '1.2.4'
3
3
  end
@@ -108,27 +108,39 @@ module RocketJobMissionControl
108
108
  expect(assigns(:dirmon_entry)).to_not be_persisted
109
109
  end
110
110
 
111
- context 'with a valid job_class_name' do
112
- let(:entry_params) { { job_class_name: 'FakeButGoodJob' } }
111
+ context 'with form params' do
112
+ let(:entry_params) { { rocket_job_dirmon_entry: { name: 'new entry' } } }
113
113
 
114
114
  it { expect(response.status).to eq(200) }
115
115
 
116
- it 'assigns the job class' do
116
+ it 'assigns the params to new entry' do
117
117
  expect(assigns(:dirmon_entry)).to be_present
118
- expect(assigns(:dirmon_entry).job_class).to eq(FakeButGoodJob)
118
+ expect(assigns(:dirmon_entry).name).to eq('new entry')
119
119
  end
120
- end
121
120
 
122
- context 'with an invalid job_class_name' do
123
- let(:entry_params) { { job_class_name: 'BadJob' } }
121
+ context 'with a valid job_class_name' do
122
+ let(:entry_params) { { rocket_job_dirmon_entry: { job_class_name: 'FakeButGoodJob' } } }
124
123
 
125
- it { expect(response.status).to eq(200) }
124
+ it { expect(response.status).to eq(200) }
126
125
 
127
- it 'adds an error' do
128
- expect(assigns(:dirmon_entry)).to be_present
129
- expect(assigns(:dirmon_entry).errors[:job_class_name]).to be_present
126
+ it 'assigns the job class' do
127
+ expect(assigns(:dirmon_entry)).to be_present
128
+ expect(assigns(:dirmon_entry).job_class).to eq(FakeButGoodJob)
129
+ end
130
+ end
131
+
132
+ context 'with an invalid job_class_name' do
133
+ let(:entry_params) { { rocket_job_dirmon_entry: { job_class_name: 'BadJob' } } }
134
+
135
+ it { expect(response.status).to eq(200) }
136
+
137
+ it 'adds an error' do
138
+ expect(assigns(:dirmon_entry)).to be_present
139
+ expect(assigns(:dirmon_entry).errors[:job_class_name]).to be_present
140
+ end
130
141
  end
131
142
  end
143
+
132
144
  end
133
145
 
134
146
  describe 'PATCH #update' do
@@ -1,4 +0,0 @@
1
- MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production.
2
- MONGODB (0.5ms) admin['$cmd'].find({:isMaster=>1}).limit(-1)
3
- MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production.
4
- MONGODB (0.4ms) admin['$cmd'].find({:isMaster=>1}).limit(-1)