apinto_dashboard

package module
v1.2.1-beta Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Apinto Dashboard

Go Report Card Releases LICENSE

  • Apinto Dashboard项目main分支与Apinto项目main分支同步更新

  • 当前Apinto Dashboard最新版本为v1.1.3-beta,Apinto要求版本不低于v0.8.4

注意:main分支为开发主要分支,频繁更新可能导致使用不稳定,若需要使用稳定版本,请查看release

什么是Apinto Dashboard

Apinto Dashboard是开源网关Apinto的可视化UI项目。

此后,大家将告别繁琐复杂的命令行Curl命令,只需在Dashboard上轻轻一点,便可实现与开源网关Apinto的交互,极大地简化了Apinto的配置流程,降低了学习及使用成本。

Apinto Dashboard与Apinto交互流程如下图所示

Apinto Dashboard与Apinto交互流程图

编译
  1. 进入build/cmd文件夹,执行编译脚本
cd builds/cmd && ./build.sh {版本号}
  1. 编译后的文件存放在 out/apinto-dashboard-{版本号} 文件夹中
部署
  1. 启动Apinto开源网关,Apinto启动教程请点击

  2. 下载并解压安装包

wget https://github.com/eolinker/apinto-dashboard/releases/download/${version}/apinto-dashboard_${version}_linux_amd64.tar.gz && tar -zxvf apinto-dashboard_${version}_linux_amd64.tar.gz && cd apinto-dashboard

上述命令中的 ${version} 为 Apinto dashboard的版本号,需要根据 Apinto 版本部署对应的 Apinto Dashboard 版本

下表为Apinto和Apinto Dashboard的版本联系

Apinto版本 Apinto Dashboard版本
0.8.x v1.1.3-beta
v0.6.x-0.7.x v1.0.4-beta

下列示例命令以Apinto Dashboard v1.1.3-beta版本为例

wget https://github.com/eolinker/apinto-dashboard/releases/download/v1.2.0-beta/apinto-dashboard_v1.2.0-beta_linux_amd64.tar.gz && tar -zxvf apinto-dashboard_v1.2.0-beta_linux_amd64.tar.gz && cd apinto-dashboard

apinto-dashboard支持在arm64、i386、amd64架构上运行,请根据需要下载对应架构及系统的安装包,安装包下载请点击跳转

  1. 编辑配置文件config.yml
zone: zh_cn # 时区,根据时区获取当地语言的前端渲染页面,可选项:zh_cn|ja_jp| en_us,当前版本仅支持zh_cn
default: monitor
apinto:		# Apinto openAPI地址列表,若有多个节点,可填写多个节点的openAPI地址
  - "http://127.0.0.1:9400"   
port: 8081    # dashboard监听端口
user_details:	# 用户账号获取渠道
  type: file	# 文件,当前版本只支持读取文件
  file: ./account.yml	# 文件名称
professions:    # 流程阶段,下面配置中的name和profession为dashboard在apinto的映射名称,下述配置内容将会在dashboard导航栏中展现
  - name: services    # dashboard模块:服务
    profession: service # apinto模块:服务
    i18n_name:    # 国际化语言名称
      zh_cn: 上游服务   # 中文描述
      en_us: upstream services  # 英文描述
  - name: templates  # dashboard模块:插件模版
    profession: template # apinto模块:插件模版
    i18n_name:
      zh_cn: 模版
      en_us: template
  - name: discoveries    # dashboard模块:服务发现
    profession: discovery    # apinto模块:服务发现
    i18n_name:
      zh_cn: 服务发现
      en_us: discoveries
  - name: outputs        # dashboard模块:输出器
    profession: output    # apinto模块:输出器
    i18n_name:
      zh_cn: 输出
      en_us: outputs

用户账号、密码默认均为admin。如若需要修改账号密码信息,可编辑account.yml文件,语法遵从yaml语法,配置详细说明如下:

account_list: # 账号列表
- user_name: admin	# 账号
  password: admin		# 密码
  info:							# 基本信息
    desc: admin用户		# 描述
  1. 启动程序

