public inbox for [email protected]
help / color / mirror / Atom feedPATCH: To fix the issue on Table collection node refresh (pgAdmin4)
2+ messages / 2 participants
[nested] [flat]
* PATCH: To fix the issue on Table collection node refresh (pgAdmin4)
@ 2016-09-13 07:58 Murtuza Zabuawala <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Murtuza Zabuawala @ 2016-09-13 07:58 UTC (permalink / raw)
To: pgadmin-hackers
Hi,
PFA patch to fix the issue where user tries to refresh on Table collection
node it was throwing error.
RM#1686
Issue: Nodes method was not implemented properly to handle such request in
Table node.
Also attaching a separate patch for typo in browser.js file due to which
this error was displaying on console and not on GUI.
@Ashesh, Would you please review this minor patch (File:
misc_typo_fix.patch), I hope it does not affect anything else :)
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[text/x-patch] RM_1686.patch (4.0K, 3-RM_1686.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index 82c343d..040afb8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -23,7 +23,7 @@ from pgadmin.browser.server_groups.servers.utils import parse_priv_from_db, \
parse_priv_to_db
from pgadmin.browser.utils import PGChildNodeView
from pgadmin.utils.ajax import make_json_response, internal_server_error, \
- make_response as ajax_response
+ make_response as ajax_response, gone
from pgadmin.utils.driver import get_driver
from config import PG_DEFAULT_DRIVER
@@ -350,6 +350,46 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
)
@check_precondition
+ def node(self, gid, sid, did, scid, tid):
+ """
+ This function is used to list all the table nodes within that collection.
+
+ Args:
+ gid: Server group ID
+ sid: Server ID
+ did: Database ID
+ scid: Schema ID
+ tid: Table ID
+
+ Returns:
+ JSON of available table nodes
+ """
+ res = []
+ SQL = render_template("/".join([self.template_path,
+ 'nodes.sql']),
+ scid=scid, tid=tid)
+ status, rset = self.conn.execute_2darray(SQL)
+ if not status:
+ return internal_server_error(errormsg=rset)
+ if len(rset['rows']) == 0:
+ return gone(gettext("Could not find the table."))
+
+ res = self.blueprint.generate_browser_node(
+ rset['rows'][0]['oid'],
+ scid,
+ rset['rows'][0]['name'],
+ icon="icon-table",
+ tigger_count=rset['rows'][0]['triggercount'],
+ has_enable_triggers=rset['rows'][0]['has_enable_triggers']
+ )
+
+ return make_json_response(
+ data=res,
+ status=200
+ )
+
+
+ @check_precondition
def nodes(self, gid, sid, did, scid):
"""
This function is used to list all the table nodes within that collection.
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/nodes.sql
index 43f14cb..409247c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/nodes.sql
@@ -3,4 +3,5 @@ SELECT rel.oid, rel.relname AS name,
(SELECT count(*) FROM pg_trigger WHERE tgrelid=rel.oid AND tgisinternal = FALSE AND tgenabled = 'O') AS has_enable_triggers
FROM pg_class rel
WHERE rel.relkind IN ('r','s','t') AND rel.relnamespace = {{ scid }}::oid
- ORDER BY rel.relname;
\ No newline at end of file
+ {% if tid %} AND rel.oid = {{tid}}::OID {% endif %}
+ ORDER BY rel.relname;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/nodes.sql
index 43f14cb..409247c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/nodes.sql
@@ -3,4 +3,5 @@ SELECT rel.oid, rel.relname AS name,
(SELECT count(*) FROM pg_trigger WHERE tgrelid=rel.oid AND tgisinternal = FALSE AND tgenabled = 'O') AS has_enable_triggers
FROM pg_class rel
WHERE rel.relkind IN ('r','s','t') AND rel.relnamespace = {{ scid }}::oid
- ORDER BY rel.relname;
\ No newline at end of file
+ {% if tid %} AND rel.oid = {{tid}}::OID {% endif %}
+ ORDER BY rel.relname;
[text/x-patch] misc_typo_fix.patch (821B, 4-misc_typo_fix.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js
index 7a202e8..b91eefd 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -1430,10 +1430,10 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
success();
}
},
- error: function(jqx, error, status) {
+ error: function(xhr, error, status) {
if (
!Alertify.pgHandleItemError(
- xhr, error, message, {item: _i, info: info}
+ xhr, error, status, {item: _i, info: info}
)
) {
var msg = xhr.responseText,
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: PATCH: To fix the issue on Table collection node refresh (pgAdmin4)
@ 2016-09-14 09:33 Dave Page <[email protected]>
parent: Murtuza Zabuawala <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Page @ 2016-09-14 09:33 UTC (permalink / raw)
To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers
Thanks, applied.
On Tue, Sep 13, 2016 at 8:58 AM, Murtuza Zabuawala
<[email protected]> wrote:
> Hi,
>
> PFA patch to fix the issue where user tries to refresh on Table collection
> node it was throwing error.
> RM#1686
>
> Issue: Nodes method was not implemented properly to handle such request in
> Table node.
>
> Also attaching a separate patch for typo in browser.js file due to which
> this error was displaying on console and not on GUI.
>
> @Ashesh, Would you please review this minor patch (File:
> misc_typo_fix.patch), I hope it does not affect anything else :)
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2016-09-14 09:33 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-09-13 07:58 PATCH: To fix the issue on Table collection node refresh (pgAdmin4) Murtuza Zabuawala <[email protected]>
2016-09-14 09:33 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox