jeremystretch 4 лет назад
Родитель
Сommit
662cafe416

+ 14 - 4
netbox/extras/forms/models.py

@@ -7,8 +7,8 @@ from extras.models import *
 from extras.utils import FeatureQuery
 from tenancy.models import Tenant, TenantGroup
 from utilities.forms import (
-    add_blank_choice, BootstrapMixin, CommentField, ContentTypeChoiceField,
-    ContentTypeMultipleChoiceField, DynamicModelMultipleChoiceField, JSONField, SlugField, StaticSelect,
+    add_blank_choice, BootstrapMixin, CommentField, ContentTypeChoiceField, ContentTypeMultipleChoiceField,
+    DynamicModelMultipleChoiceField, JSONField, SlugField, StaticSelect,
 )
 from virtualization.models import Cluster, ClusterGroup
 
@@ -41,6 +41,10 @@ class CustomFieldForm(BootstrapMixin, forms.ModelForm):
             ('Values', ('default', 'choices')),
             ('Validation', ('validation_minimum', 'validation_maximum', 'validation_regex')),
         )
+        widgets = {
+            'type': StaticSelect(),
+            'filter_logic': StaticSelect(),
+        }
 
 
 class CustomLinkForm(BootstrapMixin, forms.ModelForm):
@@ -57,6 +61,7 @@ class CustomLinkForm(BootstrapMixin, forms.ModelForm):
             ('Templates', ('link_text', 'link_url')),
         )
         widgets = {
+            'button_class': StaticSelect(),
             'link_text': forms.Textarea(attrs={'class': 'font-monospace'}),
             'link_url': forms.Textarea(attrs={'class': 'font-monospace'}),
         }
@@ -96,8 +101,7 @@ class WebhookForm(BootstrapMixin, forms.ModelForm):
         model = Webhook
         fields = '__all__'
         fieldsets = (
-            ('Webhook', ('name', 'enabled')),
-            ('Assigned Models', ('content_types',)),
+            ('Webhook', ('name', 'content_types', 'enabled')),
             ('Events', ('type_create', 'type_update', 'type_delete')),
             ('HTTP Request', (
                 'payload_url', 'http_method', 'http_content_type', 'additional_headers', 'body_template', 'secret',
@@ -105,7 +109,13 @@ class WebhookForm(BootstrapMixin, forms.ModelForm):
             ('Conditions', ('conditions',)),
             ('SSL', ('ssl_verification', 'ca_file_path')),
         )
+        labels = {
+            'type_create': 'Creations',
+            'type_update': 'Updates',
+            'type_delete': 'Deletions',
+        }
         widgets = {
+            'http_method': StaticSelect(),
             'additional_headers': forms.Textarea(attrs={'class': 'font-monospace'}),
             'body_template': forms.Textarea(attrs={'class': 'font-monospace'}),
         }

+ 1 - 2
netbox/ipam/forms/models.py

@@ -628,8 +628,7 @@ class FHRPGroupAssignmentForm(BootstrapMixin, forms.ModelForm):
 class VLANGroupForm(CustomFieldModelForm):
     scope_type = ContentTypeChoiceField(
         queryset=ContentType.objects.filter(model__in=VLANGROUP_SCOPE_TYPES),
-        required=False,
-        widget=StaticSelect
+        required=False
     )
     region = DynamicModelChoiceField(
         queryset=Region.objects.all(),

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
netbox/project-static/dist/netbox-light.css


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
netbox/project-static/dist/netbox-print.css


+ 0 - 2
netbox/project-static/styles/theme-light.scss

@@ -2,8 +2,6 @@
 
 @import './theme-base.scss';
 
-$input-border-color: $gray-200;
-
 $theme-colors: map-merge(
   $theme-colors,
   (

+ 2 - 2
netbox/utilities/forms/fields.py

@@ -168,11 +168,11 @@ class ContentTypeChoiceMixin:
 
 
 class ContentTypeChoiceField(ContentTypeChoiceMixin, forms.ModelChoiceField):
-    pass
+    widget = widgets.StaticSelect
 
 
 class ContentTypeMultipleChoiceField(ContentTypeChoiceMixin, forms.ModelMultipleChoiceField):
-    pass
+    widget = widgets.StaticSelectMultiple
 
 
 #

+ 0 - 10
netbox/utilities/forms/widgets.py

@@ -14,7 +14,6 @@ __all__ = (
     'BulkEditNullBooleanSelect',
     'ClearableFileInput',
     'ColorSelect',
-    'ContentTypeSelect',
     'DatePicker',
     'DateTimePicker',
     'NumericArrayField',
@@ -110,15 +109,6 @@ class SelectWithPK(StaticSelect):
     option_template_name = 'widgets/select_option_with_pk.html'
 
 
-class ContentTypeSelect(StaticSelect):
-    """
-    Appends an `api-value` attribute equal to the slugified model name for each ContentType. For example:
-        <option value="37" api-value="console-server-port">console server port</option>
-    This attribute can be used to reference the relevant API endpoint for a particular ContentType.
-    """
-    option_template_name = 'widgets/select_contenttype.html'
-
-
 class SelectSpeedWidget(forms.NumberInput):
     """
     Speed field with dropdown selections for convenience.

+ 0 - 1
netbox/utilities/templates/widgets/select_contenttype.html

@@ -1 +0,0 @@
-<option value="{{ widget.value }}"{% include "django/forms/widgets/attrs.html" %}{% if widget.value %} api-value="{{ widget.label|slugify }}"{% endif %}>{{ widget.label.label|default:widget.label|capfirst }}</option>

Некоторые файлы не были показаны из-за большого количества измененных файлов