mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-29 21:08:49 +01:00
Optimize attributeView image browsing (#14843)
This commit is contained in:
parent
b06cee76f8
commit
2b03a364af
7 changed files with 169 additions and 8 deletions
|
|
@ -600,6 +600,49 @@ func renderAttributeView(c *gin.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func getCurrentAttrViewImages(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
id := arg["id"].(string)
|
||||
viewIDArg := arg["viewID"]
|
||||
var viewID string
|
||||
if nil != viewIDArg {
|
||||
viewID = viewIDArg.(string)
|
||||
}
|
||||
page := 1
|
||||
pageArg := arg["page"]
|
||||
if nil != pageArg {
|
||||
page = int(pageArg.(float64))
|
||||
}
|
||||
|
||||
pageSize := -1
|
||||
pageSizeArg := arg["pageSize"]
|
||||
if nil != pageSizeArg {
|
||||
pageSize = int(pageSizeArg.(float64))
|
||||
}
|
||||
|
||||
query := ""
|
||||
queryArg := arg["query"]
|
||||
if nil != queryArg {
|
||||
query = queryArg.(string)
|
||||
}
|
||||
|
||||
images, err := model.GetCurrentAttributeViewImages(id, viewID, query, page, pageSize)
|
||||
if err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
ret.Data = images
|
||||
}
|
||||
|
||||
|
||||
func getAttributeViewKeys(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
|
|
@ -452,6 +452,8 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/av/getAttributeViewKeysByAvID", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getAttributeViewKeysByAvID)
|
||||
ginServer.Handle("POST", "/api/av/duplicateAttributeViewBlock", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, duplicateAttributeViewBlock)
|
||||
ginServer.Handle("POST", "/api/av/appendAttributeViewDetachedBlocksWithValues", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, appendAttributeViewDetachedBlocksWithValues)
|
||||
ginServer.Handle("POST", "/api/av/getCurrentAttrViewImages", model.CheckAuth, getCurrentAttrViewImages)
|
||||
|
||||
|
||||
ginServer.Handle("POST", "/api/ai/chatGPT", model.CheckAuth, model.CheckAdminRole, chatGPT)
|
||||
ginServer.Handle("POST", "/api/ai/chatGPTWithAction", model.CheckAuth, model.CheckAdminRole, chatGPTWithAction)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue