]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix the last commit and implement show APIs
authorSeven Du <dujinfang@gmail.com>
Mon, 22 Apr 2013 13:55:23 +0000 (21:55 +0800)
committerTravis Cross <tc@traviscross.com>
Fri, 7 Jun 2013 04:53:16 +0000 (04:53 +0000)
htdocs/portal/assets/js/fsportal.js
htdocs/portal/index.html

index 51c827b638989002f6f45ccc548b550ea95e704e..c1d425fbd3750e29969fb16099633844a2b50807 100644 (file)
@@ -100,7 +100,13 @@ App.ShowCodecsRoute = Ember.Route.extend({
 
 App.ShowFilesRoute = Ember.Route.extend({
        setupController: function(controller) {
-               App.showCodecsController.load();
+               App.showFilesController.load();
+       }
+});
+
+App.ShowAPIsRoute = Ember.Route.extend({
+       setupController: function(controller) {
+               App.showAPIsController.load();
        }
 });
 
@@ -118,7 +124,6 @@ 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" });
@@ -341,6 +346,37 @@ App.showFilesController = Ember.ArrayController.create({
        }
 });
 
+App.showAPIsController = Ember.ArrayController.create({
+       content: [],
+       init: function(){
+       },
+       load: function() {
+               var me = this;
+               $.getJSON("/txtapi/show?api%20as%20json", function(data){
+                         // var channels = JSON.parse(data);
+                       me.set('total', data.row_count);
+                       me.content.clear();
+                       if (data.row_count == 0) return;
+
+                       var rows = [];
+                       data.rows.forEach(function(r) {
+                               if (r.name == "show") {
+                                       r.syntax = r.syntax.replace(/\|/g, "\n");
+                               } else if (r.name == "fsctl") {
+                                       r.syntax = r.syntax.replace(/\]\|/g, "]\n");
+                               } else {
+                                       r.syntax = r.syntax.replace(/\n/g, "\n");
+                               }
+                               // console.log(r.syntax);
+                               rows.push(r);
+                       });
+
+                       me.pushObjects(rows);
+
+               });
+       }
+});
+
 App.usersController = Ember.ArrayController.create({
        content: [],
        init: function(){
index df2b0565776b9f53786d77b3e5e5e8d15d1bb885..b53fb190920f32c6fae33cb6369d9a631be2b843 100644 (file)
                                <th>Name</th>
                                <th>iKey</th>
                        </tr>
-                       {{#each App.showCodecsController.content}}
+                       {{#each App.showFilesController.content}}
                        <tr>
                                <td>{{ type }}</td>
                                <td>{{ name }}</td>
        </script>
 
        <script type="text/x-handlebars" data-template-name="showAPIs">
-               Unimplemented
+               <h1>APIs</h1>
+               <div>
+                       <table class="table">
+                       <tr>
+                               <th>Name /<br>Description</th>
+                               <th>Syntax</th>
+                               <th>iKey</th>
+                       </tr>
+                       {{#each App.showAPIsController.content}}
+                       <tr>
+                               <td>
+                                       <strong>{{ name }}</strong><br>
+                                       {{ description }}
+                               </td>
+                               <td><pre>{{ syntax }}</pre></td>
+                               <td>{{ ikey }}</td>
+                       </tr>
+                       {{/each}}
+                       </table>
+               </div>
        </script>
 
        <script type="text/x-handlebars" data-template-name="show">
                {{#linkTo "showEndpoints"}} Endpoints {{/linkTo}} |
                {{#linkTo "showCodecs"}} Codecs {{/linkTo}} |
                {{#linkTo "showFiles"}} Files {{/linkTo}} |
-               {{#linkTo "showAPIs"}} APIs {{/linkTo}}
-
-               <br>
-
-               {{#linkTo "showStatus"}} Status {{/linkTo}}
+               {{#linkTo "showAPIs"}} APIs {{/linkTo}} |
+
+               Aliases |
+               Complete |
+               Chat |
+               Management |
+               Modules |
+               Nat_map |
+               Say |
+               Interfaces |
+               Interface_types |
+               Tasks |
+               Limits
 
        </script>