App.Views.Home = Backbone.View.extend({ events: { "click a#reset" : "reset", "click #app_url" : "set_adapter", "submit form" : "edit", "click #api_btn" : "toggle_api_token" }, initialize: function() { var domain = $('input#domain').val(); this.model.get_license_info(); this.model.set('partition_type','app') this.model.fetch({ error: function(model,resp) { if(resp.status == 422){ new App.Views.Index() } } }); this.render(domain); this.options.model2.get_adapter(); }, reset: function(){ var session = new Session(); if(confirm("Are you sure you want to reset?")){ session.reset() } }, edit: function(e){ e.preventDefault(); var session = new Session() var password = $("#password2").val(); $(".edituser-status")[0].firstChild.className = "label label-warning"; $(".edituser-status")[0].firstChild.innerHTML = "loading..."; $(".edituser-status").css("visibility","visible"); $.ajax({ type: 'PUT', url: '/rc/v1/users/' + 'rhoadmin', data: {attributes : {login : 'rhoadmin', password : password}}, beforeSend: function (HttpRequest) { HttpRequest.setRequestHeader("X-RhoConnect-API-TOKEN", session.getApiKey()); }, success: function(){ //router.navigate("users", true); $(".edituser-status")[0].firstChild.className = "label label-success"; $(".edituser-status")[0].firstChild.innerHTML = "success"; }, error: function(resp){ if(resp.status == 422){ new App.Views.Index() } $(".edituser-status")[0].firstChild.className = "label label-important"; $(".edituser-status")[0].firstChild.innerHTML = "error"; $('#home-alert')[0].innerHTML = resp.responseText; $('#home-alert').css('display','block'); } }) return false; }, set_adapter: function(e){ e.preventDefault(); var adapter_url = $('#input_adapter').val(); //this.render(); $(".setadapter-status")[0].firstChild.className = "label label-warning"; $(".setadapter-status")[0].firstChild.innerHTML = "loading..."; $(".setadapter-status").css("visibility","visible"); this.delegateEvents(); this.options.model2.set_adapter(adapter_url); return false; }, toggle_api_token: function(e){ e.preventDefault(); if ($("#api_btn").attr("value") == "Show"){ $("#api_token").css('display','inline'); $("#api_btn").attr("value","Hide"); } else { $("#api_token").css('display','none'); $("#api_btn").attr("value","Show"); } }, render: function(domain) { session = new Session(); $('#secondary-nav').css('display','block'); out = "
" out += "App partition sources"; out += " |
---|
Sync Server | ";
out += "
| ";
out += "Paste this url into your client app configuration to sync with this RhoConnect instance. | "
out += "
Use this url in your client application to sync with RhoConnect
This is a list of all your source adapters partitioned by :app. Click on the source links to view the attributes and document key/values stored in redis
" out += "The reset button will clear the redis db of all data. Be careful when resetting the db as you will lose all your user information and document data!
" out += "Enter a key to view the stored value in the database. You can also set and delete keys here.
" out += "View a list of registered users here. You can also create,delete, and ping users. Viewing a particular user will allow you to view source adapters partitioned by user as well as that user's registered devices." out += "" out += "
If you do not see a link to Statistics, it is not enabled in your config.ru file. By default Rhoconnect apps will have this line Rhoconnect::Server.enable :stats
commented out. "
out += "Older versions of RhoConnect will not have this line in the config.ru file at all. Uncomment or add the line above to enable Statistics. The Statistics tab will have different graphs to measure metrics/performance for RhoConnect.