mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-11 05:24:45 -05:00
Fix tablespace statistics. Fixes #1196
This commit is contained in:
committed by
Dave Page
parent
8b0e65dc57
commit
e4ef927da3
@@ -558,16 +558,15 @@ class TablespaceView(PGChildNodeView):
|
|||||||
"/".join([self.template_path, 'stats.sql']),
|
"/".join([self.template_path, 'stats.sql']),
|
||||||
tsid=tsid, conn=self.conn
|
tsid=tsid, conn=self.conn
|
||||||
)
|
)
|
||||||
status, res = self.conn.execute_scalar(SQL)
|
status, res = self.conn.execute_dict(SQL)
|
||||||
|
|
||||||
if not status:
|
if not status:
|
||||||
return internal_server_error(errormsg=res)
|
return internal_server_error(errormsg=res)
|
||||||
|
|
||||||
# TODO:// Format & return output of stats call accordingly
|
return make_json_response(
|
||||||
# TODO:// for now it's hardcoded as below
|
data=res,
|
||||||
result = 'Tablespace Size: {0}'.format(res)
|
status=200
|
||||||
|
)
|
||||||
return ajax_response(response=result)
|
|
||||||
|
|
||||||
@check_precondition
|
@check_precondition
|
||||||
def dependencies(self, gid, sid, tsid):
|
def dependencies(self, gid, sid, tsid):
|
||||||
|
|||||||
+3
-1
@@ -8,7 +8,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
node: 'tablespace',
|
node: 'tablespace',
|
||||||
label: '{{ _('Tablespaces') }}',
|
label: '{{ _('Tablespaces') }}',
|
||||||
type: 'coll-tablespace',
|
type: 'coll-tablespace',
|
||||||
columns: ['name', 'spcuser', 'description']
|
columns: ['name', 'spcuser', 'description'],
|
||||||
|
hasStatistics: true
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
hasSQL: true,
|
hasSQL: true,
|
||||||
canDrop: true,
|
canDrop: true,
|
||||||
hasDepends: true,
|
hasDepends: true,
|
||||||
|
hasStatistics: true,
|
||||||
Init: function() {
|
Init: function() {
|
||||||
/* Avoid mulitple registration of menus */
|
/* Avoid mulitple registration of menus */
|
||||||
if (this.initialized)
|
if (this.initialized)
|
||||||
|
|||||||
+5
-2
@@ -1,6 +1,9 @@
|
|||||||
{### SQL to fetch tablespace object stats ###}
|
{### SQL to fetch tablespace object stats ###}
|
||||||
{% if tsid %}
|
{% 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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|||||||
+5
-2
@@ -1,6 +1,9 @@
|
|||||||
{### SQL to fetch tablespace object stats ###}
|
{### SQL to fetch tablespace object stats ###}
|
||||||
{% if tsid %}
|
{% 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 %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user