redis-ui 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,22 +1,57 @@
1
1
  == RedisUI
2
2
 
3
+ [WARNING]
4
+ RedisUI is not very smart (yet?) about memory management. It loads ALL of your keys and values into memory at the same time, and then messes around with them. I haven't tried it, but you may run into issues with very large production databases. At this point this is more intended for debugging/development work.
5
+ [/WARNING]
6
+
3
7
  * web accessible panel to view/manage redisdb
4
8
  * requires ruby 1.8.7+ or ruby 1.9+
5
9
 
6
10
  $ gem install redis-ui
7
11
  $ redis-ui [redis://<ip:port>] [--namespace <redis-namespace>]
8
12
 
13
+
14
+ * redis-ui runs with Vegas (see gem vegas) so also comes with all the command-line options that affords:
15
+
16
+ Vegas options:
17
+ -K, --kill kill the running process and exit
18
+ -S, --status display the current running PID and URL then quit
19
+ -s, --server SERVER serve using SERVER (thin/mongrel/webrick)
20
+ -o, --host HOST listen on HOST (default: 0.0.0.0)
21
+ -p, --port PORT use PORT (default: 5678)
22
+ -x, --no-proxy ignore env proxy settings (e.g. http_proxy)
23
+ -e, --env ENVIRONMENT use ENVIRONMENT for defaults (default: development)
24
+ -F, --foreground don't daemonize, run in the foreground
25
+ -L, --no-launch don't launch the browser
26
+ -d, --debug raise the log level to :debug (default: :info)
27
+ --app-dir APP_DIR set the app dir where files are stored (default: ~/.vegas/redis_ui)/)
28
+ -P, --pid-file PID_FILE set the path to the pid file (default: app_dir/redis_ui.pid)
29
+ --log-file LOG_FILE set the path to the log file (default: app_dir/redis_ui.log)
30
+ --url-file URL_FILE set the path to the URL file (default: app_dir/redis_ui.url)
31
+
32
+ 'redis-ui' options:
33
+ -N NAMESPACE, set the Redis namespace
34
+ --namespace
35
+
36
+ Common options:
37
+ -h, --help Show this message
38
+ --version Show version
39
+
40
+
41
+
9
42
  == Features
10
43
 
11
44
  * specify which redis server to connect to (or default to localhost at port 5678 or 5679)
45
+ * Click on the namespace tree to filter the keys shown to that namespace (since v0.4.0)
12
46
  * specify a namespace (see redis-namespace gem) to show only keys in that namespace
13
47
  * view all keys in a paged, sortable, as-you-type-filterable table
14
48
 
15
- == urls
49
+ == Todo
16
50
 
17
- * /keys (json)
18
- * /keys/:id (html or json)
19
- * /server (json)
51
+ * auto-refresh?
52
+ * incr/decr buttons for number-strings?
53
+ * in-place edit for strings?
54
+ * free-form console for typing to redis directly?
20
55
 
21
56
  == Copyright
22
57
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.0
@@ -3,6 +3,7 @@ require 'redis'
3
3
  require 'redis/namespace'
4
4
  require 'deep_merge'
5
5
  require 'pp'
6
+ require 'cgi'
6
7
 
7
8
  begin
8
9
  require 'yajl'
@@ -14,9 +15,11 @@ require 'sinatra/base'
14
15
  require 'sinatra/respond_to'
15
16
  require 'erb'
16
17
 
18
+ require 'redis-ui/helpers'
19
+
17
20
  module RedisUI
18
21
  extend self
19
-
22
+
20
23
  # hostname:port
21
24
  # redis://hostname:port
22
25
  def redis=(server)
@@ -46,6 +49,10 @@ module RedisUI
46
49
  self.redis = Redis.respond_to?(:connect) ? Redis.connect : "localhost:6379"
47
50
  self.redis
48
51
  end
52
+
53
+ def namespace
54
+ @namespace
55
+ end
49
56
 
50
57
 
51
58
  class Server < Sinatra::Base
@@ -64,86 +71,20 @@ module RedisUI
64
71
  helpers do
65
72
  include Rack::Utils
66
73
  alias_method :h, :escape_html
