Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
4e7c0e79
Commit
4e7c0e79
authored
Jul 05, 2023
by
黄智
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
e2497ab6
f570d1c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
9 deletions
+17
-9
src/bean/entity/alert_rules.go
src/bean/entity/alert_rules.go
+1
-1
src/bean/entity/metric_config.go
src/bean/entity/metric_config.go
+1
-1
src/bean/vo/request/alert_rules.go
src/bean/vo/request/alert_rules.go
+1
-1
src/bean/vo/request/metric_config.go
src/bean/vo/request/metric_config.go
+8
-6
src/service/metric_config.go
src/service/metric_config.go
+6
-0
No files found.
src/bean/entity/alert_rules.go
View file @
4e7c0e79
...
...
@@ -18,7 +18,7 @@ type AlertRules struct {
NotifyRecipients
string
`json:"notify_recipients" xorm:"notify_recipients"`
// 预警推送用户
NotifyPushCount
int
`json:"notify_push_count" xorm:"'notify_push_count'"`
// 消息推送次数
NotifyPushFrequency
int
`json:"notify_push_frequency" xorm:"'notify_push_frequency'"`
// 消息推送频率 分钟
IsEnabled
int
`json:"is_enabled" xorm:"'is_enabled'"`
// 是否开启
0:关闭 1:启动
IsEnabled
int
`json:"is_enabled" xorm:"'is_enabled'"`
// 是否开启
1:是 2:否
CreatedBy
string
`json:"created_by" xorm:"'created_by'"`
// 创建人
CreatedAt
jsontime
.
Time
`json:"created_at" xorm:"'created_at'"`
// 创建时间
UpdatedBy
string
`json:"updated_by" xorm:"'updated_by'"`
// 更新人
...
...
src/bean/entity/metric_config.go
View file @
4e7c0e79
...
...
@@ -11,7 +11,7 @@ type MetricConfig struct {
Duration
int
`json:"duration" xorm:"'duration'"`
// 持续时间
DurationUnit
string
`json:"duration_unit" xorm:"'duration_unit'"`
// 持续时间单位 s m h
CheckPeriod
int
`json:"check_period" xorm:"'check_period'"`
// 检查周期 单位:分钟
IsEnabled
int
`json:"is_enabled" xorm:"'is_enabled'"`
// 是否开启
0:关闭 1:启动
IsEnabled
int
`json:"is_enabled" xorm:"'is_enabled'"`
// 是否开启
1:是 2:否
AlertRuleType
string
`json:"alert_rule_type" xorm:"'alert_rule_type'"`
// 预警规则类型 关联字典表
SourceFrom
int
`json:"source_from" xorm:"source_from"`
// 数据来源 1:默认 2:自定义
CreatedBy
string
`json:"created_by" xorm:"'created_by'"`
// 创建人
...
...
src/bean/vo/request/alert_rules.go
View file @
4e7c0e79
...
...
@@ -67,7 +67,7 @@ type ListAlertRules struct {
// 请输入预警规则名称/预警对象/预警分类/预警指标
Id
string
`json:"id" form:"id"`
NotifyMethod
string
`json:"notify_method" form:"notify_method" binding:"omitempty,oneof=all dingtalk sms"`
// 预警通知方式 all dingtalk sms
IsEnabled
int
`json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=
0 1 2"`
// 是否开启 1:是 2:否
IsEnabled
int
`json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=
1 2"`
// 是否开启 1:是 2:否
Keyword
string
`json:"keyword" form:"keyword"`
// 预警规则名称(指标名称)
StartTime
string
`json:"start_time" form:"start_time" binding:"omitempty,datetime=2006-01-02 15:04:05"`
EndTime
string
`json:"end_time" form:"end_time" binding:"omitempty,datetime=2006-01-02 15:04:05"`
...
...
src/bean/vo/request/metric_config.go
View file @
4e7c0e79
...
...
@@ -10,7 +10,7 @@ type AddMetricConfig struct {
Duration
int
`json:"duration" form:"duration"`
// 持续时间
DurationUnit
string
`json:"duration_unit" form:"duration_unit" binding:"required,oneof=s m h"`
// 持续时间单位 s m h
CheckPeriod
int
`json:"check_period" form:"check_period" binding:"oneof=1 3 5 10 20 30"`
// 检查周期 单位:分钟
IsEnabled
int
`json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=
0 1 2"`
// 是否开启 1:是 2:否
IsEnabled
int
`json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=
1 2"`
// 是否开启 1:是 2:否
AlertRuleType
string
`json:"alert_rule_type" form:"alert_rule_type" binding:"required"`
// 预警规则类型 关联字典表
SourceFrom
int
`json:"source_from" form:"source_from" binding:"omitempty,oneof=1 2"`
// 数据来源 1:默认 2:自定义
}
...
...
@@ -24,7 +24,7 @@ type UpdateMetricConfig struct {
Duration
int
`json:"duration" form:"duration"`
// 持续时间
DurationUnit
string
`json:"duration_unit" form:"duration_unit" binding:"omitempty,oneof=s m h"`
// 持续时间单位 s m h
CheckPeriod
int
`json:"check_period" form:"check_period" binding:"omitempty,oneof=1 3 5 10 20 30"`
// 检查周期 单位:分钟
IsEnabled
int
`json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=
0 1 2"`
// 是否开启 1:是 2:否
IsEnabled
int
`json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=
1 2"`
// 是否开启 1:是 2:否
AlertRuleType
string
`json:"alert_rule_type" form:"alert_rule_type"`
// 预警规则类型 关联字典表
SourceFrom
int
`json:"source_from" form:"source_from" binding:"omitempty,oneof=1 2"`
// 数据来源 1:默认 2:自定义
}
...
...
@@ -39,9 +39,11 @@ type DetailMetricConfig struct {
}
type
ListMetricConfig
struct
{
Id
string
`json:"id" form:"id"`
ClassId
int
`json:"class_id" form:"class_id"`
MetricName
string
`json:"metric_name" form:"metric_name"`
IsEnabled
int
`json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=0 1 2"`
Id
string
`json:"id" form:"id"`
// 主键id
ClassId
int
`json:"class_id" form:"class_id"`
// 分类id
MetricName
string
`json:"metric_name" form:"metric_name"`
// 指标名称
IsEnabled
int
`json:"is_enabled" form:"is_enabled" binding:"omitempty,oneof=1 2"`
// 是否开启 1:是 2:否
StartTime
string
`json:"start_time" form:"start_time" binding:"omitempty,datetime=2006-01-02 15:04:05"`
// 开始时间
EndTime
string
`json:"end_time" form:"end_time" binding:"omitempty,datetime=2006-01-02 15:04:05"`
// 结束时间
Pagination
}
src/service/metric_config.go
View file @
4e7c0e79
...
...
@@ -78,6 +78,12 @@ func (m *MetricConfigSvc) List(req request.ListMetricConfig) (resp response.Metr
if
req
.
IsEnabled
!=
0
{
session
.
Where
(
"is_enabled = ?"
,
req
.
IsEnabled
)
}
if
req
.
StartTime
!=
""
{
session
.
Where
(
"created_at >= ?"
,
req
.
StartTime
)
}
if
req
.
EndTime
!=
""
{
session
.
Where
(
"created_at <= ?"
,
req
.
EndTime
)
}
resp
.
TotalCount
,
err
=
session
.
Limit
(
req
.
GetPageSize
(),
(
req
.
GetPage
()
-
1
)
*
req
.
GetPageSize
())
.
OrderBy
(
"id"
)
.
FindAndCount
(
&
resp
.
List
)
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment