User friendly error for VIM accounts 45/1845/1
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 17 May 2017 15:26:53 +0000 (11:26 -0400)
committerkashalkar <kiran.kashalkar@riftio.com>
Wed, 17 May 2017 15:33:51 +0000 (16:33 +0100)
Change-Id: Ibbe9982a5ad746f05209325b418ac3dcd097811b
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
skyquake/framework/utils/utils.js
skyquake/framework/widgets/skyquake_container/skyquakeApp.scss
skyquake/framework/widgets/uptime/uptime.jsx
skyquake/plugins/accounts/src/account/account.jsx

index fc6b592..7b93fd5 100644 (file)
@@ -311,4 +311,15 @@ Utils.cleanImageDataURI = (imageString, type, id) => {
     return require('style/img/catalog-default.svg');
 }
 
+Utils.parseError = (error) => {
+    let displayMsg = JSON.parse(error);
+    if (displayMsg.errorMessage && displayMsg.errorMessage.body) {
+        displayMsg = displayMsg.errorMessage.body;
+        if(displayMsg['last-error'] && displayMsg['last-error']['rpc-error'] && displayMsg['last-error']['rpc-error']['error-message']) {
+            displayMsg = displayMsg['last-error']['rpc-error']['error-message'];
+        }
+    }
+    return displayMsg
+}
+
 module.exports = Utils;
index a01f154..2869560 100644 (file)
@@ -1,14 +1,21 @@
-//import a reset
+/*import a reset*/
 @import '../../style/_colors.scss';
 html, body {
     height:100%;
     width:100%;
 }
 
+.crouton {
+    span {
+        white-space: pre;
+    }
+}
 
 .skyquakeApp {
+    display: -ms-flexbox;
     display: flex;
-    flex-direction: column;
+    -ms-flex-direction: column;
+        flex-direction: column;
     height: 100%;
     background: $gray-lightest;
     h1 {
@@ -20,6 +27,7 @@ html, body {
         color: #fff!important
     }
     .skyquakeNav {
+        display: -ms-flexbox;
         display: flex;
         color:white;
         background:black;
@@ -27,17 +35,22 @@ html, body {
         z-index: 10;
         font-size:0.75rem;
         .secondaryNav {
-            flex: 1 1 auto;
+            -ms-flex: 1 1 auto;
+                flex: 1 1 auto;
+            display: -ms-flexbox;
             display: flex;
-            justify-content: flex-end;
+            -ms-flex-pack: end;
+                justify-content: flex-end;
         }
         .app {
             position:relative;
             h2 {
                 font-size:0.75rem;
                 border-right: 1px solid black;
+                display: -ms-flexbox;
                 display: flex;
-                align-items: center;
+                -ms-flex-align: center;
+                    align-items: center;
                 .oi {
                     padding-right: 0.5rem;
                 }
@@ -102,18 +115,19 @@ html, body {
     .titleBar {
         padding: 1rem 0 0;
         h1 {
-        // background: url('../../style/img/header-logo.png') no-repeat;
+        /* background: url('../../style/img/header-logo.png') no-repeat;*/
         background-size:contain;
         height: 51px;
         line-height: 51px;
         margin-left: 20px;
-        // padding-left: 100px;
+        /* padding-left: 100px;*/
         left: 0;
         font-size: 1.625rem;
         font-weight: 400;
         text-align:left;
         position:relative;
-        flex: 1 0 auto;
+        -ms-flex: 1 0 auto;
+            flex: 1 0 auto;
         }
     }
     .corner-accent {
index 39b5faf..ee4ad0e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 
+ *
  *   Copyright 2016 RIFT.IO Inc
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
@@ -79,7 +79,7 @@ export default class UpTime extends React.Component {
       }
       let timeNow = args.timeNow ? args.timeNow : Date.now();
       if (initialTime) {
-        return Math.floor((timeNow/ 1000)) - initialTime;
+        return Math.floor((timeNow / 1000)) - initialTime;
       } else {
         return 0;
       }
index 4f011cb..41a3046 100644 (file)
@@ -23,6 +23,7 @@ import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx'
 import Crouton from 'react-crouton';
 import TextInput from 'widgets/form_controls/textInput.jsx';
 import {AccountConnectivityStatus} from '../account_sidebar/accountSidebar.jsx';
+import Utils from 'utils/utils.js';
 import 'style/common.scss';
 import './account.scss';
 class Account extends React.Component {
@@ -107,7 +108,7 @@ class Account extends React.Component {
             self.props.flux.actions.global.hideScreenLoader.defer();
         },
          function(error) {
-            self.props.flux.actions.global.showNotification(error);
+            self.props.flux.actions.global.showNotification(Utils.parseError(error));
             self.props.flux.actions.global.hideScreenLoader.defer();
          });
     }