diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py
index db9024e19..99c5fe08f 100644
--- a/netbox/dcim/views.py
+++ b/netbox/dcim/views.py
@@ -715,8 +715,20 @@ class RackRoleBulkDeleteView(generic.BulkDeleteView):
@register_model_view(RackType, 'list', path='', detail=False)
class RackTypeListView(generic.ObjectListView):
- queryset = RackType.objects.annotate(
- instance_count=count_related(Rack, 'rack_type')
+ queryset = Rack.objects.prefetch_related(
+ 'reservations',
+ 'devices',
+ 'devices__device_type'
+ 'site',
+ 'location',
+ 'status',
+ 'tenant',
+ 'tenant__tenant_group',
+ 'role',
+ 'rack_type',
+ 'rack_type__manufacturer'
+ ).annotate(
+ device_count=count_related(Device, 'rack'),
)
filterset = filtersets.RackTypeFilterSet
filterset_form = forms.RackTypeFilterForm
diff --git a/netbox/extras/templatetags/custom_links.py b/netbox/extras/templatetags/custom_links.py
index afb5937fd..4aeaaa6b1 100644
--- a/netbox/extras/templatetags/custom_links.py
+++ b/netbox/extras/templatetags/custom_links.py
@@ -3,7 +3,6 @@ from django.utils.html import escape
from django.utils.safestring import mark_safe
from core.models import ObjectType
-from extras.choices import CustomLinkButtonClassChoices
from extras.models import CustomLink
from netbox.choices import ButtonColorChoices
@@ -30,22 +29,6 @@ GROUP_BUTTON = """
GROUP_LINK = '
{}\n'
-def map_button_class(button_color):
- if button_color == ButtonColorChoices.DEFAULT:
- return 'outline-secondary'
- elif button_color == ButtonColorChoices.WHITE:
- return 'light'
- elif button_color == ButtonColorChoices.BLACK:
- return 'dark'
- elif button_color == ButtonColorChoices.GRAY or button_color == ButtonColorChoices.GREY:
- return 'secondary'
- elif button_color == CustomLinkButtonClassChoices.LINK:
- # note: using ghost-secondary as ghost-dark doesn't display in dark mode
- # with current tabler version.
- return 'ghost-secondary'
- return button_color
-
-
@register.simple_tag(takes_context=True)
def custom_links(context, obj):
"""
@@ -81,7 +64,7 @@ def custom_links(context, obj):
try:
if rendered := cl.render(link_context):
template_code += LINK_BUTTON.format(
- rendered['link'], rendered['link_target'], map_button_class(button_class), rendered['text']
+ rendered['link'], rendered['link_target'], button_class, rendered['text']
)
except Exception as e:
template_code += f'' \
@@ -106,7 +89,7 @@ def custom_links(context, obj):
if links_rendered:
template_code += GROUP_BUTTON.format(
- map_button_class(links[0].button_class), escape(group), ''.join(links_rendered)
+ links[0].button_class, escape(group), ''.join(links_rendered)
)
return mark_safe(template_code)
diff --git a/netbox/project-static/dist/netbox.css b/netbox/project-static/dist/netbox.css
index 08fdc7147..7a7854091 100644
Binary files a/netbox/project-static/dist/netbox.css and b/netbox/project-static/dist/netbox.css differ
diff --git a/netbox/project-static/styles/custom/_misc.scss b/netbox/project-static/styles/custom/_misc.scss
index f0c229e52..eeeeb18c8 100644
--- a/netbox/project-static/styles/custom/_misc.scss
+++ b/netbox/project-static/styles/custom/_misc.scss
@@ -63,3 +63,19 @@ span.color-label {
.sso-icon {
height: 24px;
}
+
+.btn-white {
+ @extend .btn-light;
+}
+
+.btn-black {
+ @extend .btn-dark;
+}
+
+.btn-grey {
+ @extend .btn-secondary;
+}
+
+.btn-gray {
+ @extend .btn-secondary;
+}