|
@@ -7,7 +7,6 @@ import (
|
|
|
|
|
|
|
|
"github.com/GoAdminGroup/example/tables"
|
|
"github.com/GoAdminGroup/example/tables"
|
|
|
"github.com/GoAdminGroup/go-admin/engine"
|
|
"github.com/GoAdminGroup/go-admin/engine"
|
|
|
- "github.com/GoAdminGroup/go-admin/plugins/admin"
|
|
|
|
|
"github.com/GoAdminGroup/go-admin/plugins/example"
|
|
"github.com/GoAdminGroup/go-admin/plugins/example"
|
|
|
"github.com/GoAdminGroup/go-admin/template"
|
|
"github.com/GoAdminGroup/go-admin/template"
|
|
|
"github.com/GoAdminGroup/go-admin/template/chartjs"
|
|
"github.com/GoAdminGroup/go-admin/template/chartjs"
|
|
@@ -24,16 +23,6 @@ func main() {
|
|
|
|
|
|
|
|
eng := engine.Default()
|
|
eng := engine.Default()
|
|
|
|
|
|
|
|
- adminPlugin := admin.NewAdmin(tables.Generators)
|
|
|
|
|
-
|
|
|
|
|
- // add generator, first parameter is the url prefix of table when visit.
|
|
|
|
|
- // example:
|
|
|
|
|
- //
|
|
|
|
|
- // "user" => http://localhost:9033/admin/info/user
|
|
|
|
|
- //
|
|
|
|
|
- adminPlugin.AddGenerator("user", tables.GetUserTable)
|
|
|
|
|
- adminPlugin.AddGenerator("external", tables.GetExternalTable)
|
|
|
|
|
-
|
|
|
|
|
// customize a plugin
|
|
// customize a plugin
|
|
|
// 自己定制一个插件👇
|
|
// 自己定制一个插件👇
|
|
|
|
|
|
|
@@ -68,7 +57,15 @@ func main() {
|
|
|
// eng.AddConfig(cfg)
|
|
// eng.AddConfig(cfg)
|
|
|
|
|
|
|
|
if err := eng.AddConfigFromJSON("./config.json").
|
|
if err := eng.AddConfigFromJSON("./config.json").
|
|
|
- AddPlugins(adminPlugin, examplePlugin).
|
|
|
|
|
|
|
+ AddGenerators(tables.Generators).
|
|
|
|
|
+ // add generator, first parameter is the url prefix of table when visit.
|
|
|
|
|
+ // example:
|
|
|
|
|
+ //
|
|
|
|
|
+ // "user" => http://localhost:9033/admin/info/user
|
|
|
|
|
+ //
|
|
|
|
|
+ AddGenerator("user", tables.GetUserTable).
|
|
|
|
|
+ AddGenerator("external", tables.GetExternalTable).
|
|
|
|
|
+ AddPlugins(examplePlugin).
|
|
|
Use(r); err != nil {
|
|
Use(r); err != nil {
|
|
|
panic(err)
|
|
panic(err)
|
|
|
}
|
|
}
|