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) {
9 this.status_update = function() {
10 $xhr('JSON', '/_g/status?callback=JSON_CALLBACK', function(code,response) {
15 setInterval( this.status_update, 5000 );
17 var a = $location.hashPath.split('/');
18 self.function_name = a[0];
21 this.fetch = function() {
23 $location.hashPath = self.function_name + '/' + self.args;
24 self.url = '/g/' + $location.hashPath + '?callback=JSON_CALLBACK';
25 $xhr('JSON', self.url, function(code, response) {
27 self.response = response;
31 this.clear = function() {
36 GearmanCntl.$inject = ['$xhr','$location'];
38 <div ng:controller="GearmanCntl">
39 <select name="function_name">
40 <option ng:repeat="f in g.status" ng:show="f.available" value="{{f.function}}">{{f.function}}</option>
41 <input type="text" name="args" value="127.0.0.1" size="40"/>
42 <button ng:click="fetch()">fetch</button>
43 <button ng:click="clear()">clear</button>
45 <table ng:show="response.columns">
46 <tr><th ng:repeat="c in response.columns">{{c}}</th></tr>
47 <tr ng:repeat="r in response.rows">
48 <td ng:repeat="v in r">{{v}}</td>
59 <tr><th>function</th><th>total</th><th>running</th><th>available</th></tr>
60 <tr ng:repeat="f in g.status">
61 <td>{{f.function}}</td>
63 <td>{{f.running}}</td>
64 <td>{{f.available}}</td>
67 <button ng:click="status_update()">update</button>