diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py index 495064c..5c10318 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/__init__.py @@ -159,6 +159,13 @@ class ExclusionConstraintView(PGChildNodeView): * get_operator(): - Returns operators for selected column. + * dependency(): + - This function will generate dependency list show it in dependency + pane for the selected Exclusion. + + * dependent(): + - This function will generate dependent list to show it in dependent + pane for the selected Exclusion. """ node_type = 'exclusion_constraint' @@ -184,6 +191,8 @@ class ExclusionConstraintView(PGChildNodeView): 'sql': [{'get': 'sql'}], 'msql': [{'get': 'msql'}, {'get': 'msql'}], 'stats': [{'get': 'statistics'}], + 'dependency': [{'get': 'dependencies'}], + 'dependent': [{'get': 'dependents'}], 'module.js': [{}, {}, {'get': 'module_js'}] }) @@ -941,6 +950,53 @@ class ExclusionConstraintView(PGChildNodeView): status=200 ) + @check_precondition + def dependents(self, gid, sid, did, scid, tid, exid): + """ + This function get the dependents and return ajax response + for the constraint node. + + Args: + gid: Server Group ID + sid: Server ID + did: Database ID + scid: Schema ID + tid: Table ID + exid: Exclusion constraint ID + """ + dependents_result = self.get_dependents( + self.conn, exid + ) + + return ajax_response( + response=dependents_result, + status=200 + ) + + @check_precondition + def dependencies(self, gid, sid, did, scid, tid, exid): + """ + This function get the dependencies and return ajax response + for the constraint node. + + Args: + gid: Server Group ID + sid: Server ID + did: Database ID + scid: Schema ID + tid: Table ID + exid: Exclusion constraint ID + + """ + dependencies_result = self.get_dependencies( + self.conn, exid + ) + + return ajax_response( + response=dependencies_result, + status=200 + ) + constraint = ConstraintRegistry( 'exclusion_constraint', ExclusionConstraintModule, ExclusionConstraintView diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py index 399fd06..938f055 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/__init__.py @@ -175,6 +175,13 @@ class IndexConstraintView(PGChildNodeView): * get_indices(): - This function returns indices for current table. + * dependency(): + - This function will generate dependency list show it in dependency + pane for the selected Index constraint. + + * dependent(): + - This function will generate dependent list to show it in dependent + pane for the selected Index constraint. """ node_type = 'index_constraint' @@ -964,6 +971,53 @@ class IndexConstraintView(PGChildNodeView): status=200 ) + @check_precondition + def dependents(self, gid, sid, did, scid, tid, cid): + """ + This function get the dependents and return ajax response + for the constraint node. + + Args: + gid: Server Group ID + sid: Server ID + did: Database ID + scid: Schema ID + tid: Table ID + cid: Index constraint ID + """ + dependents_result = self.get_dependents( + self.conn, cid + ) + + return ajax_response( + response=dependents_result, + status=200 + ) + + @check_precondition + def dependencies(self, gid, sid, did, scid, tid, cid): + """ + This function get the dependencies and return ajax response + for the constraint node. + + Args: + gid: Server Group ID + sid: Server ID + did: Database ID + scid: Schema ID + tid: Table ID + cid: Index constraint ID + + """ + dependencies_result = self.get_dependencies( + self.conn, cid + ) + + return ajax_response( + response=dependencies_result, + status=200 + ) + class PrimaryKeyConstraintView(IndexConstraintView): node_type = 'primary_key' diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js index 7db68d5..f552972 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js @@ -17,7 +17,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { dialogHelp: '{{ url_for('help.static', filename='unique_constraint_dialog.html') }}', {% endif %} hasSQL: true, - hasDepends: false, + hasDepends: true, hasStatistics: true, parent_type: 'table', canDrop: true,