From c73f413c6696f5ad6f5429eeebe465a6bc9fdd25 Mon Sep 17 00:00:00 2001 From: Malfurious Date: Tue, 21 Nov 2023 05:44:42 -0500 Subject: [PATCH] patch: colorfulhashes Color unique git hashes when they appear in DMT to aid recognition. This makes it easier to spot hash values that match, even if they appear under different service entries. Committer identities are also colored for the same reason. Colors are derived directly from the hash value. The first 6 characters of the hash are interpreted as the RGB color value. --- dmt/html/services.html | 14 ++++++++++---- dmt/script.js | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dmt/html/services.html b/dmt/html/services.html index ae4dee6..0bc7b0a 100644 --- a/dmt/html/services.html +++ b/dmt/html/services.html @@ -25,22 +25,28 @@ - + %{ col_previous_hash=$(echo "$previous_hash" | head -c6) %} + - + %{ col_current_hash=$(echo "$current_hash" | head -c6) %} + - + %{ comm_id=$(show '%cn <%ce>') %} + %{ col_comm_id=$(echo "$comm_id" | sha1sum | head -c6) %} + - + %{ tree_hash=$(show '%T') %} + %{ col_tree_hash=$(echo "$tree_hash" | head -c6) %} +
Deployed:%($previous_hash%)%($previous_hash%) %{describe $previous_hash%}
Commit:%($current_hash%)%($current_hash%) %{describe $current_hash%}
Committer:%{show '%cn <%ce>'%}%($comm_id%) %{show '%cD'%}
Tree:%{show '%T'%}%($tree_hash%)
diff --git a/dmt/script.js b/dmt/script.js index bc9554c..6996978 100644 --- a/dmt/script.js +++ b/dmt/script.js @@ -47,6 +47,7 @@ function touch_job(list, job) { // New job, new
if (document.getElementById(`${job.job}`) === null) { let abv_hash = job.hash.substring(0, 16); + let col_hash = job.hash.substring(0, 6); let reason = (job.reason == "event" ? ICON_EVENT : ICON_MAINT); let element = document.createElement("div"); @@ -60,7 +61,7 @@ function touch_job(list, job) { #${job.job} ${job.service} - ${abv_hash} + ${abv_hash}