diff mod_admin_web/admin_web/www_files/js/main.js @ 573:c9955858dc7e

mod_adhoc_web: Redesign adhoc command pane
author Florian Zeitz <florob@babelmonkeys.de>
date Wed, 18 Jan 2012 01:24:41 +0100
parents f0ef6e285d69
children 950e23318bbc
line wrap: on
line diff
--- a/mod_admin_web/admin_web/www_files/js/main.js	Tue Jan 17 16:07:21 2012 +0000
+++ b/mod_admin_web/admin_web/www_files/js/main.js	Wed Jan 18 01:24:41 2012 +0100
@@ -10,6 +10,7 @@
 var connection   = null;
 
 var adminsubHost = null;
+var adhocControl = new Adhoc('#adhocDisplay', function() {});
 
 function log(msg) {
     var entry = $('<div></div>').append(document.createTextNode(msg));
@@ -123,7 +124,9 @@
                 }
                 showDisconnect();
                 adminsubHost = $(items[0]).text();
-                Adhoc.checkFeatures('#adhoc', adminsubHost);
+		adhocControl.checkFeatures(adminsubHost,
+		    function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').append(result); }) },
+		    function () { $('#adhocCommands').empty(); $('#adhocDisplay').html('<p>This host does not support commands</p>'); });
                 connection.addHandler(_cbAdminSub, Strophe.NS.ADMINSUB + '#event', 'message');
                 connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
                     .c('subscribe', {node: Strophe.NS.C2SSTREAM}));
@@ -198,7 +201,9 @@
         connection.send($iq({to: adminsubHost, type: 'set', id: connection.getUniqueId()}).c('adminsub', {xmlns: Strophe.NS.ADMINSUB})
             .c('unsubscribe', {node: Strophe.NS.S2SSTREAM}));
         adminsubHost = $(this).val();
-        Adhoc.checkFeatures('#adhoc', adminsubHost);
+	adhocControl.checkFeatures(adminsubHost,
+	    function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').append(result); }) },
+	    function () { $('#adhocCommands').empty(); $('#adhocDisplay').html('<p>This host does not support commands</p>'); });
         $('#s2sin').empty();
         $('#s2sout').empty();
         $('#c2s').empty();