Chart export & import

This commit is contained in:
cuigh
2018-04-08 18:40:15 +08:00
parent 8be8cd382c
commit 7d1bf77be3
7 changed files with 79 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ type ChartController struct {
Query web.HandlerFunc `path:"/query" name:"chart.query" authorize:"?" desc:"chart query"`
New web.HandlerFunc `path:"/new" name:"chart.new" authorize:"!" desc:"new chart page"`
Create web.HandlerFunc `path:"/new" method:"post" name:"chart.create" authorize:"!" desc:"create chart"`
Detail web.HandlerFunc `path:"/:name/detail" name:"chart.detail" authorize:"?" desc:"chart detail"`
Edit web.HandlerFunc `path:"/:name/edit" name:"chart.edit" authorize:"!" desc:"edit chart page"`
Delete web.HandlerFunc `path:"/:name/delete" method:"post" name:"chart.delete" authorize:"!" desc:"delete chart"`
Update web.HandlerFunc `path:"/:name/edit" method:"post" name:"chart.update" authorize:"!" desc:"update chart"`
@@ -32,6 +33,7 @@ func Chart() (c *ChartController) {
Query: chartQuery,
New: chartNew,
Create: chartCreate,
Detail: chartDetail,
Edit: chartEdit,
Update: chartUpdate,
Delete: chartDelete,
@@ -50,6 +52,16 @@ func chartList(ctx web.Context) error {
return ctx.Render("system/chart/list", m)
}
func chartDetail(ctx web.Context) error {
name := ctx.P("name")
chart, err := biz.Chart.Get(name)
if err != nil {
return err
}
return ctx.JSON(chart, " ")
}
func chartQuery(ctx web.Context) error {
charts, err := biz.Chart.List()
if err != nil {