mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 09:07:45 -02:30
Add options information and linkage for dashboard views
This commit is contained in:
40
awx/api/templates/api/dashboard_inventory_graph_view.md
Normal file
40
awx/api/templates/api/dashboard_inventory_graph_view.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
Make a GET request to this resource to retrieve aggregate statistics about inventory suitable for graphing.
|
||||||
|
|
||||||
|
Including fetching the number of total hosts tracked by Tower over an amount of time and the current success or
|
||||||
|
failed status of hosts which have run jobs within an Inventory.
|
||||||
|
|
||||||
|
## Parmeters and Filtering
|
||||||
|
|
||||||
|
The `period` of the data can be adjusted with:
|
||||||
|
|
||||||
|
?period=month
|
||||||
|
|
||||||
|
Where `month` can be replaced with `week`, or `day`. `month` is the default.
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
Data about the number of hosts will be returned in the following format:
|
||||||
|
|
||||||
|
"hosts": [
|
||||||
|
[
|
||||||
|
1402808400.0,
|
||||||
|
86743
|
||||||
|
], ...]
|
||||||
|
|
||||||
|
Each element contains an epoch timestamp represented in seconds and a numerical value indicating
|
||||||
|
the number of hosts that exist at a given moment
|
||||||
|
|
||||||
|
Data about failed and successfull hosts by inventory will be given as:
|
||||||
|
|
||||||
|
{
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"successful": 21,
|
||||||
|
"source": "ec2",
|
||||||
|
"name": "aws (Test Inventory)",
|
||||||
|
"failed": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": 2,
|
||||||
|
"name": "Test Inventory"
|
||||||
|
},
|
||||||
35
awx/api/templates/api/dashboard_jobs_graph_view.md
Normal file
35
awx/api/templates/api/dashboard_jobs_graph_view.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
Make a GET request to this resource to retrieve aggregate statistics about job runs suitable for graphing.
|
||||||
|
|
||||||
|
## Parmeters and Filtering
|
||||||
|
|
||||||
|
The `period` of the data can be adjusted with:
|
||||||
|
|
||||||
|
?period=month
|
||||||
|
|
||||||
|
Where `month` can be replaced with `week`, or `day`. `month` is the default.
|
||||||
|
|
||||||
|
The type of job can be filtered with:
|
||||||
|
|
||||||
|
?job_type=all
|
||||||
|
|
||||||
|
Where `all` can be replaced with `inv_sync`, `playbook_run` or `scm_update`. `all` is the default.
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
Data will be returned in the following format:
|
||||||
|
|
||||||
|
"jobs": {
|
||||||
|
"successful": [
|
||||||
|
[
|
||||||
|
1402808400.0,
|
||||||
|
9
|
||||||
|
], ... ],
|
||||||
|
"failed": [
|
||||||
|
[
|
||||||
|
1402808400.0,
|
||||||
|
3
|
||||||
|
], ... ]
|
||||||
|
}
|
||||||
|
|
||||||
|
Each element contains an epoch timestamp represented in seconds and a numerical value indicating
|
||||||
|
the number of events during that time period
|
||||||
1
awx/api/templates/api/dashboard_view.md
Normal file
1
awx/api/templates/api/dashboard_view.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Make a GET request to this resource to retrieve aggregate statistics for Tower
|
||||||
@@ -152,6 +152,8 @@ class DashboardView(APIView):
|
|||||||
def get(self, request, format=None):
|
def get(self, request, format=None):
|
||||||
''' Show Dashboard Details '''
|
''' Show Dashboard Details '''
|
||||||
data = SortedDict()
|
data = SortedDict()
|
||||||
|
data['related'] = {'jobs_graph': reverse('api:dashboard_jobs_graph_view'),
|
||||||
|
'inventory_graph': reverse('api:dashboard_inventory_graph_view')}
|
||||||
user_inventory = get_user_queryset(request.user, Inventory)
|
user_inventory = get_user_queryset(request.user, Inventory)
|
||||||
inventory_with_failed_hosts = user_inventory.filter(hosts_with_active_failures__gt=0)
|
inventory_with_failed_hosts = user_inventory.filter(hosts_with_active_failures__gt=0)
|
||||||
user_inventory_external = user_inventory.filter(has_inventory_sources=True)
|
user_inventory_external = user_inventory.filter(has_inventory_sources=True)
|
||||||
@@ -251,7 +253,7 @@ class DashboardView(APIView):
|
|||||||
class DashboardJobsGraphView(APIView):
|
class DashboardJobsGraphView(APIView):
|
||||||
|
|
||||||
view_name = "Dashboard Jobs Graphs"
|
view_name = "Dashboard Jobs Graphs"
|
||||||
new_in_20 = True
|
new_in_200 = True
|
||||||
|
|
||||||
def get(self, request, format=None):
|
def get(self, request, format=None):
|
||||||
period = request.QUERY_PARAMS.get('period', 'month')
|
period = request.QUERY_PARAMS.get('period', 'month')
|
||||||
@@ -300,7 +302,7 @@ class DashboardJobsGraphView(APIView):
|
|||||||
class DashboardInventoryGraphView(APIView):
|
class DashboardInventoryGraphView(APIView):
|
||||||
|
|
||||||
view_name = "Dashboard Inventory Graphs"
|
view_name = "Dashboard Inventory Graphs"
|
||||||
new_in_20 = True
|
new_in_200 = True
|
||||||
|
|
||||||
def get(self, request, format=None):
|
def get(self, request, format=None):
|
||||||
period = request.QUERY_PARAMS.get('period', 'month')
|
period = request.QUERY_PARAMS.get('period', 'month')
|
||||||
|
|||||||
Reference in New Issue
Block a user