Skip to content

Commit 64b2d6a

Browse files
author
ple76
committed
Update metrics dashboard link
- Rendering to a separate macro - update query string for prod and dev - time span set to 30 days
1 parent 4c4fcc3 commit 64b2d6a

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

templates/projects/_helpers.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,3 +691,13 @@ <h3>{{user.fullname}}</h3>
691691
})();
692692
</script>
693693
{% endmacro -%}
694+
695+
{%- macro render_stats_dashboard_link(project, private_instance) %}
696+
{% if config.get('STATS_DASHBOARD_URL') %}
697+
{% set cluster = config.get('STATS_DASHBOARD_CLUSTER', '') %}
698+
{% set dashboard_url = config.get('STATS_DASHBOARD_URL') + "?var-project_id=" + project.id|string + "&var-task_source=GIGWORK_" + ("PRIV" if private_instance else "PUBLIC") + "&from=now-30d&to=now&var-cluster=" + cluster %}
699+
<div class="row" style="margin-top: 2em;" id="grafana-link">
700+
<a class="btn btn-primary" target="_blank" href="{{dashboard_url}}">Metrics Dashboard</a>
701+
</div>
702+
{% endif %}
703+
{% endmacro -%}

templates/projects/non_stats.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@
1414
<span class="alert alert-warning"><strong>Ooops</strong> Sorry, the project does not have tasks to process and
1515
show some statistics</span>
1616
</div>
17-
{% if config.get('STATS_DASHBOARD_URL') %}
18-
{% set dashboard_url = config.get('STATS_DASHBOARD_URL') + "?var-project_id=" + project.id|string + "&var-task_source=GIGWORK_" + ("PRIV" if private_instance else "PUBLIC") %}
19-
<div class="row" style="margin-top: 2em;" id="grafana-link">
20-
<a class="btn btn-primary" target="_blank" href="{{dashboard_url}}">Metrics Dashboard</a>
21-
</div>
22-
{% endif %}
17+
{{ helper.render_stats_dashboard_link(project, private_instance) }}
2318
</div>
2419
</div>
2520
{{ helper.broken_image() }}

templates/projects/stats.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@
2121
</div>
2222
</div>
2323
{% endif %}
24-
{% if config.get('STATS_DASHBOARD_URL') %}
25-
{% set dashboard_url = config.get('STATS_DASHBOARD_URL') + "?var-project_id=" + project.id|string + "&var-task_source=GIGWORK_" + ("PRIV" if private_instance else "PUBLIC") %}
26-
<div class="row" style="margin-top: 2em;" id="grafana-link">
27-
<a class="btn btn-primary" target="_blank" href="{{dashboard_url}}">Metrics Dashboard</a>
28-
</div>
29-
{% endif %}
24+
{{ helper.render_stats_dashboard_link(project, private_instance) }}
3025
<!-- Hour Stats CARD -->
3126
<div id="card" class="row">
3227
<div class="col-md-12">

0 commit comments

Comments
 (0)