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
0e483ac4
Commit
0e483ac4
authored
Jun 30, 2023
by
李科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 指标配置&预警分类批量删除
parent
3d21bfb3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
8 deletions
+25
-8
src/bean/vo/request/alert_class.go
src/bean/vo/request/alert_class.go
+2
-1
src/bean/vo/request/metric_config.go
src/bean/vo/request/metric_config.go
+2
-1
src/controller/alert_class.go
src/controller/alert_class.go
+8
-1
src/controller/metric_config.go
src/controller/metric_config.go
+9
-1
src/service/alert_class.go
src/service/alert_class.go
+2
-2
src/service/metric_config.go
src/service/metric_config.go
+2
-2
No files found.
src/bean/vo/request/alert_class.go
View file @
0e483ac4
...
...
@@ -12,7 +12,8 @@ type UpdateAlertClass struct {
}
type
DeleteAlertClass
struct
{
ClassId
int
`json:"class_id" form:"class_id" binding:"required"`
ClassId
int
`json:"class_id" form:"class_id"`
ClassIds
[]
int
`json:"class_ids" form:"class_ids" binding:"required_without=ClassId"`
}
type
MoveAlertClass
struct
{
...
...
src/bean/vo/request/metric_config.go
View file @
0e483ac4
...
...
@@ -28,7 +28,8 @@ type UpdateMetricConfig struct {
}
type
DeleteMetricConfig
struct
{
Id
string
`json:"id" form:"id" binding:"required"`
Id
string
`json:"id" form:"id"`
Ids
[]
string
`json:"ids" form:"ids" binding:"required_without=Id"`
}
type
DetailMetricConfig
struct
{
...
...
src/controller/alert_class.go
View file @
0e483ac4
...
...
@@ -111,9 +111,16 @@ func DeleteAlertClass(c *gin.Context) {
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
TranslateError
(
err
),
nil
)
return
}
var
ids
[]
int
switch
len
(
req
.
ClassIds
)
{
case
0
:
ids
=
append
(
ids
,
req
.
ClassId
)
default
:
ids
=
req
.
ClassIds
}
svc
:=
service
.
AlertClassSvc
{
User
:
header
.
GetUser
(
c
)}
err
:=
svc
.
Delete
DataById
(
req
)
err
:=
svc
.
Delete
(
ids
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
nil
)
return
...
...
src/controller/metric_config.go
View file @
0e483ac4
...
...
@@ -48,8 +48,16 @@ func DeleteMetricConfig(c *gin.Context) {
return
}
var
ids
[]
string
switch
len
(
req
.
Ids
)
{
case
0
:
ids
=
append
(
ids
,
req
.
Id
)
default
:
ids
=
req
.
Ids
}
svc
:=
service
.
MetricConfigSvc
{
User
:
header
.
GetUser
(
c
)}
err
:=
svc
.
Delete
DataById
(
req
)
err
:=
svc
.
Delete
(
ids
)
if
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
FAIL
.
WithError
(
err
),
nil
)
return
...
...
src/service/alert_class.go
View file @
0e483ac4
...
...
@@ -218,11 +218,11 @@ func (m *AlertClassSvc) SortOrderMax(parentId int) (max int, err error) {
return
}
func
(
m
*
AlertClassSvc
)
Delete
DataById
(
req
request
.
DeleteAlertClass
)
(
err
error
)
{
func
(
m
*
AlertClassSvc
)
Delete
(
ids
[]
int
)
(
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
return
}
_
,
err
=
db
.
NewSession
()
.
I
D
(
req
.
ClassId
)
.
Delete
(
&
entity
.
AlertClass
{})
_
,
err
=
db
.
NewSession
()
.
I
n
(
"class_id"
,
ids
)
.
Delete
(
&
entity
.
AlertClass
{})
return
}
src/service/metric_config.go
View file @
0e483ac4
...
...
@@ -94,11 +94,11 @@ func (m *MetricConfigSvc) List(req request.ListMetricConfig) (resp response.Unit
return
}
func
(
m
*
MetricConfigSvc
)
Delete
DataById
(
req
request
.
DeleteMetricConfi
g
)
(
err
error
)
{
func
(
m
*
MetricConfigSvc
)
Delete
(
ids
[]
strin
g
)
(
err
error
)
{
db
,
err
:=
client
.
GetDbClient
()
if
err
!=
nil
{
return
}
_
,
err
=
db
.
NewSession
()
.
Where
(
"id = ?"
,
req
.
Id
)
.
Delete
(
&
entity
.
MetricConfig
{}
)
_
,
err
=
db
.
NewSession
()
.
In
(
"id"
,
ids
)
.
Delete
(
new
(
entity
.
MetricConfig
)
)
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