mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-10-25 22:20:05 -05:00
Fixed an issue where Tablespace is created though an error is shown on the dialog. Fixes #6745
This commit is contained in:
1 parent
02b83146be
commit
461c0abce1
3 files changed
+33
-10
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user