Use same commit link style everywhere
This commit is contained in:
parent
2b81d497bc
commit
794787a4be
10 changed files with 96 additions and 75 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "SELECT name, hash, tracked, message FROM refs JOIN commits USING (hash) ORDER BY name ASC ",
|
||||
"query": "SELECT name, hash, message, reachable, tracked FROM refs JOIN commits USING (hash) ORDER BY name ASC ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
|
|
@ -14,14 +14,19 @@
|
|||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "tracked",
|
||||
"name": "message",
|
||||
"ordinal": 2,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "reachable",
|
||||
"ordinal": 3,
|
||||
"type_info": "Int64"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"ordinal": 3,
|
||||
"type_info": "Text"
|
||||
"name": "tracked",
|
||||
"ordinal": 4,
|
||||
"type_info": "Int64"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
|
|
@ -31,8 +36,9 @@
|
|||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "39e21f75c4f68be1e4f64c4a9c0a38974f12556b6ac463f21f7729f758dec886"
|
||||
"hash": "c7a4115d81a3371d77afadfdad7dbe47c4d1d23211a35c0c68174f9ce82893c2"
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "SELECT id, hash, message, date AS \"date: time::OffsetDateTime\", priority FROM queue JOIN commits USING (hash) ORDER BY priority DESC, unixepoch(date) DESC, hash ASC ",
|
||||
"query": "SELECT id, hash, message, reachable, date AS \"date: time::OffsetDateTime\", priority FROM queue JOIN commits USING (hash) ORDER BY priority DESC, unixepoch(date) DESC, hash ASC ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
|
|
@ -19,13 +19,18 @@
|
|||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "date: time::OffsetDateTime",
|
||||
"name": "reachable",
|
||||
"ordinal": 3,
|
||||
"type_info": "Int64"
|
||||
},
|
||||
{
|
||||
"name": "date: time::OffsetDateTime",
|
||||
"ordinal": 4,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "priority",
|
||||
"ordinal": 4,
|
||||
"ordinal": 5,
|
||||
"type_info": "Int64"
|
||||
}
|
||||
],
|
||||
|
|
@ -37,8 +42,9 @@
|
|||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "02a0484f131cdd7420fb073dec5c9ed2758e21a6bf74026ba3e19cba1d274536"
|
||||
"hash": "ca4e47d1a7fa0bbe474992eafeca39fa12d022fc171b8e4195cf1899ccb0557b"
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ struct Ref {
|
|||
name: String,
|
||||
hash: String,
|
||||
short: String,
|
||||
reachable: i64,
|
||||
tracked: bool,
|
||||
}
|
||||
|
||||
|
|
@ -28,16 +29,18 @@ pub async fn get(
|
|||
) -> somehow::Result<impl IntoResponse> {
|
||||
let refs = sqlx::query!(
|
||||
"\
|
||||
SELECT name, hash, tracked, message FROM refs \
|
||||
SELECT name, hash, message, reachable, tracked \
|
||||
FROM refs \
|
||||
JOIN commits USING (hash) \
|
||||
ORDER BY name ASC \
|
||||
"
|
||||
)
|
||||
.fetch(&db)
|
||||
.map_ok(|r| Ref {
|
||||
name: r.name,
|
||||
short: util::format_commit_short(&r.hash, &r.message),
|
||||
name: r.name,
|
||||
hash: r.hash,
|
||||
reachable: r.reachable,
|
||||
tracked: r.tracked != 0,
|
||||
})
|
||||
.try_collect::<Vec<_>>()
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use super::{Base, Tab};
|
|||
struct Task {
|
||||
id: String,
|
||||
short: String,
|
||||
reachable: i64,
|
||||
since: String,
|
||||
priority: i64,
|
||||
odd: bool,
|
||||
|
|
@ -22,6 +23,7 @@ async fn get_queue(db: &SqlitePool) -> somehow::Result<Vec<Task>> {
|
|||
id, \
|
||||
hash, \
|
||||
message, \
|
||||
reachable, \
|
||||
date AS \"date: time::OffsetDateTime\", \
|
||||
priority \
|
||||
FROM queue \
|
||||
|
|
@ -33,6 +35,7 @@ async fn get_queue(db: &SqlitePool) -> somehow::Result<Vec<Task>> {
|
|||
.map_ok(|r| Task {
|
||||
id: r.id,
|
||||
short: util::format_commit_short(&r.hash, &r.message),
|
||||
reachable: r.reachable,
|
||||
since: util::format_delta_from_now(r.date),
|
||||
priority: r.priority,
|
||||
odd: false,
|
||||
|
|
|
|||
|
|
@ -51,6 +51,13 @@ td+td {
|
|||
padding-left: 2ch;
|
||||
}
|
||||
|
||||
.reachable {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.orphaned {
|
||||
color: #a33;
|
||||
}
|
||||
|
||||
/* Nav bar */
|
||||
|
||||
|
|
@ -115,16 +122,6 @@ nav img {
|
|||
column-gap: 1ch;
|
||||
}
|
||||
|
||||
.commit .reachable,
|
||||
.commit .reachable a {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.commit .orphaned,
|
||||
.commit .orphaned a {
|
||||
color: #a33;
|
||||
}
|
||||
|
||||
.commit pre {
|
||||
margin: 1em 0ch 1em 4ch;
|
||||
white-space: pre-wrap;
|
||||
|
|
|
|||
|
|
@ -1,27 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
{% import "util.html" as util %}
|
||||
|
||||
{% block title %}{{ summary }}{% endblock %}
|
||||
|
||||
{% macro r_class(reachable) %}
|
||||
{%- if reachable == 0 -%}
|
||||
orphaned
|
||||
{%- else if reachable == 1 -%}
|
||||
reachable
|
||||
{%- else -%}
|
||||
tracked
|
||||
{%- endif -%}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro r_title(reachable) %}
|
||||
{%- if reachable == 0 -%}
|
||||
This commit is orphaned. It can't be reached from any ref.
|
||||
{%- else if reachable == 1 -%}
|
||||
This commit can only be reached from untracked refs.
|
||||
{%- else -%}
|
||||
This commit can be reached from a tracked ref.
|
||||
{%- endif -%}
|
||||
{% endmacro %}
|
||||
|
||||
{% block body %}
|
||||
<h2>Commit</h2>
|
||||
<div class="commit">
|
||||
|
|
@ -40,19 +21,23 @@ This commit can be reached from a tracked ref.
|
|||
<dd>{{ commit_date }}</dd>
|
||||
|
||||
{% for commit in parents %}
|
||||
<dt class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">Parent:</dt>
|
||||
<dd class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">
|
||||
<a href="{{ commit.hash }}">{{ commit.short }}</a>
|
||||
<dt>Parent:</dt>
|
||||
<dd>
|
||||
<a href="{{ commit.hash }}">
|
||||
{% call util::commit_short(commit.short, commit.reachable)%}
|
||||
</a>
|
||||
</dd>
|
||||
{% endfor %}
|
||||
|
||||
{% for commit in children %}
|
||||
<dt class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">Child:</dt>
|
||||
<dd class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">
|
||||
<a href="{{ commit.hash }}">{{ commit.short }}</a>
|
||||
<dt>Child:</dt>
|
||||
<dd>
|
||||
<a href="{{ commit.hash }}">
|
||||
{% call util::commit_short(commit.short, commit.reachable)%}
|
||||
</a>
|
||||
</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
<pre class="{% call r_class(reachable) %}" title="{% call r_title(reachable) %}">{{ message }}</pre>
|
||||
<pre class="{% call util::r_class(reachable) %}" title="{% call util::r_title(reachable) %}">{{ message }}</pre>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% import "util.html" as util %}
|
||||
|
||||
{% block title %}overview{% endblock %}
|
||||
|
||||
|
|
@ -9,7 +10,11 @@
|
|||
<dl>
|
||||
{% for ref in tracked_refs %}
|
||||
<dt>{{ ref.name }}</dt>
|
||||
<dd><a href="{{ base.root }}/commit/{{ ref.hash }}">{{ ref.short }}</a></dd>
|
||||
<dd>
|
||||
<a href="{{ base.root }}/commit/{{ ref.hash }}">
|
||||
{% call util::commit_short(ref.short, ref.reachable) %}
|
||||
</a>
|
||||
</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
</details>
|
||||
|
|
@ -18,7 +23,11 @@
|
|||
<dl>
|
||||
{% for ref in untracked_refs %}
|
||||
<dt>{{ ref.name }}</dt>
|
||||
<dd><a href="{{ base.root }}/commit/{{ ref.hash }}">{{ ref.short }}</a></dd>
|
||||
<dd>
|
||||
<a href="{{ base.root }}/commit/{{ ref.hash }}">
|
||||
{% call util::commit_short(ref.short, ref.reachable) %}
|
||||
</a>
|
||||
</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
</details>
|
||||
|
|
|
|||
|
|
@ -1,27 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
{% import "util.html" as util %}
|
||||
|
||||
{% block title %}{{ summary }}{% endblock %}
|
||||
|
||||
{% macro r_class(reachable) %}
|
||||
{%- if reachable == 0 -%}
|
||||
orphaned
|
||||
{%- else if reachable == 1 -%}
|
||||
reachable
|
||||
{%- else -%}
|
||||
tracked
|
||||
{%- endif -%}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro r_title(reachable) %}
|
||||
{%- if reachable == 0 -%}
|
||||
This commit is orphaned. It can't be reached from any ref.
|
||||
{%- else if reachable == 1 -%}
|
||||
This commit can only be reached from untracked refs.
|
||||
{%- else -%}
|
||||
This commit can be reached from a tracked ref.
|
||||
{%- endif -%}
|
||||
{% endmacro %}
|
||||
|
||||
{% block body %}
|
||||
<h2>Task</h2>
|
||||
<div class="task">
|
||||
|
|
@ -33,9 +14,11 @@ This commit can be reached from a tracked ref.
|
|||
<dt>Priority:</dt>
|
||||
<dd>{{ priority }}</dd>
|
||||
|
||||
<dt class="{% call r_class(reachable) %}" title="{% call r_title(reachable) %}">Commit:</dt>
|
||||
<dd class="{% call r_class(reachable) %}" title="{% call r_title(reachable) %}">
|
||||
<a href="{{ base.root }}/commit/{{ hash }}">{{ short }}</a>
|
||||
<dt>Commit:</dt>
|
||||
<dd>
|
||||
<a href="{{ base.root }}/commit/{{ hash }}">
|
||||
{% call util::commit_short(short, reachable) %}
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
{% import "util.html" as util %}
|
||||
|
||||
<table class="queue">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -9,7 +11,11 @@
|
|||
<tbody>
|
||||
{% for task in tasks %}
|
||||
<tr {% if task.odd %} class="odd" {% endif %}>
|
||||
<td><a href="{{ task.id }}">{{ task.short }}</a></td>
|
||||
<td>
|
||||
<a href="{{ task.id }}">
|
||||
{% call util::commit_short(task.short, task.reachable) %}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ task.since }}</td>
|
||||
<td>{{ task.priority }}</td>
|
||||
</tr>
|
||||
|
|
|
|||
23
templates/util.html
Normal file
23
templates/util.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{% macro r_class(reachable) %}
|
||||
{%- if reachable == 0 -%}
|
||||
orphaned
|
||||
{%- else if reachable == 1 -%}
|
||||
reachable
|
||||
{%- else -%}
|
||||
tracked
|
||||
{%- endif -%}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro r_title(reachable) %}
|
||||
{%- if reachable == 0 -%}
|
||||
This commit is orphaned. It can't be reached from any ref.
|
||||
{%- else if reachable == 1 -%}
|
||||
This commit can only be reached from untracked refs.
|
||||
{%- else -%}
|
||||
This commit can be reached from a tracked ref.
|
||||
{%- endif -%}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro commit_short(short, reachable) -%}
|
||||
<span class="{% call r_class(reachable) %}" title="{% call r_title(reachable) %}">{{ short }}</span>
|
||||
{%- endmacro %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue