From 61fd1c8589ba0b9dc4d9132b6df22bbdde909633 Mon Sep 17 00:00:00 2001 From: Aravind Shankar Date: Fri, 28 Jun 2019 16:43:46 +0530 Subject: [PATCH] fix to show error notification when run sql fails in cli mode, close #2438 --- console/src/components/Services/Data/RawSQL/Actions.js | 7 ++++++- console/src/components/Services/Data/RawSQL/RawSQL.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/console/src/components/Services/Data/RawSQL/Actions.js b/console/src/components/Services/Data/RawSQL/Actions.js index b021e3e1c8d1d..cebab13dce126 100644 --- a/console/src/components/Services/Data/RawSQL/Actions.js +++ b/console/src/components/Services/Data/RawSQL/Actions.js @@ -128,9 +128,14 @@ const executeSQL = (isMigration, migrationName) => (dispatch, getState) => { } response.json().then( errorMsg => { + const title = 'SQL Execution Failed'; dispatch({ type: UPDATE_MIGRATION_STATUS_ERROR, data: errorMsg }); dispatch({ type: REQUEST_ERROR, data: errorMsg }); - dispatch(handleMigrationErrors('SQL Execution Failed', errorMsg)); + if (isMigration) { + dispatch(handleMigrationErrors(title, errorMsg)); + } else { + dispatch(showErrorNotification(title, errorMsg.code, errorMsg)); + } }, () => { dispatch( diff --git a/console/src/components/Services/Data/RawSQL/RawSQL.js b/console/src/components/Services/Data/RawSQL/RawSQL.js index a22d288a884c4..56fdefe7bc88d 100644 --- a/console/src/components/Services/Data/RawSQL/RawSQL.js +++ b/console/src/components/Services/Data/RawSQL/RawSQL.js @@ -80,7 +80,7 @@ const RawSQL = ({ const isMigration = checkboxElem ? checkboxElem.checked : false; const textboxElem = document.getElementById('migration-name'); let migrationName = textboxElem ? textboxElem.value : ''; - if (migrationName.length === 0) { + if (isMigration && migrationName.length === 0) { migrationName = 'run_sql_migration'; } if (!isMigration && globals.consoleMode === 'cli') {