Various CSS and layout tweaks

This commit is contained in:
Jonathan Senecal 2023-05-12 13:13:58 -04:00
parent 3e852acc8e
commit 725c0b56c7
13 changed files with 45 additions and 21 deletions

View File

@ -22,7 +22,7 @@ DEFAULT_DASHBOARD = [
{ {
'widget': 'extras.ObjectCountsWidget', 'widget': 'extras.ObjectCountsWidget',
'width': 4, 'width': 4,
'height': 2, 'height': 5,
'title': 'Organization', 'title': 'Organization',
'config': { 'config': {
'models': [ 'models': [
@ -35,7 +35,7 @@ DEFAULT_DASHBOARD = [
{ {
'widget': 'extras.ObjectCountsWidget', 'widget': 'extras.ObjectCountsWidget',
'width': 4, 'width': 4,
'height': 3, 'height': 8,
'title': 'IPAM', 'title': 'IPAM',
'config': { 'config': {
'models': [ 'models': [
@ -51,7 +51,7 @@ DEFAULT_DASHBOARD = [
{ {
'widget': 'extras.NoteWidget', 'widget': 'extras.NoteWidget',
'width': 4, 'width': 4,
'height': 2, 'height': 4,
'title': 'Welcome!', 'title': 'Welcome!',
'color': 'green', 'color': 'green',
'config': { 'config': {
@ -65,7 +65,7 @@ DEFAULT_DASHBOARD = [
{ {
'widget': 'extras.ObjectCountsWidget', 'widget': 'extras.ObjectCountsWidget',
'width': 4, 'width': 4,
'height': 2, 'height': 4,
'title': 'Circuits', 'title': 'Circuits',
'config': { 'config': {
'models': [ 'models': [
@ -78,7 +78,7 @@ DEFAULT_DASHBOARD = [
{ {
'widget': 'extras.RSSFeedWidget', 'widget': 'extras.RSSFeedWidget',
'width': 4, 'width': 4,
'height': 4, 'height': 8,
'title': 'NetBox News', 'title': 'NetBox News',
'config': { 'config': {
'feed_url': 'http://netbox.dev/rss/', 'feed_url': 'http://netbox.dev/rss/',
@ -89,7 +89,7 @@ DEFAULT_DASHBOARD = [
{ {
'widget': 'extras.ObjectCountsWidget', 'widget': 'extras.ObjectCountsWidget',
'width': 4, 'width': 4,
'height': 3, 'height': 6,
'title': 'DCIM', 'title': 'DCIM',
'config': { 'config': {
'models': [ 'models': [
@ -104,7 +104,7 @@ DEFAULT_DASHBOARD = [
{ {
'widget': 'extras.ObjectCountsWidget', 'widget': 'extras.ObjectCountsWidget',
'width': 4, 'width': 4,
'height': 2, 'height': 4,
'title': 'Virtualization', 'title': 'Virtualization',
'config': { 'config': {
'models': [ 'models': [
@ -116,7 +116,7 @@ DEFAULT_DASHBOARD = [
{ {
'widget': 'extras.ObjectListWidget', 'widget': 'extras.ObjectListWidget',
'width': 12, 'width': 12,
'height': 5, 'height': 10,
'title': 'Change Log', 'title': 'Change Log',
'color': 'blue', 'color': 'blue',
'config': { 'config': {

View File

@ -133,7 +133,7 @@ class NoteWidget(DashboardWidget):
) )
def render(self, request): def render(self, request):
return render_markdown(self.config.get('content')) return render_markdown(self.config.get('content'), "mt-3")
@register_widget @register_widget

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -35,7 +35,7 @@ export function initDashboard(): void {
// Initialize the grid // Initialize the grid
let grid = GridStack.init({ let grid = GridStack.init({
cellHeight: 100, cellHeight: 48,
disableDrag: true, disableDrag: true,
disableResize: true, disableResize: true,
draggable: { draggable: {

View File

@ -109,6 +109,20 @@ table td > .progress {
} }
} }
// Remove scrollbars from grid stack cards on Explorer and Firefox
.grid-stack-item-content > .card-body:not(:has(.htmx-container)) {
/* Internet Explorer 10+ */
-ms-overflow-style: none;
/* Firefox */
scrollbar-width: none;
}
// Remove scrollbars from grid stack cards on Safari and Chrome
.grid-stack-item-content > .card-body:not(:has(.htmx-container))::-webkit-scrollbar {
display: none;
}
// Cards
.card > .table.table-flush { .card > .table.table-flush {
margin-bottom: 0; margin-bottom: 0;
overflow: hidden; overflow: hidden;
@ -662,6 +676,14 @@ span.color-label {
} }
} }
// Override the default GridStack style for the resize handle.
.ui-resizable-se {
bottom: 0 !important;
right: 0 !important;
background-image: none !important;
}
// Floating forms
.form-floating { .form-floating {
position: relative; position: relative;
@ -744,7 +766,7 @@ textarea.form-control[name='csv'] {
font-family: $font-family-monospace; font-family: $font-family-monospace;
} }
.card:not(:only-of-type) { .card:not(:only-of-type) + div:not(.ui-resizable-handle) {
margin-bottom: $spacer; margin-bottom: $spacer;
} }

View File

@ -9,7 +9,7 @@
gs-id="{{ widget.id }}" gs-id="{{ widget.id }}"
> >
<div class="card grid-stack-item-content"> <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="card-header text-center text-light {% if widget.color %}bg-{{ widget.color }} {% endif %}p-1">
<div class="float-start ps-1"> <div class="float-start ps-1">
<a href="#" <a href="#"
hx-get="{% url 'extras:dashboardwidget_config' id=widget.id %}" hx-get="{% url 'extras:dashboardwidget_config' id=widget.id %}"
@ -27,10 +27,10 @@
><i class="mdi mdi-close text-gray"></i></a> ><i class="mdi mdi-close text-gray"></i></a>
</div> </div>
{% if widget.title %} {% if widget.title %}
<strong>{{ widget.title }}</strong> <h6 class="card-header">{{ widget.title }}</h6>
{% endif %} {% endif %}
</div> </div>
<div class="card-body p-2 overflow-auto"> <div class="card-body overflow-auto mb-4">
{% render_widget widget %} {% render_widget widget %}
</div> </div>
</div> </div>

View File

@ -7,13 +7,13 @@
<a href="{% url model|viewname:"list" %}" class="list-group-item list-group-item-action"> <a href="{% url model|viewname:"list" %}" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between align-items-center"> <div class="d-flex w-100 justify-content-between align-items-center">
{{ model|meta:"verbose_name_plural"|bettertitle }} {{ model|meta:"verbose_name_plural"|bettertitle }}
<h6 class="mb-1">{{ count }}</h6> <h5 class="mb-1">{{ count }}</h5>
</div> </div>
</a> </a>
{% else %} {% else %}
<div class="list-group-item list-group-item-action d-flex w-100 justify-content-between align-items-center"> <div class="list-group-item list-group-item-action d-flex w-100 justify-content-between align-items-center">
{{ model|meta:"verbose_name_plural"|bettertitle }} {{ model|meta:"verbose_name_plural"|bettertitle }}
<h6 class="mb-1" title="No permission"><i class="mdi mdi-lock-outline"></i></h6> <h5 class="mb-1" title="No permission"><i class="mdi mdi-lock-outline"></i></h5>
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -1,11 +1,11 @@
{% if htmx_url and has_permission %} {% if htmx_url and has_permission %}
<div class="htmx-container" hx-get="{{ htmx_url }}" hx-trigger="load"></div> <div class="htmx-container mt-3" hx-get="{{ htmx_url }}" hx-trigger="load"></div>
{% elif htmx_url %} {% elif htmx_url %}
<div class="text-muted text-center"> <div class="text-muted text-center mt-3">
<i class="mdi mdi-lock-outline"></i> No permission to view this content. <i class="mdi mdi-lock-outline"></i> No permission to view this content.
</div> </div>
{% else %} {% else %}
<div class="text-danger text-center"> <div class="text-danger text-center mt-3">
<i class="mdi mdi-alert"></i> Unable to load content. Invalid view name: <span class="font-monospace">{{ viewname }}</span> <i class="mdi mdi-alert"></i> Unable to load content. Invalid view name: <span class="font-monospace">{{ viewname }}</span>
</div> </div>
{% endif %} {% endif %}

View File

@ -23,8 +23,9 @@
{% block title %}Home{% endblock %} {% block title %}Home{% endblock %}
{% block content-wrapper %} {% block content-wrapper %}
<div class="px-3">
{# Render the user's customized dashboard #} {# Render the user's customized dashboard #}
<div class="grid-stack" id="dashboard"> <div class="row grid-stack" id="dashboard">
{% for widget in dashboard %} {% for widget in dashboard %}
{% include 'extras/dashboard/widget.html' %} {% include 'extras/dashboard/widget.html' %}
{% endfor %} {% endfor %}
@ -64,6 +65,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
{% endblock content-wrapper %} {% endblock content-wrapper %}
{% block modals %} {% block modals %}