sidekiq_web_theme 0.1.0
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 +7 -0
- data/CHANGELOG.md +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/lib/sidekiq_web_theme/middleware.rb +37 -0
- data/lib/sidekiq_web_theme/style.css +64 -0
- data/lib/sidekiq_web_theme/version.rb +5 -0
- data/lib/sidekiq_web_theme.rb +14 -0
- metadata +63 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 64d358a51269b902c1012b0ddfa2e97ac04f06d41064072bc0296bd0e998429f
|
|
4
|
+
data.tar.gz: d1cb6a504babb6b4407a657155ac64345aa8fba511cd0e3d38e2283f751b4bb3
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 31997d80aebf6647ad46db37094b63e4c08f5f1c196acf661842a5dd929fdf85603d4c56a97b7eb215a8671d1ea644af089dba09a540eee153fc8145afae4d91
|
|
7
|
+
data.tar.gz: 77222a512ed17c6c4c3414251174c664f0581b148db3b985ad70916b4eb97a796132eeec91a497e3d0d93abe6deb48ff4bb3a71c5feee37944e63a53ef122a7a
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Umbrellio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# sidekiq_web_theme
|
|
2
|
+
|
|
3
|
+
Usability CSS fixes for the [Sidekiq](https://github.com/sidekiq/sidekiq) Web UI.
|
|
4
|
+
|
|
5
|
+
Starting with Sidekiq 8 the default Web UI layout became less usable on wide
|
|
6
|
+
screens. This gem registers a small Rack middleware on `Sidekiq::Web` that
|
|
7
|
+
injects a stylesheet into the `<head>` of every Web UI page, constraining the
|
|
8
|
+
content width, shrinking oversized fonts, making job arguments scrollable and
|
|
9
|
+
compacting the header/footer.
|
|
10
|
+
|
|
11
|
+
The injected `<style>` tag carries the per-request CSP nonce, so it works with
|
|
12
|
+
Sidekiq's default `style-src 'self' 'nonce-...'` Content-Security-Policy.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
gem "sidekiq_web_theme"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Call `setup!` where `Sidekiq::Web` is mounted (e.g. `config/routes.rb` or your
|
|
23
|
+
Sidekiq initializer), after `sidekiq/web` is required:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require "sidekiq/web"
|
|
27
|
+
require "sidekiq_web_theme"
|
|
28
|
+
|
|
29
|
+
SidekiqWebTheme.setup!
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Customizing the CSS
|
|
33
|
+
|
|
34
|
+
The stylesheet lives in `lib/sidekiq_web_theme/style.css` and is read once at
|
|
35
|
+
load time.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
Released under the [MIT License](LICENSE.txt).
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SidekiqWebTheme
|
|
4
|
+
class Middleware
|
|
5
|
+
def initialize(app)
|
|
6
|
+
@app = app
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def call(env)
|
|
10
|
+
status, headers, body = @app.call(env)
|
|
11
|
+
return [status, headers, body] unless html_response?(headers)
|
|
12
|
+
|
|
13
|
+
html = +""
|
|
14
|
+
body.each { |part| html << part }
|
|
15
|
+
body.close if body.respond_to?(:close)
|
|
16
|
+
|
|
17
|
+
return [status, headers, [html]] unless html.include?("</head>")
|
|
18
|
+
|
|
19
|
+
html = html.sub("</head>", "#{style_tag(env[:csp_nonce])}</head>")
|
|
20
|
+
headers["content-length"] = html.bytesize.to_s
|
|
21
|
+
|
|
22
|
+
[status, headers, [html]]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def style_tag(nonce)
|
|
28
|
+
nonce_attr = nonce ? %( nonce="#{nonce}") : ""
|
|
29
|
+
%(<style type="text/css"#{nonce_attr}>#{SidekiqWebTheme::CSS}</style>)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def html_response?(headers)
|
|
33
|
+
content_type = headers["content-type"] || headers["Content-Type"]
|
|
34
|
+
content_type.to_s.include?("text/html")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
body {
|
|
2
|
+
margin: 0 auto;
|
|
3
|
+
font-size: 13px;
|
|
4
|
+
max-width: 1200px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
div.args {
|
|
8
|
+
font-size: 10px;
|
|
9
|
+
max-height: 100px;
|
|
10
|
+
overflow-y: scroll;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
h1 {
|
|
14
|
+
font-size: 20px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
h2 {
|
|
18
|
+
font-size: 18px
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
article h3 {
|
|
22
|
+
font-size: 15px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
td.num span {
|
|
26
|
+
font-size: 13px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
article .count {
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
div.btn-group, td.num {
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
div.btn-group .btn {
|
|
38
|
+
line-height: 1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
td .btn {
|
|
42
|
+
line-height: 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
body > header {
|
|
46
|
+
height: 36px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
body > header .container {
|
|
50
|
+
padding: 0 10px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
body > footer {
|
|
54
|
+
height: 34px
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
body > footer .container {
|
|
58
|
+
padding: 5px 10px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
::selection {
|
|
62
|
+
background-color: #3399ff;
|
|
63
|
+
color: white;
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "sidekiq_web_theme/version"
|
|
4
|
+
require_relative "sidekiq_web_theme/middleware"
|
|
5
|
+
|
|
6
|
+
module SidekiqWebTheme
|
|
7
|
+
CSS = File.read(File.expand_path("sidekiq_web_theme/style.css", __dir__)).freeze
|
|
8
|
+
|
|
9
|
+
def self.setup!
|
|
10
|
+
Sidekiq::Web.configure do |config|
|
|
11
|
+
config.use(SidekiqWebTheme::Middleware)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sidekiq_web_theme
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Umbrellio
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: sidekiq
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '8'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '8'
|
|
26
|
+
description: Usability CSS fixes for the Sidekiq Web UI, injected via Rack middleware.
|
|
27
|
+
email:
|
|
28
|
+
- oss@umbrellio.biz
|
|
29
|
+
executables: []
|
|
30
|
+
extensions: []
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
files:
|
|
33
|
+
- CHANGELOG.md
|
|
34
|
+
- LICENSE.txt
|
|
35
|
+
- README.md
|
|
36
|
+
- lib/sidekiq_web_theme.rb
|
|
37
|
+
- lib/sidekiq_web_theme/middleware.rb
|
|
38
|
+
- lib/sidekiq_web_theme/style.css
|
|
39
|
+
- lib/sidekiq_web_theme/version.rb
|
|
40
|
+
homepage: https://github.com/umbrellio/sidekiq_web_theme
|
|
41
|
+
licenses:
|
|
42
|
+
- MIT
|
|
43
|
+
metadata:
|
|
44
|
+
homepage_uri: https://github.com/umbrellio/sidekiq_web_theme
|
|
45
|
+
source_code_uri: https://github.com/umbrellio/sidekiq_web_theme
|
|
46
|
+
rdoc_options: []
|
|
47
|
+
require_paths:
|
|
48
|
+
- lib
|
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '3.3'
|
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - ">="
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '0'
|
|
59
|
+
requirements: []
|
|
60
|
+
rubygems_version: 4.0.10
|
|
61
|
+
specification_version: 4
|
|
62
|
+
summary: Usability CSS fixes for the Sidekiq Web UI
|
|
63
|
+
test_files: []
|