hieraviz 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/CHANGELOG.md +4 -1
- data/README.md +19 -1
- data/app/apiv1.rb +14 -1
- data/app/public/css/main.css +0 -4
- data/app/public/js/farms.js +4 -4
- data/app/views/_flash.erb +5 -0
- data/app/views/_layout.erb +1 -1
- data/app/web.rb +3 -3
- data/config.ru +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92243305adbd29684586595b9756031dbab5890
|
4
|
+
data.tar.gz: 92149f89aebee317256c51b143613111431730ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2910ecf14f76df96f33f1b211bcfe315a6ba2acec195a2375c7cc95a6f3a7a02230e8703256e79d673069178cfaaa7cd19190a86660a9a23420136984bca0852
|
7
|
+
data.tar.gz: 868f5226fc033dc439515f4b3f81182f6a40068ae17da91fec87a67296384d0789d29b4e70b23176581578069e34abd6a44f71750599640ed829488ed173ad26
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
Hieraviz Changelog
|
2
2
|
========================
|
3
3
|
|
4
|
-
### v0.2.
|
4
|
+
### v0.2.1 - 2016-04-04
|
5
|
+
- replaced sinatra-flash (weird license, no debian package) with rack-flash3
|
6
|
+
|
7
|
+
### v0.2.0 - 2016-03-03
|
5
8
|
- fix button display on firefox
|
6
9
|
- fixes on http simple auth
|
7
10
|
- various refactoring
|
data/README.md
CHANGED
@@ -23,7 +23,25 @@ Install it from Rubygens:
|
|
23
23
|
|
24
24
|
Development
|
25
25
|
--------------
|
26
|
-
|
26
|
+
|
27
|
+
Make sure you have ruby installed (version 2.1.5 from jessie works fine, or use rvm).
|
28
|
+
|
29
|
+
gem install bundler
|
30
|
+
git clone https://github.com/Gandi/hieraviz.git
|
31
|
+
cd hieraviz
|
32
|
+
bundle install --path vendor
|
33
|
+
cp config/hieraviz.default.yml config/hieraviz.yml
|
34
|
+
# edit the config file
|
35
|
+
bundle exec shotgun
|
36
|
+
# or
|
37
|
+
bundle exec rackup
|
38
|
+
|
39
|
+
|
40
|
+
Production
|
41
|
+
----------------
|
42
|
+
|
43
|
+
gem install thin
|
44
|
+
thin -s 1 -C config.yml -R config.ru start
|
27
45
|
|
28
46
|
Contributing
|
29
47
|
----------------
|
data/app/apiv1.rb
CHANGED
@@ -14,6 +14,7 @@ module HieravizApp
|
|
14
14
|
|
15
15
|
configure do
|
16
16
|
set :session_secret, settings.configdata['session_seed']
|
17
|
+
set :protection, :origin_whitelist => ['http://web.example.com']
|
17
18
|
enable :sessions
|
18
19
|
end
|
19
20
|
|
@@ -52,6 +53,11 @@ module HieravizApp
|
|
52
53
|
def get_facts(base, node)
|
53
54
|
Hieraviz::Facts.new(settings.configdata['tmpdir'], base, node, username)
|
54
55
|
end
|
56
|
+
def cors_headers()
|
57
|
+
headers 'Access-Control-Allow-Origin' => '*'
|
58
|
+
headers 'Access-Control-Allow-Headers' => 'Authorization,Accepts,Content-Type,X-CSRF-Token,X-Requested-With,X-AUTH'
|
59
|
+
headers 'Access-Control-Allow-Methods' => 'GET,POST,PUT,DELETE,OPTIONS'
|
60
|
+
end
|
55
61
|
end
|
56
62
|
|
57
63
|
get %r{^/?([-_\.a-zA-Z0-9]+)?/nodes} do |base|
|
@@ -109,6 +115,7 @@ module HieravizApp
|
|
109
115
|
|
110
116
|
get %r{^/?([-_\.a-zA-Z0-9]+)?/farms} do |base|
|
111
117
|
check_authorization
|
118
|
+
cors_headers
|
112
119
|
hieracles_config = prepare_config(base)
|
113
120
|
json Hieracles::Registry.farms_counted(hieracles_config, base)
|
114
121
|
end
|
@@ -137,8 +144,14 @@ module HieravizApp
|
|
137
144
|
json res
|
138
145
|
end
|
139
146
|
|
147
|
+
options %r{^/.*/$} do
|
148
|
+
cors_headers
|
149
|
+
halt 200
|
150
|
+
end
|
151
|
+
|
140
152
|
get %r{^/?([-_\.a-zA-Z0-9]+)?/farm/([-_\.a-zA-Z0-9]+)$} do |base, farm|
|
141
|
-
check_authorization
|
153
|
+
# check_authorization
|
154
|
+
cors_headers
|
142
155
|
hieracles_config = prepare_config(base)
|
143
156
|
nodes = Hieracles::Registry.nodes_data(hieracles_config, base).each_with_object({}) do |(key, val), acc|
|
144
157
|
acc[key] = val if val['farm'] == farm
|
data/app/public/css/main.css
CHANGED
data/app/public/js/farms.js
CHANGED
@@ -51,19 +51,19 @@ ready( () => {
|
|
51
51
|
var Farm = {
|
52
52
|
show: function(el) {
|
53
53
|
addClass(meat, 'wait');
|
54
|
-
|
55
|
-
fetch('/v1/' + base + '/farm/' +
|
54
|
+
focused = el.dataset.item;
|
55
|
+
fetch('/v1/' + base + '/farm/' + focused, auth_header()).
|
56
56
|
then(res => res.json()).
|
57
57
|
then(j => {
|
58
58
|
if (j.error !== undefined) {
|
59
59
|
show_error(meat, j['error']);
|
60
60
|
} else {
|
61
|
-
build_list(meat,
|
61
|
+
build_list(meat, focused, j);
|
62
62
|
Array.prototype.forEach.call(farms, (item, i) => {
|
63
63
|
removeClass(item, 'focus');
|
64
64
|
});
|
65
65
|
addClass(el, 'focus');
|
66
|
-
update_footer('/v1/' + base + '/farm/' +
|
66
|
+
update_footer('/v1/' + base + '/farm/' + focused);
|
67
67
|
}
|
68
68
|
removeClass(meat, 'wait');
|
69
69
|
});
|
data/app/views/_layout.erb
CHANGED
data/app/web.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'sinatra/content_for'
|
2
|
-
require 'sinatra/flash'
|
3
2
|
|
4
3
|
require 'better_errors'
|
4
|
+
require 'rack-flash'
|
5
5
|
require 'dotenv'
|
6
6
|
require 'oauth2'
|
7
7
|
|
@@ -14,7 +14,7 @@ module HieravizApp
|
|
14
14
|
# the unique web endpoints management
|
15
15
|
class Web < Common
|
16
16
|
helpers Sinatra::ContentFor
|
17
|
-
|
17
|
+
use Rack::Flash
|
18
18
|
|
19
19
|
configure do
|
20
20
|
set :session_secret, settings.configdata['session_seed']
|
@@ -113,7 +113,7 @@ module HieravizApp
|
|
113
113
|
access_token = settings.oauth.access_token(request, params[:code])
|
114
114
|
session[:access_token] = access_token.token
|
115
115
|
settings.store.set access_token.token, settings.oauth.user_info(access_token.token)
|
116
|
-
flash[
|
116
|
+
flash[:info] = 'Successfully authenticated with the server'
|
117
117
|
redirect '/'
|
118
118
|
end
|
119
119
|
|
data/config.ru
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hieraviz
|
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
|
- mose
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rack-flash3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- app/public/js/modules.js
|
277
277
|
- app/public/js/nodes.js
|
278
278
|
- app/public/js/resources.js
|
279
|
+
- app/views/_flash.erb
|
279
280
|
- app/views/_foot.erb
|
280
281
|
- app/views/_head.erb
|
281
282
|
- app/views/_layout.erb
|