add show registrations

This commit is contained in:
Seven Du 2013-04-22 22:33:14 +08:00
parent ca1d8b165e
commit 4e7801905b
2 changed files with 64 additions and 0 deletions

View File

@ -80,6 +80,17 @@ App.ShowApplicationsRoute = Ember.Route.extend({
// }
});
App.ShowRegistrationsRoute = Ember.Route.extend({
setupController: function(controller) {
// Set the Controller's `title`
controller.set('title', "ShowRegistrations");
App.registrationsController.load();
}//,
// renderTemplate: function() {
// this.render('calls');
// }
});
App.ShowEndpointsRoute = Ember.Route.extend({
setupController: function(controller) {
// Set the Controller's `title`
@ -119,6 +130,7 @@ App.UsersRoute = Ember.Route.extend({
App.Router.map(function(){
this.route("calls");
this.route("channels");
this.route("showRegistrations");
this.route("showApplications");
this.route("showEndpoints");
this.route("showCodecs");
@ -271,6 +283,25 @@ App.channelsController = Ember.ArrayController.create({
});
App.registrationsController = Ember.ArrayController.create({
content: [],
init: function(){
},
load: function() {
var me = this;
$.getJSON("/txtapi/show?registrations%20as%20json", function(data){
// var channels = JSON.parse(data);
console.log(data.row_count);
me.set('total', data.row_count);
me.content.clear();
if (data.row_count == 0) return;
me.pushObjects(data.rows);
});
}
});
App.applicationsController = Ember.ArrayController.create({
content: [],
init: function(){

View File

@ -118,6 +118,38 @@
<div id="serverStatus"></div>
</script>
<script type="text/x-handlebars" data-template-name="showRegistrations">
<h1>Registrations</h1>
<div>
<table class="table">
<tr>
<th>Reg User</th>
<th>Realm</th>
<th>Expires</th>
<th>Network IP</th>
<th>Network Port</th>
<th>Network Proto</th>
<th>Hostname</th>
<th>Metadata</th>
<th>Token / Url</th>
</tr>
{{#each App.registrationsController.content}}
<tr>
<td>{{ reg_user }}</td>
<td>{{ realm }}</td>
<td>{{ expires }}</td>
<td>{{ network_ip }}</td>
<td>{{ network_port }}</td>
<td>{{ network_proto }}</td>
<td>{{ hostname }}</td>
<td>{{ metadata }}</td>
<td>{{ token }}<br>{{ url }}</td>
</tr>
{{/each}}
</table>
</div>
</script>
<script type="text/x-handlebars" data-template-name="showApplications">
<h1>Applications</h1>
<div>
@ -225,6 +257,7 @@
<script type="text/x-handlebars" data-template-name="show">
<h1>Show</h1>
{{#linkTo "showRegistrations"}} Registrations {{/linkTo}} |
{{#linkTo "showApplications"}} Applications {{/linkTo}} |
{{#linkTo "showEndpoints"}} Endpoints {{/linkTo}} |
{{#linkTo "showCodecs"}} Codecs {{/linkTo}} |