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 2018/03/09 09:44:51 UTC

[incubator-skywalking-ui] branch master updated: Bug of e2e test (#147)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9c503a2  Bug of e2e test (#147)
9c503a2 is described below

commit 9c503a299aa3cba211e851e507d5625cc7cc0dd5
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Fri Mar 9 17:44:50 2018 +0800

    Bug of e2e test (#147)
    
    * Typo Topology Map
    
    * Remove quick click
    
    * Add error message notification
    
    * Refactor trace query condition
---
 package-lock.json                 |  5 -----
 package.json                      |  5 ++---
 src/index.js                      |  3 ---
 src/routes/Dashboard/Dashboard.js |  2 +-
 src/routes/Topology/Topology.js   |  2 +-
 src/routes/Trace/Trace.js         | 15 +++++++++------
 src/utils/models.js               | 16 ++++++++++------
 src/utils/request.js              | 11 +++++++++++
 8 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 711ba2d..7bdd1e0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6187,11 +6187,6 @@
       "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
       "dev": true
     },
-    "fastclick": {
-      "version": "1.0.6",
-      "resolved": "http://registry.npm.taobao.org/fastclick/download/fastclick-1.0.6.tgz",
-      "integrity": "sha1-FhYlsnsaWAZAWTa9qaLBkm0Gvmo="
-    },
     "fastparse": {
       "version": "1.1.1",
       "resolved": "http://registry.npm.taobao.org/fastparse/download/fastparse-1.1.1.tgz",
diff --git a/package.json b/package.json
index 0eb2bae..891fa8f 100755
--- a/package.json
+++ b/package.json
@@ -4,8 +4,8 @@
   "description": "A web interface of Apache SkyWalking",
   "homepage": "https://github.com/apache/incubator-skywalking-ui",
   "bugs": {
-    "url" : "https://github.com/apache/incubator-skywalking-ui/issues",
-    "email" : "hanahmily@apache.org"
+    "url": "https://github.com/apache/incubator-skywalking-ui/issues",
+    "email": "hanahmily@apache.org"
   },
   "license": "Apache-2.0",
   "author": {
@@ -44,7 +44,6 @@
     "dva": "^2.1.0",
     "dva-loading": "^1.0.4",
     "enquire-js": "^0.1.1",
-    "fastclick": "^1.0.6",
     "lodash": "^4.17.4",
     "lodash-decorators": "^4.4.1",
     "moment": "^2.19.1",
diff --git a/src/index.js b/src/index.js
index 0cee0a3..460b7a5 100644
--- a/src/index.js
+++ b/src/index.js
@@ -25,7 +25,6 @@ import createHistory from 'history/createHashHistory';
 // import createHistory from 'history/createBrowserHistory';
 import createLoading from 'dva-loading';
 import 'moment/locale/zh-cn';
-import FastClick from 'fastclick';
 
 import './index.less';
 // 1. Initialize
@@ -46,6 +45,4 @@ app.router(require('./router').default);
 app.start('#root');
 
 
-FastClick.attach(document.body);
-
 export default app._store;  // eslint-disable-line
diff --git a/src/routes/Dashboard/Dashboard.js b/src/routes/Dashboard/Dashboard.js
index 5470750..0985217 100644
--- a/src/routes/Dashboard/Dashboard.js
+++ b/src/routes/Dashboard/Dashboard.js
@@ -72,7 +72,7 @@ export default class Dashboard extends PureComponent {
           <Col xs={24} sm={24} md={12} lg={6} xl={6}>
             <ChartCard
               title="DB & Cache"
-              avatar={<img style={{ width: 64, height: 64 }} src="img/icon/database.png" alt="database" />}
+              avatar={<img style={{ width: 56, height: 56 }} src="img/icon/database.png" alt="database" />}
               total={data.getClusterBrief.numOfDatabase
                 + data.getClusterBrief.numOfCache}
             />
diff --git a/src/routes/Topology/Topology.js b/src/routes/Topology/Topology.js
index e642fe8..7ab3eba 100644
--- a/src/routes/Topology/Topology.js
+++ b/src/routes/Topology/Topology.js
@@ -42,7 +42,7 @@ export default class Topology extends PureComponent {
     return (
       <Panel globalVariables={this.props.globalVariables} onChange={this.handleChange}>
         <ChartCard
-          title="Topolgy Map"
+          title="Topology Map"
         >
           <AppTopology
             height={this.props.graphHeight}
diff --git a/src/routes/Trace/Trace.js b/src/routes/Trace/Trace.js
index 93510e2..f86737c 100644
--- a/src/routes/Trace/Trace.js
+++ b/src/routes/Trace/Trace.js
@@ -25,7 +25,11 @@ import styles from './Trace.less';
 
 const { Option } = Select;
 const FormItem = Form.Item;
-
+const initPaging = {
+  pageNum: 1,
+  pageSize: 10,
+  needTotal: true,
+};
 
 @connect(state => ({
   trace: state.trace,
@@ -65,6 +69,9 @@ export default class Trace extends PureComponent {
     const filteredVariables = { ...variables };
     filteredVariables.queryDuration = filteredVariables.duration;
     delete filteredVariables.duration;
+    if (!filteredVariables.paging) {
+      filteredVariables.paging = initPaging;
+    }
     this.props.dispatch({
       type: 'trace/fetchData',
       payload: { variables: { condition: filteredVariables } },
@@ -84,11 +91,7 @@ export default class Trace extends PureComponent {
           values: {
             ...fieldsValue,
             queryDuration: duration,
-            paging: {
-              pageNum: 1,
-              pageSize: 10,
-              needTotal: true,
-            },
+            paging: initPaging,
           },
         },
       });
diff --git a/src/utils/models.js b/src/utils/models.js
index 66c64cd..26cd596 100644
--- a/src/utils/models.js
+++ b/src/utils/models.js
@@ -49,6 +49,9 @@ export function generateModal({ namespace, dataQuery, optionsQuery, defaultOptio
       *fetchData({ payload }, { call, put }) {
         const { variables, reducer = undefined } = payload;
         const response = yield call(queryService, namespace, { variables, query: dataQuery });
+        if (!response.data) {
+          return;
+        }
         if (reducer) {
           yield put({
             type: reducer,
@@ -75,23 +78,24 @@ export function generateModal({ namespace, dataQuery, optionsQuery, defaultOptio
         const defaultLabels = {};
         Object.keys(allOptions).forEach((_) => {
           const thisOptions = allOptions[_];
+          let newOptions = [...thisOptions];
+          if (defaultOption && defaultOption[_]) {
+            newOptions = [defaultOption[_], ...newOptions];
+          }
           if (!values[_]) {
             if (defaultOption && defaultOption[_]) {
               defaultValues[_] = defaultOption[_].key;
               defaultLabels[_] = defaultOption[_].label;
-              amendOptions[_] = [defaultOption[_], ...thisOptions];
-              return;
-            }
-            if (thisOptions.length > 0) {
+            } else 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[_] }];
+            newOptions = [...newOptions, { key, label: labels[_] }];
           }
+          amendOptions[_] = newOptions;
         });
         variables.options = {
           ...options,
diff --git a/src/utils/request.js b/src/utils/request.js
index e7a13dd..d0c6e43 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -69,6 +69,17 @@ export default function request(url, options) {
       }
       return response.json();
     })
+    .then((json) => {
+      const { errors } = json;
+      if (errors) {
+        errors.forEach((_) => {
+          notification.error({
+            message: _.message,
+          });
+        });
+      }
+      return json;
+    })
     .catch((e) => {
       const { dispatch } = store;
       const status = e.name;

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