Merge branch 'devel' of h1dev:/srv/APKPM/
[APKPM.git] / public / gearman.html
1 <!doctype html>
2 <html xmlns:ng="http://angularjs.org">
3  <script src="http://code.angularjs.org/angular-0.9.12.min.js" ng:autobind></script>
4  <body>
5   <script>
6     function GearmanCntl($xhr) {
7       var self = this;
8   
9       this.status_update = function() {
10         $xhr('JSON', '/_g/status?callback=JSON_CALLBACK', function(code,response) {
11           self.g = response;
12         });
13       }
14       this.status_update();
15  
16       this.fetch = function() {
17         self.clear();
18         self.url = '/g/' + self.function + '/' + self.args + '?callback=JSON_CALLBACK';
19         $xhr('JSON', self.url, function(code, response) {
20           self.code = code;
21           self.response = response;
22         });
23       };
24    
25       this.clear = function() {
26         self.code = null;
27         self.response = null;
28       };
29     }
30     GearmanCntl.$inject = ['$xhr'];
31   </script>
32   <div ng:controller="GearmanCntl">
33     <select name="function">
34     <option ng:repeat="f in g.status" ng:show="f.available" value="{{f.function}}">{{f.function}}</option>
35     <input type="text" name="args"     value="127.0.0.1" size="40"/>
36     <button ng:click="fetch()">fetch</button>
37     <button ng:click="clear()">clear</button>
38
39     <pre>
40 url={{url}}
41 code={{code}}
42 response={{response}}
43     </pre>
44
45 <table>
46 <tr><th>function</th><th>total</th><th>running</th><th>available</th></tr>
47 <tr ng:repeat="f in g.status">
48 <td>{{f.function}}</td>
49 <td>{{f.total}}</td>
50 <td>{{f.running}}</td>
51 <td>{{f.available}}</td>
52 </tr>
53 </table>
54 <button ng:click="status_update()">update</button>
55
56   </div>
57  </body>
58 </html>