(1) 在当前窗口运行,该方式启动的程序,当窗口关闭,进程也会关闭

./apinto-dashboard

(2)在后台运行

nohup ./apinto-dashboard > logs/stdout_apinto-dashboard_"$(date ‘+%Y%m%d-%H%M%S‘)".log 2>&1 &
  1. 浏览器打开Apinto Dashboard地址,本示例在本地部署,因此ip为127.0.0.1,端口为8081

image-20220616181447371

  1. 在浏览器中输入账号密码登录即可

至此,部署启用教程已结束,如需了解更多使用教程,请点击更多

联系我们
关于我们

EOLINK 是领先的 API 管理服务供应商,为全球超过3000家企业提供专业的 API 研发管理、API自动化测试、API监控、API网关等服务。是首家为ITSS(中国电子工业标准化技术协会)制定API研发管理行业规范的企业。

官方网站:https://www.eolink.com

免费下载PC桌面端:https://www.eolink.com/pc/

Documentation

Index

Constants

View Source
const (
	SessionName = "SESSIONID"
	CallBack    = "callback"
)
View Source
const (
	OptLogin  = "login"
	OptLogout = "logout"
	OptCreate = "create"
	OptUpdate = "update"
	OptDelete = "delete"
)

Variables

View Source
var (
	ErrorNotLogin               = errors.New("not login")
	ErrorUsernameNotFound       = errors.New("username not found")
	ErrorUserDetailsServiceNeed = errors.New("need UserDetailsService")
)
View Source
var UserDetailsKey = userDetailsKey{}

UserDetailsKey is the request context key under which UserDetails are stored.

Functions

func AddActivityLog

func AddActivityLog(r *http.Request, user, operation, target, content string, args []*Arg)

func Create

func Create(config *Config) (http.Handler, error)

func IsDirExist

func IsDirExist(dir string) bool

判断目录是否存在

func MustUsername

func MustUsername(req *http.Request) string

func NewAccountHandler

func NewAccountHandler(userDetailsService IUserDetailsService, ser http.Handler, blacklist []string) http.Handler

func RetTemplate

func RetTemplate(baseDir string, appends ...string)

func SetActivityLogAddHandler

func SetActivityLogAddHandler(h ActivityLogAddHandler, fileterForwarded bool)

Types

type AccountHandler

type AccountHandler struct {
	// contains filtered or unexported fields
}

func (*AccountHandler) Api

func (*AccountHandler) Clear

func (h *AccountHandler) Clear()

func (*AccountHandler) Post

func (*AccountHandler) View

type ActivityLogAddHandler

type ActivityLogAddHandler interface {
	Add(user, ip, content, operation, target string, args []*Arg) error
}

type ActivityLogGetHandler

type ActivityLogGetHandler interface {
	GetLogList(offset, limit int, user, operation, target string, startUnix, endUnix int64) ([]*LogEntity, int64, error)
}

type Arg

type Arg struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

type Config

type Config struct {
	DefaultZone        ZoneName
	Modules            []*Module
	UserDetailsService IUserDetailsService
	DefaultModule      string
}

type IModule

type IModule interface {
	http.Handler
	ViewLookup
}

type IOperation

type IOperation interface {
}

type IUserDetailsService

type IUserDetailsService interface {
	// LoadUserByUsername Locates the user based on the username.
	LoadUserByUsername(username string) (UserDetails, error)
}

type LogEntity

type LogEntity struct {
	Time      string `json:"time"`
	User      string `json:"user"`
	IP        string `json:"ip"`
	Operation string `json:"operation"`
	Target    string `json:"target"`
	Content   string `json:"content"`
	Args      []*Arg `json:"args"`
}

type Module

type Module struct {
	Path     string
	Handler  IModule
	Name     string
	I18nName map[ZoneName]string `json:"i18n_name"`
	NotView  bool
}

type ModuleItem

type ModuleItem struct {
	Name     string              `json:"name"`
	I18nName map[ZoneName]string `json:"i18n_name"`
	Path     string              `json:"path"`
}

