hieraviz 0.1.2 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4ae953c395227dd73942bc1faa14ab82e0d670c
4
- data.tar.gz: 5a1e231af94bedf3f98770dab19e305d022c938d
3
+ metadata.gz: b4eaf9279a8b9ffdd555aa1d48fcf395a648b5e2
4
+ data.tar.gz: 3325be3798ce496aea8ce0f99e1c58348ef72805
5
5
  SHA512:
6
- metadata.gz: 8866fb2b55e06453abfbc2c22a6ec425c20c16c0aff3a4692baa11a495256bd8082eb8579507ab1bc310094b97d78518d2054a25bcdf6df9f6bae07878953f6c
7
- data.tar.gz: b34d079696205abd7f81902f796cef8e1577b0215ae004532ae867195152d2117b87c7b5e0cf16fb84cf8504f7e73dcceee582720763e64009c9af0460afc619
6
+ metadata.gz: 1365f4a1804d57eae53a2ea56fa47a8a0be87eb605a98e575ba075dc76a68ca398c5e33125a5dcc73e9a9f95fa8dc6c30b1a38fb98270cc6e248c66f67941f77
7
+ data.tar.gz: f46e79ebd53ade534fad598bf09ce5584b41e6ff943ff65fca029fffc9089e1ea9a9d0598994a87f4c6bad2b87f7a5a2f00878757d6b361c0ec25507200e8907
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Hieraviz Changelog
2
2
  ========================
3
3
 
4
+ ### v0.2.0 - 2014-03-03
5
+ - fix button display on firefox
6
+ - fixes on http simple auth
7
+ - various refactoring
8
+
4
9
  ### v0.1.2 - 2016-02-22
5
10
  - add a way to write custom local facts
6
11
  - add display of nodes info on node panel
data/app/apiv1.rb CHANGED
@@ -19,29 +19,39 @@ module HieravizApp
19
19
 
20
20
  case settings.configdata['auth_method']
21
21
  when 'dummy'
22
+
22
23
  helpers do
23
24
  def check_authorization
25
+ logger.info session['access_token']
26
+ if !session['access_token'] && !request.env['HTTP_X_AUTH']
27
+ redirect '/v1/not_logged'
28
+ end
24
29
  true
25
30
  end
26
31
  end
32
+
27
33
  when 'gitlab', 'http'
34
+
28
35
  helpers do
29
36
  def check_authorization
30
37
  if !session['access_token'] && !request.env['HTTP_X_AUTH']
31
38
  redirect '/v1/not_logged'
32
39
  else
33
40
  token = session['access_token'] || request.env['HTTP_X_AUTH']
34
- session_info = Hieraviz::Store.get(token, settings.configdata['session_renew'])
35
- if !session_info
41
+ session_info = settings.store.get(token, settings.configdata['session_renew'])
42
+ unless session_info['username']
36
43
  redirect '/v1/unauthorized'
37
44
  end
38
45
  end
39
46
  end
40
47
  end
48
+
41
49
  end
42
50
 
43
51
  helpers do
44
-
52
+ def get_facts(base, node)
53
+ Hieraviz::Facts.new(settings.configdata['tmpdir'], base, node, username)
54
+ end
45
55
  end
46
56
 
47
57
  get %r{^/?([-_\.a-zA-Z0-9]+)?/nodes} do |base|
@@ -73,23 +83,20 @@ module HieravizApp
73
83
 
74
84
  get %r{^/?([-_\.a-zA-Z0-9]+)?/node/([-_\.a-zA-Z0-9]+)/facts} do |base, node|
75
85
  check_authorization
76
- hieracles_config = prepare_config(base, node)
77
- facts = Hieraviz::Facts.new(settings.configdata['tmpdir'], base, node, get_username)
86
+ facts = get_facts(base, node)
78
87
  json facts.read
79
88
  end
80
89
 
81
90
  post %r{^/?([-_\.a-zA-Z0-9]+)?/node/([-_\.a-zA-Z0-9]+)/facts} do |base, node|
82
91
  check_authorization
