mirror of
https://github.com/OpenBankProject/API-Manager.git
synced 2026-02-06 18:56:48 +00:00
commit
44ebd99e25
@ -1,6 +1,5 @@
|
||||
document.getElementsByClassName("include_system_calls")[0].innerHTML=`<div>
|
||||
<input type="checkbox" id="include_system_calls_id" name="Include System Calls"
|
||||
>
|
||||
<input type="checkbox" id="include_system_calls_id" name="Include System Calls">
|
||||
<label for="systemCalls">Include System Calls</label>
|
||||
</div>`
|
||||
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
{% load i18n %}
|
||||
|
||||
{% block nav_tabs %}
|
||||
<a href="{% url 'api-metrics' %}?{{ request.GET.urlencode }}">{% trans "List" %}</a>
|
||||
<li><ul class="active"><a href="{% url 'api-metrics-summary-partial-function' %}?{{ request.GET.urlencode }}">{% trans "Summary by Partial Function" %}</a></ul></li>
|
||||
<li><a href="{% url 'api-metrics' %}?{{ request.GET.urlencode }}">{% trans "List" %}</a></li>
|
||||
<li><a href="{% url 'api-metrics-summary-partial-function' %}?{{ request.GET.urlencode }}">{% trans "Summary by Partial Function" %}</a></li>
|
||||
{% endblock nav_tabs %}
|
||||
|
||||
{% block tab_content %}
|
||||
|
||||
@ -63,14 +63,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">{% trans "Update Filter" %}</button>
|
||||
<button type="submit" class="btn btn-primary" onclick="systemCalls()">{% trans "Update Filter" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
{% if form.include_obp_apps.value %}
|
||||
{% block tab_content %}
|
||||
<div class="tab-pane active">
|
||||
<h2>{% trans "Period" %}: {% trans "From" %}{{ from_date }} {% trans "to" %}{{ to_date }} </h2>
|
||||
<h2>{% trans "Period" %}: {% trans "From: " %}{{ from_date }} {% trans "To: " %}{{ to_date }} </h2>
|
||||
|
||||
<table border="1">
|
||||
<tr>
|
||||
@ -146,7 +146,7 @@
|
||||
</div>
|
||||
{% endblock tab_content %}
|
||||
{% else %}
|
||||
<h2>{% trans "Period" %} : {% trans "From" %} {{ from_date }} {% trans "to" %} {{ to_date }}</h2>
|
||||
<h2>{% trans "Period: " %} : {% trans "From: " %} {{ from_date }} {% trans "To: " %} {{ to_date }}</h2>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -206,7 +206,7 @@ class MonthlyMetricsSummaryView(LoginRequiredMixin, TemplateView):
|
||||
We need a bound form because we already send a request to the API
|
||||
without user intervention on initial request
|
||||
"""
|
||||
if (self.request.GET) and (web_page_type != SummaryType.CUSTOM):
|
||||
if (self.request.GET) or (web_page_type == SummaryType.CUSTOM):
|
||||
data = self.request.GET
|
||||
else:
|
||||
fields = self.form_class.declared_fields
|
||||
@ -253,10 +253,9 @@ class MonthlyMetricsSummaryView(LoginRequiredMixin, TemplateView):
|
||||
There are different use cases, so we accept different parameters.
|
||||
only_show_api_explorer_metrics has the default value False, because it is just used for app = API_Explorer.
|
||||
"""
|
||||
api_calls_total = 0
|
||||
average_response_time = 0
|
||||
average_calls_per_day = 0
|
||||
try:
|
||||
api_calls_total = 0
|
||||
average_response_time = 0
|
||||
urlpath = '/management/aggregate-metrics'
|
||||
if only_show_api_explorer_metrics:
|
||||
urlpath = urlpath + '?from_date={}&to_date={}&app_name={}'.format(from_date, to_date, API_EXPLORER_APP_NAME)
|
||||
@ -271,7 +270,7 @@ class MonthlyMetricsSummaryView(LoginRequiredMixin, TemplateView):
|
||||
api_cache = cache.get(cache_key)
|
||||
except Exception as err:
|
||||
api_cache = None
|
||||
if api_cache is not None:
|
||||
if not api_cache is None:
|
||||
metrics = api_cache
|
||||
else:
|
||||
api = API(self.request.session.get('obp'))
|
||||
@ -282,12 +281,11 @@ class MonthlyMetricsSummaryView(LoginRequiredMixin, TemplateView):
|
||||
|
||||
api_calls_total, average_calls_per_day, average_response_time = self.get_internal_api_call_metrics(
|
||||
api_calls_total, average_response_time, cache_key, from_date, metrics, to_date, urlpath)
|
||||
return api_calls_total, average_response_time, int(average_calls_per_day)
|
||||
except APIError as err:
|
||||
error_once_only(self.request, err)
|
||||
except Exception as err:
|
||||
error_once_only(self.request, err)
|
||||
finally:
|
||||
return api_calls_total, average_response_time, int(average_calls_per_day)
|
||||
|
||||
def get_internal_api_call_metrics(self, api_calls_total, average_response_time, cache_key, from_date, metrics,
|
||||
to_date, urlpath):
|
||||
@ -310,6 +308,7 @@ class MonthlyMetricsSummaryView(LoginRequiredMixin, TemplateView):
|
||||
only_show_api_explorer_metrics has the default value False, because it is just used for app = API_Explorer.
|
||||
"""
|
||||
apps = []
|
||||
form = self.get_form()
|
||||
active_apps_list = []
|
||||
if is_included_obp_apps:
|
||||
urlpath = '/management/metrics/top-consumers?from_date={}&to_date={}&exclude_app_names={}'.format(from_date, to_date, exclude_app_names)
|
||||
@ -876,7 +875,6 @@ class MonthlyMetricsSummaryView(LoginRequiredMixin, TemplateView):
|
||||
error_once_only(self.request, str(form.errors))
|
||||
except Exception as err:
|
||||
error_once_only(self.request, err)
|
||||
|
||||
def _daily_and_weekly(self, web_page_type, is_included_obp_apps, to_date, exclude_app_names, per_hour_chart, per_day_chart, from_date):
|
||||
if (web_page_type == SummaryType.DAILY):
|
||||
# for one day, the from_date is 1 day ago.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user