add api: /board/:bid/pure (#1073)
This commit is contained in:
parent
14ad3b1b0a
commit
7c351e09e5
|
@ -71,6 +71,20 @@ func (b *Board) Del() error {
|
|||
})
|
||||
}
|
||||
|
||||
func BoardGetByID(id int64) (*Board, error) {
|
||||
var lst []*Board
|
||||
err := DB().Where("id = ?", id).Find(&lst).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(lst) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return lst[0], nil
|
||||
}
|
||||
|
||||
// BoardGet for detail page
|
||||
func BoardGet(where string, args ...interface{}) (*Board, error) {
|
||||
var lst []*Board
|
||||
|
|
|
@ -177,6 +177,7 @@ func configRoute(r *gin.Engine, version string) {
|
|||
pages.POST("/busi-group/:id/board/:bid/clone", auth(), user(), perm("/dashboards/add"), bgrw(), boardClone)
|
||||
|
||||
pages.GET("/board/:bid", auth(), user(), boardGet)
|
||||
pages.GET("/board/:bid/pure", boardPureGet)
|
||||
pages.PUT("/board/:bid", auth(), user(), perm("/dashboards/put"), boardPut)
|
||||
pages.PUT("/board/:bid/configs", auth(), user(), perm("/dashboards/put"), boardPutConfigs)
|
||||
pages.DELETE("/boards", auth(), user(), perm("/dashboards/del"), boardDel)
|
||||
|
|
|
@ -51,6 +51,17 @@ func boardGet(c *gin.Context) {
|
|||
ginx.NewRender(c).Data(board, nil)
|
||||
}
|
||||
|
||||
func boardPureGet(c *gin.Context) {
|
||||
board, err := models.BoardGetByID(ginx.UrlParamInt64(c, "bid"))
|
||||
ginx.Dangerous(err)
|
||||
|
||||
if board == nil {
|
||||
ginx.Bomb(http.StatusNotFound, "No such dashboard")
|
||||
}
|
||||
|
||||
ginx.NewRender(c).Data(board, nil)
|
||||
}
|
||||
|
||||
// bgrwCheck
|
||||
func boardDel(c *gin.Context) {
|
||||
var f idsForm
|
||||
|
|
Loading…
Reference in New Issue