67
-
68
- def redis
69
- RedisUI.redis
70
- end
71
-
72
- def get_key(key)
73
- data = case redis.type(key)
74
- when "string"
75
- redis[key]
76
- when "list"
77
- redis.lrange(key, 0, -1)
78
- when "set"
79
- redis.smembers(key)
80
- when 'zset'
81
- redis.zrange(key, 0, -1)
82
- when 'hash'
83
- redis.hgetall(key)
84
- else
85
- '???'
86
- end
87
-
88
- {:key => key, :type => redis.type(key), :data => data}
89
- end
90
-
91
- def show(val)
92
- case val
93
- when String
94
- val
95
- when Array
96
- if val.empty?
97
- '[]'
98
- else
99
- str = "<ul><li> · "
100
- str << val.map{|v|show(v)}.join('</li><li> · ')
101
- str << '</li></ul>'
102
- end
103
- when Hash
104
- str = "<ul><li> · "
105
- arr = []
106
- val.map do |k, v|
107
- arr << "#{k} => #{show(v)}"
108
- end
109
- str << arr.join("</li><li> · ")
110
- str << '</li></ul>'
111
- else
112
- val.to_s
113
- end
114
- end
115
-
116
- def render_tree(val)
117
- str = "<ul>"
118
- val.each do |k, v|
119
- str << "<li><a href='#'>#{k}</a>#{render_tree(v)}</li>"
120
- end
121
- str << '</ul>'
122
- end
123
-
124
- def build_namespace_tree
125
- @namespace_tree = {}
126
- namespaces = redis.keys.map{|k| k.split(':')[0..-2]}.uniq.sort_by(&:size)
127
- namespaces.each do |array|
128
- hash = array.reverse.inject({}) do |branch, string|
129
- newtrunk = {}
130
- newtrunk[string] = branch
131
- newtrunk
132
- end
133
- @namespace_tree.deep_merge!(hash)
134
- end
135
- end
136
- # {
137
- # 'top' => {
138
- # 'second' => {}
139
- # }
140
- # }
141
-
74
+ include RedisUIHelpers
142
75
  end
143
76
 
144
77
  get "/" do
145
- @keys = RedisUI.redis.keys.map{ |key| get_key(key) }
146
- build_namespace_tree
78
+ keys = RedisUI.redis.keys
79
+ build_namespace_tree(keys)
80
+ @keys = keys.map{ |key| get_key(key) }
81
+ erb :index
82
+ end
83
+
84
+ get "/namespace/:ns" do
85
+ ns = Redis::Namespace.new(params[:ns], :redis => redis)
86
+ @keys = ns.keys.map{|k| get_key(k, ns)}
87
+ build_namespace_tree(redis.keys)
147
88
  erb :index
148
89
  end
149
90
 
@@ -163,6 +104,15 @@ module RedisUI
163
104
  end
164
105
  end
165
106
 
107
+ post "/del/:key" do
108
+ result = redis.del(params[:key])
109
+ if result == 1
110
+ true
111
+ else
112
+ 500
113
+ end
114
+ end
115
+
166
116
  get "/server" do
