Commit 159e45b0 authored by 李科's avatar 李科

fix: 修改预警总览展示字段

parent 738f22d0
...@@ -22,26 +22,31 @@ type AlertArray struct { ...@@ -22,26 +22,31 @@ type AlertArray struct {
} }
type RiskLevelDistribution struct { type RiskLevelDistribution struct {
Name string `json:"name"` // 名称 Name string `json:"name"` // 名称
RiskLevel int `json:"risk_level"` // 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险 //RiskLevel int `json:"risk_level"` // 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险
Percentage string `json:"percentage"` // 百分比 //Percentage string `json:"percentage"` // 百分比
Value int `json:"value"`
} }
type AlertStatusDistribution struct { type AlertStatusDistribution struct {
Name string `json:"name"` // 名称 Name string `json:"name"` // 名称
Status int `json:"status"` // 状态,1:已恢复 2:未恢复 3:已关闭 //Status int `json:"status"` // 状态,1:已恢复 2:未恢复 3:已关闭
Percentage string `json:"percentage"` // 百分比 //Percentage string `json:"percentage"` // 百分比
Value int `json:"value"`
} }
type AlertClassDistribution struct { type AlertClassDistribution struct {
Name string `json:"name"` // 名称 Name string `json:"name"` // 名称
ClassId int `json:"class_id"` // 预警分类id //ClassId int `json:"class_id"` // 预警分类id
Percentage string `json:"percentage"` // 百分比 //Percentage string `json:"percentage"` // 百分比
Value int `json:"value"`
} }
type AlertFrequencyDistribution struct { type AlertFrequencyDistribution struct {
Name string `json:"name"` // 名称 //Name string `json:"name"` // 名称
Count int `json:"count"` // 数量 //Value int `json:"count"` // 数量
XAxis []string `json:"xAxis"`
Data []int `json:"data"`
} }
func (a *AlertOverview) TableName() string { func (a *AlertOverview) TableName() string {
......
...@@ -5,11 +5,11 @@ import ( ...@@ -5,11 +5,11 @@ import (
) )
type AlertOverviewItem struct { type AlertOverviewItem struct {
AlertOverview []entity.AlertOverview `json:"alert_overview"` AlertOverview []entity.AlertOverview `json:"alert_overview"`
RiskLevelDistribution []entity.RiskLevelDistribution `json:"risk_level_distribution"` RiskLevelDistribution []entity.RiskLevelDistribution `json:"risk_level_distribution"`
AlertStatusDistribution []entity.AlertStatusDistribution `json:"alert_status_distribution"` AlertStatusDistribution []entity.AlertStatusDistribution `json:"alert_status_distribution"`
AlertClassDistribution []entity.AlertClassDistribution `json:"alert_class_distribution"` AlertClassDistribution []entity.AlertClassDistribution `json:"alert_class_distribution"`
AlertFrequencyDistribution []entity.AlertFrequencyDistribution `json:"alert_frequency_distribution"` AlertFrequencyDistribution entity.AlertFrequencyDistribution `json:"alert_frequency_distribution"`
} }
type AlertOverviewList struct { type AlertOverviewList struct {
......
...@@ -187,93 +187,53 @@ func (a *AlertOverviewSvc) Overview(req request.DetailAlertOverview) (resp respo ...@@ -187,93 +187,53 @@ func (a *AlertOverviewSvc) Overview(req request.DetailAlertOverview) (resp respo
}, },
RiskLevelDistribution: []entity.RiskLevelDistribution{ RiskLevelDistribution: []entity.RiskLevelDistribution{
{ {
Name: "重大风险", Name: "重大风险",
RiskLevel: 4, Value: 1,
Percentage: "10%",
}, },
{ {
Name: "较大风险", Name: "较大风险",
RiskLevel: 3, Value: 2,
Percentage: "20%",
}, },
{ {
Name: "一般风险", Name: "一般风险",
RiskLevel: 2, Value: 3,
Percentage: "30%",
}, },
{ {
Name: "低风险", Name: "低风险",
RiskLevel: 1, Value: 4,
Percentage: "40%",
}, },
}, },
AlertStatusDistribution: []entity.AlertStatusDistribution{ AlertStatusDistribution: []entity.AlertStatusDistribution{
{ {
Name: "未恢复", Name: "未恢复",
Status: 1, Value: 4,
Percentage: "30%",
}, },
{ {
Name: "已恢复", Name: "已恢复",
Status: 2, Value: 6,
Percentage: "70%",
}, },
}, },
AlertClassDistribution: []entity.AlertClassDistribution{ AlertClassDistribution: []entity.AlertClassDistribution{
{ {
Name: "容器集群", Name: "容器集群",
ClassId: 1, Value: 1,
Percentage: "30%",
}, },
{ {
Name: "容器节点", Name: "容器节点",
ClassId: 2, Value: 2,
Percentage: "20%",
}, },
{ {
Name: "容器组", Name: "容器组",
ClassId: 3, Value: 3,
Percentage: "30%",
}, },
{ {
Name: "网关", Name: "网关",
ClassId: 4, Value: 4,
Percentage: "20%",
}, },
}, },
AlertFrequencyDistribution: []entity.AlertFrequencyDistribution{ AlertFrequencyDistribution: entity.AlertFrequencyDistribution{
{ XAxis: []string{"0-3时", "3-6时", "6-9时", "9-12时", "12-15时", "15-18时", "18-21时", "21-24时"},
Name: "0-3时", Data: []int{12, 20, 11, 50, 60, 30, 16, 6},
Count: 12,
},
{
Name: "3-6时",
Count: 20,
},
{
Name: "6-9时",
Count: 11,
},
{
Name: "9-12时",
Count: 50,
},
{
Name: "12-15时",
Count: 60,
},
{
Name: "15-18时",
Count: 30,
},
{
Name: "18-21时",
Count: 16,
},
{
Name: "21-24时",
Count: 6,
},
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment