Skip to content

Commit f5e7852

Browse files
author
ssongliu
committed
fix: Improve application parameter modification logs
1 parent d64cb3d commit f5e7852

4 files changed

Lines changed: 604 additions & 586 deletions

File tree

agent/app/api/v2/app_install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func (b *BaseApi) GetParams(c *gin.Context) {
294294
// @Security ApiKeyAuth
295295
// @Security Timestamp
296296
// @Router /apps/installed/params/update [post]
297-
// @x-panel-log {"bodyKeys":["installId"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"应用参数修改 [installId]","formatEN":"Application param update [installId]"}
297+
// @x-panel-log {"bodyKeys":["installId"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"installId","isList":false,"db":"app_installs","output_column":"name","output_value":"name"}],"formatZH":"应用参数修改 [name]","formatEN":"Application param update [name]"}
298298
func (b *BaseApi) UpdateInstalled(c *gin.Context) {
299299
var req request.AppInstalledUpdate
300300
if err := helper.CheckBindAndValidate(&req, c); err != nil {

core/cmd/server/docs/swagger_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ func TestGenerateXlog(t *testing.T) {
3838
logContent := ""
3939
for _, comment := range d.Doc.List {
4040
if strings.HasPrefix(comment.Text, "// @Router") {
41-
routerContent = replaceStr(comment.Text, "// @Router", "[post]", "[get]", " ")
41+
routerContent = replaceStr(comment.Text, "// @Router", "[post]", "[get]")
4242
}
4343
if strings.HasPrefix(comment.Text, "// @x-panel-log") {
44-
logContent = replaceStr(comment.Text, "// @x-panel-log", " ")
44+
logContent = replaceStr(comment.Text, "// @x-panel-log")
4545
}
4646
}
4747
if len(routerContent) != 0 && len(logContent) != 0 {
4848
var item operationJson
4949
if err := json.Unmarshal([]byte(logContent), &item); err != nil {
50-
panic(fmt.Sprintf("json unamrshal failed, err: %v", err))
50+
panic(fmt.Sprintf("json unmarshal failed, err: %v", err))
5151
}
5252
xlogMap[routerContent] = item
5353
}
@@ -186,6 +186,7 @@ func replaceStr(val string, rep ...string) string {
186186
for _, item := range rep {
187187
val = strings.ReplaceAll(val, item, "")
188188
}
189+
val = strings.TrimSpace(val)
189190
return val
190191
}
191192

0 commit comments

Comments
 (0)