From 1772410a2b6ab1ce6d102802f09018964af9aa7c Mon Sep 17 00:00:00 2001 From: vrana Date: Wed, 18 Apr 2012 12:50:06 -0700 Subject: [PATCH] Allow opening editor from DarkConsole error log Test Plan: Click on "passing a null index to idx()" in DarkConsole. Click on entry in stack trace. Reviewers: epriestley Reviewed By: epriestley CC: aran, Koolvin Differential Revision: https://secure.phabricator.com/D2275 --- src/__celerity_resource_map__.php | 4 ++-- .../plugin/errorlog/DarkConsoleErrorLogPlugin.php | 12 ++++++++---- webroot/rsrc/css/aphront/dark-console.css | 4 ++++ .../rsrc/js/application/core/behavior-error-log.js | 5 ----- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index e5b93fff44..128911b06f 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -388,7 +388,7 @@ celerity_register_resource_map(array( ), 'aphront-dark-console-css' => array( - 'uri' => '/res/1a9f84bb/rsrc/css/aphront/dark-console.css', + 'uri' => '/res/4965d970/rsrc/css/aphront/dark-console.css', 'type' => 'css', 'requires' => array( @@ -1034,7 +1034,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-error-log' => array( - 'uri' => '/res/a5cb42a5/rsrc/js/application/core/behavior-error-log.js', + 'uri' => '/res/f46289e9/rsrc/js/application/core/behavior-error-log.js', 'type' => 'js', 'requires' => array( diff --git a/src/aphront/console/plugin/errorlog/DarkConsoleErrorLogPlugin.php b/src/aphront/console/plugin/errorlog/DarkConsoleErrorLogPlugin.php index 973f783192..05d2b21933 100644 --- a/src/aphront/console/plugin/errorlog/DarkConsoleErrorLogPlugin.php +++ b/src/aphront/console/plugin/errorlog/DarkConsoleErrorLogPlugin.php @@ -75,17 +75,21 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { $line .= $entry['class'].'::'; } $line .= idx($entry, 'function', ''); - $onclick = ''; + $href = null; if (isset($entry['file'])) { $line .= ' called at ['.$entry['file'].':'.$entry['line'].']'; - $onclick = jsprintf( - 'open_file(%s, %d)', $entry['file'], $entry['line']); + try { + $user = $this->getRequest()->getUser(); + $href = $user->loadEditorLink($entry['file'], $entry['line'], ''); + } catch (Exception $ex) { + // The database can be inaccessible. + } } $details .= phutil_render_tag( 'a', array( - 'onclick' => $onclick, + 'href' => $href, ), phutil_escape_html($line)); $details .= "\n"; diff --git a/webroot/rsrc/css/aphront/dark-console.css b/webroot/rsrc/css/aphront/dark-console.css index 6c7cda8baf..dbb4d580f4 100644 --- a/webroot/rsrc/css/aphront/dark-console.css +++ b/webroot/rsrc/css/aphront/dark-console.css @@ -13,6 +13,10 @@ z-index: 1; } +.dark-console a:link { + color: inherit; +} + .dark-console-tabs { width: 180px; background: #222222; diff --git a/webroot/rsrc/js/application/core/behavior-error-log.js b/webroot/rsrc/js/application/core/behavior-error-log.js index e2989b08be..e8d6b0136f 100644 --- a/webroot/rsrc/js/application/core/behavior-error-log.js +++ b/webroot/rsrc/js/application/core/behavior-error-log.js @@ -5,11 +5,6 @@ var current_details = null; -function open_file(file, row) { - // Do some fun some here, e.g., open the diffusion page for the file - // or open the file in an editor -} - function show_details(row) { var node = JX.$('row-details-' + row);