summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-11-21 06:56:43 -0500
committerMalfurious <m@lfurio.us>2023-11-21 06:56:43 -0500
commit43d5a920e71cc5270e22e8a33533448a6e3ac5e1 (patch)
treeff54435c90aba0f01961532ca5152d10ac03a836
downloadcychedelic-43d5a920e71cc5270e22e8a33533448a6e3ac5e1.tar.gz
cychedelic-43d5a920e71cc5270e22e8a33533448a6e3ac5e1.zip
colorfulhashes v0.2.0
Signed-off-by: Malfurious <m@lfurio.us>
-rw-r--r--cychedelic-colorfulhashes-v0.2.0.patch78
1 files changed, 78 insertions, 0 deletions
diff --git a/cychedelic-colorfulhashes-v0.2.0.patch b/cychedelic-colorfulhashes-v0.2.0.patch
new file mode 100644
index 0000000..3cf5038
--- /dev/null
+++ b/cychedelic-colorfulhashes-v0.2.0.patch
@@ -0,0 +1,78 @@
+From c73f413c6696f5ad6f5429eeebe465a6bc9fdd25 Mon Sep 17 00:00:00 2001
+From: Malfurious <m@lfurio.us>
+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 @@
+ <table>
+ <tr>
+ <td>Deployed:</td>
+- <td>%($previous_hash%)</td>
++ %{ col_previous_hash=$(echo "$previous_hash" | head -c6) %}
++ <td style="color: #%($col_previous_hash%);">%($previous_hash%)</td>
+ <td>%{describe $previous_hash%}</td>
+ </tr>
+ <tr>
+ <td>Commit:</td>
+- <td>%($current_hash%)</td>
++ %{ col_current_hash=$(echo "$current_hash" | head -c6) %}
++ <td style="color: #%($col_current_hash%);">%($current_hash%)</td>
+ <td>%{describe $current_hash%}</td>
+ </tr>
+ <tr>
+ <td>Committer:</td>
+- <td>%{show '%cn <%ce>'%}</td>
++ %{ comm_id=$(show '%cn <%ce>') %}
++ %{ col_comm_id=$(echo "$comm_id" | sha1sum | head -c6) %}
++ <td style="color: #%($col_comm_id%);">%($comm_id%)</td>
+ <td>%{show '%cD'%}</td>
+ </tr>
+ <tr>
+ <td>Tree:</td>
+- <td>%{show '%T'%}</td>
++ %{ tree_hash=$(show '%T') %}
++ %{ col_tree_hash=$(echo "$tree_hash" | head -c6) %}
++ <td style="color: #%($col_tree_hash%);">%($tree_hash%)</td>
+ </tr>
+ </table>
+ </div>
+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 <div>
+ 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) {
+ </a>
+ #${job.job}
+ ${job.service}
+- <small><i>${abv_hash}</i></small>
++ <small style="color: #${col_hash};"><i>${abv_hash}</i></small>
+
+ <span class="right">
+ <span class="time" id="${job.job}_time"
+--
+2.42.0
+