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
48 lines
1011 B
Python
48 lines
1011 B
Python
from django.contrib.contenttypes.models import ContentType
|
|
|
|
# Webhook content types
|
|
HTTP_CONTENT_TYPE_JSON = 'application/json'
|
|
|
|
# Dashboard
|
|
DEFAULT_DASHBOARD = [
|
|
{
|
|
'widget': 'extras.ObjectCountsWidget',
|
|
'width': 4,
|
|
'height': 3,
|
|
'title': 'IPAM',
|
|
'config': {
|
|
'models': [
|
|
'ipam.aggregate',
|
|
'ipam.prefix',
|
|
'ipam.ipaddress',
|
|
]
|
|
}
|
|
},
|
|
{
|
|
'widget': 'extras.ObjectCountsWidget',
|
|
'width': 4,
|
|
'height': 3,
|
|
'title': 'DCIM',
|
|
'config': {
|
|
'models': [
|
|
'dcim.site',
|
|
'dcim.rack',
|
|
'dcim.device',
|
|
]
|
|
}
|
|
},
|
|
{
|
|
'widget': 'extras.NoteWidget',
|
|
'width': 4,
|
|
'height': 3,
|
|
'config': {
|
|
'content': 'Welcome to **NetBox**!'
|
|
}
|
|
},
|
|
{
|
|
'widget': 'extras.ChangeLogWidget',
|
|
'width': 12,
|
|
'height': 6,
|
|
},
|
|
]
|