cache gearman calls from web_ui in redis
[APKPM.git] / templates / user.html.ep
index c21a19b..c97731c 100644 (file)
@@ -5,14 +5,20 @@
       var self = this;
    
       this.fetch = function() {
-        if ( ! self.args ) return;
+       self.clear();
+        if ( ! self.args ) {
+               self.message = 'Enter part of username to search';
+               return;
+       }
        self.url = '/g/' + self.function_name + '/' + self.args + '?callback=JSON_CALLBACK';
         $xhr('JSON', self.url, function(code, response) {
           self.code = code;
           self.response = response;
+         self.message = response.length + ' results for <tt>'+self.args+'</tt>';
         });
+       self.message = 'loading '+self.url;
       };
-   
       this.clear = function() {
         self.url = null;
         self.code = null;
@@ -20,6 +26,7 @@
        self.selected_username = null;
        self.gnuplot_sql = null;
        self.ldap = null;
+       self.message = null;
       };
 
        this.columns = [
                                console.debug( code, response );
                                self.ldap = response;
                                self.gnuplot_sql = '/gnuplot?hide=1;with=points;sql=select timestamp,snrtx,attntx,pwrtx,pwrrx,attnrx,snrrx from adsl where username = \'' + response[0].cn + '\' order by timestamp desc limit 100';
+                               self.message = 'generating ADSL graph for '+response[0].cn;
                        }
                );
+               self.message = 'LDAP search for '+self.selected_username;
        };
 
     }
@@ -99,9 +108,18 @@ th, td {
        background: #eee;
 }
 
+#message {
+       padding: 3px;
+       background: #ff8;
+
+       margin-left: 1em;
+       position: fixed;
+}
+
 </style>
 
   <div ng:controller="CRM">
+
    <form ng:submit="fetch()">
     <input type="hidden" name="function_name" value="CRM_search"      size="20"/>
     <label for="args">username:
@@ -110,8 +128,8 @@ th, td {
     <input type="submit" ng:click="fetch()" value="search">
     <input type="reset"  ng:click="clear()" value="clear">
 
-    <b ng:show="url && ! code">loading {{url}}</b>
-    <b ng:show="response">{{response.length}} results for <tt>{{args}}</tt></b>
+    <span id="message" ng:show="message">{{message | html}}</span>
+
    </form>
 
 <div id="columns" ng:show="response">
@@ -146,9 +164,9 @@ th, td {
 
     <input type=checkbox name=debug value=1>
     <pre ng:show=debug>
+message={{message}}
 url={{url}}
 code={{code}}
 response={{response}}
-username={{username}}
     </pre>
   </div>