mirror of
https://github.com/louislam/dockge.git
synced 2024-11-23 19:34:04 +00:00
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 <thcd@cock.li> Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
parent
8c4004f32d
commit
a488518f6e
3 changed files with 11 additions and 3 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -48,5 +48,7 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: pnpm run lint
|
||||||
# more things can be add later like tests etc..
|
# more things can be add later like tests etc..
|
||||||
|
|
||||||
|
|
|
@ -351,7 +351,11 @@ export class Stack {
|
||||||
for (let line of lines) {
|
for (let line of lines) {
|
||||||
try {
|
try {
|
||||||
let obj = JSON.parse(line);
|
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) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,8 +179,10 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
bgStyle() {
|
bgStyle() {
|
||||||
if (this.status === "running") {
|
if (this.status === "running" || this.status === "healthy") {
|
||||||
return "bg-primary";
|
return "bg-primary";
|
||||||
|
} else if (this.status === "unhealthy") {
|
||||||
|
return "bg-danger";
|
||||||
} else {
|
} else {
|
||||||
return "bg-secondary";
|
return "bg-secondary";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue