mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix display of exclusion contraint dependencies. Partially fixes #1892 - requires icon display fix.
This commit is contained in:
parent
ca57323ad1
commit
a3622a380a
@ -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'}]
|
||||
})
|
||||
|
||||
@ -400,7 +409,8 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
cid=exid)
|
||||
tid=tid,
|
||||
exid=exid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
if len(rset['rows']) == 0:
|
||||
@ -941,6 +951,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
|
||||
|
@ -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'
|
||||
@ -971,6 +978,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'
|
||||
|
@ -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,
|
||||
|
@ -4,4 +4,7 @@ SELECT conindid as oid,
|
||||
FROM pg_constraint ct
|
||||
WHERE contype='x' AND
|
||||
conrelid = {{tid}}::oid
|
||||
{% if exid %}
|
||||
AND conindid = {{exid}}::oid
|
||||
{% endif %}
|
||||
ORDER BY conname
|
@ -4,4 +4,7 @@ SELECT conindid as oid,
|
||||
FROM pg_constraint ct
|
||||
WHERE contype='x' AND
|
||||
conrelid = {{tid}}::oid
|
||||
{% if exid %}
|
||||
AND conindid = {{exid}}::oid
|
||||
{% endif %}
|
||||
ORDER BY conname
|
@ -4,4 +4,7 @@ SELECT conindid as oid,
|
||||
FROM pg_constraint ct
|
||||
WHERE contype='x' AND
|
||||
conrelid = {{tid}}::oid
|
||||
{% if exid %}
|
||||
AND conindid = {{exid}}::oid
|
||||
{% endif %}
|
||||
ORDER BY conname
|
Loading…
Reference in New Issue
Block a user