167
117
  {
168
118
  :info => RedisUI.redis.info,
@@ -0,0 +1,83 @@
1
+ # -*- coding: utf-8 -*-
2
+ module RedisUIHelpers
3
+ def redis
4
+ RedisUI.redis
5
+ end
6
+
7
+ def partial(template,locals=nil)
8
+ locals = (locals.is_a?(Hash)) ? locals : {template.to_sym => locals}
9
+ template = ('_' + template.to_s).to_sym
10
+ erb template, {layout: false}, locals
11
+ end
12
+
13
+ def get_key(key, redis=self.redis)
14
+ data = case redis.type(key)
15
+ when "string"
16
+ redis[key]
17
+ when "list"
18
+ redis.lrange(key, 0, -1)
19
+ when "set"
20
+ redis.smembers(key)
21
+ when 'zset'
22
+ redis.zrange(key, 0, -1)
23
+ when 'hash'
24
+ redis.hgetall(key)
25
+ else
26
+ '???'
27
+ end
28
+
29
+ {:key => key, :type => redis.type(key), :data => data}
30
+ end
31
+
32
+ def show(val)
33
+ case val
34
+ when String
35
+ val
36
+ when Array
37
+ if val.empty?
38
+ '[]'
39
+ else
40
+ str = "<ul><li> · "
41
+ str << val.map{|v|show(v)}.join('</li><li> · ')
42
+ str << '</li></ul>'
43
+ end
44
+ when Hash
45
+ str = "<ul><li> · "
46
+ arr = []
47
+ val.map do |k, v|
48
+ arr << "#{k} => #{show(v)}"
49
+ end
50
+ str << arr.join("</li><li> · ")
51
+ str << '</li></ul>'
52
+ else
53
+ val.to_s
54
+ end
55
+ end
56
+
57
+ def render_tree(val)
58
+ str = "<ul>"
59
+ val.each do |k, v|
60
+ str << "<li><a href='#'>#{k}</a>#{render_tree(v)}</li>"
61
+ end
62
+ str << '</ul>'
63
+ end
64
+
65
+ def build_namespace_tree(keys)
66
+ @namespace_tree = {}
67
+ namespaces = keys.map{|k| k.split(':')[0..-2]}.uniq.sort_by(&:size)
68
+ namespaces.each do |array|
69
+ hash = array.reverse.inject({}) do |branch, string|
70
+ newtrunk = {}
71
+ newtrunk[string] = branch
72
+ newtrunk
73
+ end
74
+ @namespace_tree.deep_merge!(hash)
75
+ end
76
+ end
77
+ # {
78
+ # 'top' => {
79
+ # 'second' => {}
80
+ # }
81
+ # }
82
+
83
+ end
@@ -1,5 +1,5 @@
1
1
  module Redis
2
2
  module Ui
3
- VERSION = "0.3.1"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -0,0 +1,47 @@
1
+ /*!
2
+ * jQuery Cookie Plugin
3
+ * https://github.com/carhartl/jquery-cookie
4
+ *
5
+ * Copyright 2011, Klaus Hartl
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.opensource.org/licenses/GPL-2.0
9
+ */
10
+ (function($) {
11
+ $.cookie = function(key, value, options) {
12
+
13
+ // key and at least value given, set cookie...
14
+ if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
15
+ options = $.extend({}, options);
16
+
17
+ if (value === null || value === undefined) {
18
+ options.expires = -1;
19
+ }
20
+
21
+ if (typeof options.expires === 'number') {
22
+ var days = options.expires, t = options.expires = new Date();
23
+ t.setDate(t.getDate() + days);
24
+ }
25
+
26
+ value = String(value);
27
+
28
+ return (document.cookie = [
29
+ encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
30
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
31
+ options.path ? '; path=' + options.path : '',
32
+ options.domain ? '; domain=' + options.domain : '',
33
+ options.secure ? '; secure' : ''
34
+ ].join(''));
35
+ }
36
+
37
+ // key and possibly options given, get cookie...
38
+ options = value || {};
39
+ var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
40
+
41
+ var pairs = document.cookie.split('; ');
42
+ for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
43
+ if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
44
+ }
45
+ return null;
46
+ };
47
+ })(jQuery);
@@ -0,0 +1,100 @@
1
+ var RedisUI = {};
2
+ RedisUI.prefs = {
3
+ "warn-on-del": true,
4
+ "num-entries" : "25"
5
+ }
6
+
7
+ $(function() {
8
+
9
+
10
+ RedisUI.keytable = $('table.keys').dataTable({
11
+ "bStateSave": true
12
+ });
13
+
14
+ $('#namespace_tree').bind("loaded.jstree", function (event, data) {
15
+ $(this).jstree("open_all");
16
+ }).jstree({
17
+ "core" : {
18
+ "animation": 20
19
+ },
20
+ "plugins" : [ "themes", "html_data" ]
21
+ });
22
+
23
+
24
+ // update prefs from cookie if available,
25
+ // else set the cookie
26
+ for(var key in RedisUI.prefs) {
27
+ if (val = $.cookie(key)) {
28
+ RedisUI.prefs[key] = val
29
+ } else {
30
+ $.cookie(key, RedisUI.prefs[key])
31
+ }
32
+ }
33
+
34
+ // Todo: give them a type so we can loop through instead of this?
35
+ // (if there are ever more than just checkboxes, anyway...)
36
+ $('#warn-on-del').prop("checked", RedisUI.prefs['warn-on-del'] == "true");
37
+ $('[name=DataTables_Table_0_length]').val(RedisUI.prefs['num-entries'])
38
+
39
+
40
+ // update pref cookie when changing options
41
+ $('input.pref-cb').click(function(e) {
42
+ $.cookie('warn-on-del', $(this).prop('checked'));
43
+ })
44
+
45
+ $('[name=DataTables_Table_0_length]').change(function(e) {
46
+ $.cookie('num-entries', $(this).val());
47
+ })
48
+
49
+
50
+
51
+
52
+
53
+
54
+ // ajax delete
55
+ $('a.del').live('click', function(e) {
56
+ e.preventDefault();
57
+
58
+ var nodes = RedisUI.keytable.fnGetNodes();
59
+ var row = $(this).closest('tr')[0]
60
+ var key = $(this).data('key')
61
+
62
+ if ($('#warn-on-del').prop('checked')){
63
+ if(confirm("This will delete the key:\n\n\""+ key +"\"\n\n...from the DB. Are you sure?") ){
64
+ doit(this)
65
+ }
66
+ } else {
67
+ // just do it!
68
+ doit(this)
69
+ }
70
+
71
+ function doit(element){
72
+ $.post($(element).attr('href'), function(response) {
73
+ RedisUI.keytable.fnDeleteRow(row);
74
+ })
75
+ }
76
+ })
77
+
78
+
79
+
80
+
81
+
82
+ function maybe_auto_refresh() {
83
+ if($('#auto-refresh').prop('checked')) {
84
+ $.ajax({
85
+ type: 'get',
86
+ dataType: 'html',
87
+ accepts: 'html',
88
+ url: window.location.href,
89
+ success: function(response) {
90
+ $('#namespaces').replaceWith($('#namespaces', response))
91
+ $('#data_table').replaceWith($('#data_table', response))
92
+ }
93
+ });
94
+ }
95
+ window.setTimeout(maybe_auto_refresh, 2000);
96
+ }
97
+
98
+ //window.setTimeout(maybe_auto_refresh, 2000);
99
+
100
+ })
@@ -46,7 +46,7 @@ table.dataTable {
46
46
  margin-bottom: 10px;
47
47
  }
