[pgAdmin4][Patch]: Dependecies/Dependents functionality - Mailing list pgadmin-hackers

From Akshay Joshi
Subject [pgAdmin4][Patch]: Dependecies/Dependents functionality
Date
Msg-id CANxoLDcG1MNGJB4z+RcK_e3vNqOeh4akfL5vLwXe9PnEFKB1GQ@mail.gmail.com
Whole thread Raw
Responses Re: [pgAdmin4][Patch]: Dependecies/Dependents functionality
List pgadmin-hackers
Hi All 

I have implemented the logic to show Dependencies/Dependents when user click on browser nodes. Attached is the patch file, please review it and if it looks good then please commit it.

I have also added this support in "Database" , "Tablespace" and "Role" as this nodes are already been committed. Following is the information about how to add the support in other nodes

Add following lines of code in <your module>.js
  • Add hasDepends: true in your file just like we have added hasSQL
Add following lines of code in <your module>.__init__.py 

"from pgadmin.browser.server_groups.servers.depends import get_dependencies, get_dependents" to import the functions.

Implement the dependents and dependencies function like below. Pass the appropriate node id and the name of the node to the functions "get_dependents" and "get_dependencies"

    @check_precondition
    def dependents(self, gid, sid, did, lid):
        """
        This function get the dependents and return ajax response
        for the language node.

        Args:
            gid: Server Group ID
            sid: Server ID
            did: Database ID
            lid: Language ID
        """
        dependents_result = get_dependents(self.conn, lid, 'language')
        return ajax_response(
                response=dependents_result,
                status=200
                )

    @check_precondition
    def dependencies(self, gid, sid, did, lid):
        """
        This function get the dependencies and return ajax response
        for the language node.

        Args:
            gid: Server Group ID
            sid: Server ID
            did: Database ID
            lid: Language ID
        """
        dependencies_result = get_dependencies(self.conn, lid, 'language')
        return ajax_response(
                response=dependencies_result,
                status=200
                )


--
Akshay Joshi
Principal Software Engineer 


Phone: +91 20-3058-9517
Mobile: +91 976-788-8246
Attachment

pgadmin-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: Building a development version of pgadmin
Next
From: Akshay Joshi
Date:
Subject: Re: [pgAdmin4] [Patch]: Language Module