From a488518f6e2e858a0e7935724514fe3f915807aa Mon Sep 17 00:00:00 2001 From: ThalesC Date: Sat, 18 Nov 2023 02:27:39 -0300 Subject: [PATCH] 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 Co-authored-by: Louis Lam --- .github/workflows/ci.yml | 4 +++- backend/stack.ts | 6 +++++- frontend/src/components/Container.vue | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fea3058..2c4525d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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.. - + diff --git a/backend/stack.ts b/backend/stack.ts index 1a2366b..94726f0 100644 --- a/backend/stack.ts +++ b/backend/stack.ts @@ -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) { } } diff --git a/frontend/src/components/Container.vue b/frontend/src/components/Container.vue index 3eb96ff..9d382be 100644 --- a/frontend/src/components/Container.vue +++ b/frontend/src/components/Container.vue @@ -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"; }