stoplight-admin 0.3.5 → 0.4.0.pre1

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
  SHA256:
3
- metadata.gz: 5d85c16c2b5ea07704e3e0eea394fb492cc2fa82ec8aafba27d08cd9e2d05a1c
4
- data.tar.gz: 1614e028fb039c9cfc2f4a7c51eb8285a5117fe2a9f5e95901f9919d6b904cfd
3
+ metadata.gz: ace5002a748d22a3962307104e9c8fa8b66d499923b4d1f8273177136c05b424
4
+ data.tar.gz: e04b845c22c1cfa0111f6744a260111456f3f852be02a16102db2a730143c09f
5
5
  SHA512:
6
- metadata.gz: da7423144b12ec70ff3dda736d7a94d7a4381225bcd2ed1290d0d0e5ef7c88035e63a5d08f14d1ab7f8aa0db278c5c0907741ad9e611b74a4816c4ed1fe34973
7
- data.tar.gz: 90a38bb503295b2c2a8c09275817f1211fb541effad7c57af1e07ac5e738bf7b0728d312b139e30115851e9bb97bb41290b4bb1d4d50b0648fd3e279ec8281a7
6
+ metadata.gz: 9acb82ce2680895afe2fdfb9ba82c38c73945fd548bbaf58c8ca93ee363612c8729ca3be8445f542460b81aa9d6b42a66ee3079c264452314261bca3e1060d35
7
+ data.tar.gz: c6076049c06185f4bd47e9c4299b860f51152cbca9484466e4654f71fe5bf67ea5e4b2293eb9db96874a0a2f276f471c6b37e33d9cd8d3881d874fb2d4be10ee
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # [Stoplight Admin][1]
2
2
 
3
3
  [![Gem version][7]][8]
4
- [![Dependency status][9]][10]
5
4
 
6
5
  A simple administration interface for [stoplight][2]. Monitor the
7
6
  status, failures, and invocations of your stoplights. Change
