mirror of
https://github.com/ansible/awx.git
synced 2026-02-12 15:14:45 -03:30
HostMetrics migration
This commit is contained in:
committed by
John Westcott IV
parent
ef4e77d78f
commit
d80759cd7a
@@ -5392,7 +5392,18 @@ class HostMetricSerializer(BaseSerializer):
|
||||
|
||||
class Meta:
|
||||
model = HostMetric
|
||||
fields = ("hostname", "first_automation", "last_automation")
|
||||
fields = (
|
||||
"id",
|
||||
"hostname",
|
||||
"url",
|
||||
"first_automation",
|
||||
"last_automation",
|
||||
"last_deleted",
|
||||
"automated_counter",
|
||||
"deleted_counter",
|
||||
"deleted",
|
||||
"used_in_inventories",
|
||||
)
|
||||
|
||||
|
||||
class InstanceGroupSerializer(BaseSerializer):
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
from django.urls import re_path
|
||||
|
||||
from awx.api.views import HostMetricList
|
||||
from awx.api.views import HostMetricList, HostMetricDetail
|
||||
|
||||
urls = [re_path(r'$^', HostMetricList.as_view(), name='host_metric_list')]
|
||||
urls = [re_path(r'$^', HostMetricList.as_view(), name='host_metric_list'), re_path(r'^(?P<pk>[0-9]+)/$', HostMetricDetail.as_view(), name='host_metric_detail')]
|
||||
|
||||
__all__ = ['urls']
|
||||
|
||||
@@ -1549,10 +1549,18 @@ class HostRelatedSearchMixin(object):
|
||||
|
||||
|
||||
class HostMetricList(ListAPIView):
|
||||
always_allow_superuser = False
|
||||
name = _("Host Metrics List")
|
||||
model = models.HostMetric
|
||||
serializer_class = serializers.HostMetricSerializer
|
||||
permission_classes = (IsSystemAdminOrAuditor,)
|
||||
search_fields = ('hostname', 'deleted')
|
||||
|
||||
|
||||
class HostMetricDetail(RetrieveDestroyAPIView):
|
||||
name = _("Host Metric Detail")
|
||||
model = models.HostMetric
|
||||
serializer_class = serializers.HostMetricSerializer
|
||||
permission_classes = (IsSystemAdminOrAuditor,)
|
||||
|
||||
|
||||
class HostList(HostRelatedSearchMixin, ListCreateAPIView):
|
||||
|
||||
Reference in New Issue
Block a user