-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version feature #388
Open
jahandaniyal
wants to merge
22
commits into
Murali-group:develop
Choose a base branch
from
jahandaniyal:version_feature
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Version feature #388
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e30eed4
Create PULL_REQUEST_TEMPLATE.md
adbharadwaj 6521955
Added GET Api for Graph Versions
jahandaniyal 240fd20
Added POST Api for graph_version
jahandaniyal 64921a3
Added DELETE API for graph_version
jahandaniyal 4d307e3
Added Version selector dropdown
jahandaniyal 321a432
Added API Specifications for Graph Version
jahandaniyal f99e668
Changes in model for version feature
jahandaniyal 76b4acc
Added changes for upload, add graph
jahandaniyal 50b9c7e
Update models - migrate json from graph to graph_version table
jahandaniyal 1cdcb57
Added migration files for model changes
jahandaniyal e6b59cf
Added graph_version specific code to views
jahandaniyal 9bd1573
Added graph_version specific code to controllers
jahandaniyal aed358b
dal changes - moved json from graph to graph_version
jahandaniyal 9141f57
UI changes for graph_version feature
jahandaniyal 5ba4276
Added Python Documentation for Version Feature
jahandaniyal 3e1dffc
Fix indentations and remove unnecessary commented code
jahandaniyal 5f7e224
Added Tests for GraphSpace models
jahandaniyal c2ed1d8
Fix indentation
jahandaniyal 4135efe
Graph Version minor UI Fixes
jahandaniyal c2b90c8
Merge branch 'version_feature' of https://github.com/jahandaniyal/Gra…
jahandaniyal c4465e3
Fix Graph Fit and Layout issues for Graph Versions
jahandaniyal 19e319d
Set correct z-index for Export button & version dropdown
jahandaniyal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Purpose | ||
_Describe the problem or feature in addition to a link to the issues._ | ||
|
||
Example: | ||
Fixes # . | ||
|
||
## Approach | ||
_How does this change address the problem?_ | ||
|
||
#### Open Questions and Pre-Merge TODOs | ||
- [ ] Use github checklists. When solved, check the box and explain the answer. | ||
|
||
## Learning | ||
_Describe the research stage_ | ||
|
||
_Links to blog posts, patterns, libraries or addons used to solve this problem_ | ||
|
||
#### Blog Posts | ||
- [How to Pull Request](https://github.com/flexyford/pull-request) Github Repo with Learning focused Pull Request Template. | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,8 +191,18 @@ def add_graph(request, name=None, tags=None, is_public=None, graph_json=None, st | |
|
||
# Construct new graph to add to database | ||
new_graph = db.add_graph(request.db_session, name=name, owner_email=owner_email, | ||
graph_json=json.dumps(G.get_graph_json()), style_json=json.dumps(G.get_style_json()), | ||
is_public=is_public, default_layout_id=default_layout_id) | ||
default_version = db.add_graph_version(request.db_session, name=name, description='Default Version', | ||
owner_email=owner_email, graph_json=json.dumps(G.get_graph_json()), | ||
style_json=json.dumps(G.get_style_json()), graph_id=new_graph.id, is_default = True) | ||
|
||
# Add default_version to new_graph | ||
new_graph.__setattr__('default_version', default_version) | ||
# Add graph_json to new_graph | ||
new_graph.__setattr__('graph_json', default_version.graph_json) | ||
# Add style_json to new_graph | ||
new_graph.__setattr__('style_json', default_version.style_json) | ||
|
||
# Add graph tags | ||
for tag in G.get_tags(): | ||
add_graph_tag(request, new_graph.id, tag) | ||
|
@@ -586,3 +596,68 @@ def add_edge(request, name=None, head_node_id=None, tail_node_id=None, is_direct | |
def delete_edge_by_id(request, edge_id): | ||
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'): | ||
""" | ||
Parameters | ||
---------- | ||
request : object | ||
HTTP GET Request. | ||
graph_id : string | ||
Unique ID of the graph. | ||
names : list of strings | ||
Search for graphs with given list of names. In order to search for graphs with given name as a substring, wrap the name with percentage symbol. For example, %xyz% will search for all graphs with xyz in their name. | ||
limit : integer | ||
Number of entities to return. Default value is 20. | ||
offset : integer | ||
Offset the list of returned entities by this number. Default value is 0. | ||
order : string | ||
Defines the column sort order, can only be 'asc' or 'desc'. | ||
sort : string | ||
Defines which column will be sorted. | ||
|
||
Returns | ||
------- | ||
total : integer | ||
Number of groups matching the request. | ||
graph_versions : List of Graph Versions. | ||
List of Graph Version Objects with given limit and offset. | ||
|
||
Raises | ||
------ | ||
|
||
Notes | ||
------ | ||
""" | ||
if sort == 'name': | ||
sort_attr = db.GraphVersion.name | ||
elif sort == 'update_at': | ||
sort_attr = db.GraphVersion.updated_at | ||
else: | ||
sort_attr = db.GraphVersion.name | ||
|
||
if order == 'desc': | ||
orber_by = db.desc(sort_attr) | ||
else: | ||
orber_by = db.asc(sort_attr) | ||
|
||
total, graph_versions = db.find_graph_versions(request.db_session, | ||
names=names, | ||
graph_id=graph_id, | ||
limit=limit, | ||
offset=offset, | ||
order_by=orber_by) | ||
|
||
return total, graph_versions | ||
|
||
def get_graph_version_by_id(request, version_id): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pydoc |
||
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): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pydoc |
||
if name is None or graph_id is None or graph_json is 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): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pydoc |
||
db.delete_graph_version(request.db_session, id=graph_version_id) | ||
return |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add python documentation. Document cases where an exception will be raised.