mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* 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
38 lines
1.2 KiB
HTML
38 lines
1.2 KiB
HTML
{% load dashboard %}
|
|
|
|
<div
|
|
class="grid-stack-item"
|
|
gs-w="{{ widget.width }}"
|
|
gs-h="{{ widget.height }}"
|
|
gs-x="{{ widget.x }}"
|
|
gs-y="{{ widget.y }}"
|
|
gs-id="{{ widget.id }}"
|
|
>
|
|
<div class="card grid-stack-item-content">
|
|
<div class="card-header text-center text-light bg-{% if widget.color %}{{ widget.color }}{% else %}secondary{% endif %} p-1">
|
|
<div class="float-start ps-1">
|
|
<a href="#"
|
|
hx-get="{% url 'extras:dashboardwidget_config' id=widget.id %}"
|
|
hx-target="#htmx-modal-content"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#htmx-modal"
|
|
><i class="mdi mdi-cog text-gray"></i></a>
|
|
</div>
|
|
<div class="float-end pe-1">
|
|
<a href="#"
|
|
hx-get="{% url 'extras:dashboardwidget_delete' id=widget.id %}"
|
|
hx-target="#htmx-modal-content"
|
|
data-bs-toggle="modal"
|
|
data-bs-target="#htmx-modal"
|
|
><i class="mdi mdi-close text-gray"></i></a>
|
|
</div>
|
|
{% if widget.title %}
|
|
<strong>{{ widget.title }}</strong>
|
|
{% endif %}
|
|
</div>
|
|
<div class="card-body p-2">
|
|
{% render_widget widget %}
|
|
</div>
|
|
</div>
|
|
</div>
|