From 55cbea1fc46294eb3707b302f918f0c19b696bd2 Mon Sep 17 00:00:00 2001 From: Praveen D Date: Wed, 5 Sep 2018 00:14:05 +0530 Subject: [PATCH 1/2] console: fix error notification non json, auto height css --- console/src/components/Main/Main.js | 1 + .../components/Main/NotificationOverrides.css | 3 + .../components/Services/Data/Notification.js | 79 ++++++++++--------- 3 files changed, 46 insertions(+), 37 deletions(-) create mode 100644 console/src/components/Main/NotificationOverrides.css diff --git a/console/src/components/Main/Main.js b/console/src/components/Main/Main.js index 208760b07fab3..84ab629d3375b 100644 --- a/console/src/components/Main/Main.js +++ b/console/src/components/Main/Main.js @@ -7,6 +7,7 @@ import * as tooltip from './Tooltips'; import 'react-toggle/style.css'; import Spinner from '../Common/Spinner/Spinner'; import { loadServerVersion, checkServerUpdates } from './Actions'; +import './NotificationOverrides.css'; const semver = require('semver'); diff --git a/console/src/components/Main/NotificationOverrides.css b/console/src/components/Main/NotificationOverrides.css new file mode 100644 index 0000000000000..3ee43d193905f --- /dev/null +++ b/console/src/components/Main/NotificationOverrides.css @@ -0,0 +1,3 @@ +.notifications-wrapper .notification { + height: auto !important; +} diff --git a/console/src/components/Services/Data/Notification.js b/console/src/components/Services/Data/Notification.js index 69e265fff5b9c..c2619544c7a03 100644 --- a/console/src/components/Services/Data/Notification.js +++ b/console/src/components/Services/Data/Notification.js @@ -8,6 +8,8 @@ const styles = require('./TableCommon/Table.scss'); const showErrorNotification = (title, message, reqBody, error) => { let modMessage; let refreshBtn; + console.log(message); + console.log(error); if ( error && error.message && @@ -40,6 +42,7 @@ const showErrorNotification = (title, message, reqBody, error) => { modMessage = error.custom; } else if (error && 'code' in error && 'error' in error && 'path' in error) { // Data API error + console.log('here'); modMessage = error.error; } else { modMessage = error ? error : message; @@ -61,6 +64,8 @@ const showErrorNotification = (title, message, reqBody, error) => { } else if (error && 'internal' in error) { finalJson = error.internal; } + console.log(finalJson); + console.log(reqBody); return dispatch => { const expandClicked = finalMsg => { // trigger a modal with a bigger view @@ -72,44 +77,44 @@ const showErrorNotification = (title, message, reqBody, error) => { level: 'error', title, message: modMessage, - action: reqBody + action: finalJson ? { - label: 'Details', - callback: () => { - dispatch( - showNotification({ - level: 'error', - title, - message: modMessage, - dismissible: 'button', - children: [ -
- { - e.preventDefault(); - expandClicked(finalJson); - }} - className={styles.aceBlockExpand + ' fa fa-expand'} - /> - - {refreshBtn} -
, - ], - }) - ); - }, - } + label: 'Details', + callback: () => { + dispatch( + showNotification({ + level: 'error', + title, + message: modMessage, + dismissible: 'button', + children: [ +
+ { + e.preventDefault(); + expandClicked(finalJson); + }} + className={styles.aceBlockExpand + ' fa fa-expand'} + /> + + {refreshBtn} +
, + ], + }) + ); + }, + } : null, }) ); From 9086c04f73104b7616ff31624d3190a7e5b0cc59 Mon Sep 17 00:00:00 2001 From: Praveen D Date: Wed, 5 Sep 2018 11:30:17 +0530 Subject: [PATCH 2/2] console: remove logs --- console/src/components/Services/Data/Notification.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/console/src/components/Services/Data/Notification.js b/console/src/components/Services/Data/Notification.js index c2619544c7a03..0bbf486f486d5 100644 --- a/console/src/components/Services/Data/Notification.js +++ b/console/src/components/Services/Data/Notification.js @@ -8,8 +8,6 @@ const styles = require('./TableCommon/Table.scss'); const showErrorNotification = (title, message, reqBody, error) => { let modMessage; let refreshBtn; - console.log(message); - console.log(error); if ( error && error.message && @@ -42,7 +40,6 @@ const showErrorNotification = (title, message, reqBody, error) => { modMessage = error.custom; } else if (error && 'code' in error && 'error' in error && 'path' in error) { // Data API error - console.log('here'); modMessage = error.error; } else { modMessage = error ? error : message; @@ -64,8 +61,6 @@ const showErrorNotification = (title, message, reqBody, error) => { } else if (error && 'internal' in error) { finalJson = error.internal; } - console.log(finalJson); - console.log(reqBody); return dispatch => { const expandClicked = finalMsg => { // trigger a modal with a bigger view