| | package echo |
| |
|
| | import ( |
| | |
| | _ "github.com/GoAdminGroup/go-admin/adapter/echo" |
| | "github.com/GoAdminGroup/go-admin/modules/config" |
| | "github.com/GoAdminGroup/go-admin/modules/language" |
| | "github.com/GoAdminGroup/go-admin/plugins/admin/modules/table" |
| |
|
| | |
| | _ "github.com/GoAdminGroup/go-admin/modules/db/drivers/mysql" |
| | |
| | _ "github.com/GoAdminGroup/go-admin/modules/db/drivers/postgres" |
| | |
| | _ "github.com/GoAdminGroup/go-admin/modules/db/drivers/sqlite" |
| | |
| | _ "github.com/GoAdminGroup/go-admin/modules/db/drivers/mssql" |
| | |
| | "github.com/GoAdminGroup/themes/adminlte" |
| |
|
| | "net/http" |
| | "os" |
| |
|
| | "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/template" |
| | "github.com/GoAdminGroup/go-admin/template/chartjs" |
| | "github.com/GoAdminGroup/go-admin/tests/tables" |
| | "github.com/labstack/echo/v4" |
| | ) |
| |
|
| | func internalHandler() http.Handler { |
| | e := echo.New() |
| |
|
| | eng := engine.Default() |
| |
|
| | adminPlugin := admin.NewAdmin(tables.Generators) |
| | adminPlugin.AddGenerator("user", tables.GetUserTable) |
| | template.AddComp(chartjs.NewChart()) |
| |
|
| | examplePlugin := example.NewExample() |
| |
|
| | if err := eng.AddConfigFromJSON(os.Args[len(os.Args)-1]). |
| | AddPlugins(adminPlugin, examplePlugin).Use(e); err != nil { |
| | panic(err) |
| | } |
| |
|
| | eng.HTML("GET", "/admin", tables.GetContent) |
| |
|
| | return e |
| | } |
| |
|
| | func NewHandler(dbs config.DatabaseList, gens table.GeneratorList) http.Handler { |
| | e := echo.New() |
| |
|
| | eng := engine.Default() |
| |
|
| | adminPlugin := admin.NewAdmin(gens) |
| |
|
| | template.AddComp(chartjs.NewChart()) |
| |
|
| | if err := eng.AddConfig(&config.Config{ |
| | Databases: dbs, |
| | UrlPrefix: "admin", |
| | Store: config.Store{ |
| | Path: "./uploads", |
| | Prefix: "uploads", |
| | }, |
| | Language: language.EN, |
| | IndexUrl: "/", |
| | Debug: true, |
| | ColorScheme: adminlte.ColorschemeSkinBlack, |
| | }). |
| | AddPlugins(adminPlugin).Use(e); err != nil { |
| | panic(err) |
| | } |
| |
|
| | eng.HTML("GET", "/admin", tables.GetContent) |
| |
|
| | return e |
| | } |
| |
|