sk_progress_bar 0.1.3 → 0.1.5
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.
- checksums.yaml +4 -4
- data/README.md +27 -4
- data/lib/generators/sk_progress_bar/channel/templates/sk_progress_bar.coffee +10 -4
- data/lib/sk_progress_bar/version.rb +1 -1
- data/lib/sk_progress_bar.rb +2 -2
- data/sk_progress_bar.gemspec +1 -2
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7ccf35a4ba8b14dd5aea9d31a21aa1062e38426b0daac2bbab98ed22ec58795
|
4
|
+
data.tar.gz: 5a15ba4a196b708bfc202f2bf7c71f7702c3f1e79662bdcf64ffc6e67b7b57be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0e3105383fa86646056f274257f3ad4ca910ac8079152bd6a45ea08db68b3c70010e4258722168dbb937a263bd9e264f280007573df28b56f6f644ecf38e1c8
|
7
|
+
data.tar.gz: 2be5ecd03799643e30ad929ddc62b21de16c41b316467ad0bca7c763eedc27bb611bb480b6ab7085c9c31b3b5756fabc9ce520d985ef04a5b2e6f4ebd0b278ef
|
data/README.md
CHANGED
@@ -35,9 +35,9 @@ Or install it yourself as:
|
|
35
35
|
|
36
36
|
## Required gems
|
37
37
|
gem 'sidekiq'
|
38
|
-
|
39
|
-
gem 'bootstrap'
|
38
|
+
gem 'bootstrap', '~> 4.3.1'
|
40
39
|
# "Boostrap" need if you will use progress bar from "bootstrap"
|
40
|
+
|
41
41
|
## Usage
|
42
42
|
require 'sk_progress_bar'
|
43
43
|
|
@@ -54,17 +54,28 @@ Or install it yourself as:
|
|
54
54
|
SkProgressBar.create_update_db(progress[:percentage], progress[:message], jid)
|
55
55
|
# Create/Update Record in DB
|
56
56
|
|
57
|
+
## Example Html Code
|
58
|
+
<progress id="sk_progress_bar" value="22" max="2"></progress>
|
59
|
+
|
57
60
|
## Example Html Code with Bootstrap
|
58
61
|
<div class="progress">
|
59
|
-
<div class="progress-bar progress-bar-striped" role="progressbar" style="width: 2%" aria-valuenow="10" aria-valuemin="2" aria-valuemax="100"></div>
|
62
|
+
<div class="progress-bar progress-bar-striped" id="sk_progress_bar" role="progressbar" style="width: 2%" aria-valuenow="10" aria-valuemin="2" aria-valuemax="100"></div>
|
60
63
|
</div>
|
61
64
|
|
62
65
|
## Example Haml Code with Bootstrap
|
63
66
|
.progress
|
64
67
|
.progress-bar.progress-bar-striped{"aria-valuemax" => "100", "aria-valuemin" => "2", "aria-valuenow" => "10", :role => "progressbar", :style => "width: 2%"}
|
65
68
|
|
69
|
+
## Example for Update Progress Bar
|
70
|
+
SkProgressBar.update_progress_bar('99', 'test message', 'sidekiq jid')
|
71
|
+
|
72
|
+
## Coffee Script (Active Cable)
|
73
|
+
All changes about javascript, coffee script, you can implement in this file!
|
74
|
+
"app/assets/javascripts/channels/sk_progress_bar.coffee"
|
75
|
+
|
76
|
+
All data in HTML page updating from this coffee file, please check this file if you want to add new js functionality!
|
66
77
|
|
67
|
-
## Example
|
78
|
+
## Example Code for "SidekiqWorker"
|
68
79
|
/app/workers/progress_bar_worker.rb
|
69
80
|
|
70
81
|
|
@@ -107,6 +118,18 @@ Or install it yourself as:
|
|
107
118
|
|
108
119
|
"Example: SkProgressBar.create_update_db(progress[:percentage], progress[:message], jid)"
|
109
120
|
|
121
|
+
## Possible Issues and Solution
|
122
|
+
If you Action Cable doesn't work.
|
123
|
+
|
124
|
+
A possible solution for your problem will be to change the settings in 'config/cable.yml' to these
|
125
|
+
|
126
|
+
redis: &redis
|
127
|
+
adapter: redis
|
128
|
+
url: redis://localhost:6379/1
|
129
|
+
production: *redis
|
130
|
+
development: *redis
|
131
|
+
test: *redis
|
132
|
+
|
110
133
|
## Development
|
111
134
|
|
112
135
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -6,14 +6,20 @@ App.sk_progress_bar = App.cable.subscriptions.create "SkProgressBarChannel",
|
|
6
6
|
# Called when the subscription has been terminated by the server
|
7
7
|
|
8
8
|
received: (data) ->
|
9
|
-
|
9
|
+
# Example: "data" variable => "message"=>"Almost done", "sk_process_id"=>"ea5d1b09c0d8538bc1b571be", "progress_status"=>50
|
10
10
|
progress_status = data.progress_status
|
11
11
|
# sk_process_id - Sidekiq Job Id
|
12
12
|
# $('.progress-bar') can be replaced to sk_process_id or any other business logic
|
13
13
|
|
14
14
|
# Example: $("##{data.sk_process_id}").attr('aria-valuenow', progress_status).css 'width', progress_status + '%'
|
15
|
-
$(".progress-bar").attr('aria-valuenow', progress_status).css 'width', progress_status + '%'
|
15
|
+
# $(".progress-bar").attr('aria-valuenow', progress_status).css 'width', progress_status + '%'
|
16
16
|
|
17
17
|
# For add percentage inside in progress bar
|
18
|
-
$(".progress-bar").text(progress_status + '%')
|
19
|
-
# Called when there's incoming data on the websocket for this channel
|
18
|
+
# $(".progress-bar").text(progress_status + '%')
|
19
|
+
# Called when there's incoming data on the websocket for this channel
|
20
|
+
|
21
|
+
document.getElementById("sk_progress_bar").max = progress_status
|
22
|
+
# Update progress bar without jquery and bootstrap
|
23
|
+
|
24
|
+
document.getElementById("sk_progress_bar").style.width = progress_status + '%'
|
25
|
+
# Update bootstrap progress bar without jquery
|
data/lib/sk_progress_bar.rb
CHANGED
@@ -10,9 +10,9 @@ module SkProgressBar
|
|
10
10
|
# Update Progress Bar
|
11
11
|
def self.update_progress_bar(percentage, message, jid=nil)
|
12
12
|
ActionCable.server.broadcast 'sk_progress_bar_channel',
|
13
|
+
progress_status: percentage,
|
13
14
|
message: message,
|
14
|
-
sk_process_id: jid
|
15
|
-
progress_status: percentage
|
15
|
+
sk_process_id: jid
|
16
16
|
end
|
17
17
|
|
18
18
|
# Return Percentage and Message result of cycle
|
data/sk_progress_bar.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["andriy.kondzolko"]
|
10
10
|
spec.email = ["kondzolko@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{Progress bar for Sidekiq Workers}
|
12
|
+
spec.summary = %q{Progress bar for Sidekiq Workers or any backend process}
|
13
13
|
spec.description = %q{Gem 'Sidekiq-progress-bar' will help to show the current stage in the work of a Sidekiq worker in the form of a progress bar!}
|
14
14
|
spec.homepage = "https://github.com/Kondzolko/sk_progress_bar"
|
15
15
|
spec.license = "MIT"
|
@@ -39,5 +39,4 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_development_dependency "bundler", "~> 2.0"
|
40
40
|
spec.add_development_dependency "rake", "~> 10.0"
|
41
41
|
spec.add_development_dependency "rspec", "~> 3.0"
|
42
|
-
spec.add_development_dependency "sidekiq"
|
43
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sk_progress_bar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andriy.kondzolko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: sidekiq
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
description: Gem 'Sidekiq-progress-bar' will help to show the current stage in the
|
70
56
|
work of a Sidekiq worker in the form of a progress bar!
|
71
57
|
email:
|
@@ -122,5 +108,5 @@ requirements: []
|
|
122
108
|
rubygems_version: 3.0.3
|
123
109
|
signing_key:
|
124
110
|
specification_version: 4
|
125
|
-
summary: Progress bar for Sidekiq Workers
|
111
|
+
summary: Progress bar for Sidekiq Workers or any backend process
|
126
112
|
test_files: []
|