Reorganization of the host selection UI in the AFE create job view.
* refactor HostSelector into view/presenter (except for tables, which will need to be separately refactored)
* reorganize view into a tabbed format with a unified hostname input tab, a metahost tab and a browse hosts tab, with the selected hosts table alongside as before
Minor changes:
* extracted SimplifiedList interface from MultiListSelectPresenter to a top-level entity
* made ExtendedListBox implement the SimplifiedList interface and got rid of the SimplifiedListWrapper decorator class
* rewrote ArrayDataSource to use a TreeSet so it's actually efficient. this should speed up working with large host selections.
* edited JSONObjectComparator to be consistent with equals() for safety when using with TreeSet
* small change to how widths get set on TabPanels in AFE. rather than setting 100% width on all tab panels' contents using CSS, set it explicitly in CustomTabPanel. there's a quirk with browser layout where a 100% width div inside a table cell will have it's width set larger than the cell containing it. it happens on IE6, FF3 and Chrome so it's probably not something that's going to change. It does go away with the "border box" model, which can be enabled with nonstandard CSS attributes, but it's easy enough to work around here that that's not worth it.
Signed-off-by: Steve Howard <showard@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3673 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_handler.py b/frontend/afe/rpc_handler.py
index 0ed01c8..b3e5fb6 100644
--- a/frontend/afe/rpc_handler.py
+++ b/frontend/afe/rpc_handler.py
@@ -5,9 +5,26 @@
__author__ = 'showard@google.com (Steve Howard)'
-import traceback, pydoc, re, urllib
+import traceback, pydoc, re, urllib, logging, logging.handlers
from autotest_lib.frontend.afe.json_rpc import serviceHandler
from autotest_lib.frontend.afe import rpc_utils
+from autotest_lib.frontend import thread_local
+from autotest_lib.client.common_lib import global_config
+from autotest_lib.frontend.afe import rpcserver_logging
+
+_LOGGING_ENABLED = global_config.global_config.get_config_value('SERVER',
+ 'rpc_logging')
+LOGGING_REGEXPS = [r'.*add_.*',
+ r'delete_.*',
+ r'.*_remove_.*',
+ r'modify_.*',
+ r'create.*']
+FULL_REGEXP = '(' + '|'.join(LOGGING_REGEXPS) + ')'
+COMPILED_REGEXP = re.compile(FULL_REGEXP)
+
+
+def should_log_message(name):
+ return COMPILED_REGEXP.match(name)
class RpcMethodHolder(object):
@@ -52,9 +69,30 @@
return self._dispatcher.dispatchRequest(decoded_request)
+ def log_request(self, user, decoded_request, decoded_result,
+ log_all=False):
+ if log_all or should_log_message(decoded_request['method']):
+ msg = '%s:%s %s' % (decoded_request['method'], user,
+ decoded_request['params'])
+ if decoded_result['err']:
+ msg += '\n' + decoded_result['err_traceback']
+ rpcserver_logging.rpc_logger.error(msg)
+ else:
+ rpcserver_logging.rpc_logger.info(msg)
+
+
+ def encode_result(self, results):
+ return self._dispatcher.translateResult(results)
+
+
def handle_rpc_request(self, request):
+ user = thread_local.get_user()
json_request = self.raw_request_data(request)
- result = self.execute_request(json_request)
+ decoded_request = self.decode_request(json_request)
+ decoded_result = self.dispatch_request(decoded_request)
+ result = self.encode_result(decoded_result)
+ if _LOGGING_ENABLED:
+ self.log_request(user, decoded_request, decoded_result)
return rpc_utils.raw_http_response(result)