83
- hieracles_config = prepare_config(base, node)
84
- facts = Hieraviz::Facts.new(settings.configdata['tmpdir'], base, node, get_username)
92
+ facts = get_facts(base, node)
85
93
  data = JSON.parse(request.body.read.to_s)
86
94
  json facts.write(data)
87
95
  end
88
96
 
89
97
  delete %r{^/?([-_\.a-zA-Z0-9]+)?/node/([-_\.a-zA-Z0-9]+)/facts} do |base, node|
90
98
  check_authorization
91
- hieracles_config = prepare_config(base, node)
92
- facts = Hieraviz::Facts.new(settings.configdata['tmpdir'], base, node, get_username)
99
+ facts = get_facts(base, node)
93
100
  json facts.remove
94
101
  end
95
102
 
@@ -118,9 +125,8 @@ module HieravizApp
118
125
  hieracles_config = prepare_config(base, node)
119
126
  hiera = Hieracles::Hiera.new(hieracles_config)
120
127
  nodeinfo = Hieracles::Node.new(node, hieracles_config)
121
- facts = Hieraviz::Facts.new(settings.configdata['tmpdir'], base, node, get_username)
122
- puts facts.instance_variable_get(:@filename)
123
- res = {
128
+ facts = get_facts(base, node)
129
+ res = {
124
130
  'hiera' => hiera.hierarchy,
125
131
  'vars' => hiera.params,
126
132
  'info' => nodeinfo.info,
@@ -134,9 +140,8 @@ module HieravizApp
134
140
  get %r{^/?([-_\.a-zA-Z0-9]+)?/farm/([-_\.a-zA-Z0-9]+)$} do |base, farm|
135
141
  check_authorization
136
142
  hieracles_config = prepare_config(base)
137
- nodes = Hieracles::Registry.nodes_data(hieracles_config, base).reduce({}) do |a, (k, v)|
138
- a[k] = v if v['farm'] == farm
139
- a
143
+ nodes = Hieracles::Registry.nodes_data(hieracles_config, base).each_with_object({}) do |(key, val), acc|
144
+ acc[key] = val if val['farm'] == farm
140
145
  end
141
146
  json nodes
142
147
  end
@@ -148,15 +153,15 @@ module HieravizApp
148
153
  end
149
154
 
150
155
  get '/not_logged' do
151
- json({ error: "Not connected." })
156
+ json(error: 'Not connected.')
152
157
  end
153
158
 
154
159
  get '/unauthorized' do
155
- json({ error: "Unauthorized" })
160
+ json(error: 'Unauthorized')
156
161
  end
157
162
 
158
163
  not_found do
159
- json({ error: "endpoint not found" })
164
+ json(error: 'Endpoint not found')
160
165
  end
161
166
 
162
167
  end
data/app/common.rb CHANGED
@@ -7,99 +7,91 @@ module HieravizApp
7
7
  configure do
8
8
  set :app_name, 'HieraViz'
9
9
  set :configdata, Hieraviz::Config.load
10
- set :config, Hieracles::Config.new({ config: Hieraviz::Config.configfile })
11
10
  set :basepaths, Hieraviz::Config.basepaths
11
+ set :store, Hieraviz::Store.new(settings.configdata['tmpdir'])
12
12
  enable :session
13
13
  enable :logging
14
14
  end
15
15
 
16
16
  helpers do
17
-
18
17
  case settings.configdata['auth_method']
19
18
  when 'dummy'
20
19
 
21
- def get_username
20
+ def username
22
21
  'Dummy'
23
22
  end
24
- def get_userinfo
23
+
24
+ def userinfo
25
25
  { 'username' => 'Dummy' }
26
26
  end
27
27
 
28
28
  when 'http'
29
29
 
30
- def get_username
30
+ def username
31
31
  settings.configdata['http_auth']['username']
32
32
  end
33
- def get_userinfo
33
+
34
+ def userinfo
34
35
  { 'username' => settings.configdata['http_auth']['username'] }
35
36
  end
36
37
 
37
38
  when 'gitlab'
38
-
39
- def get_username
39
+
40
+ def username
40
41
  if session['access_token']
41
- session_info = Hieraviz::Store.get(session['access_token'], settings.configdata['session_renew'])
42
- if session_info
43
- session_info['username']
44
- else
45
- ''
46
- end
42
+ session_info = settings.store.get(session['access_token'], settings.configdata['session_renew'])
43
+ session_info['username'] || ''
44
+ else
45
+ ''
47
46
  end
48
47
  end
49
48
 
50
- def get_userinfo
51
- Hieraviz::Store.get(session['access_token'], settings.configdata['session_renew'])
49
+ def userinfo
50
+ settings.store.get(session['access_token'], settings.configdata['session_renew'])
52
51
  end
53
-
52
+
54
53
  end
55
54
 
56
- def prepare_config(e, node = nil)
57
- e ||= File.basename(settings.configdata['basepath'])
58
- path = get_path(e)[0]
55
+ def prepare_config(paths, node = nil)
56
+ paths ||= File.basename(settings.configdata['basepath'])
57
+ path = get_path(paths)[0]
59
58
  if path
60
59
  @base = get_base(path)
61
- @base_name = @base.gsub(/\//,'')
62
- get_config(path, cached_params(e, node))
60
+ @base_name = @base.gsub(%r{/}, '')
61
+ get_config(path, cached_params(paths, node))
63
62
  end
64
63
  end
65
64
 
66
65
  def cached_params(base, node)
67
66
  if node
68
- cache = Hieraviz::Facts.new settings.configdata['tmpdir'], base, node, get_username
69
- if cache.exist?
70
- return cache.read
71
- end
67
+ cache = Hieraviz::Facts.new settings.configdata['tmpdir'], base, node, username
68
+ return cache.read if cache.exist?
72
69
  end
73
70
  {}
74
71
  end
75
72
 
76
- def prepare_params(e)
77
- e ||= File.basename(settings.configdata['basepath'])
78
- path = get_path(e)[0]
79
- if path
80
- settings.configdata['basepath'] = path
81
- settings.configdata
82
- end
73
+ def prepare_params(paths)
74
+ paths ||= File.basename(settings.configdata['basepath'])
75
+ path = get_path(paths)[0]
76
+ return unless path
77
+ settings.configdata['basepath'] = path
78
+ settings.configdata
83
79
  end
84
-
80
+
85
81
  def get_path(path)
86
82
  if settings.basepaths
87
- settings.basepaths.select do |p|
88
- path == File.basename(p)
83
+ settings.basepaths.select do |file|
84
+ path == File.basename(file)
89
85
  end
90
86
  else
91
- [ settings.configdata['basepath'] ]
87
+ [settings.configdata['basepath']]
92
88
  end
93
89
  end
94
-
90
+
95
91
  def get_config(path, extra)
96
92
  args = { config: Hieraviz::Config.configfile }
97
- if path
98
- args[:basepath] = path
99
- end
100
- if extra.length > 0
101
- args[:params] = format_params(extra)
102
- end
93
+ args[:basepath] = path if path
94
+ args[:params] = format_params(extra) unless extra.empty?
103
95
  Hieracles::Config.new args
104
96
  end
105
97
 
@@ -108,12 +100,10 @@ module HieravizApp
108
100
  end
109
101
 
110
102
  def format_params(params)
111
- params.reduce([]) do |a, (k, v)|
112
- a << "#{k}=#{v}"
113
- a
103
+ params.each_with_object([]) do |(key, val), acc|
104
+ acc << "#{key}=#{val}"
114
105
  end.join(',')
115
106
  end
116
-
117
107
  end
118
108
 
119
109
  end
@@ -1,27 +1,29 @@
1
-
2
1
  ready( () => {
3
2
  var bases = document.querySelectorAll('.base .all .select');
4
- var button = document.querySelector(".base .current");
5
- var menu = document.querySelector(".base .all");
6
- var menuvisible = false;
7
- filterBox(".base .all .filter input", bases);
3
+ if (bases.length > 0) {
4
+ var button = document.querySelector(".base .current");
5
+ var menu = document.querySelector(".base .all");
6
+ var menuvisible = false;
7
+ filterBox(".base .all .filter input", bases);
8
+
8
9
 
9
- button.addEventListener('click', (ev) => {
10
- if (menuvisible) {
11
- removeClass(menu, "focus");
12
- } else {
13
- addClass(menu, "focus");
14
- }
15
- menuvisible = !menuvisible;
16
- });
10
+ button.addEventListener('click', (ev) => {
11
+ if (menuvisible) {
12
+ removeClass(menu, "focus");
13
+ } else {
14
+ addClass(menu, "focus");
15
+ }
16
+ menuvisible = !menuvisible;
17
+ });
17
18
 
18
- /* declaration of events for the bases menu */
19
- Array.prototype.forEach.call(bases, (item, i) => {
20
- item.addEventListener('click', (ev) => {
21
- var url = window.location;
22
- base = ev.target.textContent;
23
- url.pathname = url.pathname.replace(/^\/[^\/]+/,"/"+base);
19
+ /* declaration of events for the bases menu */
20
+ Array.prototype.forEach.call(bases, (item, i) => {
21
+ item.addEventListener('click', (ev) => {
22
+ var url = window.location;
23
+ base = ev.target.textContent;
24
+ url.pathname = url.pathname.replace(/^\/[^\/]+/,"/"+base);
25
+ });
24
26
  });
25
- });
26
27
 
28
+ }
27
29
  });
@@ -10,7 +10,7 @@ https://fetch.spec.whatwg.org
10
10
  */
11
11
 
12
12
  function ready(fn) {
13
- if (document.readyState != 'loading') {
13
+ if (document.readyState !== 'loading') {
14
14
  fn();
15
15
  } else {
16
16
  document.addEventListener('DOMContentLoaded', fn);
@@ -24,25 +24,6 @@ ready( () => {
24
24
  focusNav('farms');
25
25
  filterBox(".side .filter input", farms);
26
26
 
27
- function restore_url(list) {
28
- if (window.location.hash != '') {
29
- var target = window.location.hash.replace(/#/,'');
30
- var parts = target.split('/');
31
- Array.prototype.forEach.call(list, (item, i) => {
32
- if (item.textContent == parts[0]) {
33
- if (parts[1] != undefined) {
34
- Farm[parts[1]](parts[0]);
35
- } else {
36
- var event = document.createEvent('HTMLEvents');
37
- event.initEvent('click', true, false);
38
- item.dispatchEvent(event);
39
- }
40
- }
41
- });
42
- }
43
- }
44
-
45
-
46
27
  function build_list(top, title, hash) {
47
28
  window.location.hash = '#'+title;
48
29
  top.innerHTML = "<h3>Farm "+title+"</h3>";
@@ -74,7 +55,7 @@ ready( () => {
74
55
  fetch('/v1/' + base + '/farm/' + farm, auth_header()).
75
56
  then(res => res.json()).
76
57
  then(j => {
77
- if (j.error != undefined) {
58
+ if (j.error !== undefined) {
78
59
  show_error(meat, j['error']);
79
60
  } else {
80
61
  build_list(meat, farm, j);
@@ -86,7 +67,7 @@ ready( () => {
86
67
  }
87
68
  removeClass(meat, 'wait');
88
69
  });
89
- },
70
+ }
90
71
  };
91
72
 
92
73
  Array.prototype.forEach.call(farms, (item, i) => {
@@ -96,6 +77,6 @@ ready( () => {
96
77
  });
97
78
 
98
79
  update_footer('/v1/' + base + '/farms');
99
- restore_url(farms);
80
+ restore_url(farms, Farm);
100
81
 
101
82
  });
@@ -9,6 +9,7 @@ let's use the fetch API for ajax calls
9
9
  https://fetch.spec.whatwg.org
10
10
  */
11
11
 
12
+ // "use strict";
12
13
 
13
14
  function ready(fn) {
14
15
  if (document.readyState != 'loading') {
@@ -27,7 +28,7 @@ function make_base_auth(user, password) {
27
28
  }
28
29
 
29
30
  function addClass(el, className) {
30
- if (el.classList != null)
31
+ if (el.classList !== null)
31
32
  el.classList.add(className);
32
33
  else
33
34
  el.className += ' ' + className;
@@ -59,21 +60,23 @@ function shortParamFile(path) {
59
60
 
60
61
  function filterBox(input, els) {
61
62
  var filterinput = document.querySelector(input);
62
- filterinput.focus();
63
- filterinput.addEventListener('keyup', (ev) => {
64
- el = ev.target;
65
- if (el.value == '')
66
- Array.prototype.forEach.call(els, (item, i) => {
67
- item.style.display = 'block';
68
- });
69
- else
70
- Array.prototype.forEach.call(els, (item, i) => {
71
- if (item.textContent.match(el.value))
63
+ if (filterinput !== null) {
64
+ filterinput.focus();
65
+ filterinput.addEventListener('keyup', (ev) => {
66
+ el = ev.target;
67
+ if (el.value === '')
68
+ Array.prototype.forEach.call(els, (item, i) => {
72
69
  item.style.display = 'block';
73
- else
74
- item.style.display = 'none';
75
- });
76
- });
70
+ });
71
+ else
72
+ Array.prototype.forEach.call(els, (item, i) => {
73
+ if (item.textContent.match(el.value))
74
+ item.style.display = 'block';
75
+ else
76
+ item.style.display = 'none';
77
+ });
78
+ });
79
+ }
77
80
  }
78
81
 
79
82
  function start_wait(meat) {
@@ -95,6 +98,23 @@ function auth_header() {
95
98
  return { headers: h }
96
99
  }
97
100
 
101
+ function restore_url(list, someclass) {
102
+ if (window.location.hash !== '') {
103
+ var target = window.location.hash.replace(/#/,'');
104
+ var parts = target.split('/');
105
+ Array.prototype.forEach.call(list, (item, i) => {
106
+ if (item.textContent.split(' ')[0] === parts[0]) {
107
+ if (parts[1] !== undefined) {
108
+ someclass[parts[1]](parts[0]);
109
+ } else {
110
+ var event = document.createEvent('HTMLEvents');
111
+ event.initEvent('click', true, false);
112
+ item.dispatchEvent(event);
113
+ }
114
+ }
115
+ });
116
+ }
117
+ }
98
118
 
99
119
  ready( () => {
100
120
 
@@ -17,24 +17,6 @@ ready( () => {
17
17
  focusNav('nodes');
18
18
  filterBox(".side .filter input", nodes);
19
19
 
20
- function restore_url(list) {
21
- if (window.location.hash != '') {
22
- var target = window.location.hash.replace(/#/,'');
23
- var parts = target.split('/');
24
- Array.prototype.forEach.call(list, (item, i) => {
25
- if (item.textContent == parts[0]) {
26
- if (parts[1] != undefined) {
27
- Node[parts[1]](parts[0]);
28
- } else {
29
- var event = document.createEvent('HTMLEvents');
30
- event.initEvent('click', true, false);
31
- item.dispatchEvent(event);
32
- }
33
- }
34
- });
35
- }
36
- }
37
-
38
20
  function build_line(top, file, key, value, overriden) {
39
21
  if (overriden === true) {
40
22
  rowclass = "row overriden";
@@ -50,7 +32,7 @@ ready( () => {
50
32
 
51
33
  function build_row(top, key, params) {
52
34
  build_line(top, params['file'], key, params['value'], false);
53
- if (params['overriden'] == true) {
35
+ if (params['overriden'] === true) {
54
36
  Array.prototype.forEach.call(params['found_in'], (values, i) => {
55
37
  build_line(top, values['file'], key, values['value'], true);
56
38
  });
@@ -111,7 +93,7 @@ ready( () => {
111
93
  fetch(req, auth_header()).
112
94
  then(res => res.json()).
113
95
  then(j => {
114
- if (j.error != undefined) {
96
+ if (j.error !== undefined) {
115
97
  show_error(hierachy, j['error']);
116
98
  } else {
117
99
  location.reload();
@@ -136,7 +118,7 @@ ready( () => {
136
118
  fetch(req, auth_header()).
137
119
  then(res => res.json()).
138
120
  then(j => {
139
- if (j.error != undefined) {
121
+ if (j.error !== undefined) {
140
122
  show_error(hierachy, j['error']);
141
123
  } else {
142
124
  location.reload();
@@ -152,10 +134,9 @@ ready( () => {
152
134
  then(res => res.json()).
153
135
  then(j => {
154
136
  var hierachy = document.querySelector('div.hierarchy');
155
- if (j.error != undefined) {
137
+ if (j.error !== undefined) {
156
138
  show_error(hierachy, j['error']);
157
139
  } else {
158
- console.debug(j);
159
140
  // --------------------
160
141
  addTo(hierarchy, "<h3>From hiera config</h3>");
161
142
  var hierafiles = document.createElement('div');
@@ -171,7 +152,7 @@ ready( () => {
171
152
  hierarchy.appendChild(nodeinfo);
172
153
  Array.prototype.forEach.call(Object.keys(j.info), (item, k) => {
173
154
  var index = j.vars.indexOf(item);
174
- if (index > -1 && (j.facts == null || j.facts[item] == undefined)) {
155
+ if (index > -1 && (Object.keys(j.facts).length === 0 || j.facts[item] === undefined)) {
175
156
  addTo(nodeinfo, "<div class=\"var\"><div class=\"label\">"+item+"</div>" +
176
157
  "<div><input type=\"text\" name=\""+item+"\" value=\""+j.info[item]+"\" disabled></div></div>");
177
158
  j.vars.splice(index, 1);
@@ -182,9 +163,9 @@ ready( () => {
182
163
  var factinfo = document.createElement('div');
183
164
  factinfo.className = "factinfo";
184
165
  hierarchy.appendChild(factinfo);
185
- if (j.facts == null) {
166
+ if (Object.keys(j.facts).length === 0) {
186
167
  Array.prototype.forEach.call(Object.keys(j.vars), (item, k) => {
187
- if (j.defaults != null && j.defaults[j.vars[item]] != undefined) {
168
+ if (j.defaults !== null && j.defaults[j.vars[item]] !== undefined) {
188
169
  addTo(factinfo, "<div class=\"var\"><div class=\"label\">"+j.vars[item]+"</div>" +
189
170
  "<div><input type=\"text\" class=\"userinput\" name=\"" +
190
171
  j.vars[item]+"\" value=\"" +
@@ -192,7 +173,7 @@ ready( () => {
192
173
  }
193
174
  });
194
175
  Array.prototype.forEach.call(Object.keys(j.vars), (item, k) => {
195
- if (j.defaults == null || j.defaults[j.vars[item]] == undefined) {
176
+ if (Object.keys(j.defaults).length === 0 || j.defaults[j.vars[item]] === undefined) {
196
177
  addTo(factinfo, "<div class=\"var\"><div class=\"label\">"+j.vars[item]+"</div>" +
197
178
  "<div><input type=\"text\" class=\"userinput\" name=\"" +
198
179
  j.vars[item]+"\" value=\"\"></div></div>");
@@ -201,7 +182,7 @@ ready( () => {
201
182
  } else {
202
183
  Array.prototype.forEach.call(Object.keys(j.facts), (item, k) => {
203
184
  var override = '';
204
- if (j.defaults != null && j.defaults[item] != undefined) {
185
+ if (j.defaults !== null && j.defaults[item] !== undefined) {
205
186
  override = " <i>("+j.defaults[item]+")</i>";
206
187
  }
207
188
  addTo(factinfo, "<div class=\"var\"><div class=\"label\">" +
@@ -218,7 +199,7 @@ ready( () => {
218
199
  // . . . . . . . . . . .
219
200
  var updateinfo = document.createElement('button');
220
201
  updateinfo.id = 'updateinfo';
221
- updateinfo.innerText = 'Update';
202
+ updateinfo.textContent = 'Update';
222
203
  updatediv.appendChild(updateinfo);
223
204
  updateinfo.addEventListener('click', (ev) => {
224
205
  var fields = get_input();
@@ -227,7 +208,7 @@ ready( () => {
227
208
  // // . . . . . . . . . . .
228
209
  // var checkinfo = document.createElement('button');
229
210
  // checkinfo.id = 'checkinfo';
230
- // checkinfo.innerText = 'Check';
211
+ // checkinfo.textContent = 'Check';
231
212
  // updatediv.appendChild(checkinfo);
232
213
  // checkinfo.addEventListener('click', (ev) => {
233
214
 
@@ -235,7 +216,7 @@ ready( () => {
235
216
  // . . . . . . . . . . .
236
217
  var restoreinfo = document.createElement('button');
237
218
  restoreinfo.id = 'restoreinfo';
238
- restoreinfo.innerText = 'Restore Defaults';
219
+ restoreinfo.textContent = 'Restore Defaults';
239
220
  updatediv.appendChild(restoreinfo);
240
221
  restoreinfo.addEventListener('click', (ev) => {
241
222
  clear_input(node);
@@ -294,7 +275,7 @@ ready( () => {
294
275
  then(j => {
295
276
  // console.log(auth_header().headers.getAll('x-auth'));
296
277
  build_top(node);
297
- if (j.error != undefined) {
278
+ if (j.error !== undefined) {
298
279
  show_error(meat, j['error']);
299
280
  } else {
300
281
  build_params(meat, node, j);
@@ -313,7 +294,7 @@ ready( () => {
313
294
  then(res => res.json()).
314
295
  then(j => {
315
296
  build_top(node);
316
- if (j.error != undefined) {
297
+ if (j.error !== undefined) {
317
298
  show_error(meat, j['error']);
318
299
  } else {
319
300
  build_info(meat, node, j);
@@ -332,7 +313,7 @@ ready( () => {
332
313
  then(res => res.json()).
333
314
  then(j => {
334
315
  build_top(node);
335
- if (j.error != undefined) {
316
+ if (j.error !== undefined) {
336
317
  show_error(meat, j['error']);
337
318
  } else {
338
319
  build_params(meat, node, j);
@@ -343,7 +324,7 @@ ready( () => {
343
324
  }
344
325
  end_wait(meat);
345
326
  });
346
- },
327
+ }
347
328
  }
348
329
 
349
330
  /* declaration of events for the nodes menu */
@@ -354,6 +335,6 @@ ready( () => {
354
335
  });
355
336
 
356
337
  update_footer('/v1/' + base + '/nodes');
357
- restore_url(nodes);
338
+ restore_url(nodes, Node);
358
339
 
359
340
  });
data/app/views/_head.erb CHANGED
@@ -4,8 +4,8 @@
4
4
  </a>
5
5
  </div>
6
6
 
7
- <% if session[:access_token] && @username != '' and @base -%>
8
7
  <div class="nav">
8
+ <% if session[:access_token] && @username != '' and @base -%>
9
9
  <% if settings.basepaths -%>
10
10
  <div class="base">
11
11
  <span class="current"><%= @base_name %></span>
@@ -21,13 +21,15 @@
21
21
  </div>
22
22
  </div>
23
23
  <% end -%>
24
+ <% end -%>
24
25
 
26
+ <% if session[:access_token] -%>
25
27
  <a href="<%= @base %>/nodes" class="nodes">Nodes</a>
26
28
  <a href="<%= @base %>/farms" class="farms">Farms</a>
27
29
  <a href="<%= @base %>/modules" class="modules">Modules</a>
28
30
  <a href="<%= @base %>/resources" class="resources">Resources</a>
29
- </div>
30
31
  <% end -%>
32
+ </div>
31
33
 
32
34
  <% if session[:access_token] && @username != '' -%>
33
35
  <div class="auth">