sidekiq-scheduler-manager 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq-scheduler-manager/version.rb +1 -1
- data/lib/sidekiq-scheduler-manager/web.rb +9 -10
- data/web/views/scheduler.html.erb +11 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09ed7b7fda3248c577ed15c12385d4719ada2025
|
4
|
+
data.tar.gz: 154e509a45c26d5249b16baaed2826e7070fd362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b84a9763544b9be365eb1eaa4151a0bdc540a95e12ede266cf368995350c21fd57c9a3f12bcc8918ae6ebf25c39f9f4aa4f8eb64176a7877341e50f7efae700
|
7
|
+
data.tar.gz: 1cf41c188a01439aa35ed5ed39ee18f56ec38493c9b444a6897f1df778c036e27798f7f6a29691dd536965aeed321aafe8ea39676e52a9bc0280e22f944714f3
|
@@ -141,21 +141,20 @@ module SidekiqSchedulerManager
|
|
141
141
|
end
|
142
142
|
|
143
143
|
app.get '/schedulers/export' do
|
144
|
+
result = Array.new
|
144
145
|
schedulers = Sidekiq.get_all_schedules
|
145
|
-
|
146
|
-
|
147
|
-
hash[key] = value
|
146
|
+
schedulers.each do |scheduler|
|
147
|
+
result.push(scheduler)
|
148
148
|
end
|
149
|
-
|
150
|
-
|
151
|
-
# send_data JSON.pretty_generate(hash), filename: "schedule.json", disposition: "attachment", :content_type => 'application/json'
|
152
|
-
redirect "#{root_path}schedulers"
|
149
|
+
[200, { "Content-Type" => "application/octet-stream", "Content-Disposition" => "attachment", "filename" => "sidekiq_schedule.json" }, [JSON.pretty_generate(result)]]
|
153
150
|
end
|
154
151
|
|
155
|
-
app.
|
156
|
-
|
157
|
-
|
152
|
+
app.post '/schedulers/import' do
|
153
|
+
# puts params
|
154
|
+
tmpfile = params[:file][:tempfile]
|
155
|
+
file = tmpfile.read
|
158
156
|
|
157
|
+
data_hash = JSON.parse(file)
|
159
158
|
data_hash.each do |job_name, data|
|
160
159
|
unless job_name.to_s.strip.empty?
|
161
160
|
Sidekiq.set_schedule(job_name, data)
|
@@ -4,15 +4,17 @@
|
|
4
4
|
<table class="table table-hover table-bordered table-striped table-white">
|
5
5
|
<thead>
|
6
6
|
<tr>
|
7
|
-
<
|
8
|
-
<%=
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
<form action="<%= root_path %>schedulers/import" accept-charset="UTF-8" enctype="multipart/form-data" method="post">
|
8
|
+
<%= csrf_tag %>
|
9
|
+
<a class="btn" href="schedulers/new">
|
10
|
+
<%= t('Create') %>
|
11
|
+
</a>
|
12
|
+
<a class="btn" href="schedulers/export">
|
13
|
+
<%= t('Export') %>
|
14
|
+
</a>
|
15
|
+
<label for="file" class="btn">Import</label>
|
16
|
+
<input type="file" name="file" id="file" style="visibility:hidden;" onchange="this.form.submit()" />
|
17
|
+
</form>
|
16
18
|
</tr>
|
17
19
|
<tr>
|
18
20
|
<th><%= t('name') %></th>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-scheduler-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vudn-job
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|