mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-09-03 20:52:57 -05:00
Do not show success message, when there is an error saving the data in
the DataGrid. Fixes #2907
This commit is contained in:
committed by
Ashesh Vashi
parent
281b6c91b5
commit
ea82d92e41
@@ -2422,6 +2422,7 @@ define('tools.querytool', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
grid.setSelectedRows([]);
|
grid.setSelectedRows([]);
|
||||||
|
|
||||||
// Reset data store
|
// Reset data store
|
||||||
self.data_store = {
|
self.data_store = {
|
||||||
'added': {},
|
'added': {},
|
||||||
@@ -2429,38 +2430,40 @@ define('tools.querytool', [
|
|||||||
'deleted': {},
|
'deleted': {},
|
||||||
'added_index': {},
|
'added_index': {},
|
||||||
'updated_index': {}
|
'updated_index': {}
|
||||||
}
|
};
|
||||||
|
|
||||||
// Reset old primary key data now
|
// Reset old primary key data now
|
||||||
self.primary_keys_data = {};
|
self.primary_keys_data = {};
|
||||||
|
|
||||||
// Clear msgs after successful save
|
// Clear msgs after successful save
|
||||||
$('.sql-editor-message').html('');
|
$('.sql-editor-message').html('');
|
||||||
} else {
|
|
||||||
// Something went wrong while saving data on the db server
|
alertify.success(gettext("Data saved successfully."));
|
||||||
$("#btn-flash").prop('disabled', false);
|
} else {
|
||||||
$('.sql-editor-message').text(res.data.result);
|
// Something went wrong while saving data on the db server
|
||||||
var err_msg = S(gettext("%s.")).sprintf(res.data.result).value();
|
$("#btn-flash").prop('disabled', false);
|
||||||
alertify.error(err_msg, 20);
|
$('.sql-editor-message').text(res.data.result);
|
||||||
grid.setSelectedRows([]);
|
var err_msg = S(gettext("%s.")).sprintf(res.data.result).value();
|
||||||
// To highlight the row at fault
|
alertify.error(err_msg, 20);
|
||||||
if(_.has(res.data, '_rowid') &&
|
grid.setSelectedRows([]);
|
||||||
(!_.isUndefined(res.data._rowid)|| !_.isNull(res.data._rowid))) {
|
// To highlight the row at fault
|
||||||
|
if(_.has(res.data, '_rowid') &&
|
||||||
|
(!_.isUndefined(res.data._rowid)|| !_.isNull(res.data._rowid))) {
|
||||||
var _row_index = self._find_rowindex(res.data._rowid);
|
var _row_index = self._find_rowindex(res.data._rowid);
|
||||||
if(_row_index in self.data_store.added_index) {
|
if(_row_index in self.data_store.added_index) {
|
||||||
// Remove new row index from temp_list if save operation
|
// Remove new row index from temp_list if save operation
|
||||||
// fails
|
// fails
|
||||||
var index = self.handler.temp_new_rows.indexOf(res.data._rowid);
|
var index = self.handler.temp_new_rows.indexOf(res.data._rowid);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
self.handler.temp_new_rows.splice(index, 1);
|
self.handler.temp_new_rows.splice(index, 1);
|
||||||
}
|
}
|
||||||
self.data_store.added[self.data_store.added_index[_row_index]].err = true
|
self.data_store.added[self.data_store.added_index[_row_index]].err = true
|
||||||
} else if (_row_index in self.data_store.updated_index) {
|
} else if (_row_index in self.data_store.updated_index) {
|
||||||
self.data_store.updated[self.data_store.updated_index[_row_index]].err = true
|
self.data_store.updated[self.data_store.updated_index[_row_index]].err = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
grid.gotoCell(_row_index, 1);
|
grid.gotoCell(_row_index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the sql results in history tab
|
// Update the sql results in history tab
|
||||||
_.each(res.data.query_result, function (r) {
|
_.each(res.data.query_result, function (r) {
|
||||||
@@ -2476,7 +2479,6 @@ define('tools.querytool', [
|
|||||||
self.trigger('pgadmin-sqleditor:loading-icon:hide');
|
self.trigger('pgadmin-sqleditor:loading-icon:hide');
|
||||||
|
|
||||||
grid.invalidate();
|
grid.invalidate();
|
||||||
alertify.success(gettext("Data saved successfully."));
|
|
||||||
if (self.close_on_save) {
|
if (self.close_on_save) {
|
||||||
self.close();
|
self.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user