1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
Files
netbox-community-netbox/netbox/templates/home.html
Jeremy Stretch 084a2cc52c Closes #9416: Dashboard widgets (#11823)
* Replace masonry with gridstack

* Initial work on dashboard widgets

* Implement function to save dashboard layout

* Define a default dashboard

* Clean up widgets

* Implement widget configuration views & forms

* Permit merging dict value with existing dict in user config

* Add widget deletion view

* Enable HTMX for widget configuration

* Implement view to add dashboard widgets

* ObjectCountsWidget: Identify models by app_label & name

* Add color customization to dashboard widgets

* Introduce Dashboard model to store user dashboard layout & config

* Clean up utility functions

* Remove hard-coded API URL

* Use fixed grid cell height

* Add modal close button

* Clean up dashboard views

* Rebuild JS
2023-02-24 16:04:00 -05:00

51 lines
1.6 KiB
HTML

{% extends 'base/layout.html' %}
{% load helpers %}
{% load render_table from django_tables2 %}
{% block header %}
{% if new_release %}
{# new_release is set only if the current user is a superuser or staff member #}
<div class="header-alert-container">
<div class="alert alert-info text-center mw-md-50" role="alert">
<h6 class="alert-heading">
<i class="mdi mdi-information-outline"></i><br/>New Release Available
</h6>
<small><a href="{{ new_release.url }}">NetBox v{{ new_release.version }}</a> is available.</small>
<hr class="my-2" />
<small class="mb-0">
<a href="https://docs.netbox.dev/en/stable/installation/upgrading/">Upgrade Instructions</a>
</small>
</div>
</div>
{% endif %}
{% endblock %}
{% block title %}Home{% endblock %}
{% block content-wrapper %}
{# Render the user's customized dashboard #}
<div class="grid-stack">
{% for widget in dashboard %}
{% include 'extras/dashboard/widget.html' %}
{% endfor %}
</div>
<div class="text-end px-2">
<a href="#"
hx-get="{% url 'extras:dashboardwidget_add' %}"
hx-target="#htmx-modal-content"
data-bs-toggle="modal"
data-bs-target="#htmx-modal"
class="btn btn-success btn-sm"
>
<i class="mdi mdi-plus"></i> Add Widget
</a>
<button id="save_dashboard" class="btn btn-primary btn-sm" data-url="{% url 'extras-api:dashboard' %}">
<i class="mdi mdi-content-save-outline"></i> Save
</button>
</div>
{% endblock content-wrapper %}
{% block modals %}
{% include 'inc/htmx_modal.html' %}
{% endblock modals %}