From 023203b809c387ffb6e4f2c638a02f2888d93c66 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Mon, 22 Apr 2013 21:01:27 +0800 Subject: [PATCH] add status on main page and add showFiles --- htdocs/portal/assets/js/fsportal.js | 28 ++++++++++++++++++++++++ htdocs/portal/index.html | 33 ++++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/htdocs/portal/assets/js/fsportal.js b/htdocs/portal/assets/js/fsportal.js index 4689474414..51c827b638 100644 --- a/htdocs/portal/assets/js/fsportal.js +++ b/htdocs/portal/assets/js/fsportal.js @@ -35,6 +35,9 @@ var App = Ember.Application.create({ rootElement: $('#container'), total: 0, ready: function(){ + $.get("/txtapi/status", function(data){ + $('#serverStatus').html("
" + data + "
"); + }); } }); @@ -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(){ diff --git a/htdocs/portal/index.html b/htdocs/portal/index.html index 476d2a12db..df2b056577 100644 --- a/htdocs/portal/index.html +++ b/htdocs/portal/index.html @@ -108,8 +108,14 @@