48
48
 
49
- table td a{display:block; color:#333;}
49
+ table td a{color:#333;}
50
50
 
51
51
  table th {
52
52
  text-align:left;
@@ -80,6 +80,13 @@ table li {
80
80
  margin-left: 1ex;
81
81
  }
82
82
 
83
+
84
+
85
+
86
+
87
+
88
+
89
+
83
90
  #container>ul{padding:0.5em; margin:1em;}
84
91
  #container>li{padding:0.5em 0;}
85
92
 
@@ -0,0 +1,9 @@
1
+ <ul>
2
+ <% tree.each do |k, v| %>
3
+ <li>
4
+ <% param = namespace ? "#{namespace}:#{k}" : k %>
5
+ <a href="/namespace/<%= CGI.escape param %>"><%= k %></a>
6
+ <%= partial :namespace_tree, tree: v, namespace: param %>
7
+ </li>
8
+ <% end %>
9
+ </ul>
@@ -1,14 +1,13 @@
1
- <!--
2
1
  <div id="options" class="panel">
3
2
  <h2>Options</h2>
4
- <p><input id="auto-refresh" name="auto-refresh" type="checkbox" checked="checked" /> <label for="auto-refresh">Auto-Refresh?</label></p>
3
+ <!-- <p><input id="auto-refresh" name="auto-refresh" type="checkbox" checked="checked" /> <label for="auto-refresh">Auto-Refresh?</label></p> -->
4
+ <p><input class="pref-cb" id="warn-on-del" name="warn-on-del" type="checkbox" checked="checked" /> <label for="warn-on-del">Warn on Delete?</label></p>
5
5
  </div>
6
- -->
7
6
 
8
7
  <div id="namespaces" class="panel">
9
8
  <h2>Namespaces</h2>
10
9
  <div id="namespace_tree">
11
- <%= render_tree(@namespace_tree) %>
10
+ <%= partial :namespace_tree, tree: @namespace_tree, namespace: RedisUI.namespace %>
12
11
  </div>
13
12
  <div class="clear"></div>
14
13
  </div>
@@ -18,16 +17,20 @@
18
17
  <table class="keys">
19
18
  <thead>
20
19
  <tr>
20
+ <th class="del-column"></th>
21
21
  <th>Key</th>
22
22
  <th>Type</th>
23
23
  <th>Value</th>
24
24
  </tr>
25
25
  </thead>
26
26
  <tbody>
27
- <% @keys.each do |key| %>
28
- <tr class="key">
27
+ <% @keys.each_with_index do |key, i| %>
28
+ <tr class="key" id="key<%= i %>">
29
+ <td style="width: 20px;">
30
+ <a class="del" href="/del/<%= CGI.escape key[:key] %>" data-key="<%= key[:key] %>">X</a>
31
+ </td>
29
32
  <td>
30
- <a href="/keys/<%= key[:key] %>">
33
+ <a href="/keys/<%= CGI.escape key[:key] %>">
31
34
  <%= key[:key] %>
32
35
  </a>
33
36
  </td>
@@ -6,7 +6,8 @@
6
6
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js"></script>
7
7
  <script src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.1/jquery.dataTables.min.js"></script>
8
8
  <script src="/js/lib/jstree/jquery.jstree.js"></script>
9
- <script src="/js/lib/redis-ui.js"></script>
9
+ <script src="/js/redis-ui.js"></script>
10
+ <script src="/js/lib/jquery.cookie.js"></script>
10
11
  </head>
11
12
 
12
13
  <body>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-19 00:00:00.000000000Z
13
+ date: 2012-06-20 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bacon
17
- requirement: &2168562820 !ruby/object:Gem::Requirement
17
+ requirement: &2177777680 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2168562820
25
+ version_requirements: *2177777680
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: json
28
- requirement: &2168562400 !ruby/object:Gem::Requirement
28
+ requirement: &2177777260 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2168562400
36
+ version_requirements: *2177777260
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: redis
39
- requirement: &2165601840 !ruby/object:Gem::Requirement
39
+ requirement: &2177808320 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2165601840
47
+ version_requirements: *2177808320
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: redis-namespace
50
- requirement: &2165601420 !ruby/object:Gem::Requirement
50
+ requirement: &2177807900 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2165601420
58
+ version_requirements: *2177807900
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: sinatra
61
- requirement: &2165601000 !ruby/object:Gem::Requirement
61
+ requirement: &2177807480 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2165601000
69
+ version_requirements: *2177807480
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: sinatra-respond_to
72
- requirement: &2165600580 !ruby/object:Gem::Requirement
72
+ requirement: &2177807060 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2165600580
80
+ version_requirements: *2177807060
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: vegas
83
- requirement: &2165600160 !ruby/object:Gem::Requirement
83
+ requirement: &2177806640 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *2165600160
91
+ version_requirements: *2177806640
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: deep_merge
94
- requirement: &2165599740 !ruby/object:Gem::Requirement
94
+ requirement: &2177806220 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '0'
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *2165599740
102
+ version_requirements: *2177806220
103
103
  description: View and manage redis store
104
104
  email:
105
105
  - james@supermatter.com
@@ -118,7 +118,9 @@ files:
118
118
  - bin/redis-ui
119
119
  - config.ru
120
120
  - lib/redis-ui.rb
121
+ - lib/redis-ui/helpers.rb
121
122
  - lib/redis-ui/version.rb
123
+ - lib/static/js/lib/jquery.cookie.js
122
124
  - lib/static/js/lib/jstree/jquery.jstree.js
123
125
  - lib/static/js/lib/jstree/themes/apple/bg.jpg
124
126
  - lib/static/js/lib/jstree/themes/apple/d.png
@@ -139,8 +141,9 @@ files:
139
141
  - lib/static/js/lib/jstree/themes/default/d.png
140
142
  - lib/static/js/lib/jstree/themes/default/style.css
141
143
  - lib/static/js/lib/jstree/themes/default/throbber.gif
142
- - lib/static/js/lib/redis-ui.js
144
+ - lib/static/js/redis-ui.js
143
145
  - lib/static/stylesheets/redis-ui.css
146
+ - lib/views/_namespace_tree.html.erb
144
147
  - lib/views/index.html.erb
145
148
  - lib/views/layout.html.erb
146
149
  - lib/views/show.html.erb
@@ -1,35 +0,0 @@
1
- $(function() {
2
-
3
- $('table.keys').dataTable({
4
- "bStateSave": true
5
- });
6
-
7
- $('#namespace_tree').bind("loaded.jstree", function (event, data) {
8
- $(this).jstree("open_all");
9
- }).jstree({
10
- "core" : {
11
- "animation": 20
12
- },
13
- "plugins" : [ "themes", "html_data" ]
14
- });
15
-
16
-
17
- function maybe_auto_refresh() {
18
- if($('#auto-refresh').prop('checked')) {
19
- $.ajax({
20
- type: 'get',
21
- dataType: 'html',
22
- accepts: 'html',
23
- url: window.location.href,
24
- success: function(response) {
25
- $('#namespaces').replaceWith($('#namespaces', response))
26
- $('#data_table').replaceWith($('#data_table', response))
27
- }
28
- });
29
- }
30
- window.setTimeout(maybe_auto_refresh, 2000);
31
- }
32
-
33
- //window.setTimeout(maybe_auto_refresh, 2000);
34
-
35
- })