From 782e8d5875a966cedce6af1e503ddd4d2f061c3c Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 15 Oct 2020 15:34:23 -0400 Subject: [PATCH] add two_weeks filter to dashbaord job graph api view --- awx/api/templates/api/dashboard_jobs_graph_view.md | 2 +- awx/api/views/__init__.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/api/templates/api/dashboard_jobs_graph_view.md b/awx/api/templates/api/dashboard_jobs_graph_view.md index 2e510b2a56..baadd4d561 100644 --- a/awx/api/templates/api/dashboard_jobs_graph_view.md +++ b/awx/api/templates/api/dashboard_jobs_graph_view.md @@ -8,7 +8,7 @@ The `period` of the data can be adjusted with: ?period=month -Where `month` can be replaced with `week`, or `day`. `month` is the default. +Where `month` can be replaced with `week`, `two_weeks`, or `day`. `month` is the default. The type of job can be filtered with: diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py index 11df2b2089..3b5ffc9671 100644 --- a/awx/api/views/__init__.py +++ b/awx/api/views/__init__.py @@ -316,6 +316,9 @@ class DashboardJobsGraphView(APIView): if period == 'month': end_date = start_date - dateutil.relativedelta.relativedelta(months=1) interval = 'days' + elif period == 'two_weeks': + end_date = start_date - dateutil.relativedelta.relativedelta(weeks=2) + interval = 'days' elif period == 'week': end_date = start_date - dateutil.relativedelta.relativedelta(weeks=1) interval = 'days'