Skip to content

Commit

Permalink
More consistent colors; lowered commit hex len to 7 chars; added favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
lovec741 committed Oct 13, 2024
1 parent 1b66898 commit 914671f
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def info(repo: Repository):
commit_hash = log[1].split()[0][1:]
try:
commit_msg, commit_author, commit_url = repo.get_commit_info(commit_hash)
formatted_commit_info = f"<a href='{commit_url}' target='_blank'>#{commit_hash}</a>: {commit_msg} (by {commit_author})"
formatted_commit_info = f"<a href='{commit_url}' target='_blank' class='link-pink'>#{commit_hash}</a>: {commit_msg} (by {commit_author})"
except Exception as e:
formatted_commit_info = ''
else:
Expand Down
8 changes: 4 additions & 4 deletions src/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ def _runJob(self, reponame, user):
repo = self._updateRepo(reponame)
try:
if self._build(reponame):
msg = f"#{repo.head.commit.hexsha[:10]} Build succeeded."
msg = f"#{repo.head.commit.hexsha[:8]} Build succeeded."
time_end = time.time()
else:
msg = f"#{repo.head.commit.hexsha[0:10]} Build failed."
msg = f"#{repo.head.commit.hexsha[0:8]} Build failed."
time_end = time.time()
except:
msg = f"#{repo.head.commit.hexsha[0:10]} Build error."
msg = f"#{repo.head.commit.hexsha[0:8]} Build error."
raise
except GitCommandError as e:
msg = f"Pull error. ({e})"
Expand Down Expand Up @@ -250,7 +250,7 @@ def get_current_build_status(self):
return {
"status": status,
"timeinfo": f"- {self._format_time_ago(last_record[0])}",
"commit": f" - <a href='{commit_url}' target='_blank'>#{commit_hash}</a>: {commit_msg} (by {commit_author})"
"commit": f" - <a href='{commit_url}' target='_blank' class='link-pink'>#{commit_hash}</a>: {commit_msg} (by {commit_author})"
}
except Exception as e:
return {
Expand Down
Binary file added src/static/favicon.ico
Binary file not shown.
44 changes: 44 additions & 0 deletions src/static/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
table td {
padding: 1px 10px 1px 10px;
}

:root {
--bs-pink: #da1175;
}

.btn-pink {
color: #fff;
background-color: var(--bs-pink);
border-color: var(--bs-pink);
}

.btn-pink:hover {
color: #fff;
background-color: #b80e63;
border-color: #ad0d5d;
}

.btn-outline-pink {
color: var(--bs-pink) !important;
border-color: var(--bs-pink) !important;
}

.btn-outline-pink:hover {
color: #fff !important;
background-color: var(--bs-pink) !important;
border-color: var(--bs-pink) !important;
}

.link-pink {
color: var(--bs-pink) !important;
}

.link-pink:hover {
color: #b80e63 !important;
text-decoration: underline !important;
}

.text-pink {
color: var(--bs-pink) !important;
}

.bg-pink {
background-color: var(--bs-pink) !important;
}
6 changes: 3 additions & 3 deletions src/templates/base.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Astrid - {% block title %}{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" type="text/css" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<link rel="stylesheet" href="/static/style.css" type="text/css" />
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
</head>

<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: #da1175;">
<nav class="navbar navbar-expand-lg navbar-dark bg-pink">
<div class="container">
<a class="navbar-brand fw-bold" href="/">
<img src="{{ url_for('static', filename='astrid_logo_white.svg') }}" alt="Astrid Logo" style="height: 2.5em">
</a>
{% if user %}
<div class="ms-auto">
<span class="text-white me-3">
User: {{user['name']}}
User: <b>{{user['name']}}</b>
</span>
<a href="{{url_for('logout')}}" class="btn btn-outline-light btn-sm">Logout</a>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/templates/buildlog.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
{% block title %}{{repo_name}} buildlog{% endblock %}
{% block content %}
<h2 class="mb-4">Build Log for {{repo_name}}</h2>
<a href="{{ url_for('index') }}" class="btn btn-secondary mb-3 me-2">
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary mb-3 me-2">
<i class="bi bi-arrow-left"></i> Back
</a>
<a href="{{ url_for('info', repo_name=repo_name) }}" class="btn btn-info mb-3 me-2">
<i class="bi bi-clock-history"></i> Build History
</a>
{% if log %}
<a href="#bottom" class="btn btn-secondary mb-3">
<a href="#bottom" class="btn btn-outline-secondary mb-3">
<i class="bi bi-arrow-down"></i> Go to Bottom
</a>

<pre class="p-4 bg-dark text-light border border-secondary rounded"><code>{{ log | e }}</code></pre>
<a href="#" class="btn btn-secondary mb-5">
<a href="#" class="btn btn-outline-secondary mb-5">
<i class="bi bi-arrow-up"></i> Go to Top
</a>
{% else %}
Expand Down
24 changes: 13 additions & 11 deletions src/templates/index.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{% if repo.checkAccess() %}
<tr>
<td>
<a href='{{ url_for('repository', repo_name=repo.name) }}' class="text-decoration-none d-block w-100 h-100">
<a href='{{ url_for('repository', repo_name=repo.name) }}' class="link-pink text-decoration-none d-block w-100">
<span class="fw-bold">{{ repo.name }}</span>
{% if repo.isBuilding() %}
<span class="ms-2 text-muted">(Building...)</span>
Expand All @@ -54,16 +54,18 @@
<small class="text-muted">{{ status.timeinfo }}</small>
<small class="text-muted">{{ status.commit }}</small>
</td>
<td class="text-end">
<a href="{{ url_for('repository', repo_name=repo.name) }}" class="btn btn-outline-primary btn-sm mb-2 mb-md-0">
<i class="bi bi-folder2-open"></i> Open Repo
</a>
<a href="{{ url_for('info', repo_name=repo.name) }}" class="btn btn-outline-info btn-sm mb-2 mb-md-0">
<i class="bi bi-clock-history"></i> Build History
</a>
<a href="{{ url_for('buildlog', repo_name=repo.name) }}" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-file-text"></i> Build Log
</a>
<td>
<div class="d-flex gap-2 flex-md-row flex-column justify-content-end">
<a href="{{ url_for('repository', repo_name=repo.name) }}" class="btn btn-outline-primary btn-sm">
<i class="bi bi-folder2-open"></i> Open Repo
</a>
<a href="{{ url_for('info', repo_name=repo.name) }}" class="btn btn-outline-info btn-sm">
<i class="bi bi-clock-history"></i> Build History
</a>
<a href="{{ url_for('buildlog', repo_name=repo.name) }}" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-file-text"></i> Build Log
</a>
</div>
</td>
</tr>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions src/templates/info.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
{% block title %}{{repo_name}} info{% endblock %}
{% block content %}
<h2 class="mb-4">Build History for {{repo_name}}</h2>
<a href="{{ url_for('index') }}" class="btn btn-secondary mb-3 me-2">
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary mb-3 me-2">
<i class="bi bi-arrow-left"></i> Back
</a>
<a href="{{ url_for('buildlog', repo_name=repo_name) }}" class="btn btn-primary mb-3">
<a href="{{ url_for('buildlog', repo_name=repo_name) }}" class="btn btn-secondary mb-3">
<i class="bi bi-file-text"></i> Build Log
</a>
<table class="table table-striped table-hover">
Expand Down
6 changes: 3 additions & 3 deletions src/templates/listdir.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
</thead>
<tbody>
<tr>
<td><a href=".." class="text-decoration-none"><i class="bi bi-arrow-up"></i> Parent Directory</a></td>
<td><a href=".." class="link-pink text-decoration-none"><i class="bi bi-arrow-up"></i> Parent Directory</a></td>
<td></td>
<td></td>
</tr>
{% for dir in dirs %}
<tr>
<td><a href="{{dir[0]}}/" class="text-decoration-none"><i class="bi bi-folder"></i> {{dir[0]}}/</a></td>
<td><a href="{{dir[0]}}/" class="link-pink text-decoration-none"><i class="bi bi-folder"></i> {{dir[0]}}/</a></td>
<td>{{dir[1]}}</td>
<td>{{dir[2]}}</td>
</tr>
{% endfor %}
{% for file in files %}
<tr>
<td><a href="{{file[0]}}" class="text-decoration-none"><i class="bi bi-file-earmark"></i> {{file[0]}}</a></td>
<td><a href="{{file[0]}}" class="link-pink text-decoration-none"><i class="bi bi-file-earmark"></i> {{file[0]}}</a></td>
<td>{{file[1]}}</td>
<td>{{file[2]}}</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/path_breadcrumb.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% if loop.last %}
<li class="breadcrumb-item active" aria-current="page">{{ crumb.name }}</li>
{% else %}
<li class="breadcrumb-item"><a href="{{ crumb.url }}">{{ crumb.name }}</a></li>
<li class="breadcrumb-item"><a href="{{ crumb.url }}" class="link-pink">{{ crumb.name }}</a></li>
{% endif %}
{% endfor %}
</ol>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/signin.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="d-flex flex-column align-items-center justify-content-center" style="height: 70vh;">
<h2 class="mb-4">Welcome to Astrid</h2>
<p class="text-center mb-4">You are currently signed out. Please sign in to continue.</p>
<a href="{{url_for('login')}}" class="btn btn-primary btn-lg">
<a href="{{url_for('login')}}" class="btn btn-outline-pink btn-lg">
<i class="bi bi-box-arrow-in-right me-2"></i>Sign In
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/viewfile.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% include "path_breadcrumb.html.jinja" %}

<div class="mb-3">
<a href="{{ url_for('download_file', repo_name=repo_name, path=path) }}" class="btn btn-primary">
<a href="{{ url_for('download_file', repo_name=repo_name, path=path) }}" class="btn btn-secondary">
<i class="bi bi-download"></i> Download File
</a>
</div>
Expand Down

0 comments on commit 914671f

Please sign in to comment.