Open
Conversation
Adding a pull request template to standardize the description of the proposed changes from contributors. Project contributors will automatically see the template's contents in the pull request body. More details can be found [here](https://help.github.com/articles/creating-a-pull-request-template-for-your-repository/).
adbharadwaj
reviewed
Jun 10, 2018
applications/graphs/controllers.py
Outdated
| else: | ||
| orber_by = db.asc(sort_attr) | ||
|
|
||
| ## TODO: create a util function to relpace the code parse sort and order parameters. This code is repeated again and again. |
Collaborator
Author
There was a problem hiding this comment.
Hi.
I did not understand the question. Could you please elaborate.
Thanks
adbharadwaj
reviewed
Jun 24, 2018
| db.delete_edge(request.db_session, id=edge_id) | ||
| return | ||
|
|
||
| def search_graph_versions(request, graph_id=None, names=None, limit=20, offset=0, order='desc', sort='name'): |
Collaborator
There was a problem hiding this comment.
Add python documentation. Document cases where an exception will be raised.
|
|
||
| return total, graph_versions | ||
|
|
||
| def get_graph_version_by_id(request, version_id): |
| def get_graph_version_by_id(request, version_id): | ||
| return db.get_graph_version_by_id(request.db_session, version_id) | ||
|
|
||
| def add_graph_version(request, name=None, description=None, owner_email=None, graph_json=None, graph_id=None): |
| raise Exception("Required Parameter is missing!") | ||
| return db.add_graph_version(request.db_session, name=name, description=description, owner_email=owner_email, graph_json=graph_json, graph_id=graph_id) | ||
|
|
||
| def delete_graph_version_by_id(request, graph_version_id): |
| return total, query.all() | ||
|
|
||
| @with_session | ||
| def find_graph_versions(db_session, names=None, graph_id=None, limit=None, offset=None, |
Collaborator
There was a problem hiding this comment.
Pydoc for all dal functions
applications/graphs/views.py
Outdated
| ------ | ||
|
|
||
| """ | ||
| #authorization.validate(request, permission='GRAPH_UPDATE', graph_id=graph_id) |
Collaborator
There was a problem hiding this comment.
Why are we not validating auth for delete operation?
Collaborator
|
@jahandaniyal I added some more Pre-Merge TODOs |
Collaborator
|
Sanity checks
|
jahandaniyal
commented
Jul 1, 2018
|
|
||
| # Create | ||
| self.session.add(User(email='owner@example.com', password="password", is_admin=0)) | ||
| self.session.add(Graph(name='graph1', owner_email='owner@example.com', json='{}', is_public=0)) |
Collaborator
Author
There was a problem hiding this comment.
Removed 'json' parameter as we are no longer storing graph_json and style_json in Graph Table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This patch implements Graph Version- Allow users to Create, Get, and Delete Graph Versions.
Feature Details
Version Control will be an important feature for GraphSpace, multiple versions of a Graph can be created
by a user and the user can switch between these versions using the GraphSpace Application or through REST APIs.
Currently Graph Version feature allows user to do the following operations on the Graph
Create a Graph Version
Get all versions of a particular Graph
Get a graph version by
graph_version_idSet a graph version as default version of the Graph
Delete a graph version
Screenshot for Graph Version Tab
Approach
Major changes have been made in the Graph table to implement Graph Version feature.
The
graph_json&style_jsonhave been migrated to GraphVersion table. A columndefault_version_idhas been added to Graph table, it stores the id of the default version of the graph. The Graph APIs have not been affected in a major way (default_version_idparameter has been added to link a graph to a particular version), however, the API is still backwards compatible with the previous format/parameters.Creating Graph Version :
A graph version is created by default when a new graph is created.
Users can also create graph version for existing graphs. Currently, graph versions can only be added using the REST APIs.
Example,
POST :
http://127.0.0.1:8000/api/v1/graphs/<graph_id>/version/will create a new graph version for the graph with ID -graph_id. More information about REST API usage has been documented inapi specificationsGET/read graph version :
When a Graph is opened, all the versions associated with that graph are fetched from the graph_version table.
Specific graph versions can also be fetched using
graph_version_idExample,
GET :
http://127.0.0.1:8000/api/v1/graphs/<graph_id>/version?owner_email=<user_id>- Query all the versions of graph with id -graph_id.GET :
http://127.0.0.1:8000/api/v1/graphs/<graph_id>/version/<graph_version_id>?owner_email=<user_id>- Query graph version with ID -graph_version_idand graph ID -graph_idDelete graph version:
Non-default graph versions can be deleted using GraphVersion REST API, however, to delete a default graph version a different version needs to be made default before deleting it.
Example,
DELETE :
http://127.0.0.1:8000/api/v1/graphs/<graph_id>/version/<graph_version_id>?owner_email=<user_id>- This will delete graph version with IDgraph_version_idfor graph with idgraph_idTesting REST APIs & GraphSpace ajax requests :
Since, there were changes in the existing graph table - REST API for both
GraphandGraphVersionhave been tested.Graph REST API Test :
Get all Graphs : Passed. Works as expected
Get graph by ID : Passed. Works as expected
Add a Graph : Passed. Works as expected
Delete a Graph : Passed. Works as expected. Deletes all graph versions for a particular graph also.
Graph Version REST API Test :
Get all version of a graph : Passed. Fetches all graph versions for a particular graph
Get specific version of a graph : Passed. Fetches graph version by ID or else returns None.
Add a version : Passed. Works as expected
Delete a graph version : User can delete any non-default graph version using the REST APIs. To delete the default graph version, user needs to set another version as the default. Deleting a graph will automatically remove all graph versions for that graph.
View API RAML as HTML document
Open Questions and Pre-Merge TODOs
@jahandaniyal
Learning
http://gsoc18.blogspot.com/
Links to blog posts, patterns, libraries or addons used to solve this problem
Blog Posts