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/01/29 07:39:38 UTC

[incubator-skywalking-ui] 02/02: Refactor topology

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

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

commit 1a3e9e2f364dc286962d750d854ea8284241794f
Author: hanahmily <ha...@gmail.com>
AuthorDate: Mon Jan 29 15:38:11 2018 +0800

    Refactor topology
---
 src/main/frontend/src/models/topology.js          |  6 +++---
 src/main/frontend/src/routes/Topology/Topology.js | 12 +++++++-----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/main/frontend/src/models/topology.js b/src/main/frontend/src/models/topology.js
index 4d43bc7..53c3c84 100644
--- a/src/main/frontend/src/models/topology.js
+++ b/src/main/frontend/src/models/topology.js
@@ -1,6 +1,6 @@
-import { generateBaseModal } from '../utils/utils';
+import { generateModal } from '../utils/utils';
 
-export default generateBaseModal({
+export default generateModal({
   namespace: 'topology',
   state: {
     getClusterTopology: {
@@ -8,7 +8,7 @@ export default generateBaseModal({
       calls: [],
     },
   },
-  query: `
+  dataQuery: `
     query Topology($duration: Duration!) {
       getClusterTopology(duration: $duration) {
         nodes {
diff --git a/src/main/frontend/src/routes/Topology/Topology.js b/src/main/frontend/src/routes/Topology/Topology.js
index 0e6d986..f17f16e 100644
--- a/src/main/frontend/src/routes/Topology/Topology.js
+++ b/src/main/frontend/src/routes/Topology/Topology.js
@@ -7,26 +7,28 @@ import { Panel } from '../../components/Page';
 @connect(state => ({
   topology: state.topology,
   duration: state.global.duration,
+  globalVariables: state.global.globalVariables,
 }))
 export default class Topology extends PureComponent {
   static defaultProps = {
     graphHeight: 600,
   };
-  handleChange = (duration) => {
+  handleChange = (variables) => {
     this.props.dispatch({
-      type: 'topology/fetch',
-      payload: { duration },
+      type: 'topology/fetchData',
+      payload: { variables },
     });
   }
   render() {
+    const { data } = this.props.topology;
     return (
-      <Panel duration={this.props.duration} onDurationChange={this.handleChange}>
+      <Panel globalVariables={this.props.globalVariables} onChange={this.handleChange}>
         <ChartCard
           title="Topolgy Graph"
         >
           <AppTopology
             height={this.props.graphHeight}
-            elements={this.props.topology.getClusterTopology}
+            elements={data.getClusterTopology}
           />
         </ChartCard>
       </Panel>

-- 
To stop receiving notification emails like this one, please contact
hanahmily@apache.org.