Fixed an issue where Tablespace is created though an error is shown on the dialog. Fixes #6745

This commit is contained in:
Nikhil Mohite
2021-12-21 18:07:17 +05:30
committed by Akshay Joshi
parent 02b83146be
commit 461c0abce1
3 changed files with 33 additions and 10 deletions

View File

@@ -17,4 +17,5 @@ Housekeeping
Bug fixes
*********
| `Issue #6745 <https://redmine.postgresql.org/issues/6745>`_ - Fixed an issue where Tablespace is created though an error is shown on the dialog.
| `Issue #7034 <https://redmine.postgresql.org/issues/7034>`_ - Fixed an issue where Columns with default value not showing when adding a new row.

View File

@@ -322,16 +322,6 @@ class TablespaceView(PGChildNodeView):
if not status:
return internal_server_error(errormsg=res)
SQL = render_template(
"/".join([self.template_path, self._ALTER_SQL]),
data=data, conn=self.conn
)
# Checking if we are not executing empty query
if SQL and SQL.strip('\n') and SQL.strip(' '):
status, res = self.conn.execute_scalar(SQL)
if not status:
return internal_server_error(errormsg=res)
# To fetch the oid of newly created tablespace
SQL = render_template(
@@ -344,6 +334,32 @@ class TablespaceView(PGChildNodeView):
if not status:
return internal_server_error(errormsg=tsid)
SQL = render_template(
"/".join([self.template_path, self._ALTER_SQL]),
data=data, conn=self.conn
)
# Checking if we are not executing empty query
if SQL and SQL.strip('\n') and SQL.strip(' '):
status, res = self.conn.execute_scalar(SQL)
if not status:
return jsonify(
node=self.blueprint.generate_browser_node(
tsid,
sid,
data['name'],
icon="icon-tablespace"
),
success=0,
errormsg=gettext(
'Tablespace created successfully, '
'Set parameter fail: {0}'.format(res)
),
info=gettext(
res
)
)
return jsonify(
node=self.blueprint.generate_browser_node(
tsid,

View File

@@ -1550,6 +1550,12 @@ define('pgadmin.browser.node', [
$(pnlDependencies).removeData('node-prop');
if (pnlDependents)
$(pnlDependents).removeData('node-prop');
if(nodeData.success === 0) {
Notify.alert(gettext('Error'),
gettext(nodeData.errormsg)
);
}
}
}
);