Skip to content

Commit 6e452b2

Browse files
committed
fix(be): add status title
1 parent 60c989f commit 6e452b2

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

pkg/task_logger/task_logger.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package task_logger
22

33
import (
44
"os/exec"
5+
"strings"
56
"time"
67
)
78

@@ -20,6 +21,24 @@ const (
2021
TaskFailStatus TaskStatus = "error"
2122
)
2223

24+
func (s TaskStatus) String() string {
25+
switch s {
26+
case TaskWaitingStatus,
27+
TaskStartingStatus,
28+
TaskWaitingConfirmation,
29+
TaskConfirmed,
30+
TaskRejected,
31+
TaskRunningStatus,
32+
TaskStoppingStatus,
33+
TaskStoppedStatus,
34+
TaskSuccessStatus,
35+
TaskFailStatus:
36+
return string(s)
37+
default:
38+
return "unknown"
39+
}
40+
}
41+
2342
func (s TaskStatus) IsValid() bool {
2443
switch s {
2544
case TaskWaitingStatus,
@@ -57,7 +76,7 @@ func (s TaskStatus) Format() (res string) {
5776
}
5877

5978
// to avoid email content injection issue
60-
//res += strings.ToUpper(string(s))
79+
res += strings.ToUpper(s.String())
6180

6281
return
6382
}

0 commit comments

Comments
 (0)