rhoconnect 3.1.2 → 3.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +14 -2
- data/CREDITS +151 -10
- data/Gemfile +16 -5
- data/Gemfile.lock +58 -23
- data/Rakefile +70 -50
- data/bench/bench_runner.rb +2 -2
- data/bench/benchapp/Gemfile +6 -0
- data/bench/benchapp/Gemfile.lock +5 -0
- data/bench/benchapp/config.ru +2 -0
- data/bench/lib/bench/cli.rb +2 -0
- data/bench/lib/bench/distr_runner.rb +3 -2
- data/bench/lib/bench/runner.rb +1 -1
- data/bench/lib/bench.rb +10 -1
- data/bench/run_bench.sh +1 -1
- data/bench/scripts/test_query_script.rb +2 -1
- data/bench/spec/bench_spec_helper.rb +1 -0
- data/bin/rhoconnect +9 -27
- data/bin/rhoconnect-benchmark +10 -1
- data/commands/commands/dtach_commands/dtach_about.rb +6 -0
- data/commands/commands/dtach_commands/dtach_install.rb +30 -0
- data/commands/commands/redis_commands/redis_about.rb +6 -0
- data/commands/commands/redis_commands/redis_attach.rb +6 -0
- data/commands/commands/redis_commands/redis_download.rb +33 -0
- data/commands/commands/redis_commands/redis_install.rb +26 -0
- data/commands/commands/redis_commands/redis_make.rb +9 -0
- data/commands/commands/redis_commands/redis_restart.rb +7 -0
- data/commands/commands/redis_commands/redis_runner.rb +67 -0
- data/commands/commands/redis_commands/redis_start.rb +6 -0
- data/commands/commands/redis_commands/redis_startbg.rb +6 -0
- data/commands/commands/redis_commands/redis_stop.rb +6 -0
- data/commands/commands/rhoconnect/attach.rb +7 -0
- data/commands/commands/rhoconnect/clean_start.rb +9 -0
- data/commands/commands/rhoconnect/config.rb +15 -0
- data/commands/commands/rhoconnect/console.rb +15 -0
- data/commands/commands/rhoconnect/console_helper.rb +3 -0
- data/commands/commands/rhoconnect/create_user.rb +18 -0
- data/commands/commands/rhoconnect/delete_device.rb +9 -0
- data/commands/commands/rhoconnect/delete_user.rb +8 -0
- data/commands/commands/rhoconnect/flushdb.rb +14 -0
- data/commands/commands/rhoconnect/get_token.rb +25 -0
- data/commands/commands/rhoconnect/reset.rb +16 -0
- data/commands/commands/rhoconnect/reset_refresh.rb +11 -0
- data/commands/commands/rhoconnect/restart.rb +7 -0
- data/commands/commands/rhoconnect/secret.rb +11 -0
- data/commands/commands/rhoconnect/set_admin_password.rb +26 -0
- data/commands/commands/rhoconnect/spec.rb +15 -0
- data/commands/commands/rhoconnect/start.rb +18 -0
- data/commands/commands/rhoconnect/startbg.rb +34 -0
- data/commands/commands/rhoconnect/startdebug.rb +35 -0
- data/commands/commands/rhoconnect/stop.rb +11 -0
- data/commands/commands/rhoconnect/war.rb +32 -0
- data/commands/commands/rhoconnect/web.rb +7 -0
- data/commands/execute.rb +35 -0
- data/commands/generators/app.rb +6 -0
- data/commands/generators/source.rb +6 -0
- data/commands/utilities/dtach_installed.rb +10 -0
- data/doc/benchmarks-running.txt +5 -0
- data/doc/command-line.txt +216 -27
- data/doc/heroku-addon.txt +1 -1
- data/doc/preparing-production.txt +20 -1
- data/doc/public/cli.txt +191 -0
- data/doc/push-backend-setup.txt +148 -0
- data/doc/push-client-setup.txt +61 -0
- data/doc/push-server-setup.txt +91 -0
- data/doc/push.txt +8 -137
- data/doc/rest-api.txt +96 -0
- data/doc/settings.txt +1 -1
- data/doc/supported-platforms.txt +2 -1
- data/doc/tutorial.txt +6 -4
- data/examples/simple/Gemfile +39 -0
- data/examples/simple/Rakefile +7 -12
- data/examples/simple/config.ru +16 -31
- data/examples/simple/settings/settings.yml +5 -4
- data/examples/simple/sources/product.rb +51 -0
- data/generators/templates/application/Gemfile +7 -0
- data/generators/templates/application/Rakefile +5 -18
- data/generators/templates/application/config.ru +11 -19
- data/install.sh +24 -49
- data/installer/unix-like/create_texts.rb +71 -123
- data/installer/unix-like/post_install.sh +3 -0
- data/installer/unix-like/post_uninstall.sh +2 -0
- data/installer/unix-like/pre_install.sh +5 -3
- data/installer/unix-like/pre_uninstall.sh +14 -6
- data/installer/unix-like/rho_connect_install_checkers.rb +1 -1
- data/installer/unix-like/rho_connect_install_constants.rb +6 -10
- data/installer/unix-like/rho_connect_install_debian.rb +2 -2
- data/installer/unix-like/rho_connect_install_dnd.rb +2 -5
- data/installer/unix-like/rho_connect_install_installers.rb +15 -23
- data/installer/unix-like/rho_connect_install_yum.rb +2 -2
- data/installer/utils/constants.rb +4 -4
- data/installer/utils/create_sha1.rb +1 -1
- data/installer/utils/nix_install_test.rb +32 -31
- data/installer/utils/nix_installation.rake +1 -1
- data/installer/utils/package_upload/repos.rake +34 -30
- data/installer/utils/package_upload/s3_upload.rb +3 -3
- data/lib/rhoconnect/api/source/fast_delete.rb +10 -0
- data/lib/rhoconnect/api/source/fast_insert.rb +10 -0
- data/lib/rhoconnect/api/source/fast_update.rb +10 -0
- data/lib/rhoconnect/api/source/get_source_params.rb +1 -1
- data/lib/rhoconnect/api/source/list_sources.rb +2 -2
- data/lib/rhoconnect/api/source/save_adapter.rb +1 -1
- data/lib/rhoconnect/api/source/update_source_params.rb +6 -0
- data/lib/rhoconnect/async.rb +82 -0
- data/lib/rhoconnect/bulk_data/bulk_data.rb +5 -1
- data/lib/rhoconnect/client_sync.rb +18 -3
- data/lib/rhoconnect/console/rhoconnect_api.rb +2 -2
- data/lib/rhoconnect/console/server.rb +5 -32
- data/lib/rhoconnect/console.rb +2 -2
- data/lib/rhoconnect/graph_helper.rb +225 -0
- data/lib/rhoconnect/jobs/bulk_data_job.rb +24 -2
- data/lib/rhoconnect/server.rb +31 -11
- data/lib/rhoconnect/source.rb +10 -5
- data/lib/rhoconnect/source_sync.rb +32 -2
- data/lib/rhoconnect/tasks.rb +19 -108
- data/lib/rhoconnect/test_methods.rb +20 -0
- data/lib/rhoconnect/utilities.rb +118 -0
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect/web-console/controllers/admins.js +245 -0
- data/lib/rhoconnect/web-console/models/adapter.js +53 -0
- data/lib/rhoconnect/web-console/models/client.js +105 -0
- data/lib/rhoconnect/web-console/models/doc.js +113 -0
- data/lib/rhoconnect/web-console/models/session.js +40 -0
- data/lib/rhoconnect/web-console/models/source.js +115 -0
- data/lib/rhoconnect/web-console/models/stats.js +84 -0
- data/lib/rhoconnect/web-console/models/user.js +111 -0
- data/lib/rhoconnect/web-console/public/backbone.js +1432 -0
- data/lib/rhoconnect/web-console/public/bootstrap.css +3990 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/excanvas.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.barRenderer.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasAxisLabelRenderer.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasAxisTickRenderer.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.canvasTextRenderer.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.categoryAxisRenderer.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.cursor.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.dateAxisRenderer.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.dateAxisRenderer.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jqplot.pointLabels.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery-1.4.2.min.js +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery.jqplot.min.css +0 -0
- data/lib/rhoconnect/{console/app → web-console}/public/jqplot/jquery.jqplot.min.js +0 -0
- data/lib/rhoconnect/web-console/public/jquery-1.7.1.min.js +154 -0
- data/lib/rhoconnect/web-console/public/rhoconnect-web.js +15 -0
- data/lib/rhoconnect/web-console/public/underscore.js +999 -0
- data/lib/rhoconnect/web-console/server.rb +55 -0
- data/lib/rhoconnect/web-console/templates/index.erb +90 -0
- data/lib/rhoconnect/web-console/templates/jqplot.erb +60 -0
- data/lib/rhoconnect/web-console/views/api_token.js +16 -0
- data/lib/rhoconnect/web-console/views/doc.js +63 -0
- data/lib/rhoconnect/web-console/views/edit_user.js +43 -0
- data/lib/rhoconnect/web-console/views/home.js +56 -0
- data/lib/rhoconnect/web-console/views/index.js +63 -0
- data/lib/rhoconnect/web-console/views/new_ping.js +58 -0
- data/lib/rhoconnect/web-console/views/new_user.js +29 -0
- data/lib/rhoconnect/web-console/views/server_doc.js +103 -0
- data/lib/rhoconnect/web-console/views/set_adapter.js +38 -0
- data/lib/rhoconnect/web-console/views/settings.js +53 -0
- data/lib/rhoconnect/web-console/views/show_device.js +56 -0
- data/lib/rhoconnect/web-console/views/show_user.js +38 -0
- data/lib/rhoconnect/web-console/views/source_docs.js +30 -0
- data/lib/rhoconnect/web-console/views/stats.js +69 -0
- data/lib/rhoconnect/web-console/views/users.js +20 -0
- data/lib/rhoconnect.rb +2 -1
- data/rhoconnect.gemspec +3 -1
- data/spec/api/application/rhoconnect_api_spec.rb +3 -5
- data/spec/api/source/fast_delete_spec.rb +27 -0
- data/spec/api/source/fast_insert_spec.rb +28 -0
- data/spec/api/source/fast_update_spec.rb +51 -0
- data/spec/api/source/get_source_params_spec.rb +1 -0
- data/spec/api/source/update_source_params_spec.rb +24 -0
- data/spec/async_spec.rb +19 -0
- data/spec/client_sync_spec.rb +19 -2
- data/spec/javascripts/PlayerSpec.js +58 -0
- data/spec/javascripts/admins_routes_spec.js +117 -0
- data/spec/javascripts/admins_spec.js +27 -0
- data/spec/javascripts/doc_view_spec.js +37 -0
- data/spec/javascripts/edit_user_view_spec.js +44 -0
- data/spec/javascripts/helpers/SpecHelper.js +9 -0
- data/spec/javascripts/helpers/jasmine-jquery.js +305 -0
- data/spec/javascripts/helpers/jasmine-sinon.js +43 -0
- data/spec/javascripts/helpers/sinon-1.3.2.js +3551 -0
- data/spec/javascripts/home_view_spec.js +39 -0
- data/spec/javascripts/index_view_spec.js +42 -0
- data/spec/javascripts/new_ping_view_spec.js +48 -0
- data/spec/javascripts/new_user_view_spec.js +42 -0
- data/spec/javascripts/server_doc_view_spec.js +39 -0
- data/spec/javascripts/set_adapter_view_spec.js +32 -0
- data/spec/javascripts/show_device_view_spec.js +41 -0
- data/spec/javascripts/show_user_view_spec.js +46 -0
- data/spec/javascripts/source_docs_view_spec.js +36 -0
- data/spec/javascripts/support/jasmine.yml +79 -0
- data/spec/javascripts/support/jasmine_config.rb +23 -0
- data/spec/javascripts/support/jasmine_runner.rb +32 -0
- data/spec/javascripts/users_view_spec.js +35 -0
- data/spec/jobs/bulk_data_job_spec.rb +10 -2
- data/spec/perf/bulk_data_perf_spec.rb +1 -0
- data/spec/server/server_spec.rb +3 -1
- data/spec/source_sync_spec.rb +14 -1
- data/spec/spec_helper.rb +51 -0
- data/spec/store_spec.rb +6 -0
- data/spec/test_methods_spec.rb +11 -0
- data/tasks/redis.rake +3 -1
- metadata +172 -64
- data/doc/contributing.txt +0 -60
- data/lib/rhoconnect/console/app/helpers/auth_helper.rb +0 -22
- data/lib/rhoconnect/console/app/helpers/extensions.rb +0 -19
- data/lib/rhoconnect/console/app/helpers/helpers.rb +0 -57
- data/lib/rhoconnect/console/app/public/ThickBox.css +0 -649
- data/lib/rhoconnect/console/app/public/home.css +0 -431
- data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
- data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
- data/lib/rhoconnect/console/app/public/main.css +0 -7
- data/lib/rhoconnect/console/app/public/reset.css +0 -76
- data/lib/rhoconnect/console/app/public/style.css +0 -2201
- data/lib/rhoconnect/console/app/public/text.txt +0 -0
- data/lib/rhoconnect/console/app/routes/adapter.rb +0 -28
- data/lib/rhoconnect/console/app/routes/auth.rb +0 -29
- data/lib/rhoconnect/console/app/routes/client.rb +0 -31
- data/lib/rhoconnect/console/app/routes/docs.rb +0 -145
- data/lib/rhoconnect/console/app/routes/heroku.rb +0 -19
- data/lib/rhoconnect/console/app/routes/home.rb +0 -63
- data/lib/rhoconnect/console/app/routes/timing.rb +0 -242
- data/lib/rhoconnect/console/app/routes/user.rb +0 -122
- data/lib/rhoconnect/console/app/views/adapter.erb +0 -16
- data/lib/rhoconnect/console/app/views/client.erb +0 -30
- data/lib/rhoconnect/console/app/views/content.erb +0 -14
- data/lib/rhoconnect/console/app/views/doc.erb +0 -8
- data/lib/rhoconnect/console/app/views/docdata.erb +0 -28
- data/lib/rhoconnect/console/app/views/docs.erb +0 -30
- data/lib/rhoconnect/console/app/views/edituser.erb +0 -13
- data/lib/rhoconnect/console/app/views/headermenu.erb +0 -40
- data/lib/rhoconnect/console/app/views/home.erb +0 -24
- data/lib/rhoconnect/console/app/views/index.erb +0 -58
- data/lib/rhoconnect/console/app/views/jqplot.erb +0 -52
- data/lib/rhoconnect/console/app/views/layout.erb +0 -153
- data/lib/rhoconnect/console/app/views/login.erb +0 -26
- data/lib/rhoconnect/console/app/views/newuser.erb +0 -17
- data/lib/rhoconnect/console/app/views/ping.erb +0 -40
- data/lib/rhoconnect/console/app/views/result.erb +0 -11
- data/lib/rhoconnect/console/app/views/rightboxlinks.erb +0 -15
- data/lib/rhoconnect/console/app/views/select_doc.erb +0 -17
- data/lib/rhoconnect/console/app/views/upload_doc.erb +0 -23
- data/lib/rhoconnect/console/app/views/user.erb +0 -29
- data/lib/rhoconnect/console/app/views/users.erb +0 -19
- data/lib/rhoconnect/server/views/index.erb +0 -13
@@ -0,0 +1,115 @@
|
|
1
|
+
var Source = Backbone.Model.extend({
|
2
|
+
|
3
|
+
defaults: {
|
4
|
+
api_token: null,
|
5
|
+
rhoconnect_version: null,
|
6
|
+
licensee: null,
|
7
|
+
seats: null,
|
8
|
+
issued: null,
|
9
|
+
source_id: null,
|
10
|
+
partition_type: null,
|
11
|
+
user_id: null,
|
12
|
+
doctype: null,
|
13
|
+
device_id: null
|
14
|
+
},
|
15
|
+
|
16
|
+
initialize: function(){
|
17
|
+
var session = new Session();
|
18
|
+
this.set('api_token', session.getApiKey())
|
19
|
+
},
|
20
|
+
|
21
|
+
url: '/api/admin',
|
22
|
+
|
23
|
+
methodUrl: {
|
24
|
+
'create': '/api/admin/get_license_info',
|
25
|
+
'read' : '/api/source/list_sources'
|
26
|
+
},
|
27
|
+
|
28
|
+
sync: function(method, model, options) {
|
29
|
+
if (model.methodUrl && model.methodUrl[method.toLowerCase()]) {
|
30
|
+
options = options || {};
|
31
|
+
options.url = model.methodUrl[method.toLowerCase()];
|
32
|
+
if(method == 'read'){
|
33
|
+
options.url += "?api_token=" + this.get('api_token') + "&partition_type=" + this.get('partition_type')
|
34
|
+
}
|
35
|
+
}
|
36
|
+
Backbone.sync(method, model, options);
|
37
|
+
},
|
38
|
+
|
39
|
+
parse: function(resp){
|
40
|
+
if(resp[0] != undefined || resp.length < 1){
|
41
|
+
var user = this.get('user_id');
|
42
|
+
var doctype = this.get('doctype');
|
43
|
+
var client_id = this.get('client_id');
|
44
|
+
var adapters = "";
|
45
|
+
$.each(resp, function(index,value){
|
46
|
+
if(doctype == null){
|
47
|
+
adapters += "<tr><td colspan='2'><a href='#sources/"+value+"'>"+ value + "</a></td></tr>"
|
48
|
+
}
|
49
|
+
else{
|
50
|
+
adapters += "<tr><td colspan='2'><a href='#sources/"+value+"/"+user+"/"+doctype+"/"+client_id+"'>"+ value + "</a></td></tr>"
|
51
|
+
}
|
52
|
+
})
|
53
|
+
$('#source-table tr:last').after(adapters);
|
54
|
+
}
|
55
|
+
else{
|
56
|
+
var license_text = "License to " + resp["licensee"] +
|
57
|
+
" on " + resp["issued"] + ", available " +
|
58
|
+
resp["available"] + " out of " +
|
59
|
+
resp['seats'] + " devices"
|
60
|
+
var license_footer = "Licensed to Rhomobile "+resp['available']+"/"+resp['seats']+" devices available"
|
61
|
+
$('#license').html(license_text);
|
62
|
+
$('#license_info').html(license_footer);
|
63
|
+
}
|
64
|
+
},
|
65
|
+
|
66
|
+
list_source_docs: function(source_id,user_id){
|
67
|
+
var session = new Session();
|
68
|
+
$.ajax({
|
69
|
+
type: 'POST',
|
70
|
+
url: '/api/source/list_source_docs',
|
71
|
+
data: {api_token : session.getApiKey, source_id : source_id, user_id : user_id},
|
72
|
+
success: function(resp){
|
73
|
+
var r = JSON.parse(resp)
|
74
|
+
var docs = "";
|
75
|
+
$.each(r, function(index,value){
|
76
|
+
docs += "<tr><td width='25%'>" + index + "</td><td><a href='#doc/"+value+"/source_id="+source_id+"'>" + value + "</a></td></tr>"
|
77
|
+
})
|
78
|
+
$('#sourcedocs-table tr:last').after(docs);
|
79
|
+
},
|
80
|
+
error: function(resp){
|
81
|
+
if(resp.status == 422){
|
82
|
+
new App.Views.Index()
|
83
|
+
}
|
84
|
+
$('#docalert')[0].innerHTML = resp.responseText;
|
85
|
+
$('#docalert').css('display','block');
|
86
|
+
}
|
87
|
+
})
|
88
|
+
},
|
89
|
+
|
90
|
+
get_source_params: function(source_id,user_id){
|
91
|
+
var session = new Session();
|
92
|
+
$.ajax({
|
93
|
+
type: 'POST',
|
94
|
+
url: '/api/source/get_source_params',
|
95
|
+
data: {api_token : session.getApiKey, source_id : source_id, user : user_id},
|
96
|
+
success: function(resp){
|
97
|
+
var r = JSON.parse(resp)
|
98
|
+
var params = "";
|
99
|
+
$.each(r, function(index,value){
|
100
|
+
if(value.value != null && value.value != "")
|
101
|
+
params += "<tr><td width='25%'>" + value.name + "</td><td>" + value.value + "</td></tr>"
|
102
|
+
})
|
103
|
+
$('#sourceparams-table tr:last').after(params);
|
104
|
+
},
|
105
|
+
error: function(resp){
|
106
|
+
if(resp.status == 422){
|
107
|
+
new App.Views.Index()
|
108
|
+
}
|
109
|
+
$('#docalert')[0].innerHTML = resp.responseText;
|
110
|
+
$('#docalert').css('display','block');
|
111
|
+
}
|
112
|
+
})
|
113
|
+
}
|
114
|
+
|
115
|
+
})
|
@@ -0,0 +1,84 @@
|
|
1
|
+
var Stats = Backbone.Model.extend({
|
2
|
+
|
3
|
+
initialize: function(){
|
4
|
+
var session = new Session();
|
5
|
+
this.set('api_token', session.getApiKey())
|
6
|
+
},
|
7
|
+
|
8
|
+
user_stats: function(){
|
9
|
+
session = new Session();
|
10
|
+
$.ajax({
|
11
|
+
type: 'POST',
|
12
|
+
url: 'get_user_graph',
|
13
|
+
data: {api_token : session.getApiKey()},
|
14
|
+
success: function(resp){
|
15
|
+
$('#stats_main').html(resp);
|
16
|
+
},
|
17
|
+
error: function(resp){
|
18
|
+
if(resp.status == 422){
|
19
|
+
new App.Views.Index()
|
20
|
+
}
|
21
|
+
$('#stats-alert')[0].innerHTML = resp.responseText;
|
22
|
+
$('#stats-alert').css('display','block');
|
23
|
+
}
|
24
|
+
})
|
25
|
+
},
|
26
|
+
|
27
|
+
device_count: function(){
|
28
|
+
session = new Session();
|
29
|
+
$.ajax({
|
30
|
+
type: 'POST',
|
31
|
+
url: 'device_count',
|
32
|
+
data: {api_token : session.getApiKey()},
|
33
|
+
success: function(resp){
|
34
|
+
$('#stats_main').html(resp);
|
35
|
+
},
|
36
|
+
error: function(resp){
|
37
|
+
if(resp.status == 422){
|
38
|
+
new App.Views.Index()
|
39
|
+
}
|
40
|
+
$('#stats-alert')[0].innerHTML = resp.responseText;
|
41
|
+
$('#stats-alert').css('display','block');
|
42
|
+
}
|
43
|
+
})
|
44
|
+
},
|
45
|
+
|
46
|
+
source_timing: function(display_name){
|
47
|
+
session = new Session();
|
48
|
+
$.ajax({
|
49
|
+
type: 'POST',
|
50
|
+
url: 'source_timing',
|
51
|
+
data: {api_token : session.getApiKey(),display_name : display_name},
|
52
|
+
success: function(resp){
|
53
|
+
$('#stats_main').html(resp);
|
54
|
+
},
|
55
|
+
error: function(resp){
|
56
|
+
if(resp.status == 422){
|
57
|
+
new App.Views.Index()
|
58
|
+
}
|
59
|
+
$('#stats-alert')[0].innerHTML = "No Data Available";
|
60
|
+
$('#stats-alert').css('display','block');
|
61
|
+
}
|
62
|
+
})
|
63
|
+
},
|
64
|
+
|
65
|
+
http_timing: function(display_name){
|
66
|
+
session = new Session();
|
67
|
+
$.ajax({
|
68
|
+
type: 'POST',
|
69
|
+
url: 'http_timing',
|
70
|
+
data: {api_token : session.getApiKey(),display_name : display_name},
|
71
|
+
success: function(resp){
|
72
|
+
$('#stats_main').html(resp);
|
73
|
+
},
|
74
|
+
error: function(resp){
|
75
|
+
if(resp.status == 422){
|
76
|
+
new App.Views.Index()
|
77
|
+
}
|
78
|
+
$('#stats-alert')[0].innerHTML = "No Data Available";
|
79
|
+
$('#stats-alert').css('display','block');
|
80
|
+
}
|
81
|
+
})
|
82
|
+
}
|
83
|
+
|
84
|
+
})
|
@@ -0,0 +1,111 @@
|
|
1
|
+
var User = Backbone.Model.extend({
|
2
|
+
|
3
|
+
defaults: {
|
4
|
+
api_token: null,
|
5
|
+
name: null
|
6
|
+
},
|
7
|
+
|
8
|
+
initialize: function(){
|
9
|
+
var session = new Session();
|
10
|
+
this.set('api_token', session.getApiKey())
|
11
|
+
},
|
12
|
+
|
13
|
+
get_users: function(tble_name){
|
14
|
+
var tble_name = tble_name;
|
15
|
+
$.ajax({
|
16
|
+
type: 'POST',
|
17
|
+
url: '/api/list_users',
|
18
|
+
data: {api_token : this.get('api_token')},
|
19
|
+
success: function(resp){
|
20
|
+
var r = JSON.parse(resp)
|
21
|
+
data = ""
|
22
|
+
names = "";
|
23
|
+
count = r.length;
|
24
|
+
$.each(r,function(index,value){
|
25
|
+
data += "<tr><td colspan='3'><a href='#user/"+value+"'>"+value+"</a></td></tr>";
|
26
|
+
names += value;
|
27
|
+
if(index + 1 < count)
|
28
|
+
names += ",";
|
29
|
+
})
|
30
|
+
if(tble_name == 'ping')
|
31
|
+
$('#pinguser').val(names);
|
32
|
+
else
|
33
|
+
$('#users_table tr:last').after(data);
|
34
|
+
},
|
35
|
+
error: function(resp){
|
36
|
+
if(resp.status == 422){
|
37
|
+
new App.Views.Index()
|
38
|
+
}
|
39
|
+
$('#ping-alert')[0].innerHTML = resp.responseText;
|
40
|
+
$('#ping-alert').css('display','block');
|
41
|
+
}
|
42
|
+
})
|
43
|
+
},
|
44
|
+
|
45
|
+
create_user: function(){
|
46
|
+
var login = $('#new-login').val();
|
47
|
+
var password = $('#new-password').val();
|
48
|
+
$.ajax({
|
49
|
+
type: 'POST',
|
50
|
+
url: '/api/create_user',
|
51
|
+
data: {api_token : this.get('api_token'), attributes : {login : login, password : password}},
|
52
|
+
success: function(resp){
|
53
|
+
router.navigate("users", true);
|
54
|
+
},
|
55
|
+
error: function(resp){
|
56
|
+
if(resp.status == 422){
|
57
|
+
new App.Views.Index()
|
58
|
+
}
|
59
|
+
$('#newuser-alert')[0].innerHTML = resp.responseText;
|
60
|
+
$('#newuser-alert').css('display','block');
|
61
|
+
}
|
62
|
+
})
|
63
|
+
},
|
64
|
+
|
65
|
+
delete_user: function(){
|
66
|
+
if(confirm("Are you sure you want to delete this user?")){
|
67
|
+
$.ajax({
|
68
|
+
type: 'POST',
|
69
|
+
url: '/api/user/delete_user',
|
70
|
+
data: {api_token : this.get('api_token'), user_id : this.get('name')},
|
71
|
+
success: function(resp){
|
72
|
+
router.navigate("users", true);
|
73
|
+
},
|
74
|
+
error: function(resp){
|
75
|
+
if(resp.status == 422){
|
76
|
+
new App.Views.Index()
|
77
|
+
}
|
78
|
+
$('#newuser-alert')[0].innerHTML = resp.responseText;
|
79
|
+
$('#newuser-alert').css('display','block');
|
80
|
+
}
|
81
|
+
})
|
82
|
+
}
|
83
|
+
|
84
|
+
},
|
85
|
+
|
86
|
+
new_ping: function(){
|
87
|
+
$.ajax({
|
88
|
+
type: 'POST',
|
89
|
+
url: '/api/source/list_sources',
|
90
|
+
data: {api_token : this.get('api_token'), user_id : this.get('name')},
|
91
|
+
success: function(resp){
|
92
|
+
var r = JSON.parse(resp);
|
93
|
+
source_list = "";
|
94
|
+
var count = r.length;
|
95
|
+
$.each(r, function(index,value){
|
96
|
+
source_list += value;
|
97
|
+
if(index + 1 < count)
|
98
|
+
source_list += ",";
|
99
|
+
})
|
100
|
+
$('input#sources').val(source_list);
|
101
|
+
},
|
102
|
+
error: function(resp){
|
103
|
+
if(resp.status == 422){
|
104
|
+
new App.Views.Index()
|
105
|
+
}
|
106
|
+
$('#newuser-alert')[0].innerHTML = resp.responseText;
|
107
|
+
$('#newuser-alert').css('display','block');
|
108
|
+
}
|
109
|
+
})
|
110
|
+
}
|
111
|
+
})
|