From 91b4ff08360901622d65099e639415f398ff1b1c Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 11 Jul 2011 00:40:06 +0200 Subject: [PATCH] display messages from each step --- public/user.html | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/public/user.html b/public/user.html index 67a6eb5..92b3225 100644 --- a/public/user.html +++ b/public/user.html @@ -13,12 +13,18 @@ if ( ! username ) username = self.search_username; $log.info( 'CRM_search', username ); self.clear(); + self.message.CRM = 'search for '+username; self.r.CRM_search.query({username: username}, function(CRM) { self.CRM = CRM; $log.info( 'CRM', CRM ) + if ( ! CRM.length ) { + self.message.CRM = 'no results'; + return; + } + self.message.CRM = null; if ( CRM.length == 1 ) { self.selected_username = CRM[0].USERNAME; - $log.info( 'auto-selected', self.selected_username ); + $log.info( 'auto-selected ', self.selected_username ); } }); }; @@ -33,22 +39,24 @@ if ( ! username ) username = self.selected_username; if ( ! username ) { - $log.error( 'no username for LDAP_search' ); + self.message.LDAP = 'no username'; return; } $log.info( 'LDAP_search', username ); self.clear_LDAP(); self.selected_username = username; + self.message.LDAP = 'search '+username; self.r.LDAP_search.query({ username: username }, function(LDAP) { self.LDAP = LDAP; $log.info( 'LDAP', LDAP ); if ( self.LDAP.length == 0 ) { - $log.error( 'no LDAP results for', username ); + self.message.LDAP ='no results for '+username; return; } self.cpe.parser = LDAP[0]._cpe_parser; self.cpe.table_name = 'cpe_' + LDAP[0]._cpe_parser; self.username = LDAP[0].cn; + self.message.LDAP = null; $log.info( 'cpe', self.cpe ); }); }; @@ -62,6 +70,9 @@ $log.warn("no columns for gnuplot"); return; } + + self.message.gnuplot = 'redrawing '+h_cols.join(' '); + var cols = [ 'timestamp' ]; for ( var i = 0; i < h_cols.length; i++ ) { cols.push( 'h->\'' + h_cols[i] + '\' as "' + h_cols[i] + '"' ); @@ -77,14 +88,16 @@ console.debug( cols ); self.r.table = $resource('/table/:table'); self.table_update = function () { if ( ! self.username || ! self.cpe.table_name ) return; + self.message.table = self.username + ' loading from ' + self.cpe.table_name; self.r.table.get({ username: self.username, table: self.cpe.table_name, limit: self.cpe.limit }, function(table) { $log.info( 'table', table ); self.cpe.table = table; - + self.message.table = table.rows.length == 0 ? 'no results' : null; + if ( h_cols = self.cpe_hash[self.cpe.parser] ) { self.gnuplot_draw( h_cols ); } else { - self.message = 'no graph defined for ' + self.cpe.parser; + self.message.gnuplot = 'no graph for ' + self.cpe.parser; } }); }; @@ -102,9 +115,10 @@ console.debug( cols ); self.selected_username = null; self.gnuplot = {}; self.cpe = { limit: 1 }; - self.message = null; }; + self.message = {}; + self.$watch('selected_username', function() { if ( self.selected_username == null ) self.clear_LDAP(); }); @@ -226,7 +240,9 @@ th, td { - {{message | html}} + +
{{category}} {{status}}
+
@@ -267,7 +283,7 @@ th, td { - +

{{cpe.table_name}} {{username}}

-- 2.20.1