Closes: #18588: Relabel Service to Application Service (#19900)

* Closes: #18588: Relabel Service model to Application Service

Updates the `verbose_name` of the `Service` and `ServiceTemplate` models to "Application Service" and
"Application Service Template" respectively. This serves as the foundational change for relabeling
the model throughout the user interface to reduce ambiguity.

To preserve backward compatibility for the REST and GraphQL APIs, the test suites have been updated
to assert the stability of the original field and parameter names. This includes:

*   Using `filter_name_map` in the filterset test case to ensure API query parameters remain
    `service` and `service_id`.
*   Employing the GraphQL test suite's aliasing mechanism to ensure the public schema remains
    unchanged despite the underlying `verbose_name` modification.

Subsequent commits will address UI-specific labels in navigation, tables, forms, and templates.

* Rename to Application Services/Application Service Templates in nav menu

* Rename ~service to ~'Application Service' in templates

This was done for both the Service model and Service Template model
appearances in templates where the word was hardcoded.

* Change ~service to ~'application service' hardcoded strings in Python files

* Update ~service to ~'application service' in docs
This commit is contained in:
Jason Novinger
2025-07-21 09:22:27 -04:00
committed by GitHub
parent 4e0e4598b0
commit 59e1d3a607
15 changed files with 56 additions and 33 deletions

View File

@@ -660,7 +660,7 @@ class IPAddressFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFil
service_id = django_filters.ModelMultipleChoiceFilter(
field_name='services',
queryset=Service.objects.all(),
label=_('Service (ID)'),
label=_('Application Service (ID)'),
)
nat_inside_id = django_filters.ModelMultipleChoiceFilter(
field_name='nat_inside',

View File

@@ -758,7 +758,7 @@ class ServiceTemplateForm(NetBoxModelForm):
comments = CommentField()
fieldsets = (
FieldSet('name', 'protocol', 'ports', 'description', 'tags', name=_('Service Template')),
FieldSet('name', 'protocol', 'ports', 'description', 'tags', name=_('Application Service Template')),
)
class Meta:
@@ -803,7 +803,7 @@ class ServiceForm(NetBoxModelForm):
FieldSet(
'parent_object_type', 'parent', 'name',
InlineFields('protocol', 'ports', label=_('Port(s)')),
'ipaddresses', 'description', 'tags', name=_('Service')
'ipaddresses', 'description', 'tags', name=_('Application Service')
),
)
@@ -845,7 +845,7 @@ class ServiceForm(NetBoxModelForm):
class ServiceCreateForm(ServiceForm):
service_template = DynamicModelChoiceField(
label=_('Service template'),
label=_('Application Service template'),
queryset=ServiceTemplate.objects.all(),
required=False
)
@@ -857,7 +857,7 @@ class ServiceCreateForm(ServiceForm):
FieldSet('service_template', name=_('From Template')),
FieldSet('name', 'protocol', 'ports', name=_('Custom')),
),
'ipaddresses', 'description', 'tags', name=_('Service')
'ipaddresses', 'description', 'tags', name=_('Application Service')
),
)
@@ -886,4 +886,6 @@ class ServiceCreateForm(ServiceForm):
if not self.cleaned_data['description']:
self.cleaned_data['description'] = service_template.description
elif not all(self.cleaned_data[f] for f in ('name', 'protocol', 'ports')):
raise forms.ValidationError(_("Must specify name, protocol, and port(s) if not using a service template."))
raise forms.ValidationError(
_("Must specify name, protocol, and port(s) if not using an application service template.")
)

View File

@@ -55,8 +55,8 @@ class ServiceTemplate(ServiceBase, PrimaryModel):
class Meta:
ordering = ('name',)
verbose_name = _('service template')
verbose_name_plural = _('service templates')
verbose_name = _('application service template')
verbose_name_plural = _('application service templates')
class Service(ContactsMixin, ServiceBase, PrimaryModel):
@@ -84,7 +84,7 @@ class Service(ContactsMixin, ServiceBase, PrimaryModel):
related_name='services',
blank=True,
verbose_name=_('IP addresses'),
help_text=_("The specific IP addresses (if any) to which this service is bound")
help_text=_("The specific IP addresses (if any) to which this application service is bound")
)
clone_fields = ['protocol', 'ports', 'description', 'parent', 'ipaddresses', ]
@@ -94,5 +94,5 @@ class Service(ContactsMixin, ServiceBase, PrimaryModel):
models.Index(fields=('parent_object_type', 'parent_object_id')),
)
ordering = ('protocol', 'ports', 'pk') # (protocol, port) may be non-unique
verbose_name = _('service')
verbose_name_plural = _('services')
verbose_name = _('application service')
verbose_name_plural = _('application services')

View File

@@ -1162,6 +1162,7 @@ class ServiceTemplateTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
graphql_base_name = 'service_template'
@classmethod
def setUpTestData(cls):
@@ -1197,6 +1198,7 @@ class ServiceTest(APIViewTestCases.APIViewTestCase):
bulk_update_data = {
'description': 'New description',
}
graphql_base_name = 'service'
@classmethod
def setUpTestData(cls):

View File

@@ -1101,6 +1101,9 @@ class IPAddressTestCase(TestCase, ChangeLoggedFilterSetTests):
queryset = IPAddress.objects.all()
filterset = IPAddressFilterSet
ignore_fields = ('fhrpgroup',)
filter_name_map = {
'application_service': 'service',
}
@classmethod
def setUpTestData(cls):