This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new e85c881  [SPARK-34221][WEBUI] Ensure if a stage fails in the UI page, 
the corresponding error message can be displayed correctly
e85c881 is described below

commit e85c881c21eafa26fa7421f7abb8421082b472bb
Author: neko <[email protected]>
AuthorDate: Wed Jan 27 10:01:57 2021 -0800

    [SPARK-34221][WEBUI] Ensure if a stage fails in the UI page, the 
corresponding error message can be displayed correctly
    
    ### What changes were proposed in this pull request?
    Ensure that if a stage fails in the UI page, the corresponding error 
message can be displayed correctly.
    
    ### Why are the changes needed?
    errormessage is not handled properly in JavaScript. If the 'at' is not 
exist, the error message on the page will be blank.
    I made wochanges,
    1. `msg.indexOf("at")` => `msg.indexOf("\n")`
    
    
![image](https://user-images.githubusercontent.com/52202080/105663531-7362cb00-5f0d-11eb-87fd-008ed65c33ca.png)
    
      As shows ablove, truncated at the 'at' position will result in a strange 
abstract of the error message. If there is a `\n` worit is more reasonable to 
truncate at the '\n' position.
    
    2. If the `\n` does not exist check whether the msg  is more than 100. If 
true, then truncate the display to avoid too long error message
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Manual test shows as belows, just a js change:
    
    before modified:
    
![problem](https://user-images.githubusercontent.com/52202080/105712153-661cff00-5f54-11eb-80bf-e33c323c4e55.png)
    
    after modified
    ![after 
mdified](https://user-images.githubusercontent.com/52202080/105712180-6c12e000-5f54-11eb-8998-ff8bc8a0a503.png)
    
    Closes #31314 from akiyamaneko/error_message_display_empty.
    
    Authored-by: neko <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
    (cherry picked from commit f1bc37e6244e959f1d950c450010dd6024b6ba5f)
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 core/src/main/resources/org/apache/spark/ui/static/stagepage.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/src/main/resources/org/apache/spark/ui/static/stagepage.js 
b/core/src/main/resources/org/apache/spark/ui/static/stagepage.js
index 67d6d74..400b70f 100644
--- a/core/src/main/resources/org/apache/spark/ui/static/stagepage.js
+++ b/core/src/main/resources/org/apache/spark/ui/static/stagepage.js
@@ -861,7 +861,8 @@ $(document).ready(function () {
                                 if (typeof msg === 'undefined') {
                                     return "";
                                 } else {
-                                    var formHead = msg.substring(0, 
msg.indexOf("at"));
+                                    var indexOfLineSeparator = 
msg.indexOf("\n");
+                                    var formHead = indexOfLineSeparator > 0 ? 
msg.substring(0, indexOfLineSeparator) : (msg.length > 100 ? msg.substring(0, 
100) : msg);
                                     var form = "<span 
onclick=\"this.parentNode.querySelector('.stacktrace-details').classList.toggle('collapsed')\"
 class=\"expand-details\">+details</span>";
                                     var formMsg = "<div 
class=\"stacktrace-details collapsed\"><pre>" + row.errorMessage + 
"</pre></div>";
                                     return formHead + form + formMsg;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to