mirror of
https://github.com/louislam/dockge.git
synced 2024-11-27 13:14:03 +00:00
Improve handling of stack status, close #11
This commit is contained in:
parent
0208684b50
commit
c8770a9605
1 changed files with 6 additions and 3 deletions
|
@ -264,15 +264,18 @@ export class Stack {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the status string from `docker compose ls` to the status number
|
* Convert the status string from `docker compose ls` to the status number
|
||||||
|
* Input Example: "exited(1), running(1)"
|
||||||
* @param status
|
* @param status
|
||||||
*/
|
*/
|
||||||
static statusConvert(status : string) : number {
|
static statusConvert(status : string) : number {
|
||||||
if (status.startsWith("created")) {
|
if (status.startsWith("created")) {
|
||||||
return CREATED_STACK;
|
return CREATED_STACK;
|
||||||
} else if (status.startsWith("running")) {
|
} else if (status.includes("exited")) {
|
||||||
return RUNNING;
|
// If one of the service is exited, we consider the stack is exited
|
||||||
} else if (status.startsWith("exited")) {
|
|
||||||
return EXITED;
|
return EXITED;
|
||||||
|
} else if (status.startsWith("running")) {
|
||||||
|
// If there is no exited services, there should be only running services
|
||||||
|
return RUNNING;
|
||||||
} else {
|
} else {
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue