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

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

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