Merge pull request #350 from hongwei1/develop

bugfix/tweaked the BarchartData. put to html instead of JS
This commit is contained in:
Simon Redfern 2023-12-07 16:09:49 +01:00 committed by GitHub
commit 19a496cae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 6 deletions

View File

@ -48,7 +48,7 @@
<li {% ifequal request.path my_user_invitation %} class="active" {% endifequal %}><a href="{{ my_user_invitation }}">{% trans "Invite User" %}</a></li>
</ul>
</li>
{% url "api-metrics" as api_metrics_url %} {% url "connector-metrics" as connector_metrics_url %} {% url "metrics-summary" as metrics_summary_url %}
{% url "api-metrics" as api_metrics_url %} {% url "connector-metrics" as connector_metrics_url %} {% url "weekly-summary" as metrics_summary_url %}
<li class="dropdown{% if api_metrics_url in request.path or connector_metrics_url in request.path or metrics_summary_url in request.path %} active{% endif %}">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">{% trans "Metrics" %}</a>
<ul class="dropdown-menu">

View File

@ -1,4 +1,5 @@
$(document).ready(function($) {
const BarchartData = $.parseJSON($('#barchart_data_div').attr("value"));
let barChart = new Chart($("#barchart"), {
type: 'horizontalBar',
data: {

View File

@ -13,12 +13,10 @@
<div class="tab-pane active">
<canvas id="barchart" width="100%" height="50%"></canvas>
</div>
<span id="barchart_data_div" style="display:none;visibility: hidden;opacity: 0" value= '{{ barchart_data|safe }}'></span>
{% endblock tab_content %}
{% block extrajs %}
<script type="text/javascript" src="{% static 'metrics/js/Chart.min.js' %}"></script>
<script type="text/javascript" src="{% static 'metrics/js/metrics.js' %}"></script>
<script type="text/javascript">
const BarchartData = {{ barchart_data|safe }};
</script>
{% endblock extrajs %}

View File

@ -819,7 +819,8 @@ class MonthlyMetricsSummaryView(LoginRequiredMixin, TemplateView):
per_day_chart = self.plot_line_chart(calls_per_day, date_list, "month")
api_host_name = API_HOST
top_apps_using_warehouse = self.get_top_apps_using_warehouse(from_date, to_date)
# top_apps_using_warehouse = self.get_top_apps_using_warehouse(from_date, to_date)
# top_warehouse_calls = self.get_top_warehouse_calls(form.cleaned_data, from_date, to_date)
# user_email_cansearchwarehouse, number_of_users_with_cansearchwarehouse = self.get_users_cansearchwarehouse()
# median_time_to_first_api_call = self.median_time_to_first_api_call(from_date, to_date)
@ -827,7 +828,6 @@ class MonthlyMetricsSummaryView(LoginRequiredMixin, TemplateView):
top_apis_bar_chart = self.plot_bar_chart(top_apis)
top_consumers = self.get_top_consumers(form.cleaned_data, from_date, to_date)
top_consumers_bar_chart = self.plot_topconsumer_bar_chart(top_consumers)
# top_warehouse_calls = self.get_top_warehouse_calls(form.cleaned_data, from_date, to_date)
api_calls, average_response_time, average_calls_per_day = self.get_aggregate_metrics(from_date, to_date, include_app_names)
unique_app_names, number_of_apps_with_unique_app_name, number_of_apps_with_unique_developer_email = self.get_total_number_of_apps(
form.cleaned_data, from_date, to_date)