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

hanahmily pushed a commit to branch fix/e2e
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking-ui.git


The following commit(s) were added to refs/heads/fix/e2e by this push:
     new 811f17a  Support traceIds
811f17a is described below

commit 811f17a78431bc8dff5d3af66e77d1caf2db8c47
Author: hanahmily <[email protected]>
AuthorDate: Thu Mar 1 20:41:12 2018 +0800

    Support traceIds
---
 mock/trace.js                      |  4 ++--
 src/components/TraceTable/index.js | 16 ++++++++++++----
 src/models/trace.js                | 10 +++++-----
 src/routes/Trace/Trace.js          | 13 ++++++++-----
 4 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/mock/trace.js b/mock/trace.js
index 5b183a0..c1167c5 100644
--- a/mock/trace.js
+++ b/mock/trace.js
@@ -16,11 +16,11 @@ export default {
         data: {
           queryBasicTraces: {
             'traces|10': [{
-              operationName: '@url',
+              key: '@url',
               duration: '@natural(100, 1000)',
               start: '@datetime',
               'isError|1': true,
-              traceId: '@guid',
+              'traceIds|1-3': ['@guid'],
             }],
             total: '@natural(5, 50)',
           },
diff --git a/src/components/TraceTable/index.js 
b/src/components/TraceTable/index.js
index a9858fb..de46a1c 100644
--- a/src/components/TraceTable/index.js
+++ b/src/components/TraceTable/index.js
@@ -10,7 +10,7 @@ class TraceTable extends PureComponent {
     const columns = [
       {
         title: 'OperationName',
-        dataIndex: 'operationName',
+        dataIndex: 'key',
       },
       {
         title: 'Duration',
@@ -33,15 +33,23 @@ class TraceTable extends PureComponent {
       },
       {
         title: 'GlobalTraceId',
-        dataIndex: 'traceId',
+        render: (text, record) => {
+          const { traceIds = [] } = record;
+          if (traceIds.length < 1) {
+            return 'Nan';
+          }
+          if (traceIds.length > 1) {
+            return `${traceIds[0]} ...`;
+          } else {
+            return traceIds[0];
+          }
+        },
       },
     ];
-
     return (
       <div className={styles.standardTable}>
         <Table
           loading={loading}
-          rowKey={record => record.traceId}
           dataSource={traces}
           columns={columns}
           pagination={pagination}
diff --git a/src/models/trace.js b/src/models/trace.js
index 7ff6aae..b612bfa 100644
--- a/src/models/trace.js
+++ b/src/models/trace.js
@@ -14,11 +14,11 @@ const dataQuery = `
   query BasicTraces($condition: TraceQueryCondition) {
     queryBasicTraces(condition: $condition) {
       traces {
-        operationName
+        key: operationName
         duration
         start
         isError
-        traceId
+        traceIds
   }
       total
     }
@@ -82,16 +82,16 @@ export default generateModal({
       yield put({
         type: 'saveSpans',
         payload: response,
-        traceId: payload.variables.traceId,
+        key: payload.key,
       });
     },
   },
   reducers: {
     saveSpans(state, action) {
-      const { traceId } = action;
+      const { key } = action;
       const { queryTrace: { spans } } = action.payload.data;
       const { data: { queryBasicTraces: { traces } } } = state;
-      const trace = traces.find(t => t.traceId === traceId);
+      const trace = traces.find(t => t.key === key);
       trace.spans = spans;
       return {
         ...state,
diff --git a/src/routes/Trace/Trace.js b/src/routes/Trace/Trace.js
index 77ba305..6d376d9 100644
--- a/src/routes/Trace/Trace.js
+++ b/src/routes/Trace/Trace.js
@@ -96,11 +96,14 @@ export default class Trace extends PureComponent {
   }
   handleTableExpand = (expanded, record) => {
     const { dispatch } = this.props;
-    if (expanded && !record.spans) {
-      dispatch({
-        type: 'trace/fetchSpans',
-        payload: { variables: { traceId: record.traceId } },
-      });
+    if (expanded) {
+      const { traceIds = [] } = record;
+      if (traceIds.length > 0) {
+        dispatch({
+          type: 'trace/fetchSpans',
+          payload: { variables: { traceId: traceIds[0] }, key: record.key },
+        });
+      }
     }
   }
   renderForm() {

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to