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
fca661f8
Commit
fca661f8
authored
Jun 30, 2023
by
陈子龙
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-czl' into dev
parents
fb038039
59555fcd
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
59 additions
and
9 deletions
+59
-9
src/bean/entity/task_history.go
src/bean/entity/task_history.go
+14
-0
src/bean/vo/request/host_manage.go
src/bean/vo/request/host_manage.go
+6
-6
src/bean/vo/request/task_history.go
src/bean/vo/request/task_history.go
+1
-0
src/bean/vo/response/task_history.go
src/bean/vo/response/task_history.go
+1
-0
src/controller/host_manage.go
src/controller/host_manage.go
+2
-2
src/controller/task_history.go
src/controller/task_history.go
+25
-0
src/controller/task_manage.go
src/controller/task_manage.go
+1
-1
src/router/automatedmaintenrouter.go
src/router/automatedmaintenrouter.go
+7
-0
src/service/task_history.go
src/service/task_history.go
+1
-0
src/service/task_manage.go
src/service/task_manage.go
+1
-0
No files found.
src/bean/entity/task_history.go
0 → 100644
View file @
fca661f8
package
entity
import
"time"
type
TaskHistory
struct
{
Id
int
`json:"id" xorm:"pk autoincr" `
// id
TaskId
int
`json:"task_id" xorm:"task_id"`
// 任务id
ExecStartTime
time
.
Time
`json:"exec_start_time" xorm:"exec_start_time" `
// 执行开始时间
ExecEndTime
time
.
Time
`json:"exec_end_time" xorm:"exec_end_time" `
// 执行结束时间
CreateUser
string
`json:"create_user" xorm:"create_user"`
// 操作人
ExecDesc
string
`json:"exec_desc" xorm:"exec_desc" `
// 执行说明
State
int
`json:"state" xorm:"state"`
// 状态(0执行中 1成功 2失败)
ExecLog
string
`json:"exec_log" xorm:"exec_log"`
// 执行日志
}
src/bean/vo/request/host_manage.go
View file @
fca661f8
...
...
@@ -28,9 +28,9 @@ type DelHostManageReq struct {
}
type
ListHostManageReq
struct
{
Search
string
`json:"search"
`
//关键词
CreateDateFrom
string
`json:"create_date_from"`
//创建时间从
CreateDateTo
string
`json:"create_date_to"
`
//创建时间至
Search
string
`json:"search"
form:"search"`
//关键词
CreateDateFrom
string
`json:"create_date_from"
form:"create_date_from"
`
//创建时间从
CreateDateTo
string
`json:"create_date_to"
form:"create_date_to"`
//创建时间至
Pagination
}
...
...
@@ -44,8 +44,8 @@ type StateHostManageReq struct {
// HostIpExceptionListReq 异常列表
type
HostIpExceptionListReq
struct
{
DetectionType
int
`json:"detection_type" binding:"oneof=1 2"`
//1主页异常ip列表 2保存检测时异常列表
Id
int
`json:"id"
`
//主机分组ID
Uuid
string
`json:"uuid"
`
//临时缓存uuid
DetectionType
int
`json:"detection_type"
form:"detection_type"
binding:"oneof=1 2"`
//1主页异常ip列表 2保存检测时异常列表
Id
int
`json:"id"
form:"id"`
//主机分组ID
Uuid
string
`json:"uuid"
form:"uuid"`
//临时缓存uuid
Pagination
}
src/bean/vo/request/task_history.go
0 → 100644
View file @
fca661f8
package
request
src/bean/vo/response/task_history.go
0 → 100644
View file @
fca661f8
package
response
src/controller/host_manage.go
View file @
fca661f8
...
...
@@ -182,7 +182,7 @@ func DetailsHostManage(c *gin.Context) {
// PageListHostManage 列表-分页
func
PageListHostManage
(
c
*
gin
.
Context
)
{
var
req
request
.
ListHostManageReq
if
err
:=
c
.
ShouldBind
JSON
(
&
req
);
err
!=
nil
{
if
err
:=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
nil
)
return
}
...
...
@@ -276,7 +276,7 @@ func StateHostManage(c *gin.Context) {
// HostIpExceptionList 主机ip异常列表
func
HostIpExceptionList
(
c
*
gin
.
Context
)
{
var
req
request
.
HostIpExceptionListReq
if
err
:=
c
.
ShouldBind
JSON
(
&
req
);
err
!=
nil
{
if
err
:=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
nil
)
return
}
...
...
src/controller/task_history.go
0 → 100644
View file @
fca661f8
package
controller
import
(
"github.com/gin-gonic/gin"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/service"
)
// TaskHistoryList 任务历史
func
TaskHistoryList
(
c
*
gin
.
Context
)
{
var
req
request
.
ListTaskManageReq
if
err
:=
c
.
ShouldBindJSON
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
nil
)
return
}
taskManageSvc
:=
service
.
TaskManageSvc
{}
total
,
list
,
err
:=
taskManageSvc
.
ListTaskManage
(
req
)
if
err
!=
nil
{
SendJsonPageResponse
(
c
,
err
,
nil
,
0
)
return
}
SendJsonPageResponse
(
c
,
resp
.
OK
,
list
,
total
)
}
src/controller/task_manage.go
View file @
fca661f8
...
...
@@ -103,7 +103,7 @@ func DetailsTaskManage(c *gin.Context) {
// ListTaskManage 任务列表
func
ListTaskManage
(
c
*
gin
.
Context
)
{
var
req
request
.
ListTaskManageReq
if
err
:=
c
.
ShouldBind
JSON
(
&
req
);
err
!=
nil
{
if
err
:=
c
.
ShouldBind
(
&
req
);
err
!=
nil
{
SendJsonResponse
(
c
,
resp
.
InvalidParam
.
WithError
(
err
),
nil
)
return
}
...
...
src/router/automatedmaintenrouter.go
View file @
fca661f8
...
...
@@ -20,6 +20,13 @@ func InitAutomatedMaintenRouter(e *gin.Engine) {
task
.
GET
(
"/list"
,
controller
.
ListTaskManage
)
// 列表
task
.
POST
(
"/exec/script"
,
controller
.
ExecScript
)
// 立即执行
}
//任务历史
taskHistory
:=
so
.
Group
(
"/task_history"
)
{
taskHistory
.
GET
(
"/list"
,
controller
.
TaskHistoryList
)
// 任务历史
}
//主机管理
host
:=
so
.
Group
(
"/host_manage"
)
{
...
...
src/service/task_history.go
0 → 100644
View file @
fca661f8
package
service
src/service/task_manage.go
View file @
fca661f8
...
...
@@ -193,6 +193,7 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq) (data interface{},
}
req
.
Value
=
fmt
.
Sprintf
(
"@/etc/ansible/ansible_extra.yml"
)
}
var
cmd
*
exec
.
Cmd
if
req
.
Value
!=
""
{
cmd
=
exec
.
Command
(
"ansible-playbook"
,
"-i"
,
"/etc/ansible/hosts"
,
"/etc/ansible/ansible.yml"
,
"--extra-vars"
,
req
.
Value
)
...
...
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