add status on main page and add showFiles

This commit is contained in:
Seven Du 2013-04-22 21:01:27 +08:00
parent 5f0b5770b6
commit 023203b809
2 changed files with 58 additions and 3 deletions

View File

@ -35,6 +35,9 @@ var App = Ember.Application.create({
rootElement: $('#container'),
total: 0,
ready: function(){
$.get("/txtapi/status", function(data){
$('#serverStatus').html("<pre>" + data + "</pre>");
});
}
});
@ -95,6 +98,12 @@ App.ShowCodecsRoute = Ember.Route.extend({
}
});
App.ShowFilesRoute = Ember.Route.extend({
setupController: function(controller) {
App.showCodecsController.load();
}
});
App.UsersRoute = Ember.Route.extend({
setupController: function(controller) {
App.usersController.load();
@ -109,6 +118,7 @@ App.Router.map(function(){
this.route("showCodecs");
this.route("showFiles");
this.route("showAPIs");
this.route("showStatus");
this.route("show");
this.route("users");
this.route("about", { path: "/about" });
@ -313,6 +323,24 @@ App.showCodecsController = Ember.ArrayController.create({
}
});
App.showFilesController = Ember.ArrayController.create({
content: [],
init: function(){
},
load: function() {
var me = this;
$.getJSON("/txtapi/show?files%20as%20json", function(data){
// var channels = JSON.parse(data);
me.set('total', data.row_count);
me.content.clear();
if (data.row_count == 0) return;
me.pushObjects(data.rows);
});
}
});
App.usersController = Ember.ArrayController.create({
content: [],
init: function(){

View File

@ -108,8 +108,14 @@
</div>
<script type="text/x-handlebars" data-template-name="index">
<h1>Welcome to FreeSWITCH Portal</h1>
Welcome
<h1>Welcome to FreeSWITCH !</h1>
---- The World's First Cross-Platform Scalable FREE Multi-Protocol Soft Switch
<br>
<br>
<br>
<br>
<div id="serverStatus"></div>
</script>
<script type="text/x-handlebars" data-template-name="showApplications">
@ -175,7 +181,23 @@
</script>
<script type="text/x-handlebars" data-template-name="showFiles">
Unimplemented
<h1>Files</h1>
<div>
<table class="table">
<tr>
<th>Type</th>
<th>Name</th>
<th>iKey</th>
</tr>
{{#each App.showCodecsController.content}}
<tr>
<td>{{ type }}</td>
<td>{{ name }}</td>
<td>{{ ikey }}</td>
</tr>
{{/each}}
</table>
</div>
</script>
<script type="text/x-handlebars" data-template-name="showAPIs">
@ -189,6 +211,11 @@
{{#linkTo "showCodecs"}} Codecs {{/linkTo}} |
{{#linkTo "showFiles"}} Files {{/linkTo}} |
{{#linkTo "showAPIs"}} APIs {{/linkTo}}
<br>
{{#linkTo "showStatus"}} Status {{/linkTo}}
</script>
<script type="text/x-handlebars" data-template-name="about">