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/03/09 08:20:52 UTC

[incubator-skywalking-ui] branch bug/e2e updated: Add error message notification

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

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


The following commit(s) were added to refs/heads/bug/e2e by this push:
     new 55a3e36  Add error message notification
55a3e36 is described below

commit 55a3e367dcbdbeb82c7b29e21636a4ec7ee41ea5
Author: hanahmily <ha...@gmail.com>
AuthorDate: Fri Mar 9 16:19:54 2018 +0800

    Add error message notification
---
 src/routes/Dashboard/Dashboard.js |  2 +-
 src/utils/models.js               |  3 +++
 src/utils/request.js              | 11 +++++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

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/utils/models.js b/src/utils/models.js
index 66c64cd..e3712bf 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,
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
hanahmily@apache.org.