@@ -33,6 +32,15 @@ example using a local Redis data store:
33
32
  ``` rb
34
33
  # app.rb
35
34
 
35
+ require 'bundler/inline'
36
+
37
+ gemfile do
38
+ source 'https://rubygems.org'
39
+
40
+ gem 'webrick'
41
+ gem 'stoplight-admin'
42
+ end
43
+
36
44
  require 'redis'
37
45
  require 'sinatra'
38
46
  require 'sinatra/stoplight_admin'
@@ -86,13 +94,11 @@ end
86
94
  Stoplight is brought to you by [@camdez][4] and [@tfausak][5] from
87
95
  [@OrgSync][6].
88
96
 
89
- [1]: https://github.com/orgsync/stoplight-admin
90
- [2]: https://github.com/orgsync/stoplight
97
+ [1]: https://github.com/bolshakov/stoplight-admin
98
+ [2]: https://github.com/bolshakov/stoplight
91
99
  [3]: http://bundler.io
92
100
  [4]: https://github.com/camdez
93
101
  [5]: https://github.com/tfausak
94
102
  [6]: https://github.com/OrgSync
95
103
  [7]: https://badge.fury.io/rb/stoplight-admin.svg
96
104
  [8]: https://rubygems.org/gems/stoplight-admin
97
- [9]: https://gemnasium.com/orgsync/stoplight-admin.svg
98
- [10]: https://gemnasium.com/orgsync/stoplight-admin
@@ -1,6 +1,5 @@
1
1
  # coding: utf-8
2
2
 
3
- require 'haml'
4
3
  require 'sinatra/base'
5
4
  require 'sinatra/json'
6
5
  require 'stoplight'
@@ -103,7 +102,7 @@ module Sinatra
103
102
 
104
103
  def with_lights
105
104
  [*params[:names]]
106
- .map { |l| URI.unescape(l) }
105
+ .map { |l| CGI.unescape(l) }
107
106
  .each { |l| yield(l) }
108
107
  end
109
108
  end
@@ -118,7 +117,7 @@ module Sinatra
118
117
  ls = lights
119
118
  stats = stat_params(ls)
120
119
 
121
- haml :index, locals: stats.merge(lights: ls)
120
+ erb :index, locals: stats.merge(lights: ls)
122
121
  end
123
122
 
124
123
  app.get '/stats' do
@@ -0,0 +1,120 @@
1
+ <div class="jumbotron hidden-xs hidden-sm">
2
+ <h1>&#x1f6a6; All of the Lights</h1>
3
+ <p>Cop lights, flashlights, spotlights, strobe lights&hellip;</p>
4
+ </div>
5
+
6
+ <div class="main">
7
+ <% if lights.empty? %>
8
+ <div class="alert alert-warning" role="alert">
9
+ <strong>No lights found.</strong>
10
+ Ensure that your Stoplight data store is properly configured and that your Stoplight blocks have been run.
11
+ </div>
12
+ <% else %>
13
+ <div class="well">
14
+ <form method="post" action="<%= url('/green_all') %>">
15
+ <button class="btn-lg btn btn-success"
16
+ type="submit"
17
+ <%= count_red + count_yellow > 0 ? nil : "disabled" %>>
18
+ Greenify All
19
+ </button>
20
+ </form>
21
+ </div>
22
+
23
+ <div class="progress">
24
+ <div class="progress-bar progress-bar-danger" style="width: <%= percent_red %>%">
25
+ <span><%= count_red %></span>
26
+ </div>
27
+ <div class="progress-bar progress-bar-warning" style="width: <%= percent_yellow %>%">
28
+ <span><%= count_yellow %></span>
29
+ </div>
30
+ <div class="progress-bar progress-bar-success" style="width: <%= percent_green %>%">
31
+ <span><%= count_green %></span>
32
+ </div>
33
+ </div>
34
+
35
+ <div class="lights">
36
+ <table class="table table-hover">
37
+ <thead class="hidden-xs">
38
+ <tr>
39
+ <th>Status</th>
40
+ <th>
41
+ <abbr title="Locked lights will not change color automatically.">Locked?</abbr>
42
+ </th>
43
+ <th>Name</th>
44
+ <th>
45
+ <abbr title="Exceptions which caused the light to turn red.">Failures</abbr>
46
+ </th>
47
+ </tr>
48
+ </thead>
49
+ <tbody>
50
+ <% lights.each do |l| %>
51
+ <tr>
52
+ <td class="indicator">
53
+ <% if l[:color] == GREEN %>
54
+ <form method="post" action="<%= url('/red') %>">
55
+ <input type="hidden" name="names" value="<%= ERB::Util.html_escape(l[:name]) %>">
56
+ <button type="submit" class="btn btn-success">
57
+ <span>G</span><span class="hidden-xs">REEN</span>
58
+ </button>
59
+ </form>
60
+ <% elsif l[:color] == YELLOW %>
61
+ <form method="post" action="<%= url('/green') %>">
62
+ <input type="hidden" name="names" value="<%= ERB::Util.html_escape(l[:name]) %>">
63
+ <button type="submit" class="btn btn-warning">
64
+ <span>Y</span><span class="hidden-xs">ELLOW</span>
65
+ </button>
66
+ </form>
67
+ <% else %>
68
+ <form method="post" action="<%= url('/green') %>">
69
+ <input type="hidden" name="names" value="<%= ERB::Util.html_escape(l[:name]) %>">
70
+ <button type="submit" class="btn btn-danger">
71
+ <span>R</span><span class="hidden-xs">ED</span>
72
+ </button>
73
+ </form>
74
+ <% end %>
75
+ </td>
76
+ <td class="locked">
77
+ <% if l[:locked] %>
78
+ <form method="post" action="<%= url('/unlock') %>">
79
+ <input type="hidden" name="names" value="<%= ERB::Util.html_escape(l[:name]) %>">
80
+ <button type="submit" class="btn btn-link">
81
+ <span class="glyphicon glyphicon-lock"></span>
82
+ </button>
83
+ </form>
84
+ <% else %>
85
+ <form method="post" action="<%= url('/lock') %>">
86
+ <input type="hidden" name="names" value="<%= ERB::Util.html_escape(l[:name]) %>">
87
+ <button type="submit" class="btn btn-link">
88
+ <span class="glyphicon glyphicon-minus"></span>
89
+ </button>
90
+ </form>
91
+ <% end %>
92
+ </td>
93
+ <td class="name">
94
+ <%= l[:name] %>
95
+ </td>
96
+ <td class="failures">
97
+ <% if l[:failures] %>
98
+ <ul>
99
+ <% l[:failures].each do |failure| %>
100
+ <li>
101
+ <span class="error">
102
+ <%= ERB::Util.html_escape(failure.error_class) %>
103
+ \:
104
+ <%= ERB::Util.html_escape(failure.error_message) %>
105
+ </span>
106
+ <span class="timestamp">
107
+ <%= ERB::Util.html_escape(failure.time) %>
108
+ </span>
109
+ </li>
110
+ <% end %>
111
+ </ul>
112
+ <% end %>
113
+ </td>
114
+ </tr>
115
+ <% end %>
116
+ </tbody>
117
+ </table>
118
+ </div>
119
+ <% end %>
120
+ </div>
@@ -0,0 +1,55 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+
7
+ <title>Stoplight Admin</title>
8
+
9
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
10
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
11
+ <link rel="shortcut icon" href="//i.imgur.com/qvfoNuh.png">
12
+
13
+ <style>
14
+ td.indicator {
15
+ font-size: 200%;
16
+ }
17
+
18
+ td.name {
19
+ font-weight: bold;
20
+ }
21
+
22
+ td.locked button {
23
+ font-size: 200%;
24
+ }
25
+
26
+ td.failures span.error {
27
+ font-weight: bold;
28
+ }
29
+
30
+ td.failures ul {
31
+ padding: 0;
32
+ list-style-type: none;
33
+ }
34
+
35
+ .btn-group form {
36
+ display: inline-block;
37
+ }
38
+ </style>
39
+ </head>
40
+ <body>
41
+ <div class="navbar navbar-inverse navbar-static-top" role="navigation">
42
+ <div class="container">
43
+ <div class="navbar-header">
44
+ <a class="navbar-brand" href="<%= url('/') %>">Stoplight Admin</a>
45
+ </div>
46
+ </div>
47
+ </div>
48
+
49
+ <div class="container" role="main">
50
+ <%= yield %>
51
+ </div>
52
+
53
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
54
+ </body>
55
+ </html>
metadata CHANGED
@@ -1,58 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stoplight-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Desautels
8
8
  - Taylor Fausak
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-22 00:00:00.000000000 Z
12
+ date: 2023-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: haml
15
+ name: redis
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 5.0.4
20
+ version: '3.2'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 5.0.4
27
+ version: '3.2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: sinatra-contrib
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 2.0.5
34
+ version: 2.2.3
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 2.0.5
42
- - !ruby/object:Gem::Dependency
43
- name: redis
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '3.2'
49
- type: :runtime
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '3.2'
41
+ version: 2.2.3
56
42
  - !ruby/object:Gem::Dependency
57
43
  name: stoplight
58
44
  requirement: !ruby/object:Gem::Requirement
@@ -67,62 +53,6 @@ dependencies:
67
53
  - - ">="
68
54
  - !ruby/object:Gem::Version
69
55
  version: '1.4'
70
- - !ruby/object:Gem::Dependency
71
- name: bundler
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '1.10'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '1.10'
84
- - !ruby/object:Gem::Dependency
85
- name: pry-byebug
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
89
- - !ruby/object:Gem::Version
90
- version: 3.7.0
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: 3.7.0
98
- - !ruby/object:Gem::Dependency
99
- name: rake
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - "~>"
103
- - !ruby/object:Gem::Version
104
- version: '11.1'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - "~>"
110
- - !ruby/object:Gem::Version
111
- version: '11.1'
112
- - !ruby/object:Gem::Dependency
113
- name: rspec
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - "~>"
117
- - !ruby/object:Gem::Version
118
- version: 3.8.0
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - "~>"
124
- - !ruby/object:Gem::Version
125
- version: 3.8.0
126
56
  description: A simple administration interface for Stoplight.
127
57
  email:
128
58
  - camdez@gmail.com
@@ -134,13 +64,13 @@ files:
134
64
  - LICENSE.md
135
65
  - README.md
136
66
  - lib/sinatra/stoplight_admin.rb
137
- - lib/sinatra/views/index.haml
138
- - lib/sinatra/views/layout.haml
139
- homepage: https://github.com/orgsync/stoplight-admin
67
+ - lib/sinatra/views/index.erb
68
+ - lib/sinatra/views/layout.erb
69
+ homepage: https://github.com/bolshakov/stoplight-admin
140
70
  licenses:
141
71
  - MIT
142
72
  metadata: {}
143
- post_install_message:
73
+ post_install_message:
144
74
  rdoc_options: []
145
75
  require_paths:
146
76
  - lib
@@ -148,15 +78,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
78
  requirements:
149
79
  - - ">="
150
80
  - !ruby/object:Gem::Version
151
- version: 1.9.3
81
+ version: 2.5.0
152
82
  required_rubygems_version: !ruby/object:Gem::Requirement
153
83
  requirements:
154
- - - ">="
84
+ - - ">"
155
85
  - !ruby/object:Gem::Version
156
- version: '0'
86
+ version: 1.3.1
157
87
  requirements: []
158
- rubygems_version: 3.0.3
159
- signing_key:
88
+ rubygems_version: 3.4.6
89
+ signing_key:
160
90
  specification_version: 4
161
91
  summary: A simple administration interface for Stoplight.
162
92
  test_files: []
@@ -1,79 +0,0 @@
1
- .jumbotron.hidden-xs.hidden-sm
2
- %h1 &#x1f6a6; All of the Lights
3
- %p Cop lights, flashlights, spotlights, strobe lights&hellip;
4
-
5
- .main
6
- - if lights.empty?
7
- .alert.alert-warning{role: 'alert'}
8
- %strong No lights found.
9
- Ensure that your Stoplight data store is properly configured and that your Stoplight blocks have been run.
10
- - else
11
- .well
12
- %form{method: 'post', action: url('/green_all')}
13
- %button.btn-lg.btn.btn-success{type: 'submit', disabled: count_red + count_yellow > 0 ? nil : 'disabled'} Greenify All
14
-
15
- .progress
16
- .progress-bar.progress-bar-danger{style: "width: #{percent_red}%"}
17
- .span= count_red
18
- .progress-bar.progress-bar-warning{style: "width: #{percent_yellow}%"}
19
- .span= count_yellow
20
- .progress-bar.progress-bar-success{style: "width: #{percent_green}%"}
21
- .span= count_green
22
-
23
- .lights
24
- %table.table.table-hover
25
- %thead.hidden-xs
26
- %tr
27
- %th Status
28
- %th
29
- %abbr{title: 'Locked lights will not change color automatically.'} Locked?
30
- %th Name
31
- %th
32
- %abbr{title: 'Exceptions which caused the light to turn red.'} Failures
33
- %tbody
34
- - lights.each do |l|
35
- %tr
36
- %td.indicator
37
- - if l[:color] == GREEN
38
- %form{method: 'post', action: url('/red')}
39
- %input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
40
- %button{type: 'submit', class: 'btn btn-success'}
41
- G
42
- %span.hidden-xs> REEN
43
- - elsif l[:color] == YELLOW
44
- %form{method: 'post', action: url('/green')}
45
- %input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
46
- %button{type: 'submit', class: 'btn btn-warning'}
47
- Y
48
- %span.hidden-xs> ELLOW
49
- - else
50
- %form{method: 'post', action: url('/green')}
51
- %input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
52
- %button{type: 'submit', class: 'btn btn-danger'}
53
- R
54
- %span.hidden-xs> ED
55
- %td.locked
56
- - if l[:locked]
57
- %form{method: 'post', action: url('/unlock')}
58
- %input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
59
- %button{type: 'submit', class: 'btn btn-link'}
60
- %span{class: 'glyphicon glyphicon-lock'}
61
- - else
62
- %form{method: 'post', action: url('/lock')}
63
- %input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
64
- %button{type: 'submit', class: 'btn btn-link'}
65
- %span{class: 'glyphicon glyphicon-minus'}
66
- %td.name
67
- = l[:name]
68
- %td.failures
69
- - if l[:failures]
70
- %ul
71
- - l[:failures].each do |failure|
72
- %li
73
- %span.error
74
- &= failure.error_class
75
- \:
76
- &= failure.error_message
77
- @
78
- %span.timestamp
79
- &= failure.time
@@ -1,48 +0,0 @@
1
- !!! 5
2
- %html{lang: 'en'}
3
- %head
4
- %meta{charset: 'utf-8'}
5
- %meta{name: 'viewport', content: 'width=device-width, initial-scale=1'}
6
-
7
- %title Stoplight Admin
8
-
9
- %link{rel: 'stylesheet', href: '//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'}
10
- %link{rel: 'stylesheet', href: '//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css'}
11
- %link{rel: 'shortcut icon', href: '//i.imgur.com/qvfoNuh.png'}
12
-
13
- :css
14
- td.indicator {
15
- font-size: 200%;
16
- }
17
-
18
- td.name {
19
- font-weight: bold;
20
- }
21
-
22
- td.locked button {
23
- font-size: 200%;
24
- }
25
-
26
- td.failures span.error {
27
- font-weight: bold;
28
- }
29
-
30
- td.failures ul {
31
- padding: 0;
32
- list-style-type: none;
33
- }
34
-
35
- .btn-group form {
36
- display: inline-block;
37
- }
38
-
39
- %body
40
- .navbar.navbar-inverse.navbar-static-top{role: 'navigation'}
41
- .container
42
- .navbar-header
43
- %a{class: 'navbar-brand', href: url('/')} Stoplight Admin
44
-
45
- .container{role: 'main'}
46
- = yield
47
-
48
- %script{src: '//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js'}