diff options
| author | toufic ar <contact@toufy.me> | 2026-05-15 18:18:58 +0300 |
|---|---|---|
| committer | toufic ar <contact@toufy.me> | 2026-05-15 18:18:58 +0300 |
| commit | e05def62569358ff93691b03177abbaa9442bc53 (patch) | |
| tree | 04a057446f7b688ca1a52b0df0c1bcb399e1cf7d | |
| parent | 4a17d522ced7e9b775570afd6ccbbbe225f957c3 (diff) | |
| download | makeshiftci-e05def62569358ff93691b03177abbaa9442bc53.tar.gz makeshiftci-e05def62569358ff93691b03177abbaa9442bc53.zip | |
repo branch support, a little webUI polishing
| -rwxr-xr-x | msci | 21 | ||||
| -rw-r--r-- | web/templates/base.html | 14 | ||||
| -rw-r--r-- | web/templates/home.html | 17 | ||||
| -rw-r--r-- | web/templates/project.html | 27 | ||||
| -rw-r--r-- | web/templates/run.html | 9 |
5 files changed, 66 insertions, 22 deletions
@@ -60,11 +60,17 @@ run_project() { ( set -euo pipefail ppath="$MSCI_HOME"/projects/"$1".json + git_params=() repo_name="$1" + repo_branch=$(jq -r '.branch // empty' "$ppath") + if [ -n "$repo_branch" ]; then + git_params+=(-b "$repo_branch") + fi repo_url=$(jq -r '.url' "$ppath") repo_path="$MSCI_HOME"/tmp/"$repo_name" + git_params+=("$repo_url" "$repo_path") echo "cloning repo: $repo_url" | tee -a "$2" - ! git clone "$repo_url" "$repo_path" &>/dev/null && + ! git clone "${git_params[@]}" &>/dev/null && echo "failed to clone repo" | tee -a "$2" && exit 1 ! pushd "$repo_path" &>/dev/null && echo "unable to cd into cloned repo" | tee -a "$2" && exit 1 @@ -115,16 +121,19 @@ create_project() { [[ -n ${purl//[[:space:]]/} ]] && break echo "URL can't be empty" done + read -rp ".makeshiftci repo branch (optional): " pbranch phidden=$(confirm_in "hidden?" && echo true || echo false) read -rp "cron (optional): " pcron jq -n \ --arg pname "$pname" \ --arg purl "$purl" \ + --arg pbranch "$pbranch" \ --argjson phidden "$phidden" \ --arg pcron "$pcron" \ '{ name: $pname, url: $purl, + branch: (if $pbranch == "" then null else $pbranch end), hidden: $phidden, cron: (if $pcron == "" then null else $pcron end) }' \ @@ -145,15 +154,19 @@ edit_project() { echo "editing $ppath" oldname=$(jq -r '.name' "$ppath") oldurl=$(jq -r '.url' "$ppath") + oldbranch=$(jq -r '.branch // empty' "$ppath") washidden=$(jq '.hidden' "$ppath") keephidden=$([ "$washidden" = 'true' ] && echo "keep" || echo "make") - oldcron=$(jq -r '.cron' "$ppath") + oldcron=$(jq -r '.cron // empty' "$ppath") echo "project name: $oldname" read -rp "new name (optional): " pname [ -z "${pname//[[:space:]]/}" ] && pname=$oldname echo ".makeshiftci repo URL: $oldurl" read -rp "new URL (optional): " purl [ -z "${purl//[[:space:]]/}" ] && purl=$oldurl + echo ".makeshiftci repo branch: $oldbranch" + read -rp "new branch (optional): " pbranch + [ -z "${pbranch//[[:space:]]/}" ] && pbranch=$oldbranch echo "hidden: $washidden" phidden=$(confirm_in "$keephidden hidden?" && echo true || echo false) echo "cron: $oldcron" @@ -162,13 +175,15 @@ edit_project() { jq -n \ --arg pname "$pname" \ --arg purl "$purl" \ + --arg pbranch "$pbranch" \ --argjson phidden "$phidden" \ --arg pcron "$pcron" \ '{ name: $pname, url: $purl, + branch: (if $pbranch == "" then null else $pbranch end), hidden: $phidden, - cron: (if $pcron == "null" then null else $pcron end) + cron: (if $pcron == "" then null else $pcron end) }' \ >"$ppath" [ ! "$pcron" = "$oldcron" ] && write_cron diff --git a/web/templates/base.html b/web/templates/base.html index 81d6a59..03015ff 100644 --- a/web/templates/base.html +++ b/web/templates/base.html @@ -17,10 +17,6 @@ margin: 0; padding: 0; } - html, - body { - height: 100%; - } :root { --primary: #de3163; --secondary: #722f37; @@ -62,13 +58,11 @@ {% block extrastyle %}{% endblock %} </head> <body> - <div class="content-box"> - <div class="heading"> - <h1><a href="/">makeshiftci</a>{% block path %}{% endblock %}</h1> - {% block headingcontent %}{% endblock %} - </div> - {% block content %}{% endblock %} + <div class="heading"> + <h1><a href="/">makeshiftci</a>{% block path %}{% endblock %}</h1> + {% block headingcontent %}{% endblock %} </div> + <div class="content-box"> {% block content %}{% endblock %} </div> </body> </html> <!-- vim: set filetype=jinja: --> diff --git a/web/templates/home.html b/web/templates/home.html index 20ef75a..733f9ef 100644 --- a/web/templates/home.html +++ b/web/templates/home.html @@ -26,9 +26,16 @@ text-decoration: underline; font-style: italic; } + .branchlink a { + color: var(--orange); + text-decoration: none; + font-weight: bolder; + font-style: italic; + } .cronlink a { color: var(--orange); text-decoration: none; + text-decoration: underline; font-weight: bolder; } } @@ -50,6 +57,16 @@ >{{ project[1]['url'] }}</a ></h4 > + <h4 class="branchlink" + >branch: + <a + href="{{ project[1]['url'] }}" + target="_blank" + > + {% if not project[1]['branch'] %} not set {% else %} {{ + project[1]['branch'] }} {% endif %} + </a></h4 + > <h4 class="cronlink" >cron: <a diff --git a/web/templates/project.html b/web/templates/project.html index 9b0aa58..7e72a48 100644 --- a/web/templates/project.html +++ b/web/templates/project.html @@ -82,15 +82,28 @@ block path %}/<a href="/{{ project_path }}">{{ project_path }}</a>{% endblock %} ><a href="{{ project.url }}" target="_blank" - class="heading-url" - >{{ project.url }}</a - ><a + style="text-decoration: none" + ><span class="heading-url">{{ project.url }}</span + ><span style="text-decoration: none; font-weight: normal">::</span>{% if + project.branch %}<span + style=" + color: var(--orange); + text-decoration: none; + font-weight: bolder; + font-style: italic; + " + >{{ project.branch }}</span + >{% endif %}</a + > + {% if project.cron %} + <a href="https://crontab.guru/#{{ project.cron }}" target="_blank" class="heading-cron" >{{ project.cron }}</a - ></h4 -> + > + {% endif %} +</h4> {% endblock %} {% block content %} <div class="fullbody"> @@ -104,7 +117,9 @@ block path %}/<a href="/{{ project_path }}">{{ project_path }}</a>{% endblock %} >#{{ run.number }}</a ></span ></span - ><span class="rundate">{{ run.date }}</span></h3 + ><span class="rundate"> + {% if not run.date %} no date {% else %} {{ run.date }} {% endif %} + </span></h3 > <hr style="margin: 5px" /> <h4 diff --git a/web/templates/run.html b/web/templates/run.html index 77f9f90..92d7843 100644 --- a/web/templates/run.html +++ b/web/templates/run.html @@ -10,9 +10,12 @@ {% for n in run %} <script> - document.getElementById('stdout').textContent = {{ n|tojson }}; - var s = document.currentScript; - s.parentNode.removeChild(s); + if (document.getElementById('stdout').textContent !== {{ n|tojson }}) { + document.getElementById('stdout').textContent = {{ n|tojson }}; + window.scrollTo({ left: 0, top: document.body.scrollHeight, behavior: "smooth" }); + } + var s = document.currentScript; + s.parentNode.removeChild(s); </script> {% endfor %} {% endblock %} |
