-
Notifications
You must be signed in to change notification settings - Fork 65
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
[change] Add user defined properties field in Node and Link #85 #91
Merged
Merged
Changes from all commits
Commits
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
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
11 changes: 1 addition & 10 deletions
11
openwisp_network_topology/integrations/device/migrations/0002_create_relations.py
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import swapper | ||
|
||
|
||
def get_model(apps, app_name, model): | ||
model_name = swapper.get_model_name(app_name, model) | ||
model_label = swapper.split(model_name)[0] | ||
return apps.get_model(model_label, model) | ||
|
||
|
||
def create_relations_0001(apps, schema_editor): | ||
Node = get_model(apps, 'topology', 'Node') | ||
DeviceNode = swapper.load_model('topology_device', 'DeviceNode') | ||
queryset = Node.objects.select_related('topology').filter( | ||
topology__parser='netdiff.OpenvpnParser' | ||
) | ||
for node in queryset.iterator(): | ||
DeviceNode.auto_create(node) |
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
8 changes: 1 addition & 7 deletions
8
openwisp_network_topology/migrations/0011_fix_link_properties.py
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
47 changes: 47 additions & 0 deletions
47
openwisp_network_topology/migrations/0013_add_user_defined_properties_field.py
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,47 @@ | ||
# Generated by Django 3.0.9 on 2020-09-01 14:57 | ||
|
||
import collections | ||
|
||
import jsonfield.fields | ||
import rest_framework.utils.encoders | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('topology', '0012_update_openvpn_netjson_ids'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='link', | ||
name='user_properties', | ||
field=jsonfield.fields.JSONField( | ||
blank=True, | ||
default=dict, | ||
dump_kwargs={ | ||
'cls': rest_framework.utils.encoders.JSONEncoder, | ||
'indent': 4, | ||
}, | ||
help_text='If you need to add additional data to this link use this field', | ||
load_kwargs={'object_pairs_hook': collections.OrderedDict}, | ||
verbose_name='user defined properties', | ||
), | ||
), | ||
migrations.AddField( | ||
model_name='node', | ||
name='user_properties', | ||
field=jsonfield.fields.JSONField( | ||
blank=True, | ||
default=dict, | ||
dump_kwargs={ | ||
'cls': rest_framework.utils.encoders.JSONEncoder, | ||
'indent': 4, | ||
}, | ||
help_text='If you need to add additional data to this node use this field', | ||
load_kwargs={'object_pairs_hook': collections.OrderedDict}, | ||
verbose_name='user defined properties', | ||
), | ||
), | ||
] |
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
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
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
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.
this module needs to be added here: https://github.com/openwisp/openwisp-network-topology/blob/master/requirements.txt
openwisp-controller is not a direct dependency. The build is not failing because openwisp-controller is being installed with an additional command to test the integration module.
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.
@nemesisdesign Thank you for this catch. I forgot to add it 😄 . But the build isn't failing because of this. the Build is failing because modify_settings is called. I tried some many fix but they didn't work. I don't think the fix should be done in this module. if we fix it here, we might be hiding a potential bug which will certainly surface again one day. My master branch is equally failing with the same error.