minor error stuff

This commit is contained in:
Hamcha 2023-11-19 21:21:04 +01:00
parent a3f0ddb99f
commit 6e30007b4a
3 changed files with 38 additions and 14 deletions

View file

@ -51,11 +51,6 @@ impl IntoResponse for AppError {
code: "file-error".to_string(),
message: err.to_string(),
},
AppError::DockerError(err) => ErrorInfo {
status: StatusCode::INTERNAL_SERVER_ERROR,
code: "docker-error".to_string(),
message: err.to_string(),
},
AppError::Template(err) => ErrorInfo {
status: StatusCode::INTERNAL_SERVER_ERROR,
code: "template-error".to_string(),
@ -70,7 +65,21 @@ impl IntoResponse for AppError {
code: code.to_string(),
message: message.to_string(),
},
AppError::DockerError(err) => match err {
bollard::errors::Error::DockerResponseServerError {
status_code,
message,
} => ErrorInfo {
status: StatusCode::from_u16(status_code).unwrap(),
code: "docker-error".to_string(),
message,
},
_ => ErrorInfo {
status: StatusCode::INTERNAL_SERVER_ERROR,
code: "docker-error".to_string(),
message: err.to_string(),
},
},
AppError::JSONFormat(rejection) => {
let status = match rejection {
JsonRejection::JsonDataError(_) => StatusCode::UNPROCESSABLE_ENTITY,

View file

@ -11,7 +11,7 @@
<dt>ID</dt>
<dd>{{ info.id }}</dd>
<dt>Status</dt>
<dd>{{ info.state }}</dd>
<dd data-state="{{ info.state }}">{{ info.state }}</dd>
<dt>Image</dt>
<dd>{{ info.image }}</dd>
<dt>Image ID</dt>
@ -129,6 +129,22 @@
word-break: break-all;
}
dd[data-state] {
background-color: #202248;
}
dd[data-state="running"] {
background-color: #113B29;
color: #3DD68C;
}
dd[data-state="stopped"],
dd[data-state="exited"],
dd[data-state="dead"] {
background-color: #500F1C;
color: #FF9592;
}
dd:after {
content: "";

View file

@ -7,8 +7,8 @@
<h2>All stacks</h2>
<ul>
{% for stack in stacks %}
<li><a href="/stack/{{stack.name}}">{{stack.name}}</a> {% if !stack.active %}<div class="stopped">
INACTIVE</div>{% endif %}</li>
<li class="{% if stack.active %}active{% endif %}"><a href="/stack/{{stack.name}}">{{stack.name}}</a>
</li>
{% endfor %}
</ul>
</main>
@ -24,12 +24,11 @@
align-items: center;
margin-bottom: 0.5rem;
gap: 0.5rem;
border-left: 5px solid #E5484D;
padding-left: 0.5ch;
.stopped {
background-color: #E5484D;
padding: 2px 4px;
border-radius: 4px;
font-size: 11pt;
&.active {
border-left-color: #33B074;
}
}
</style>