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 629684d47b2fc2fca7999595ce8944d94a98bb0b
Author: hanahmily <hanahm...@gmail.com>
AuthorDate: Sat Feb 3 12:37:27 2018 +0800

    Overhaul ui for e2e test
---
 .../frontend/src/components/Page/Search/index.js   |  3 ++-
 src/main/frontend/src/models/application.js        | 26 +++++++++---------
 src/main/frontend/src/models/global.js             |  4 +--
 src/main/frontend/src/models/topology.js           |  6 ++---
 .../frontend/src/routes/Application/Application.js |  9 +++++++
 src/main/frontend/src/routes/Server/Server.js      |  3 +--
 src/main/frontend/src/routes/Service/Service.js    |  1 +
 src/main/frontend/src/routes/Topology/Topology.js  |  2 +-
 src/main/frontend/src/utils/utils.js               | 31 +++++++++++++---------
 9 files changed, 51 insertions(+), 34 deletions(-)

diff --git a/src/main/frontend/src/components/Page/Search/index.js 
b/src/main/frontend/src/components/Page/Search/index.js
index 46eaf24..199647a 100644
--- a/src/main/frontend/src/components/Page/Search/index.js
+++ b/src/main/frontend/src/components/Page/Search/index.js
@@ -19,7 +19,7 @@ export default class Search extends PureComponent {
     if (!value || value.length < 1) {
       return;
     }
-    const { url, query } = this.props;
+    const { url, query, variables: { duration } } = this.props;
     this.lastFetchId += 1;
     const fetchId = this.lastFetchId;
     this.setState({ data: [], fetching: true });
@@ -28,6 +28,7 @@ export default class Search extends PureComponent {
       body: {
         variables: {
           keyword: value,
+          duration,
         },
         query,
       },
diff --git a/src/main/frontend/src/models/application.js 
b/src/main/frontend/src/models/application.js
index 85488d9..03cc45a 100644
--- a/src/main/frontend/src/models/application.js
+++ b/src/main/frontend/src/models/application.js
@@ -11,16 +11,16 @@ const optionsQuery = `
 
 const dataQuery = `
   query Application($applicationId: ID!, $duration: Duration!) {
-    getSlowService(applicationId: $applicationId, duration: $duration) {
-      key: id
-      name
-      avgResponseTime
-    }
-    getServerThroughput(applicationId: $applicationId, duration: $duration) {
-      key: id
-      name
-      tps
-    }
+    # getSlowService(applicationId: $applicationId, duration: $duration, top: 
10) {
+    #   key: id
+    #   name
+    #   avgResponseTime
+    # }
+    # getServerThroughput(applicationId: $applicationId, duration: $duration, 
top: 10) {
+    #   key: id
+    #   name
+    #   tps
+    # }
     getApplicationTopology(applicationId: $applicationId, duration: $duration) 
{
       nodes {
         id
@@ -36,15 +36,15 @@ const dataQuery = `
           numOfServerAlarm
           numOfServiceAlarm
         }
-      },
-      calls: {
+      }
+      calls {
         source
         target
         isAlert
         callType
         callsPerSec
         responseTimePerSec
-      },
+      }
     }
   }
 `;
diff --git a/src/main/frontend/src/models/global.js 
b/src/main/frontend/src/models/global.js
index c8f419a..1d207f6 100644
--- a/src/main/frontend/src/models/global.js
+++ b/src/main/frontend/src/models/global.js
@@ -3,7 +3,7 @@ import { generateDuration } from '../utils/utils';
 
 const noticeQuery = `
   query Notice($duration:Duration!){
-    applicationAlarmList: loadAlarmList(alarmType: 'APPLICATION', duration: 
$duration, paging: { pageNum: 1, pageSize: 5, needTotal: true }) {
+    applicationAlarmList: loadAlarmList(alarmType: APPLICATION, duration: 
$duration, paging: { pageNum: 1, pageSize: 5, needTotal: true }) {
       items {
         title
         startTime
@@ -11,7 +11,7 @@ const noticeQuery = `
       }
       total
     }
-    serverAlarmList: loadAlarmList(alarmType: 'SERVER', duration: $duration, 
paging: { pageNum: 1, pageSize: 5, needTotal: true }) {
+    serverAlarmList: loadAlarmList(alarmType: SERVER, duration: $duration, 
paging: { pageNum: 1, pageSize: 5, needTotal: true }) {
       items {
         title
         startTime
diff --git a/src/main/frontend/src/models/topology.js 
b/src/main/frontend/src/models/topology.js
index 53c3c84..01872c2 100644
--- a/src/main/frontend/src/models/topology.js
+++ b/src/main/frontend/src/models/topology.js
@@ -25,15 +25,15 @@ export default generateModal({
             numOfServerAlarm
             numOfServiceAlarm
           }
-        },
-        calls: {
+        }
+        calls {
           source
           target
           isAlert
           callType
           callsPerSec
           responseTimePerSec
-        },
+        }
       }
     }
   `,
diff --git a/src/main/frontend/src/routes/Application/Application.js 
b/src/main/frontend/src/routes/Application/Application.js
index ceff4e7..176eecd 100644
--- a/src/main/frontend/src/routes/Application/Application.js
+++ b/src/main/frontend/src/routes/Application/Application.js
@@ -57,6 +57,15 @@ export default class Application extends PureComponent {
       payload: { variables: this.props.globalVariables },
     });
   }
+  componentWillUpdate(nextProps) {
+    if (nextProps.globalVariables.duration === 
this.props.globalVariables.duration) {
+      return;
+    }
+    this.props.dispatch({
+      type: 'application/initOptions',
+      payload: { variables: nextProps.globalVariables },
+    });
+  }
   handleSelect = (selected) => {
     this.props.dispatch({
       type: 'application/saveVariables',
diff --git a/src/main/frontend/src/routes/Server/Server.js 
b/src/main/frontend/src/routes/Server/Server.js
index bd93492..f91743a 100644
--- a/src/main/frontend/src/routes/Server/Server.js
+++ b/src/main/frontend/src/routes/Server/Server.js
@@ -64,12 +64,12 @@ export default class Server extends PureComponent {
                 placeholder="Select a server"
                 onSelect={this.handleSelect.bind(this)}
                 url="/server/search"
+                variables={{ duration: this.props.globalVariables.duration }}
                 query={`
                   query SearchServer($keyword: String!, $duration: Duration!) {
                     searchServer(keyword: $keyword, duration: $duration) {
                       key: id
                       label: name
-                      os
                       host
                       pid
                       ipv4
@@ -87,7 +87,6 @@ export default class Server extends PureComponent {
         >
           <Card title="Info" style={{ marginTop: 24 }} bordered={false}>
             <DescriptionList>
-              <Description term="OS Name">{serverInfo.os}</Description>
               <Description term="Host Name">{serverInfo.host}</Description>
               <Description term="Process Id">{serverInfo.pid}</Description>
               <Description term="IPv4">{serverInfo.ipv4}</Description>
diff --git a/src/main/frontend/src/routes/Service/Service.js 
b/src/main/frontend/src/routes/Service/Service.js
index 964c765..c38eb75 100644
--- a/src/main/frontend/src/routes/Service/Service.js
+++ b/src/main/frontend/src/routes/Service/Service.js
@@ -63,6 +63,7 @@ export default class Service extends PureComponent {
                 placeholder="Search a service"
                 onSelect={this.handleSelect.bind(this)}
                 url="/service/search"
+                variables={{ duration: this.props.globalVariables.duration }}
                 query={`
                   query SearchService($keyword: String!, $duration: Duration!) 
{
                     searchService(keyword: $keyword, duration: $duration) {
diff --git a/src/main/frontend/src/routes/Topology/Topology.js 
b/src/main/frontend/src/routes/Topology/Topology.js
index f17f16e..b234ce8 100644
--- a/src/main/frontend/src/routes/Topology/Topology.js
+++ b/src/main/frontend/src/routes/Topology/Topology.js
@@ -24,7 +24,7 @@ export default class Topology extends PureComponent {
     return (
       <Panel globalVariables={this.props.globalVariables} 
onChange={this.handleChange}>
         <ChartCard
-          title="Topolgy Graph"
+          title="Topolgy Map"
         >
           <AppTopology
             height={this.props.graphHeight}
diff --git a/src/main/frontend/src/utils/utils.js 
b/src/main/frontend/src/utils/utils.js
index 0571b0f..e8e5ad9 100644
--- a/src/main/frontend/src/utils/utils.js
+++ b/src/main/frontend/src/utils/utils.js
@@ -185,24 +185,27 @@ export function generateModal({ namespace, dataQuery, 
optionsQuery, state = {},
         const defaultLabels = {};
         Object.keys(allOptions).forEach((_) => {
           const thisOptions = allOptions[_];
-          if (!values[_] && thisOptions.length > 0) {
-            defaultValues[_] = thisOptions[0].key;
-            defaultLabels[_] = thisOptions[0].label;
+          if (!values[_]) {
+            if (thisOptions.length > 0) {
+              defaultValues[_] = thisOptions[0].key;
+              defaultLabels[_] = thisOptions[0].label;
+            }
+            return;
           }
           const key = values[_];
           if (!thisOptions.find(o => o.key === key)) {
             amendOptions[_] = [...thisOptions, { key, label: labels[_] }];
           }
         });
-        return {
-          ...preState,
-          variables: {
+        variables.options = {
+          ...options,
+          ...allOptions,
+          ...amendOptions,
+        };
+        let newVariables = variables;
+        if (Object.keys(defaultValues).length > 0) {
+          newVariables = {
             ...variables,
-            options: {
-              ...options,
-              ...allOptions,
-              ...amendOptions,
-            },
             values: {
               ...values,
               ...defaultValues,
@@ -211,7 +214,11 @@ export function generateModal({ namespace, dataQuery, 
optionsQuery, state = {},
               ...labels,
               ...defaultLabels,
             },
-          },
+          };
+        }
+        return {
+          ...preState,
+          variables: newVariables,
         };
       },
       save(preState, { payload: { variables: { values = {}, options = {}, 
labels = {} },

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

Reply via email to