forked from GoAdminGroup/go-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_list.go
39 lines (33 loc) · 1.1 KB
/
api_list.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package controller
import (
"github.com/plumk97/go-admin/context"
"github.com/plumk97/go-admin/plugins/admin/modules/constant"
"github.com/plumk97/go-admin/plugins/admin/modules/parameter"
"github.com/plumk97/go-admin/plugins/admin/modules/response"
)
func (h *Handler) ApiList(ctx *context.Context) {
prefix := ctx.Query(constant.PrefixKey)
panel := h.table(prefix, ctx)
params := parameter.GetParam(ctx.Request.URL, panel.GetInfo().DefaultPageSize, panel.GetInfo().SortField,
panel.GetInfo().GetSort())
panel, panelInfo, urls, err := h.showTableData(ctx, prefix, params, panel, "api_")
if err != nil {
response.Error(ctx, err.Error())
return
}
response.OkWithData(ctx, map[string]interface{}{
"panel": panelInfo,
"footer": panelInfo.Paginator.GetContent() + panel.GetInfo().FooterHtml,
"header": aDataTable().GetDataTableHeader() + panel.GetInfo().HeaderHtml,
"prefix": h.config.PrefixFixSlash(),
"urls": map[string]string{
"edit": urls[0],
"new": urls[1],
"delete": urls[2],
"export": urls[3],
"detail": urls[4],
"info": urls[5],
"update": urls[6],
},
})
}