Skip to content

Commit

Permalink
format dag run count
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelleinio authored May 17, 2024
1 parent 8b19b78 commit 2e0ff56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion airflow/www/static/js/dags.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ d3.selectAll(".js-last-run-tooltip").on(
}
);

function formatCount(count) {
if (count >= 1000000) return Math.floor(count / 1000000) + 'M';
if (count >= 1000) return Math.floor(count / 1000) + 'k';
return count;
}

function drawDagStats(selector, dagId, states) {
const g = d3
.select(`svg#${selector}-${dagId.replace(/\./g, "__dot__")}`)
Expand Down Expand Up @@ -281,7 +287,7 @@ function drawDagStats(selector, dagId, states) {
.attr("font-size", 9)
.attr("y", 3)
.style("pointer-events", "none")
.text((d) => (d.count > 0 ? d.count : ""));
.text((d) => (d.count > 0 ? formatCount(d.count) : ""));
}

function dagStatsHandler(selector, json) {
Expand Down

0 comments on commit 2e0ff56

Please sign in to comment.