mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix tablespace statistics. Fixes #1196
This commit is contained in:
parent
8b0e65dc57
commit
e4ef927da3
@ -558,16 +558,15 @@ class TablespaceView(PGChildNodeView):
|
||||
"/".join([self.template_path, 'stats.sql']),
|
||||
tsid=tsid, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
# TODO:// Format & return output of stats call accordingly
|
||||
# TODO:// for now it's hardcoded as below
|
||||
result = 'Tablespace Size: {0}'.format(res)
|
||||
|
||||
return ajax_response(response=result)
|
||||
return make_json_response(
|
||||
data=res,
|
||||
status=200
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def dependencies(self, gid, sid, tsid):
|
||||
|
@ -8,7 +8,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
node: 'tablespace',
|
||||
label: '{{ _('Tablespaces') }}',
|
||||
type: 'coll-tablespace',
|
||||
columns: ['name', 'spcuser', 'description']
|
||||
columns: ['name', 'spcuser', 'description'],
|
||||
hasStatistics: true
|
||||
});
|
||||
};
|
||||
|
||||
@ -23,6 +24,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
hasSQL: true,
|
||||
canDrop: true,
|
||||
hasDepends: true,
|
||||
hasStatistics: true,
|
||||
Init: function() {
|
||||
/* Avoid mulitple registration of menus */
|
||||
if (this.initialized)
|
||||
|
@ -1,6 +1,9 @@
|
||||
{### SQL to fetch tablespace object stats ###}
|
||||
{% if tsid %}
|
||||
SELECT pg_size_pretty(pg_tablespace_size({{ tsid|qtLiteral }}::OID)) AS size
|
||||
SELECT pg_size_pretty(pg_tablespace_size({{ tsid|qtLiteral }}::OID)) AS {{ conn|qtIdent(_('Size')) }}
|
||||
{% else %}
|
||||
SELECT ts.spcname as name, pg_size_pretty(pg_tablespace_size(ts.oid)) AS size FROM pg_catalog.pg_tablespace ts;
|
||||
SELECT ts.spcname AS {{ conn|qtIdent(_('Name')) }},
|
||||
pg_size_pretty(pg_tablespace_size(ts.oid)) AS {{ conn|qtIdent(_('Size')) }}
|
||||
FROM
|
||||
pg_catalog.pg_tablespace ts;
|
||||
{% endif %}
|
||||
|
@ -1,6 +1,9 @@
|
||||
{### SQL to fetch tablespace object stats ###}
|
||||
{% if tsid %}
|
||||
SELECT pg_size_pretty(pg_tablespace_size({{ qtLiteral(tsid) }}::OID)) AS size
|
||||
SELECT pg_size_pretty(pg_tablespace_size({{ tsid|qtLiteral }}::OID)) AS {{ conn|qtIdent(_('Size')) }}
|
||||
{% else %}
|
||||
SELECT ts.spcname as name, pg_size_pretty(pg_tablespace_size(ts.oid)) AS size FROM pg_catalog.pg_tablespace ts;
|
||||
SELECT ts.spcname AS {{ conn|qtIdent(_('Name')) }},
|
||||
pg_size_pretty(pg_tablespace_size(ts.oid)) AS {{ conn|qtIdent(_('Size')) }}
|
||||
FROM
|
||||
pg_catalog.pg_tablespace ts;
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user