Skip to content

Commit

Permalink
Add health status check (#58)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Nov 18, 2023
1 parent 8c4004f commit a488518
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm run lint
# more things can be add later like tests etc..

6 changes: 5 additions & 1 deletion backend/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,11 @@ export class Stack {
for (let line of lines) {
try {
let obj = JSON.parse(line);
statusList.set(obj.Service, obj.State);
if (obj.Health === "") {
statusList.set(obj.Service, obj.State);
} else {
statusList.set(obj.Service, obj.Health);
}
} catch (e) {
}
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ export default defineComponent({
},
bgStyle() {
if (this.status === "running") {
if (this.status === "running" || this.status === "healthy") {
return "bg-primary";
} else if (this.status === "unhealthy") {
return "bg-danger";
} else {
return "bg-secondary";
}
Expand Down

0 comments on commit a488518

Please sign in to comment.