From 8902111c23f89f1eba71ce28df2e52661d3f2221 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Fri, 7 Apr 2023 12:02:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=AE=B0=E5=BD=95=E6=B8=85=E7=A9=BA=E6=8C=89?= =?UTF-8?q?=E9=92=AE=20(#528)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/v1/cronjob.go | 24 ++ backend/app/repo/cronjob.go | 7 + backend/app/service/cornjob.go | 22 ++ backend/router/ro_cronjob.go | 1 + cmd/server/docs/docs.go | 415 ++++++++++++-------- cmd/server/docs/swagger.json | 344 +++++++++------- cmd/server/docs/swagger.yaml | 318 ++++++++------- frontend/src/api/modules/cronjob.ts | 4 + frontend/src/lang/modules/en.ts | 2 + frontend/src/lang/modules/zh.ts | 1 + frontend/src/views/cronjob/record/index.vue | 18 +- 11 files changed, 697 insertions(+), 459 deletions(-) diff --git a/backend/app/api/v1/cronjob.go b/backend/app/api/v1/cronjob.go index a53bc7f25..2fcbdc335 100644 --- a/backend/app/api/v1/cronjob.go +++ b/backend/app/api/v1/cronjob.go @@ -92,6 +92,30 @@ func (b *BaseApi) SearchJobRecords(c *gin.Context) { }) } +// @Tags Cronjob +// @Summary Clean job records +// @Description 清空计划任务记录 +// @Accept json +// @Param request body dto.OperateByID true "request" +// @Success 200 +// @Security ApiKeyAuth +// @Router /cronjobs/records/clean [post] +// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"cronjobs","output_colume":"name","output_value":"name"}],"formatZH":"清空计划任务记录 [name]","formatEN":"clean cronjob [name] records"} +func (b *BaseApi) CleanRecord(c *gin.Context) { + var req dto.OperateByID + if err := c.ShouldBindJSON(&req); err != nil { + helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err) + return + } + + if err := cronjobService.CleanRecord(req.ID); err != nil { + helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err) + return + } + + helper.SuccessWithData(c, nil) +} + // @Tags Cronjob // @Summary Delete cronjob // @Description 删除计划任务 diff --git a/backend/app/repo/cronjob.go b/backend/app/repo/cronjob.go index 2764f046d..97630e955 100644 --- a/backend/app/repo/cronjob.go +++ b/backend/app/repo/cronjob.go @@ -20,6 +20,7 @@ type ICronjobRepo interface { Page(limit, offset int, opts ...DBOption) (int64, []model.Cronjob, error) Create(cronjob *model.Cronjob) error WithByJobID(id int) DBOption + WithByRecordDropID(id int) DBOption Save(id uint, cronjob model.Cronjob) error Update(id uint, vars map[string]interface{}) error Delete(opts ...DBOption) error @@ -113,6 +114,12 @@ func (c *CronjobRepo) WithByJobID(id int) DBOption { } } +func (c *CronjobRepo) WithByRecordDropID(id int) DBOption { + return func(g *gorm.DB) *gorm.DB { + return g.Where("id < ?", id) + } +} + func (u *CronjobRepo) StartRecords(cronjobID uint, fromLocal bool, targetPath string) model.JobRecords { var record model.JobRecords record.StartTime = time.Now() diff --git a/backend/app/service/cornjob.go b/backend/app/service/cornjob.go index 237b99940..80ceefb97 100644 --- a/backend/app/service/cornjob.go +++ b/backend/app/service/cornjob.go @@ -27,6 +27,7 @@ type ICronjobService interface { Delete(ids []uint) error Download(down dto.CronjobDownload) (string, error) StartJob(cronjob *model.Cronjob) (int, error) + CleanRecord(id uint) error } func NewICronjobService() ICronjobService { @@ -78,6 +79,27 @@ func (u *CronjobService) SearchRecords(search dto.SearchRecord) (int64, interfac return total, dtoCronjobs, err } +func (u *CronjobService) CleanRecord(id uint) error { + _, records, err := cronjobRepo.PageRecords(1, 7, cronjobRepo.WithByJobID(int(id)), commonRepo.WithOrderBy("created_at desc")) + if err != nil { + return err + } + if len(records) < 7 { + return nil + } + delRecords, err := cronjobRepo.ListRecord(cronjobRepo.WithByJobID(int(id)), cronjobRepo.WithByRecordDropID(int(records[6].ID))) + if err != nil { + return err + } + for _, del := range delRecords { + _ = os.RemoveAll(del.Records) + } + if err := cronjobRepo.DeleteRecord(cronjobRepo.WithByJobID(int(id)), cronjobRepo.WithByRecordDropID(int(records[6].ID))); err != nil { + return err + } + return nil +} + func (u *CronjobService) Download(down dto.CronjobDownload) (string, error) { record, _ := cronjobRepo.GetRecord(commonRepo.WithByID(down.RecordID)) if record.ID == 0 { diff --git a/backend/router/ro_cronjob.go b/backend/router/ro_cronjob.go index 8dd3befc6..a56ea390b 100644 --- a/backend/router/ro_cronjob.go +++ b/backend/router/ro_cronjob.go @@ -24,5 +24,6 @@ func (s *CronjobRouter) InitCronjobRouter(Router *gin.RouterGroup) { cmdRouter.POST("/download", baseApi.TargetDownload) cmdRouter.POST("/search", baseApi.SearchCronjob) cmdRouter.POST("/search/records", baseApi.SearchJobRecords) + cmdRouter.POST("/records/clean", baseApi.CleanRecord) } } diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 6576b276d..15a433741 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -1,10 +1,17 @@ -// Package docs GENERATED BY SWAG; DO NOT EDIT +// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag package docs -import "github.com/swaggo/swag" +import ( + "bytes" + "encoding/json" + "strings" + "text/template" -const docTemplate = `{ + "github.com/swaggo/swag" +) + +var doc = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { @@ -69,7 +76,7 @@ const docTemplate = `{ "summary": "Get app list update", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -449,7 +456,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -551,7 +558,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -593,7 +600,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -637,7 +644,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -656,7 +663,7 @@ const docTemplate = `{ "summary": "Sync app installed", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -696,7 +703,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -749,7 +756,7 @@ const docTemplate = `{ "summary": "Sync app list", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -787,7 +794,7 @@ const docTemplate = `{ "summary": "Check System isDemo", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -815,7 +822,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -865,7 +872,7 @@ const docTemplate = `{ "summary": "User logout", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -910,7 +917,7 @@ const docTemplate = `{ "summary": "Check is First login", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -943,7 +950,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -986,7 +993,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1028,7 +1035,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1107,7 +1114,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1149,7 +1156,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1241,7 +1248,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1281,7 +1288,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1321,7 +1328,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1458,7 +1465,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1611,7 +1618,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1653,7 +1660,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1736,7 +1743,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1824,7 +1831,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1866,7 +1873,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1947,7 +1954,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2017,7 +2024,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2062,7 +2069,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2155,7 +2162,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -2191,7 +2198,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2371,7 +2378,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2413,7 +2420,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2503,7 +2510,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2554,7 +2561,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2596,7 +2603,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2714,7 +2721,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2757,7 +2764,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2808,7 +2815,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2859,7 +2866,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2882,6 +2889,57 @@ const docTemplate = `{ } } }, + "/cronjobs/records/clean": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "清空计划任务记录", + "consumes": [ + "application/json" + ], + "tags": [ + "Cronjob" + ], + "summary": "Clean job records", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.OperateByID" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "x-panel-log": { + "BeforeFuntions": [ + { + "db": "cronjobs", + "input_colume": "id", + "input_value": "id", + "isList": false, + "output_colume": "name", + "output_value": "name" + } + ], + "bodyKeys": [ + "id" + ], + "formatEN": "clean cronjob [name] records", + "formatZH": "清空计划任务记录 [name]", + "paramKeys": [] + } + } + }, "/cronjobs/search": { "post": { "security": [ @@ -2982,7 +3040,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3034,7 +3092,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3167,7 +3225,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3231,7 +3289,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3282,7 +3340,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3333,7 +3391,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3373,7 +3431,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3460,7 +3518,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3606,7 +3664,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3646,7 +3704,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3686,7 +3744,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3748,7 +3806,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3912,7 +3970,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3952,7 +4010,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3994,7 +4052,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4036,7 +4094,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4073,7 +4131,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -4106,7 +4164,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4193,7 +4251,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4235,7 +4293,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4277,7 +4335,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4319,7 +4377,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4406,7 +4464,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4449,7 +4507,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4492,7 +4550,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4535,7 +4593,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4613,7 +4671,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4686,7 +4744,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4764,7 +4822,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4808,7 +4866,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4905,7 +4963,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4948,7 +5006,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5035,7 +5093,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5077,7 +5135,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5373,7 +5431,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5416,7 +5474,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5511,7 +5569,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5624,7 +5682,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5693,7 +5751,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5884,7 +5942,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5982,7 +6040,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6033,7 +6091,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6073,7 +6131,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6106,7 +6164,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6148,7 +6206,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6181,7 +6239,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6223,7 +6281,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6265,7 +6323,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6309,7 +6367,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6360,7 +6418,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6411,7 +6469,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6454,7 +6512,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6487,7 +6545,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6532,7 +6590,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6669,7 +6727,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6733,7 +6791,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6795,7 +6853,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6821,7 +6879,7 @@ const docTemplate = `{ "summary": "Clean monitor datas", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6861,7 +6919,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6901,7 +6959,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6951,7 +7009,7 @@ const docTemplate = `{ "summary": "Load system available status", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6984,7 +7042,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7027,7 +7085,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7078,7 +7136,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7130,7 +7188,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7173,7 +7231,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7224,7 +7282,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7340,7 +7398,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7383,7 +7441,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } }, @@ -7414,7 +7472,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7456,7 +7514,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7697,7 +7755,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7856,7 +7914,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7907,7 +7965,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7959,7 +8017,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8010,7 +8068,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8052,7 +8110,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8139,7 +8197,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8260,7 +8318,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8388,7 +8446,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8439,7 +8497,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8547,7 +8605,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8677,7 +8735,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8710,7 +8768,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8761,7 +8819,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8848,7 +8906,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8881,7 +8939,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8930,7 +8988,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8963,7 +9021,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9041,7 +9099,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9973,7 +10031,9 @@ const docTemplate = `{ "S3", "SFTP", "MINIO", - "LOCAL" + "LOCAL", + "COS", + "KODO" ] } } @@ -9995,6 +10055,9 @@ const docTemplate = `{ "name": { "type": "string" }, + "pingStatus": { + "type": "string" + }, "status": { "type": "string" }, @@ -10014,7 +10077,8 @@ const docTemplate = `{ "enum": [ "start", "stop", - "reload" + "disablePing", + "enablePing" ] } } @@ -10699,21 +10763,6 @@ const docTemplate = `{ } } }, - "dto.NginxKey": { - "type": "string", - "enum": [ - "index", - "limit-conn", - "ssl", - "http-per" - ], - "x-enum-varnames": [ - "Index", - "LimitConn", - "SSL", - "HttpPer" - ] - }, "dto.OperateByID": { "type": "object", "required": [ @@ -11240,7 +11289,9 @@ const docTemplate = `{ "OSS", "S3", "SFTP", - "MINIO" + "MINIO", + "COS", + "KODO" ] } } @@ -12186,7 +12237,7 @@ const docTemplate = `{ }, "params": {}, "scope": { - "$ref": "#/definitions/dto.NginxKey" + "type": "string" }, "websiteId": { "type": "integer" @@ -12200,7 +12251,7 @@ const docTemplate = `{ ], "properties": { "scope": { - "$ref": "#/definitions/dto.NginxKey" + "type": "string" }, "websiteId": { "type": "integer" @@ -13263,18 +13314,56 @@ const docTemplate = `{ } }` +type swaggerInfo struct { + Version string + Host string + BasePath string + Schemes []string + Title string + Description string +} + // SwaggerInfo holds exported Swagger Info so clients can modify it -var SwaggerInfo = &swag.Spec{ - Version: "1.0", - Host: "localhost", - BasePath: "/api/v1", - Schemes: []string{}, - Title: "1Panel", - Description: "开源Linux面板", - InfoInstanceName: "swagger", - SwaggerTemplate: docTemplate, +var SwaggerInfo = swaggerInfo{ + Version: "1.0", + Host: "localhost", + BasePath: "/api/v1", + Schemes: []string{}, + Title: "1Panel", + Description: "开源Linux面板", +} + +type s struct{} + +func (s *s) ReadDoc() string { + sInfo := SwaggerInfo + sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) + + t, err := template.New("swagger_info").Funcs(template.FuncMap{ + "marshal": func(v interface{}) string { + a, _ := json.Marshal(v) + return string(a) + }, + "escape": func(v interface{}) string { + // escape tabs + str := strings.Replace(v.(string), "\t", "\\t", -1) + // replace " with \", and if that results in \\", replace that with \\\" + str = strings.Replace(str, "\"", "\\\"", -1) + return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1) + }, + }).Parse(doc) + if err != nil { + return doc + } + + var tpl bytes.Buffer + if err := t.Execute(&tpl, sInfo); err != nil { + return doc + } + + return tpl.String() } func init() { - swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) + swag.Register("swagger", &s{}) } diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json index f5e58cb7b..9d6c5eba8 100644 --- a/cmd/server/docs/swagger.json +++ b/cmd/server/docs/swagger.json @@ -62,7 +62,7 @@ "summary": "Get app list update", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -442,7 +442,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -544,7 +544,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -586,7 +586,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -630,7 +630,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -649,7 +649,7 @@ "summary": "Sync app installed", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -689,7 +689,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -742,7 +742,7 @@ "summary": "Sync app list", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -780,7 +780,7 @@ "summary": "Check System isDemo", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -808,7 +808,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -858,7 +858,7 @@ "summary": "User logout", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -903,7 +903,7 @@ "summary": "Check is First login", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -936,7 +936,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -979,7 +979,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1021,7 +1021,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1100,7 +1100,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1142,7 +1142,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1234,7 +1234,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1274,7 +1274,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1314,7 +1314,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1451,7 +1451,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1604,7 +1604,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1646,7 +1646,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1729,7 +1729,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1817,7 +1817,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1859,7 +1859,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1940,7 +1940,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2010,7 +2010,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2055,7 +2055,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2148,7 +2148,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -2184,7 +2184,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2364,7 +2364,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2406,7 +2406,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2496,7 +2496,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2547,7 +2547,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2589,7 +2589,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2707,7 +2707,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2750,7 +2750,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2801,7 +2801,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2852,7 +2852,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2875,6 +2875,57 @@ } } }, + "/cronjobs/records/clean": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "清空计划任务记录", + "consumes": [ + "application/json" + ], + "tags": [ + "Cronjob" + ], + "summary": "Clean job records", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.OperateByID" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "x-panel-log": { + "BeforeFuntions": [ + { + "db": "cronjobs", + "input_colume": "id", + "input_value": "id", + "isList": false, + "output_colume": "name", + "output_value": "name" + } + ], + "bodyKeys": [ + "id" + ], + "formatEN": "clean cronjob [name] records", + "formatZH": "清空计划任务记录 [name]", + "paramKeys": [] + } + } + }, "/cronjobs/search": { "post": { "security": [ @@ -2975,7 +3026,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3027,7 +3078,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3160,7 +3211,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3224,7 +3275,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3275,7 +3326,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3326,7 +3377,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3366,7 +3417,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3453,7 +3504,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3599,7 +3650,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3639,7 +3690,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3679,7 +3730,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3741,7 +3792,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3905,7 +3956,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3945,7 +3996,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3987,7 +4038,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4029,7 +4080,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4066,7 +4117,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -4099,7 +4150,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4186,7 +4237,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4228,7 +4279,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4270,7 +4321,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4312,7 +4363,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4399,7 +4450,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4442,7 +4493,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4485,7 +4536,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4528,7 +4579,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4606,7 +4657,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4679,7 +4730,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4757,7 +4808,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4801,7 +4852,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4898,7 +4949,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4941,7 +4992,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5028,7 +5079,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5070,7 +5121,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5366,7 +5417,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5409,7 +5460,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5504,7 +5555,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5617,7 +5668,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5686,7 +5737,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5877,7 +5928,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5975,7 +6026,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6026,7 +6077,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6066,7 +6117,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6099,7 +6150,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6141,7 +6192,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6174,7 +6225,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6216,7 +6267,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6258,7 +6309,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6302,7 +6353,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6353,7 +6404,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6404,7 +6455,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6447,7 +6498,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6480,7 +6531,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6525,7 +6576,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6662,7 +6713,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6726,7 +6777,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6788,7 +6839,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6814,7 +6865,7 @@ "summary": "Clean monitor datas", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6854,7 +6905,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6894,7 +6945,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6944,7 +6995,7 @@ "summary": "Load system available status", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6977,7 +7028,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7020,7 +7071,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7071,7 +7122,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7123,7 +7174,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7166,7 +7217,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7217,7 +7268,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7333,7 +7384,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7376,7 +7427,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } }, @@ -7407,7 +7458,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7449,7 +7500,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7690,7 +7741,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7849,7 +7900,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7900,7 +7951,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7952,7 +8003,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8003,7 +8054,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8045,7 +8096,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8132,7 +8183,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8253,7 +8304,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8381,7 +8432,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8432,7 +8483,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8540,7 +8591,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8670,7 +8721,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8703,7 +8754,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8754,7 +8805,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8841,7 +8892,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8874,7 +8925,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8923,7 +8974,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8956,7 +9007,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9034,7 +9085,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9966,7 +10017,9 @@ "S3", "SFTP", "MINIO", - "LOCAL" + "LOCAL", + "COS", + "KODO" ] } } @@ -9988,6 +10041,9 @@ "name": { "type": "string" }, + "pingStatus": { + "type": "string" + }, "status": { "type": "string" }, @@ -10007,7 +10063,8 @@ "enum": [ "start", "stop", - "reload" + "disablePing", + "enablePing" ] } } @@ -10692,21 +10749,6 @@ } } }, - "dto.NginxKey": { - "type": "string", - "enum": [ - "index", - "limit-conn", - "ssl", - "http-per" - ], - "x-enum-varnames": [ - "Index", - "LimitConn", - "SSL", - "HttpPer" - ] - }, "dto.OperateByID": { "type": "object", "required": [ @@ -11233,7 +11275,9 @@ "OSS", "S3", "SFTP", - "MINIO" + "MINIO", + "COS", + "KODO" ] } } @@ -12179,7 +12223,7 @@ }, "params": {}, "scope": { - "$ref": "#/definitions/dto.NginxKey" + "type": "string" }, "websiteId": { "type": "integer" @@ -12193,7 +12237,7 @@ ], "properties": { "scope": { - "$ref": "#/definitions/dto.NginxKey" + "type": "string" }, "websiteId": { "type": "integer" diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml index a0e8a2b49..449575649 100644 --- a/cmd/server/docs/swagger.yaml +++ b/cmd/server/docs/swagger.yaml @@ -607,6 +607,8 @@ definitions: - SFTP - MINIO - LOCAL + - COS + - KODO type: string required: - fileDir @@ -624,6 +626,8 @@ definitions: properties: name: type: string + pingStatus: + type: string status: type: string version: @@ -635,7 +639,8 @@ definitions: enum: - start - stop - - reload + - disablePing + - enablePing type: string required: - operation @@ -1094,18 +1099,6 @@ definitions: subnet: type: string type: object - dto.NginxKey: - enum: - - index - - limit-conn - - ssl - - http-per - type: string - x-enum-varnames: - - Index - - LimitConn - - SSL - - HttpPer dto.OperateByID: properties: id: @@ -1456,6 +1449,8 @@ definitions: - S3 - SFTP - MINIO + - COS + - KODO type: string required: - from @@ -2082,7 +2077,7 @@ definitions: type: string params: {} scope: - $ref: '#/definitions/dto.NginxKey' + type: string websiteId: type: integer required: @@ -2091,7 +2086,7 @@ definitions: request.NginxScopeReq: properties: scope: - $ref: '#/definitions/dto.NginxKey' + type: string websiteId: type: integer required: @@ -2835,7 +2830,7 @@ paths: description: 获取应用更新版本 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Get app list update @@ -3073,7 +3068,7 @@ paths: $ref: '#/definitions/request.AppInstalledOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate installed app @@ -3140,7 +3135,7 @@ paths: $ref: '#/definitions/request.AppInstalledUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change app params @@ -3167,7 +3162,7 @@ paths: $ref: '#/definitions/request.PortUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change app port @@ -3196,7 +3191,7 @@ paths: $ref: '#/definitions/request.AppInstalledSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: List app installed @@ -3207,7 +3202,7 @@ paths: description: 同步已安装应用列表 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Sync app installed @@ -3233,7 +3228,7 @@ paths: $ref: '#/definitions/request.AppSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: List apps @@ -3265,7 +3260,7 @@ paths: description: 同步应用列表 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Sync app list @@ -3293,7 +3288,7 @@ paths: description: 判断是否为demo环境 responses: "200": - description: OK + description: "" summary: Check System isDemo tags: - Auth @@ -3311,7 +3306,7 @@ paths: $ref: '#/definitions/dto.InitUser' responses: "200": - description: OK + description: "" summary: Init user tags: - Auth @@ -3340,7 +3335,7 @@ paths: description: 用户登出 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: User logout @@ -3371,7 +3366,7 @@ paths: description: 判断是否为首次登录 responses: "200": - description: OK + description: "" summary: Check is First login tags: - Auth @@ -3389,7 +3384,7 @@ paths: $ref: '#/definitions/dto.ContainerCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create container @@ -3417,7 +3412,7 @@ paths: $ref: '#/definitions/dto.ComposeCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create compose @@ -3444,7 +3439,7 @@ paths: $ref: '#/definitions/dto.ComposeOperation' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate compose @@ -3494,7 +3489,7 @@ paths: $ref: '#/definitions/dto.ComposeCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Test compose @@ -3521,7 +3516,7 @@ paths: $ref: '#/definitions/dto.ComposeUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update compose @@ -3578,7 +3573,7 @@ paths: $ref: '#/definitions/dto.DaemonJsonConf' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update docker daemon.json @@ -3604,7 +3599,7 @@ paths: $ref: '#/definitions/dto.DaemonJsonUpdateByFile' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update docker daemon.json by upload file @@ -3630,7 +3625,7 @@ paths: $ref: '#/definitions/dto.DockerOperation' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate docker @@ -3716,7 +3711,7 @@ paths: $ref: '#/definitions/dto.ImageLoad' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load image @@ -3816,7 +3811,7 @@ paths: $ref: '#/definitions/dto.BatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete image @@ -3843,7 +3838,7 @@ paths: $ref: '#/definitions/dto.ImageSave' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Save image @@ -3896,7 +3891,7 @@ paths: $ref: '#/definitions/dto.ImageTag' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Tag image @@ -3952,7 +3947,7 @@ paths: $ref: '#/definitions/dto.NetworkCreat' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create network @@ -3979,7 +3974,7 @@ paths: $ref: '#/definitions/dto.BatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete network @@ -4030,7 +4025,7 @@ paths: $ref: '#/definitions/dto.ContainerOperation' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate Container @@ -4075,7 +4070,7 @@ paths: - application/json responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create image repo @@ -4104,7 +4099,7 @@ paths: - application/json responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete image repo @@ -4163,7 +4158,7 @@ paths: - application/json responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load repo status @@ -4185,7 +4180,7 @@ paths: - application/json responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update image repo @@ -4297,7 +4292,7 @@ paths: $ref: '#/definitions/dto.ComposeTemplateCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create compose template @@ -4324,7 +4319,7 @@ paths: $ref: '#/definitions/dto.BatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete compose template @@ -4381,7 +4376,7 @@ paths: $ref: '#/definitions/dto.ComposeTemplateUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update compose template @@ -4414,7 +4409,7 @@ paths: $ref: '#/definitions/dto.VolumeCreat' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create volume @@ -4441,7 +4436,7 @@ paths: $ref: '#/definitions/dto.BatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete volume @@ -4515,7 +4510,7 @@ paths: $ref: '#/definitions/dto.CronjobCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create cronjob @@ -4543,7 +4538,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete cronjob @@ -4576,7 +4571,7 @@ paths: $ref: '#/definitions/dto.CronjobDownload' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Download cronjob records @@ -4609,7 +4604,7 @@ paths: $ref: '#/definitions/dto.OperateByID' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Handle cronjob once @@ -4628,6 +4623,39 @@ paths: formatEN: manually execute the cronjob [name] formatZH: 手动执行计划任务 [name] paramKeys: [] + /cronjobs/records/clean: + post: + consumes: + - application/json + description: 清空计划任务记录 + parameters: + - description: request + in: body + name: request + required: true + schema: + $ref: '#/definitions/dto.OperateByID' + responses: + "200": + description: "" + security: + - ApiKeyAuth: [] + summary: Clean job records + tags: + - Cronjob + x-panel-log: + BeforeFuntions: + - db: cronjobs + input_colume: id + input_value: id + isList: false + output_colume: name + output_value: name + bodyKeys: + - id + formatEN: clean cronjob [name] records + formatZH: 清空计划任务记录 [name] + paramKeys: [] /cronjobs/search: post: consumes: @@ -4686,7 +4714,7 @@ paths: $ref: '#/definitions/dto.CronjobUpdateStatus' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update cronjob status @@ -4720,7 +4748,7 @@ paths: $ref: '#/definitions/dto.CronjobUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update cronjob @@ -4805,7 +4833,7 @@ paths: $ref: '#/definitions/dto.MysqlDBCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create mysql database @@ -4845,7 +4873,7 @@ paths: $ref: '#/definitions/dto.ChangeDBInfo' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change mysql access @@ -4878,7 +4906,7 @@ paths: $ref: '#/definitions/dto.ChangeDBInfo' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change mysql password @@ -4911,7 +4939,7 @@ paths: $ref: '#/definitions/dto.MysqlConfUpdateByFile' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update mysql conf by upload file @@ -4937,7 +4965,7 @@ paths: $ref: '#/definitions/dto.MysqlDBDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete mysql database @@ -4992,7 +5020,7 @@ paths: $ref: '#/definitions/dto.UpdateDescription' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update mysql database description @@ -5083,7 +5111,7 @@ paths: $ref: '#/definitions/dto.RedisConfUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update redis conf @@ -5109,7 +5137,7 @@ paths: $ref: '#/definitions/dto.RedisConfUpdateByFile' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update redis conf by file @@ -5135,7 +5163,7 @@ paths: $ref: '#/definitions/dto.ChangeDBInfo' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change redis password @@ -5174,7 +5202,7 @@ paths: $ref: '#/definitions/dto.RedisConfPersistenceUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update redis persistence conf @@ -5274,7 +5302,7 @@ paths: $ref: '#/definitions/dto.MysqlVariablesUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update mysql variables @@ -5300,7 +5328,7 @@ paths: $ref: '#/definitions/request.FileCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create file @@ -5327,7 +5355,7 @@ paths: $ref: '#/definitions/request.FileBatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Batch delete file @@ -5354,7 +5382,7 @@ paths: $ref: '#/definitions/request.FilePathCheck' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Check file exist @@ -5378,7 +5406,7 @@ paths: type: file responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: ChunkUpload file @@ -5398,7 +5426,7 @@ paths: $ref: '#/definitions/request.FileCompress' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Compress file @@ -5454,7 +5482,7 @@ paths: $ref: '#/definitions/request.FileDeCompress' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Decompress file @@ -5481,7 +5509,7 @@ paths: $ref: '#/definitions/request.FileDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete file @@ -5508,7 +5536,7 @@ paths: $ref: '#/definitions/request.FileDownload' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Download file @@ -5535,7 +5563,7 @@ paths: $ref: '#/definitions/dto.FilePath' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Download file with path @@ -5591,7 +5619,7 @@ paths: $ref: '#/definitions/request.FileCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change file mode @@ -5619,7 +5647,7 @@ paths: $ref: '#/definitions/request.FileMove' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Move file @@ -5647,7 +5675,7 @@ paths: $ref: '#/definitions/request.FileRename' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change file name @@ -5675,7 +5703,7 @@ paths: $ref: '#/definitions/request.FileEdit' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update file content @@ -5724,7 +5752,7 @@ paths: $ref: '#/definitions/request.DirSizeReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load file size @@ -5770,7 +5798,7 @@ paths: type: file responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Upload file @@ -5819,7 +5847,7 @@ paths: $ref: '#/definitions/request.FileWget' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Wget file @@ -5848,7 +5876,7 @@ paths: $ref: '#/definitions/dto.HostOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create host @@ -5909,7 +5937,7 @@ paths: $ref: '#/definitions/dto.CommandOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create command @@ -5937,7 +5965,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete command @@ -5992,7 +6020,7 @@ paths: $ref: '#/definitions/dto.CommandOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update command @@ -6019,7 +6047,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete host @@ -6204,7 +6232,7 @@ paths: $ref: '#/definitions/dto.GroupCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create group @@ -6232,7 +6260,7 @@ paths: $ref: '#/definitions/dto.OperateByID' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete group @@ -6293,7 +6321,7 @@ paths: $ref: '#/definitions/dto.GroupUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update group @@ -6364,7 +6392,7 @@ paths: $ref: '#/definitions/dto.HostConnTest' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Test host conn by info @@ -6406,7 +6434,7 @@ paths: $ref: '#/definitions/dto.ChangeHostGroup' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update host group @@ -6526,7 +6554,7 @@ paths: $ref: '#/definitions/request.NginxConfigFileUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update OpenResty conf by upload file @@ -6587,7 +6615,7 @@ paths: $ref: '#/definitions/request.NginxConfigUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update OpenResty conf @@ -6620,7 +6648,7 @@ paths: $ref: '#/definitions/request.RuntimeCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create runtime @@ -6646,7 +6674,7 @@ paths: type: string responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Get runtime @@ -6666,7 +6694,7 @@ paths: $ref: '#/definitions/request.RuntimeDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete runtime @@ -6693,7 +6721,7 @@ paths: $ref: '#/definitions/request.RuntimeSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: List runtimes @@ -6713,7 +6741,7 @@ paths: $ref: '#/definitions/request.RuntimeUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update runtime @@ -6740,7 +6768,7 @@ paths: $ref: '#/definitions/dto.BackupOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create backup account @@ -6767,7 +6795,7 @@ paths: $ref: '#/definitions/dto.CommonBackup' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Backup system data @@ -6796,7 +6824,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete backup account @@ -6829,7 +6857,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete backup record @@ -6862,7 +6890,7 @@ paths: $ref: '#/definitions/dto.DownloadRecord' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Download backup record @@ -6890,7 +6918,7 @@ paths: $ref: '#/definitions/dto.RecordSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Page backup records @@ -6910,7 +6938,7 @@ paths: $ref: '#/definitions/dto.CommonRecover' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Recover system data @@ -6940,7 +6968,7 @@ paths: $ref: '#/definitions/dto.CommonRecover' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Recover system data by upload @@ -7026,7 +7054,7 @@ paths: $ref: '#/definitions/dto.BackupOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update backup account @@ -7066,7 +7094,7 @@ paths: $ref: '#/definitions/dto.PasswordUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Reset system password expired @@ -7105,7 +7133,7 @@ paths: $ref: '#/definitions/dto.MfaCredential' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Bind mfa @@ -7122,7 +7150,7 @@ paths: description: 清空监控数据 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Clean monitor datas @@ -7148,7 +7176,7 @@ paths: $ref: '#/definitions/dto.PasswordUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update system password @@ -7174,7 +7202,7 @@ paths: $ref: '#/definitions/dto.PortUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update system port @@ -7205,7 +7233,7 @@ paths: description: 获取系统可用状态 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load system available status @@ -7225,7 +7253,7 @@ paths: $ref: '#/definitions/dto.SnapshotCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create system snapshot @@ -7253,7 +7281,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete system backup @@ -7286,7 +7314,7 @@ paths: $ref: '#/definitions/dto.UpdateDescription' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update snapshot description @@ -7320,7 +7348,7 @@ paths: $ref: '#/definitions/dto.SnapshotImport' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Import system snapshot @@ -7348,7 +7376,7 @@ paths: $ref: '#/definitions/dto.SnapshotRecover' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Recover system backup @@ -7381,7 +7409,7 @@ paths: $ref: '#/definitions/dto.SnapshotRecover' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Rollback system backup @@ -7455,7 +7483,7 @@ paths: $ref: '#/definitions/dto.SettingUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update system setting @@ -7483,7 +7511,7 @@ paths: $ref: '#/definitions/dto.Upgrade' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load release notes by version @@ -7502,7 +7530,7 @@ paths: $ref: '#/definitions/dto.Upgrade' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Upgrade @@ -7529,7 +7557,7 @@ paths: $ref: '#/definitions/request.WebsiteCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create website @@ -7682,7 +7710,7 @@ paths: $ref: '#/definitions/request.WebsiteResourceReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website acme account @@ -7781,7 +7809,7 @@ paths: $ref: '#/definitions/request.NginxConfigUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update nginx conf @@ -7814,7 +7842,7 @@ paths: $ref: '#/definitions/request.WebsiteDefaultUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change default server @@ -7848,7 +7876,7 @@ paths: $ref: '#/definitions/request.WebsiteDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website @@ -7881,7 +7909,7 @@ paths: $ref: '#/definitions/request.WebsiteDnsAccountCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create website dns account @@ -7908,7 +7936,7 @@ paths: $ref: '#/definitions/request.WebsiteResourceReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website dns account @@ -7963,7 +7991,7 @@ paths: $ref: '#/definitions/request.WebsiteDnsAccountUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website dns account @@ -8040,7 +8068,7 @@ paths: $ref: '#/definitions/request.WebsiteDomainDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website domain @@ -8122,7 +8150,7 @@ paths: $ref: '#/definitions/request.WebsiteNginxUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website nginx conf @@ -8155,7 +8183,7 @@ paths: $ref: '#/definitions/request.WebsiteOp' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate website @@ -8223,7 +8251,7 @@ paths: $ref: '#/definitions/request.WebsitePHPConfigUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website php conf @@ -8306,7 +8334,7 @@ paths: type: integer responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Search website ssl by id @@ -8326,7 +8354,7 @@ paths: $ref: '#/definitions/request.WebsiteResourceReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website ssl @@ -8359,7 +8387,7 @@ paths: $ref: '#/definitions/request.WebsiteSSLRenew' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Reset website ssl @@ -8414,7 +8442,7 @@ paths: $ref: '#/definitions/request.WebsiteSSLSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Page website ssl @@ -8434,7 +8462,7 @@ paths: $ref: '#/definitions/request.WebsiteSSLUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update ssl @@ -8466,7 +8494,7 @@ paths: type: integer responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Search website ssl by website id @@ -8486,7 +8514,7 @@ paths: $ref: '#/definitions/request.WebsiteUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website @@ -8535,7 +8563,7 @@ paths: $ref: '#/definitions/request.WebsiteWafUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website waf conf diff --git a/frontend/src/api/modules/cronjob.ts b/frontend/src/api/modules/cronjob.ts index 73d51fe82..95904b0a4 100644 --- a/frontend/src/api/modules/cronjob.ts +++ b/frontend/src/api/modules/cronjob.ts @@ -22,6 +22,10 @@ export const searchRecords = (params: Cronjob.SearchRecord) => { return http.post>(`cronjobs/search/records`, params); }; +export const cleanRecords = (id: number) => { + return http.post(`cronjobs/records/clean`, { id: id }); +}; + export const getRecordDetail = (params: string) => { return http.post(`cronjobs/search/detail`, { path: params }); }; diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 99e8b58ac..824250ef9 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -584,6 +584,8 @@ const message = { taskName: 'Task name', cronSpec: 'Lifecycle', cronSpecHelper: 'Enter the correct execution period', + cleanHelper: + 'This operation will retain the latest seven task execution records and log files. Do you want to continue?', directory: 'Backup directory', sourceDir: 'Backup directory', allOptionHelper: diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index bac5cbe94..b99ba1429 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -588,6 +588,7 @@ const message = { taskName: '任务名称', cronSpec: '执行周期', cronSpecHelper: '请输入正确的执行周期', + cleanHelper: '该操作将保留最新的 7 份任务执行记录和日志文件,是否继续?', directory: '备份目录', sourceDir: '备份目录', allOptionHelper: '当前计划任务为备份所有 {0},暂不支持直接下载,可在 {0} 备份列表中查看', diff --git a/frontend/src/views/cronjob/record/index.vue b/frontend/src/views/cronjob/record/index.vue index de06250f2..691b38d37 100644 --- a/frontend/src/views/cronjob/record/index.vue +++ b/frontend/src/views/cronjob/record/index.vue @@ -65,6 +65,7 @@ > {{ $t('commons.button.disable') }} + {{ $t('commons.button.enable') }} + + {{ $t('commons.button.clean') }} + @@ -289,7 +293,7 @@ import { reactive, ref } from 'vue'; import { Cronjob } from '@/api/interface/cronjob'; import { loadZero } from '@/utils/util'; -import { searchRecords, download, handleOnce, updateStatus } from '@/api/modules/cronjob'; +import { searchRecords, download, handleOnce, updateStatus, cleanRecords } from '@/api/modules/cronjob'; import { dateFormat } from '@/utils/util'; import i18n from '@/lang'; import { ElMessageBox } from 'element-plus'; @@ -519,6 +523,18 @@ const loadRecord = async (row: Cronjob.Record) => { currentRecordDetail.value = res.data; } }; +const cleanRecord = async () => { + ElMessageBox.confirm(i18n.global.t('cronjob.cleanHelper'), i18n.global.t('commons.button.clean'), { + confirmButtonText: i18n.global.t('commons.button.confirm'), + cancelButtonText: i18n.global.t('commons.button.cancel'), + type: 'info', + }).then(async () => { + await cleanRecords(dialogData.value.rowData.id); + MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); + search(true); + }); +}; + function isBackup() { return ( dialogData.value.rowData!.type === 'website' ||