You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2017/12/14 22:41:11 UTC

[incubator-skywalking-ui] 01/02: 1. format the date: startTime, endTime 2. format the log data, change \n\t to

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

wusheng pushed a commit to branch feature/3.0.2
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking-ui.git

commit 9cf7931bb5356c24aa5dfcbaeb763b0b43b03009
Author: pengys5 <80...@qq.com>
AuthorDate: Mon Jun 5 21:59:07 2017 +0800

    1. format the date: startTime, endTime
    2. format the log data, change \n\t to </br>
---
 src/main/resources/static/trace/span.html | 14 +++++++-------
 src/main/resources/static/trace/span.js   | 23 +++++++++++++++++++----
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/main/resources/static/trace/span.html b/src/main/resources/static/trace/span.html
index a793a24..f61c873 100644
--- a/src/main/resources/static/trace/span.html
+++ b/src/main/resources/static/trace/span.html
@@ -6,8 +6,8 @@
             <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                     class="sr-only">Close</span></button>
             <h4 class="modal-title">Span Info</h4>
-            <small class="font-bold">OperationName: {{:on}})</small><br/>
-            <small class="font-bold">{{:st}} - {{:et}}</small>
+            <small class="font-bold">OperationName: {{:operationName}})</small><br/>
+            <small class="font-bold">{{dateFormat:startTime}} - {{dateFormat:endTime}}</small>
         </div>
         <div class="modal-body" style="padding: 0">
             <div class="tabs-container">
@@ -15,7 +15,7 @@
                 <div class="tabs-left">
                     <ul class="nav nav-tabs">
                         <li class="active"><a data-toggle="tab" href="#tags">Tags</a></li>
-                        {{for lo}}
+                        {{for logs}}
                           <li class=""><a data-toggle="tab" href="#logData{{: #index+1}}">Log Data{{: #index+1}}</a></li>
                         {{/for}}
                     </ul>
@@ -33,12 +33,12 @@
                                 {{/props}}
                             </div>
                         </div>
-                        {{for lo}}
+                        {{for logs}}
                         <div id="logData{{: #index+1}}" class="tab-pane">
                             <div class="panel-body">
-                                <strong>time</strong><p>{{:tm}}</p>
-                                {{props fi}}
-                                    <strong>{{>key}}</strong><p>{{>prop}}</p>
+                                <strong>time</strong><p>{{dateFormat:time}}</p>
+                                {{props fields}}
+                                    <strong>{{>key}}</strong><p>{{tabCharacter:prop}}</p>
                                 {{/props}}
                             </div>
                         </div>
diff --git a/src/main/resources/static/trace/span.js b/src/main/resources/static/trace/span.js
index 43d9684..58789b4 100644
--- a/src/main/resources/static/trace/span.js
+++ b/src/main/resources/static/trace/span.js
@@ -5,11 +5,26 @@
 function showSpanModal(spanSegId) {
     $.getJSON("/spanDataLoad?spanSegId=" + spanSegId, function (data) {
         var spanModalTemplate = $.templates("#spanModalTemplate");
-
-        data.st = moment(data.st).format("YYYY/MM/DD HH:mm:ss SSS");
-        data.et = moment(data.et).format("YYYY/MM/DD HH:mm:ss SSS");
-
         spanModalTemplate.link("#spanModalDiv", data);
         $("#spanModalDiv").modal("toggle");
     });
+}
+
+$.views.converters({
+    dateFormat: function (val) {
+        return moment(val).format("YYYY/MM/DD HH:mm:ss SSS");
+    },
+
+    tabCharacter: function (val) {
+        console.log(val);
+        return replaceAll(val);
+    }
+});
+
+function replaceAll(str) {
+    if (str != null){
+        str = str.replace(/\\n\\t/ig, "<br />");
+        str = str.replace(/\\n/ig, "<br />");
+    }
+    return str;
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@skywalking.apache.org" <co...@skywalking.apache.org>.