uadmin

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 47 Imported by: 0

README

uAdmin the Golang Web Framework

Easy to use, blazing fast and secure.

go report card GoDoc codecov Build Status

Originally open source by IntegrityNet Solutions and Services

For Documentation:

join gophers.slack.com

Social Media:

Screenshots

Dashboard Menu

Dashboard  

Log

Log  

Login Form

Login Form  

Features

  • AB Testing System
  • API Configuration
  • Approval System
  • Authentication and Permissions
  • Clean and sharp UI
  • Dashboard customization
  • Data Access API (dAPI)
  • Database schema migration
  • Error Handling
  • Export to Excel
  • Form and List customization
  • Image Cropping
  • IP address and port configuration
  • Log feature that keeps track of many things in your app
  • Metric System
  • Multilingual translation
  • MySQL Database Support
  • Offers FREE hosting for your app while you are developing by using a single command: uadmin publish
  • Pretty good security features (SSL, 2-Factor Authentication, Password Reset, Hash Salt, Database Encryption)
  • Public access to media
  • Self relation of foreign key/many2many
  • Sending an email from your app by establishing an email configuration
  • System settings which can be used system wide to keep application settings
  • Tag support for fields
  • Translation files preloading
  • Validation for user input
  • Webcam support on image and file fields

Minimum requirements

Operating System Architectures Notes
FreeBSD 10.3 or later amd64, 386 Debian GNU/kFreeBSD not supported
Linux 2.6.23 or later with glibc amd64, 386, arm, arm64, s390x, ppc64le CentOS/RHEL 5.x not supported. Install from source for other libc.
macOS 10.10 or later amd64 Use the clang or gcc that comes with Xcode for cgo support.
Windows 7, Server 2008 R2 or later amd64, 386 Use MinGW gcc. No need for cygwin or msys.
  • A C compiler is required only if you plan to use cgo.
  • You only need to install the command line tools for Xcode. If you have already installed Xcode 4.3+, you can install it from the Components tab of the Downloads preferences panel.
Hardware
  • RAM - minimum 256MB
  • CPU - minimum 2GHz
Software
  • Go Version 1.12 or later

Installation

$ go get -u github.com/sergeyglazyrindev/uadmin/...

To test if your installation is fine, run the uadmin command line:

$ uadmin
Usage: uadmin COMMAND [--src]
This tools helps you prepare a folder for a new project or update static files and templates

Commands:
  prepare         Generates folders and prepares static and templates
  version         Shows the version of uAdmin

Arguments:
  --src           If you want to copy static files and templates from src folder

Get full documentation online:
https://uadmin-docs.readthedocs.io/en/latest/

Your First App

Let's build your first app which is a Todo list. First, we will create a folder for your project and prepare it.

$ mkdir -p ~/go/src/github.com/your_name/todo
$ cd ~/go/src/github.com/your_name/todo
$ uadmin prepare
[   OK   ]   Created: /Users/abdullah/go/src/github.com/twistedhardware/test/models
[   OK   ]   Created: /Users/abdullah/go/src/github.com/twistedhardware/test/api
[   OK   ]   Created: /Users/abdullah/go/src/github.com/twistedhardware/test/views
[   OK   ]   Created: /Users/abdullah/go/src/github.com/twistedhardware/test/media
[  INFO  ]   Copying static/templates from: /Users/abdullah/go/pkg/mod/github.com/sergeyglazyrindev/uadmin@v0.6.0
[   OK   ]   Created: /Users/abdullah/go/src/github.com/twistedhardware/test/static
[   OK   ]   Created: /Users/abdullah/go/src/github.com/twistedhardware/test/templates

Now use your code editor to create main.go and put this code inside it.

package main

import (
	"github.com/sergeyglazyrindev/uadmin"
	"time"
)

type Todo struct {
	uadmin.Model
	Name        string
	Description string `uadmin:"html"`
	TargetDate  time.Time
	Progress    int `uadmin:"progress_bar"`
}

func main() {
	uadmin.Register(Todo{})
	uadmin.StartServer()
}

Prepare modules

$ go mod init
go: creating new go.mod: module github.com/twistedhardware/test
go: to add module requirements and sums:
	go mod tidy

$ go mod tidy
go: finding module for package github.com/sergeyglazyrindev/uadmin
go: found github.com/sergeyglazyrindev/uadmin in github.com/sergeyglazyrindev/uadmin v0.6.0

Run your app (Linux, Apple macOS or Windows):

$ go build; ./todo
[   OK   ]   Initializing DB: [14/14]
[   OK   ]   Initializing Languages: [185/185]
[  INFO  ]   Auto generated admin user. Username:admin, Password:admin.
[   OK   ]   Synching System Settings: [49/49]
[   OK   ]   Server Started: http://0.0.0.0:8080
         ___       __          _
  __  __/   | ____/ /___ ___  (_)___
 / / / / /| |/ __  / __ '__ \/ / __ \
/ /_/ / ___ / /_/ / / / / / / / / / /
\__,_/_/  |_\__,_/_/ /_/ /_/_/_/ /_/

In Windows:

> go build && todo.exe
[   OK   ]   Initializing DB: [14/14]
[   OK   ]   Initializing Languages: [185/185]
[  INFO  ]   Auto generated admin user. Username:admin, Password:admin.
[   OK   ]   Synching System Settings: [49/49]
[   OK   ]   Server Started: http://0.0.0.0:8080
         ___       __          _
  __  __/   | ____/ /___ ___  (_)___
 / / / / /| |/ __  / __  __ \/ / __ \
/ /_/ / ___ / /_/ / / / / / / / / / /
\__,_/_/  |_\__,_/_/ /_/ /_/_/_/ /_/

Quick Reference

Overriding Save Function

func (m *Model) Save() {
	// business logic
	uadmin.Save(m)
}

Validation

func (m Model) Validate() (ret map[string]string) {
  ret = map[string]string{}
  if m.Name != "test" {
    ret["Name"] = "Error name not found"
  }
  return
}

Dockerize Your App

