2 <html xmlns:ng="http://angularjs.org">
3 <script src="http://code.angularjs.org/angular-0.9.12.min.js" ng:autobind></script>
6 function GearmanCntl($xhr,$location,$defer) {
9 this.status_update = function() {
10 $xhr('JSON', '/_g/status?callback=JSON_CALLBACK', function(code,response) {
13 if ( self.status_interval > 0 ) {
14 $defer( self.status_update, self.status_interval * 1000 );
17 this.status_interval = 5; // seconds
20 var a = $location.hashPath.split('/');
21 self.function_name = a[0];
24 this.fetch = function() {
26 $location.hashPath = self.function_name + '/' + self.args;
27 self.url = '/g/' + $location.hashPath + '?callback=JSON_CALLBACK';
28 $xhr('JSON', self.url, function(code, response) {
30 self.response = response;
34 this.clear = function() {
39 GearmanCntl.$inject = ['$xhr','$location','$defer'];
41 <div ng:controller="GearmanCntl">
42 <select name="function_name">
43 <option ng:repeat="f in g.status" ng:show="f.available" value="{{f.function}}">{{f.function}}</option>
44 <input type="text" name="args" value="127.0.0.1" size="40"/>
45 <button ng:click="fetch()">fetch</button>
46 <button ng:click="clear()">clear</button>
48 <table ng:show="response.columns">
49 <tr><th ng:repeat="c in response.columns">{{c}}</th></tr>
50 <tr ng:repeat="r in response.rows">
51 <td ng:repeat="v in r">{{v}}</td>
62 <tr><th>function</th><th>total</th><th>running</th><th>available</th></tr>
63 <tr ng:repeat="f in g.status.$orderBy('function')">
64 <td>{{f.function}}</td>
66 <td>{{f.running}}</td>
67 <td>{{f.available}}</td>
70 <button ng:click="status_update()">update</button>
71 <input name=status_interval size=2>s