You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ha...@apache.org on 2018/06/29 03:23:50 UTC

[incubator-skywalking-ui] 02/02: Refactor link parameter

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

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

commit 611711d54d079579771013cb973edd1268300dbb
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Fri Jun 29 10:48:29 2018 +0800

    Refactor link parameter
---
 src/models/trace.js             |  5 +++--
 src/routes/Topology/Topology.js | 11 ++++++++++-
 src/utils/models.js             | 15 +++++++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/models/trace.js b/src/models/trace.js
index d6ef5df..c118deb 100644
--- a/src/models/trace.js
+++ b/src/models/trace.js
@@ -153,10 +153,11 @@ export default generateModal({
     setup({ history, dispatch }) {
       return history.listen(({ pathname, state }) => {
         if (pathname === '/trace' && state) {
+          const { traceState = 'ALL', queryOrder = 'BY_START_TIME' } = state;
           dispatch({
-            type: 'saveVariables',
+            type: 'initVariables',
             payload: {
-              values: state.values,
+              values: { ...state.values, traceState, queryOrder },
               labels: state.labels,
             },
           });
diff --git a/src/routes/Topology/Topology.js b/src/routes/Topology/Topology.js
index 5ba2fd7..21127c1 100644
--- a/src/routes/Topology/Topology.js
+++ b/src/routes/Topology/Topology.js
@@ -118,7 +118,16 @@ export default class Topology extends PureComponent {
     const { data: { appInfo } } = this.props.topology;
     return [
       <Icon type="appstore" onClick={() => redirect(this.props.history, '/monitor/application', { key: appInfo.id, label: appInfo.name })} />,
-      <Icon type="exception" onClick={() => redirect(this.props.history, '/trace', { values: { applicationId: appInfo.id }, labels: { applicationId: appInfo.name } })} />,
+      <Icon
+        type="exception"
+        onClick={() => redirect(this.props.history, '/trace',
+        { values: {
+            applicationId: appInfo.id,
+            duration: { ...this.props.duration, input: this.props.globalVariables.duration },
+          },
+          labels: { applicationId: appInfo.name },
+        })}
+      />,
       appInfo.isAlarm ? <Icon type="bell" onClick={() => redirect(this.props.history, '/monitor/alarm')} /> : null,
     ];
   }
diff --git a/src/utils/models.js b/src/utils/models.js
index 3c22d22..16a32c6 100644
--- a/src/utils/models.js
+++ b/src/utils/models.js
@@ -180,6 +180,21 @@ export function generateModal({ namespace, dataQuery, optionsQuery, defaultOptio
           },
         };
       },
+      initVariables(preState, { payload: { values: variableValues, labels = {} } }) {
+        const { variables: preVariables } = preState;
+        return {
+          ...preState,
+          variables: {
+            ...preVariables,
+            values: {
+              ...variableValues,
+            },
+            labels: {
+              ...labels,
+            },
+          },
+        };
+      },
       ...reducers,
     },
     subscriptions: {