Skip to content
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

Dashboard View #191

Merged
merged 39 commits into from
Sep 13, 2022
Merged

Dashboard View #191

merged 39 commits into from
Sep 13, 2022

Conversation

jvanderaa
Copy link
Collaborator

@jvanderaa jvanderaa commented Jul 7, 2022

WIP yet, this is the work towards building a Dashboard view for the components of the circuit maintenance.

Outstanding:

  • Complete planned dashboard metrics
  • Integrate functions/methods into Capacity Metrics

@jvanderaa jvanderaa marked this pull request as draft July 7, 2022 18:56
@scetron
Copy link
Contributor

scetron commented Jul 8, 2022

I think this is a great addition to the plugin and agree with @glennmatthews that it would make a good plugin landing/home page.

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@jvanderaa
Copy link
Collaborator Author

I'm currently waiting on #195 before I continue on.

@jvanderaa jvanderaa marked this pull request as ready for review August 19, 2022 14:04
@chadell chadell changed the title WIP: Dashboard View Dashboard View Aug 23, 2022
nautobot_circuit_maintenance/__init__.py Show resolved Hide resolved
nautobot_circuit_maintenance/urls.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/__init__.py Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
Copy link
Contributor

@chadell chadell left a comment

Choose a reason for hiding this comment

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

Calling the overview view, without any Circuit Maintenance, raises an AttributeError exception

AttributeError at /plugins/circuit-maintenance/maintenance/overview/
'NoneType' object has no attribute 'start_time'
Request Method:	GET
Request URL:	http://localhost:8080/plugins/circuit-maintenance/maintenance/overview/
Django Version:	3.2.15
Exception Type:	AttributeError
Exception Value:	
'NoneType' object has no attribute 'start_time'
Exception Location:	/source/nautobot_circuit_maintenance/views.py, line 169, in get_month_list
Python Executable:	/usr/local/bin/python
Python Version:	3.7.13
Python Path:	
['/source',
 '/usr/local/lib/python3.7/site-packages/git/ext/gitdb',
 '/source',
 '/usr/local/bin',
 '/usr/local/lib/python37.zip',
 '/usr/local/lib/python3.7',
 '/usr/local/lib/python3.7/lib-dynload',
 '/root/.local/lib/python3.7/site-packages',
 '/usr/local/lib/python3.7/site-packages',
 '/source',
 '/usr/local/lib/python3.7/site-packages/gitdb/ext/smmap']
Server time:	Wed, 24 Aug 2022 07:08:07 +0000

Copy link
Contributor

@chadell chadell left a comment

Choose a reason for hiding this comment

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

Accessing the overview view with a CircuitMaintenance without circuits, trigger a ZeroDivisionError exception

ZeroDivisionError at /plugins/circuit-maintenance/maintenance/overview/
division by zero
Request Method:	GET
Request URL:	http://localhost:8080/plugins/circuit-maintenance/maintenance/overview/
Django Version:	3.2.15
Exception Type:	ZeroDivisionError
Exception Value:	
division by zero
Exception Location:	/source/nautobot_circuit_maintenance/views.py, line 69, in setup
Python Executable:	/usr/local/bin/python
Python Version:	3.7.13
Python Path:	
['/source',
 '/usr/local/lib/python3.7/site-packages/git/ext/gitdb',
 '/source',
 '/usr/local/bin',
 '/usr/local/lib/python37.zip',
 '/usr/local/lib/python3.7',
 '/usr/local/lib/python3.7/lib-dynload',
 '/root/.local/lib/python3.7/site-packages',
 '/usr/local/lib/python3.7/site-packages',
 '/source',
 '/usr/local/lib/python3.7/site-packages/gitdb/ext/smmap']
Server time:	Wed, 24 Aug 2022 07:09:54 +0000

Copy link
Contributor

@chadell chadell left a comment

Choose a reason for hiding this comment

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

I create a CM for the next 30 Days, and is not showing up in the dashboard (this circuit is not associated to a Device)

image

image

@jvanderaa
Copy link
Collaborator Author

"Average Duration of Maintenances" is always 0? I added some future circuit maintenances, and always show as 0

Corrected. The seconds property was initially giving good results. But the proper method to use was total_seconds() to get the duration within seconds on a timedelta object.

@jvanderaa jvanderaa requested review from chadell and glennmatthews and removed request for glennmatthews and chadell September 1, 2022 12:26
README.md Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
nautobot_circuit_maintenance/views.py Outdated Show resolved Hide resolved
return f"plugins:{self.model._meta.app_label}:{self.model._meta.model_name}_{{}}"

def assertInstanceEqual(self, instance, data, api=False): # pylint: disable=arguments-differ
"""Used to overwrite inbuilt function. Causing type issues for datetimepicker."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't ring a bell to me, sorry.

@jvanderaa jvanderaa requested a review from chadell September 6, 2022 19:11
Copy link
Contributor

@chadell chadell left a comment

Choose a reason for hiding this comment

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

It's almost a 👍 , I would only simply the testing of the new view (as suggested by Glenn) with a simpler test class, without all the tests that apply to a model, but in this case it's only for an extra view. It should get rid of a lot of the skip that are not adding any value

@jvanderaa
Copy link
Collaborator Author

Done @chadell

chadell
chadell previously approved these changes Sep 8, 2022
Copy link
Contributor

@chadell chadell left a comment

Choose a reason for hiding this comment

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

LGTM
🎉 Amazing work Josh!
I see this just a first iteration of the dashboard, where we could extend and add useful information as we add more features.

Regarding testing, for the assertInstanceEqual weirdness, I would create a housekeeping issue to fix it.

{% table_config_form table table_name="ObjectTable" %}
{% endblock %}
{% block javascript %}
<script src="{% static 'js/tableconfig.js' %}"></script>
Copy link
Contributor

Choose a reason for hiding this comment

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

@jvanderaa , could you give explain (point to doc) what are we using this for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@itdependsnetworks I took this from the GC plugin. Any insight?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed it for now. It is used for table selection.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's get this merged and released?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's used for customizing a table view to specify which columns are displayed. If you're removing it, you should also remove the table_config_form template tag as well.

scetron
scetron previously approved these changes Sep 9, 2022
Copy link
Contributor

@scetron scetron left a comment

Choose a reason for hiding this comment

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

Looks good to me

…nance/circuit_maintenance_overview.html

Co-authored-by: Christian Adell <[email protected]>
Copy link
Contributor

@chadell chadell left a comment

Choose a reason for hiding this comment

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

LGTM

@chadell chadell merged commit 9606a95 into nautobot:develop Sep 13, 2022
@chadell chadell mentioned this pull request Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants