mirror of
https://shylinux.com/x/operation
synced 2025-04-25 01:08:04 +08:00
49 lines
1.0 KiB
Go
49 lines
1.0 KiB
Go
package dashboard
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
kit "shylinux.com/x/toolkits"
|
|
|
|
"shylinux.com/x/operation/src/dashboard/model"
|
|
)
|
|
|
|
type client struct {
|
|
Table
|
|
fields string `data:"host,port,username,database"`
|
|
config string `name:"config host* port* username* password* database*" role:"leader"`
|
|
}
|
|
|
|
func (s client) List(m *ice.Message, arg ...string) {
|
|
if len(arg) == 1 {
|
|
s.SelectDetail(m, model.UID, arg[0])
|
|
if m.Append(model.USERNAME) == "" {
|
|
m.SetAppend().EchoInfoButton("", s.Config)
|
|
} else {
|
|
m.PushAction(s.Config).Action(s.Config)
|
|
s.UserPlaceInit(m)
|
|
}
|
|
}
|
|
}
|
|
func (s client) Config(m *ice.Message, arg ...string) {
|
|
s.Update(m, kit.Dict(arg), model.UID, m.Option(model.CLIENT_UID))
|
|
s.UserPlaceInit(m)
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(client{}) }
|
|
|
|
type ClientType int
|
|
|
|
const (
|
|
ClientPlace ClientType = iota
|
|
ClientMySQL
|
|
ClientRedis
|
|
)
|
|
|
|
var ClientTypeList = map[ClientType]string{
|
|
ClientPlace: "place",
|
|
ClientMySQL: "mysql",
|
|
ClientRedis: "redis",
|
|
}
|
|
|
|
func (s ClientType) String() string { return ClientTypeList[s] }
|