Skip to content

Commit a488518

Browse files
ThalesCThaleslouislam
authored
Add health status check (#58)
* set Health value to Status if existent Check if Health has any value and save it to be displayed. If Health is empty, continue as normal. * add healthy and unhealthy status to be displayed Check if status is either Running or Healthy to set span class to bg-primary, and check if status is Unhealthy to set span class to bg-danger. * Add lint to workflow * Fix lint --------- Co-authored-by: Thales <[email protected]> Co-authored-by: Louis Lam <[email protected]>
1 parent 8c4004f commit a488518

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,7 @@ jobs:
4848
- name: Install dependencies
4949
run: pnpm install
5050

51+
- name: Lint
52+
run: pnpm run lint
5153
# more things can be add later like tests etc..
52-
54+

backend/stack.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,11 @@ export class Stack {
351351
for (let line of lines) {
352352
try {
353353
let obj = JSON.parse(line);
354-
statusList.set(obj.Service, obj.State);
354+
if (obj.Health === "") {
355+
statusList.set(obj.Service, obj.State);
356+
} else {
357+
statusList.set(obj.Service, obj.Health);
358+
}
355359
} catch (e) {
356360
}
357361
}

frontend/src/components/Container.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,10 @@ export default defineComponent({
179179
},
180180
181181
bgStyle() {
182-
if (this.status === "running") {
182+
if (this.status === "running" || this.status === "healthy") {
183183
return "bg-primary";
184+
} else if (this.status === "unhealthy") {
185+
return "bg-danger";
184186
} else {
185187
return "bg-secondary";
186188
}

0 commit comments

Comments
 (0)