Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

[models] Added link status up/down time #43#73

Merged
rohithasrk merged 1 commit intoopenwisp:masterfrom
R9295:link-status
Jan 10, 2018
Merged

[models] Added link status up/down time #43#73
rohithasrk merged 1 commit intoopenwisp:masterfrom
R9295:link-status

Conversation

@R9295
Copy link
Copy Markdown
Contributor

@R9295 R9295 commented Jan 4, 2018

Implements and closes #43

@coveralls
Copy link
Copy Markdown

coveralls commented Jan 4, 2018

Coverage Status

Coverage decreased (-1.8%) to 98.16% when pulling 1fc4a4c on R9295:link-status into dae62c2 on netjson:master.

Copy link
Copy Markdown
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress @R9295.

We need to show this information in the API so it appears in the visualizer.

We don't need to show it in the admin so you can safely remove the admin code.

Take a look at how some fields are added into the "properties" section of the NetJSON nodes, which are shown in the visualizer: https://github.com/netjson/django-netjsongraph/blob/master/django_netjsongraph/base/node.py#L87-L100

You need to do something similar with this new field.

PS: me and @rohithasrk forgot to create a migration in the previous release, delete the migration you created, rebase on current master and regenerate the migration

Comment thread django_netjsongraph/base/link.py Outdated
blank=True,
load_kwargs={'object_pairs_hook': OrderedDict},
dump_kwargs={'indent': 4})
last_status_change = models.DateTimeField(auto_now=True)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to status_changed for consistency with the created and modified fields

Comment thread django_netjsongraph/base/admin.py Outdated
class AbstractLinkAdmin(BaseAdmin):
raw_id_fields = ['source', 'target']
list_display = ['__str__', 'topology', 'status', 'cost', 'cost_text']
list_display = ['__str__', 'topology', 'status', 'cost', 'cost_text', 'uptime_or_downtime']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not add this information in the admin list, we need to show this in the visualizer

Comment thread django_netjsongraph/base/link.py Outdated
def send_status_changed_signal(self):
link_status_changed.send(sender=self.__class__, link=self)

def last_status_change_diff(self):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I came to the conclusion that we can simplify the implementation and remove this addition because calculating this for each node in a large graph would slow down the generation of the NetworkGraph even further to little advantage. By returning the status_changed field in the API frontend javascript implementations can calculate this value on the fly - and having the raw value is good enough for now.

@R9295 R9295 force-pushed the link-status branch 2 times, most recently from f2ec641 to 4ec15ec Compare January 5, 2018 15:59
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 5, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 23b94e4 on R9295:link-status into 1150666 on netjson:master.

@rohithasrk rohithasrk merged commit 9b2be9c into openwisp:master Jan 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Link status up/down time

4 participants