type ModuleItemPlan

type ModuleItemPlan struct {
	// contains filtered or unexported fields
}

func NewModuleItemPlan

func NewModuleItemPlan(modules []*ModuleItem) *ModuleItemPlan

func (*ModuleItemPlan) CreateViewData

func (mp *ModuleItemPlan) CreateViewData(name string, data interface{}, err error, user UserDetails) map[string]interface{}

type ModuleViewFinder

type ModuleViewFinder struct {
	// contains filtered or unexported fields
}

func NewViewModuleEmpty

func NewViewModuleEmpty(prefix string, views map[string]string, defaultName string) *ModuleViewFinder

func (*ModuleViewFinder) Lookup

func (v *ModuleViewFinder) Lookup(r *http.Request) (view string, has bool)

type Operation

type Operation struct {
}

type SessionManager

type SessionManager struct {
	// contains filtered or unexported fields
}

func NewSessionManager

func NewSessionManager() *SessionManager

func (*SessionManager) Delete

func (sm *SessionManager) Delete(session string)

func (*SessionManager) Get

func (sm *SessionManager) Get(session string) (UserDetails, bool)

func (*SessionManager) Set

func (sm *SessionManager) Set(session string, details UserDetails)

type TemplateWriter

type TemplateWriter struct {
	// contains filtered or unexported fields
}

func NewTemplateWriter

func NewTemplateWriter() *TemplateWriter

func (*TemplateWriter) Header

func (t *TemplateWriter) Header() http.Header

func (*TemplateWriter) Write

func (t *TemplateWriter) Write(bytes []byte) (int, error)

func (*TemplateWriter) WriteHeader

func (t *TemplateWriter) WriteHeader(statusCode int)

func (*TemplateWriter) WriteHeaderTo

func (t *TemplateWriter) WriteHeaderTo(w http.ResponseWriter)

func (*TemplateWriter) WriteTo

func (t *TemplateWriter) WriteTo(w http.ResponseWriter)

type UserDetails

type UserDetails interface {

	// GetUsername  Returns the username used to authenticate the user.
	GetUsername() string
	// GetAuthorities Returns the authorities granted to the user.
	GetAuthorities() map[string]interface{}
	// GetPassword Returns the password used to authenticate the user.
	GetPassword() string
	// IsAccountNonExpired Indicates whether the user's account has expired.
	IsAccountNonExpired() bool
	// IsAccountNonLocked Indicates whether the user is locked or unlocked.
	IsAccountNonLocked() bool
	// IsCredentialsNonExpired Indicates whether the user's credentials (password) has expired.
	IsCredentialsNonExpired() bool
	// IsEnabled Indicates whether the user is enabled or disabled.
	IsEnabled() bool
}

func UserDetailsFromRequest

func UserDetailsFromRequest(req *http.Request) (UserDetails, error)

type ViewHandlerFunc

type ViewHandlerFunc func(r *http.Request) (view string, data interface{}, err error)

func (ViewHandlerFunc) Lookup

func (f ViewHandlerFunc) Lookup(r *http.Request) (view string, data interface{}, err error)

type ViewLookup

type ViewLookup interface {
	Lookup(r *http.Request) (view string, data interface{}, has bool)
}

type ViewServer

type ViewServer struct {
	// contains filtered or unexported fields
}

func (*ViewServer) ServeHTTP

func (v *ViewServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Views

type Views struct {
	// contains filtered or unexported fields
}

func (*Views) Error

func (v *Views) Error(w http.ResponseWriter, cache *TemplateWriter)

func (*Views) ServeHTTP

func (v *Views) ServeHTTP(w http.ResponseWriter, req *http.Request)

type ZoneName

type ZoneName string
const (
	ZhCn ZoneName = "zh_cn"
	JaJp ZoneName = "ja_jp"
	EnUs ZoneName = "EN_US"
)

func (ZoneName) Read

func (zone ZoneName) Read(from map[ZoneName]string) string

Jump to

Keyboard shortcuts

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