This commit is contained in:
parent
043d81b823
commit
f818a3525b
1 changed files with 13 additions and 8 deletions
|
@ -36,8 +36,9 @@ type PieIntValue struct {
|
|||
Value int
|
||||
}
|
||||
|
||||
const SUCCESS_CHART_COLOR = "#7cffb2"
|
||||
const FAILED_CHART_COLOR = "#ff6e76"
|
||||
const CHART_COLOR_SUCCESS = "#7cffb2"
|
||||
const CHART_COLOR_FAILED = "#ff6e76"
|
||||
const CHART_COLOR_UNKNOWN = "#fddd60"
|
||||
|
||||
func generatePie(name string, data []opts.PieData) ChartData {
|
||||
pie := charts.NewPie()
|
||||
|
@ -51,13 +52,17 @@ func generatePie(name string, data []opts.PieData) ChartData {
|
|||
}))
|
||||
|
||||
for i := range data {
|
||||
if data[i].Name == "Success" {
|
||||
if data[i].Name == "Success" || data[i].Name == "Healthy" {
|
||||
data[i].ItemStyle = &opts.ItemStyle{
|
||||
Color: SUCCESS_CHART_COLOR,
|
||||
Color: CHART_COLOR_SUCCESS,
|
||||
}
|
||||
} else if data[i].Name == "Failed" {
|
||||
} else if data[i].Name == "Failed" || data[i].Name == "Damaged" {
|
||||
data[i].ItemStyle = &opts.ItemStyle{
|
||||
Color: FAILED_CHART_COLOR,
|
||||
Color: CHART_COLOR_FAILED,
|
||||
}
|
||||
} else if data[i].Name == "Unknown" || data[i].Name == "None" {
|
||||
data[i].ItemStyle = &opts.ItemStyle{
|
||||
Color: CHART_COLOR_UNKNOWN,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -243,14 +248,14 @@ func generateStats(ctx context.Context) ([]ChartData, error) {
|
|||
successBarData = append(successBarData, opts.BarData{
|
||||
Value: v.Count,
|
||||
ItemStyle: &opts.ItemStyle{
|
||||
Color: SUCCESS_CHART_COLOR,
|
||||
Color: CHART_COLOR_SUCCESS,
|
||||
},
|
||||
})
|
||||
} else if v.Status == constants.TASK_STATUS_FAILED {
|
||||
failedBarData = append(failedBarData, opts.BarData{
|
||||
Value: v.Count,
|
||||
ItemStyle: &opts.ItemStyle{
|
||||
Color: FAILED_CHART_COLOR,
|
||||
Color: CHART_COLOR_FAILED,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue