console: update sidebar loading state after table rename error

GitOrigin-RevId: 4b837af9ca0bc09823170611234c0e15fd22c344
This commit is contained in:
Abhijeet Singh Khangarot 2021-04-08 17:30:21 +05:30 committed by hasura-bot
parent 3f0bb499cb
commit 834c324d47
2 changed files with 4 additions and 0 deletions

View File

@ -12,6 +12,7 @@ export const createNewSchema = (schemaName, successCb, errorCb) => {
dispatch(setSidebarLoading(true)); dispatch(setSidebarLoading(true));
const source = getState().tables.currentDataSource; const source = getState().tables.currentDataSource;
if (!gqlPattern.test(schemaName)) { if (!gqlPattern.test(schemaName)) {
dispatch(setSidebarLoading(false));
return dispatch( return dispatch(
showErrorNotification( showErrorNotification(
gqlSchemaErrorNotif[0], gqlSchemaErrorNotif[0],
@ -69,6 +70,7 @@ export const deleteCurrentSchema = (successCb, errorCb) => {
const confirmMessage = `This will permanently delete schema "${currentSchema}" from the database`; const confirmMessage = `This will permanently delete schema "${currentSchema}" from the database`;
const isOk = getConfirmation(confirmMessage, true, currentSchema); const isOk = getConfirmation(confirmMessage, true, currentSchema);
if (!isOk) { if (!isOk) {
dispatch(setSidebarLoading(false));
return; return;
} }
const migration = new Migration(); const migration = new Migration();

View File

@ -775,6 +775,7 @@ const changeTableName = (oldName, newName, isTable, tableType) => {
const property = tableType.toLowerCase(); const property = tableType.toLowerCase();
if (oldName === newName) { if (oldName === newName) {
dispatch(setSidebarLoading(false));
return dispatch( return dispatch(
showErrorNotification( showErrorNotification(
`Renaming ${property} failed`, `Renaming ${property} failed`,
@ -784,6 +785,7 @@ const changeTableName = (oldName, newName, isTable, tableType) => {
} }
if (!gqlPattern.test(newName)) { if (!gqlPattern.test(newName)) {
dispatch(setSidebarLoading(false));
const gqlValidationError = isTable const gqlValidationError = isTable
? gqlTableErrorNotif ? gqlTableErrorNotif
: gqlViewErrorNotif; : gqlViewErrorNotif;