Sha256: ae6fc878a12425821f3a5359589e80514b4443e59ce1c27510ea62a3bdb0c346

Contents?: true

Size: 1.91 KB

Versions: 10

Compression:

Stored size: 1.91 KB

Contents

var Stats = Backbone.Model.extend({
	
	initialize: function(){
		var session = new Session();
		this.set('api_token', session.getApiKey())
	},
		
	user_stats: function(){
		session = new Session();
	    $.ajax({
			type: 'POST',
			url: 'get_user_graph',
			data: {api_token : session.getApiKey()},
			success: function(resp){
				$('#stats_main').html(resp);
			},
			error: function(resp){
				if(resp.status == 422){
					 new App.Views.Index()
				}
				$('#stats-alert')[0].innerHTML = resp.responseText;
		        $('#stats-alert').css('display','block');
			}
		})
	},
	
	device_count: function(){
		session = new Session();
	    $.ajax({
			type: 'POST',
			url: 'device_count',
			data: {api_token : session.getApiKey()},
			success: function(resp){
				$('#stats_main').html(resp);
			},
			error: function(resp){
				if(resp.status == 422){
					 new App.Views.Index()
				}
				$('#stats-alert')[0].innerHTML = resp.responseText;
		        $('#stats-alert').css('display','block');
			}
		})
	},
	
	source_timing: function(display_name){
		session = new Session();
	    $.ajax({
			type: 'POST',
			url: 'source_timing',
			data: {api_token : session.getApiKey(),display_name : display_name},
			success: function(resp){
				$('#stats_main').html(resp);
			},
			error: function(resp){
				if(resp.status == 422){
					 new App.Views.Index()
				}
				$('#stats-alert')[0].innerHTML = "No Data Available";
		        $('#stats-alert').css('display','block');
			}
		})
	},
	
	http_timing: function(display_name){
		session = new Session();
	    $.ajax({
			type: 'POST',
			url: 'http_timing',
			data: {api_token : session.getApiKey(),display_name : display_name},
			success: function(resp){
				$('#stats_main').html(resp);
			},
			error: function(resp){
				if(resp.status == 422){
					 new App.Views.Index()
				}
				$('#stats-alert')[0].innerHTML = "No Data Available";
		        $('#stats-alert').css('display','block');
			}
		})
	}
	
})

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rhoconnect-3.3.1.beta4 lib/rhoconnect/web-console/models/stats.js
rhoconnect-3.3.1.beta3 lib/rhoconnect/web-console/models/stats.js
rhoconnect-3.3.1.beta2 lib/rhoconnect/web-console/models/stats.js
rhoconnect-3.2.1 lib/rhoconnect/web-console/models/stats.js
rhoconnect-3.2.0 lib/rhoconnect/web-console/models/stats.js
rhoconnect-3.2.0.beta5 lib/rhoconnect/web-console/models/stats.js
rhoconnect-3.2.0.beta4 lib/rhoconnect/web-console/models/stats.js
rhoconnect-3.2.0.beta3 lib/rhoconnect/web-console/models/stats.js
rhoconnect-3.2.0.beta2 lib/rhoconnect/web-console/models/stats.js
rhoconnect-3.2.0.beta1 lib/rhoconnect/web-console/models/stats.js