Create `Docker

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearApp added in v1.0.1

func ClearApp()

func ClearTestApp added in v1.0.1

func ClearTestApp()

func Run added in v1.0.1

func Run(t *testing.T, currentsuite suite.TestingSuite)

func StoreCurrentApp added in v1.0.1

func StoreCurrentApp(app *App)

func TestHTTPResponse added in v1.0.1

func TestHTTPResponse(t *testing.T, app *App, req *http.Request, f func(w *httptest.ResponseRecorder) bool)

Helper function to process a request and test its response

Types

type AddLanguageHandler added in v1.0.1

type AddLanguageHandler struct {
}

func (AddLanguageHandler) GetHelpText added in v1.0.1

func (command AddLanguageHandler) GetHelpText() string

func (AddLanguageHandler) Proceed added in v1.0.1

func (command AddLanguageHandler) Proceed(subaction string, args []string) error

type AddLanguageHandlerOptions added in v1.0.1

type AddLanguageHandlerOptions struct {
	Code string `short:"c" required:"true" description:"Language you wanna add to the system'"`
}

type AdminCommand added in v1.0.1

type AdminCommand struct {
}

func (AdminCommand) GetHelpText added in v1.0.1

func (c AdminCommand) GetHelpText() string

func (AdminCommand) Proceed added in v1.0.1

func (c AdminCommand) Proceed(subaction string, args []string) error

type AdminStartServerOptions added in v1.0.1

type AdminStartServerOptions struct {
}

type App added in v1.0.1

type App struct {
	Config              *core.UadminConfig
	Database            *core.Database
	Router              *gin.Engine
	CommandRegistry     *CommandRegistry
	BlueprintRegistry   core.IBlueprintRegistry
	DashboardAdminPanel *core.DashboardAdminPanel
}

func NewApp added in v1.0.1

func NewApp(environment string, dontInitialize ...bool) *App

func NewFullAppForTests added in v1.0.1

func NewFullAppForTests() *App

func NewTestApp added in v1.0.1

func NewTestApp() *App

func (App) BaseAPIUrl added in v1.0.1

func (a App) BaseAPIUrl() string

func (App) ExecuteCommand added in v1.0.1

func (a App) ExecuteCommand()

func (App) Initialize added in v1.0.1

func (a App) Initialize()

func (App) InitializeRouter added in v1.0.1

func (a App) InitializeRouter()

func (App) RegisterBaseBlueprints added in v1.0.1

func (a App) RegisterBaseBlueprints()

func (App) RegisterBaseCommands added in v1.0.1

func (a App) RegisterBaseCommands()

func (App) RegisterBlueprint added in v1.0.1

func (a App) RegisterBlueprint(blueprint core.IBlueprint)

func (App) RegisterCommand added in v1.0.1

func (a App) RegisterCommand(name string, command core.ICommand)

func (App) StartAPI added in v1.0.1

func (a App) StartAPI()

func (App) StartAdmin added in v1.0.1

func (a App) StartAdmin()

func (App) TriggerCommandExecution added in v1.0.1

func (a App) TriggerCommandExecution(action string, subaction string, params []string)

type BlueprintCommand added in v1.0.1

type BlueprintCommand struct {
}

func (BlueprintCommand) GetHelpText added in v1.0.1

func (c BlueprintCommand) GetHelpText() string

func (BlueprintCommand) Proceed added in v1.0.1

func (c BlueprintCommand) Proceed(subaction string, args []string) error

type CommandRegistry added in v1.0.1

type CommandRegistry struct {
	Actions map[string]core.ICommand
}

func (CommandRegistry) MakeHelpText added in v1.0.1

func (r CommandRegistry) MakeHelpText() string

type ContentTypeCommand added in v1.0.1

type ContentTypeCommand struct {
}

func (ContentTypeCommand) GetHelpText added in v1.0.1

func (c ContentTypeCommand) GetHelpText() string

func (ContentTypeCommand) Proceed added in v1.0.1

func (c ContentTypeCommand) Proceed(subaction string, args []string) error

type CreateBlueprint added in v1.0.1

type CreateBlueprint struct {
}

func (CreateBlueprint) GetHelpText added in v1.0.1

func (command CreateBlueprint) GetHelpText() string

func (CreateBlueprint) Proceed added in v1.0.1

func (command CreateBlueprint) Proceed(subaction string, args []string) error

type CreateBlueprintOptions added in v1.0.1

type CreateBlueprintOptions struct {
	Message string `short:"m" required:"true" description:"Describe what is this migration for"`
	Name    string `short:"n" required:"true" description:"Blueprint you'd like to create migration for'"`
}

type CreateFakedDataCommand added in v1.0.1

type CreateFakedDataCommand struct {
}

func (CreateFakedDataCommand) GetHelpText added in v1.0.1

func (c CreateFakedDataCommand) GetHelpText() string

func (CreateFakedDataCommand) Proceed added in v1.0.1

func (c CreateFakedDataCommand) Proceed(subaction string, args []string) error

type CreateMigration added in v1.0.1

type CreateMigration struct {
}

func (CreateMigration) GetHelpText added in v1.0.1

func (command CreateMigration) GetHelpText() string

func (CreateMigration) Proceed added in v1.0.1

func (command CreateMigration) Proceed(subaction string, args []string) error

type CreateMigrationOptions added in v1.0.1

type CreateMigrationOptions struct {
	Message   string `short:"m" description:"Describe what is this migration for"`
	Blueprint string `short:"b" description:"Blueprint you'd like to create migration for"`
	MergeMode bool   `long:"merge" description:"Merge conflicted migrations"`
}

type CreateSuperadmin added in v1.0.1

type CreateSuperadmin struct {
}

func (CreateSuperadmin) GetHelpText added in v1.0.1

func (command CreateSuperadmin) GetHelpText() string

func (CreateSuperadmin) Proceed added in v1.0.1

func (command CreateSuperadmin) Proceed(subaction string, args []string) error

type DetermineConflictsMigration added in v1.0.1

type DetermineConflictsMigration struct {
}

func (DetermineConflictsMigration) GetHelpText added in v1.0.1

func (command DetermineConflictsMigration) GetHelpText() string

func (DetermineConflictsMigration) Proceed added in v1.0.1

func (command DetermineConflictsMigration) Proceed(subaction string, args []string) error

type DownMigration added in v1.0.1

type DownMigration struct {
}

func (DownMigration) GetHelpText added in v1.0.1

func (command DownMigration) GetHelpText() string

func (DownMigration) Proceed added in v1.0.1

func (command DownMigration) Proceed(subaction string, args []string) error

type DownMigrationOptions added in v1.0.1

type DownMigrationOptions struct {
	MigrationName string `short:"m" required:"false" default:"" description:"Migration downgrade your database to"`
}

type LanguageCommand added in v1.0.1

type LanguageCommand struct {
}

func (LanguageCommand) GetHelpText added in v1.0.1

func (c LanguageCommand) GetHelpText() string

func (LanguageCommand) Proceed added in v1.0.1

func (c LanguageCommand) Proceed(subaction string, args []string) error

type MigrateCommand added in v1.0.1

type MigrateCommand struct {
}

func (MigrateCommand) GetHelpText added in v1.0.1

func (c MigrateCommand) GetHelpText() string

func (MigrateCommand) Proceed added in v1.0.1

func (c MigrateCommand) Proceed(subaction string, args []string) error

type Migration added in v1.0.1

type Migration struct {
	gorm.Model
	MigrationName string `gorm:"index:migration_migration_name,unique"`
	AppliedAt     time.Time
}

type OpenAPICommand added in v1.0.1

type OpenAPICommand struct {
}

func (OpenAPICommand) GetHelpText added in v1.0.1

func (c OpenAPICommand) GetHelpText() string

func (OpenAPICommand) Proceed added in v1.0.1

func (c OpenAPICommand) Proceed(subaction string, args []string) error

type ServeAdminServer added in v1.0.1

type ServeAdminServer struct {
}

func (ServeAdminServer) GetHelpText added in v1.0.1

func (command ServeAdminServer) GetHelpText() string

func (ServeAdminServer) Proceed added in v1.0.1

func (command ServeAdminServer) Proceed(subaction string, args []string) error

type ServeOpenAPIEditorCommand added in v1.0.1

type ServeOpenAPIEditorCommand struct {
}

func (ServeOpenAPIEditorCommand) GetHelpText added in v1.0.1

func (command ServeOpenAPIEditorCommand) GetHelpText() string

func (ServeOpenAPIEditorCommand) Proceed added in v1.0.1

func (command ServeOpenAPIEditorCommand) Proceed(subaction string, args []string) error

type ServeSwaggerServer added in v1.0.1

type ServeSwaggerServer struct {
}

func (ServeSwaggerServer) GetHelpText added in v1.0.1

func (command ServeSwaggerServer) GetHelpText() string

func (ServeSwaggerServer) Proceed added in v1.0.1

func (command ServeSwaggerServer) Proceed(subaction string, args []string) error

type ServeSwaggerServerOptions added in v1.0.1

type ServeSwaggerServerOptions struct {
}

type SuperadminCommand added in v1.0.1

type SuperadminCommand struct {
}

func (SuperadminCommand) GetHelpText added in v1.0.1

func (c SuperadminCommand) GetHelpText() string

func (SuperadminCommand) Proceed added in v1.0.1

func (c SuperadminCommand) Proceed(subaction string, args []string) error

type SuperadminCommandOptions added in v1.0.1

type SuperadminCommandOptions struct {
	Username  string `short:"n" required:"true" description:"Username" valid:"username-uadmin,username-unique"`
	Email     string `short:"e" required:"true" description:"Email'" valid:"email,email-unique"`
	FirstName string `short:"f" required:"false" description:"First name'"`
	LastName  string `short:"l" required:"false" description:"Last name'"`
}

type SwaggerCommand added in v1.0.1

type SwaggerCommand struct {
}

func (SwaggerCommand) GetHelpText added in v1.0.1

func (c SwaggerCommand) GetHelpText() string

func (SwaggerCommand) Proceed added in v1.0.1

func (c SwaggerCommand) Proceed(subaction string, args []string) error

type SyncContentTypes added in v1.0.1

type SyncContentTypes struct {
}

func (SyncContentTypes) GetHelpText added in v1.0.1

func (command SyncContentTypes) GetHelpText() string

func (SyncContentTypes) Proceed added in v1.0.1

func (command SyncContentTypes) Proceed(subaction string, args []string) error

type TestSuite added in v1.0.1

type TestSuite struct {
	suite.Suite
	App *App
}

func (*TestSuite) SetupTest added in v1.0.1

func (suite *TestSuite) SetupTest()

func (*TestSuite) TearDownSuite added in v1.0.1

func (suite *TestSuite) TearDownSuite()

type UpMigration added in v1.0.1

type UpMigration struct {
}

func (UpMigration) GetHelpText added in v1.0.1

func (command UpMigration) GetHelpText() string

func (UpMigration) Proceed added in v1.0.1

func (command UpMigration) Proceed(subaction string, args []string) error

type UpMigrationOptions added in v1.0.1

type UpMigrationOptions struct {
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL