mirror of
https://shylinux.com/x/operation
synced 2025-04-25 01:08:04 +08:00
opt some
This commit is contained in:
parent
c4ac8bc279
commit
65a8e59689
2
Makefile
2
Makefile
@ -5,7 +5,7 @@ flags = -ldflags "-w -s" -v
|
|||||||
|
|
||||||
all: def
|
all: def
|
||||||
@date +"%Y-%m-%d %H:%M:%S"
|
@date +"%Y-%m-%d %H:%M:%S"
|
||||||
go build ${flags} -o ${binarys} src/main.go src/option.go${version} ${binpack} && ./${binarys} forever restart &>/dev/null
|
go build ${flags} -o ${binarys} src/main.go src/option.go ${version} ${binpack} && ./${binarys} forever restart &>/dev/null
|
||||||
|
|
||||||
def:
|
def:
|
||||||
@[ -f ${version} ] || echo "package main">${version}
|
@[ -f ${version} ] || echo "package main">${version}
|
||||||
|
1
go.mod
1
go.mod
@ -5,4 +5,5 @@ go 1.13
|
|||||||
require (
|
require (
|
||||||
shylinux.com/x/community v0.0.5 // indirect
|
shylinux.com/x/community v0.0.5 // indirect
|
||||||
shylinux.com/x/ice v1.5.44 // indirect
|
shylinux.com/x/ice v1.5.44 // indirect
|
||||||
|
shylinux.com/x/mysql-story v0.6.18 // indirect
|
||||||
)
|
)
|
||||||
|
2
go.sum
2
go.sum
@ -21,6 +21,7 @@ github.com/glerchundi/subcommands v0.0.0-20181212083838-923a6ccb11f8/go.mod h1:r
|
|||||||
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
|
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
|
||||||
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
||||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
|
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
|
||||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||||
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
@ -170,6 +171,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
|
|||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo=
|
||||||
gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
|
gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
|
||||||
gorm.io/driver/sqlite v1.5.6/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4=
|
gorm.io/driver/sqlite v1.5.6/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4=
|
||||||
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||||
|
21
src/dashboard/client.go
Normal file
21
src/dashboard/client.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package dashboard
|
||||||
|
|
||||||
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
|
type client struct{ Table }
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(client{}) }
|
||||||
|
|
||||||
|
type ClientType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
ClientMySQL ClientType = iota
|
||||||
|
ClientRedis
|
||||||
|
)
|
||||||
|
|
||||||
|
var ClientTypeList = map[ClientType]string{
|
||||||
|
ClientMySQL: "mysql",
|
||||||
|
ClientRedis: "redis",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s ClientType) String() string { return ClientTypeList[s] }
|
41
src/dashboard/common.go
Normal file
41
src/dashboard/common.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package dashboard
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/dashboard/model"
|
||||||
|
"shylinux.com/x/operation/src/operation"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Table struct {
|
||||||
|
operation.Table
|
||||||
|
list string `name:"list client_uid uid auto" role:"void"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case model.USER_CLIENT_ROLE:
|
||||||
|
s.InputsListRole(m, UserClientRoleList, arg...)
|
||||||
|
case model.CLIENT_TYPE:
|
||||||
|
s.InputsList(m, ClientTypeList, arg...)
|
||||||
|
default:
|
||||||
|
s.Table.Inputs(m, arg...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||||
|
m.RewriteAppend(func(value, key string, index int) string {
|
||||||
|
switch key {
|
||||||
|
case model.USER_CLIENT_ROLE:
|
||||||
|
value = UserClientRole(kit.Int(value)).String()
|
||||||
|
case model.CLIENT_TYPE:
|
||||||
|
value = ClientType(kit.Int(value)).String()
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
})
|
||||||
|
return s.Table.RewriteAppend(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tables struct{ Table }
|
||||||
|
|
||||||
|
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
|
35
src/dashboard/model/model.go
Normal file
35
src/dashboard/model/model.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "shylinux.com/x/mysql-story/src/db"
|
||||||
|
|
||||||
|
const (
|
||||||
|
UID = "uid"
|
||||||
|
NAME = "name"
|
||||||
|
TYPE = "type"
|
||||||
|
ROLE = "role"
|
||||||
|
TITLE = "title"
|
||||||
|
CONTENT = "content"
|
||||||
|
USER_UID = "user_uid"
|
||||||
|
USER_CLIENT_ROLE = "user_client_role"
|
||||||
|
CLIENT_UID = "client_uid"
|
||||||
|
CLIENT_NAME = "client_name"
|
||||||
|
CLIENT_TYPE = "client_type"
|
||||||
|
SUMMARY_UID = "summary_uid"
|
||||||
|
COMPANY_UID = "company_uid"
|
||||||
|
CITY_UID = "city_uid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserClient struct {
|
||||||
|
db.ModelUserPlace
|
||||||
|
ClientUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
type Client struct {
|
||||||
|
db.ModelPlace
|
||||||
|
CompanyUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
type Summary struct {
|
||||||
|
db.ModelContent
|
||||||
|
ClientUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { db.CmdModels("", &UserClient{}, &Client{}, &Summary{}) }
|
13
src/dashboard/portal.go
Normal file
13
src/dashboard/portal.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package dashboard
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/community/src/gonganxitong"
|
||||||
|
"shylinux.com/x/operation/src/operation"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Portal struct {
|
||||||
|
operation.Portal
|
||||||
|
placeCreate string `name:"placeCreate city_name* company_name* client_type*:select client_name*" role:"void"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { gonganxitong.PortalCmd(Portal{Portal: operation.NewPortal(userClient{}, client{})}) }
|
34
src/dashboard/portal.json
Normal file
34
src/dashboard/portal.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"portal": "数据分析",
|
||||||
|
"summary": "数据汇总",
|
||||||
|
"icons": {
|
||||||
|
"summary": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||||
|
},
|
||||||
|
"input": {
|
||||||
|
"My Client": "我的数据",
|
||||||
|
"user_client_role": "用户角色",
|
||||||
|
"client_name": "数据名称",
|
||||||
|
"client_type": "数据类型"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"user_client_role": {
|
||||||
|
"visitor": "访客",
|
||||||
|
"creator": "创建人",
|
||||||
|
"leader": "管理人员",
|
||||||
|
"worker": "工作人员",
|
||||||
|
"server": "服务人员",
|
||||||
|
"style": {
|
||||||
|
"creator": "danger",
|
||||||
|
"leader": "danger"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"client_type": {
|
||||||
|
"mysql": "MySQL",
|
||||||
|
"redis": "Redis",
|
||||||
|
"icons": {
|
||||||
|
"mysql": "https://2023-contexts.shylinux.com/p/src/studio/studio.png?pod=20230511-mysql-story",
|
||||||
|
"redis": "https://2023-contexts.shylinux.com/p/src/client/redis.png?pod=20230511-redis-story"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
src/dashboard/summary.go
Normal file
25
src/dashboard/summary.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package dashboard
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/dashboard/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type summary struct {
|
||||||
|
Table
|
||||||
|
client client
|
||||||
|
userClient userClient
|
||||||
|
create string `name:"create title* content*" role:"leader"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s summary) Create(m *ice.Message, arg ...string) {
|
||||||
|
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CLIENT_UID))...)
|
||||||
|
s.RecordEventWithName(m, "")
|
||||||
|
}
|
||||||
|
func (s summary) List(m *ice.Message, arg ...string) {
|
||||||
|
s.TablesWithRole(m, arg, s.userClient, s.client, s, model.TITLE, model.CONTENT).Display("")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(summary{}) }
|
9
src/dashboard/summary.js
Normal file
9
src/dashboard/summary.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Volcanos(chat.ONIMPORT, {
|
||||||
|
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
|
||||||
|
can.onimport.itemcards(can, msg, function(value) { return [
|
||||||
|
{view: html.TITLE, list: [value.title]},
|
||||||
|
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
|
||||||
|
{view: html.OUTPUT, list: [value.content]},
|
||||||
|
] })
|
||||||
|
},
|
||||||
|
})
|
15
src/dashboard/userClient.go
Normal file
15
src/dashboard/userClient.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package dashboard
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/operation"
|
||||||
|
)
|
||||||
|
|
||||||
|
type userClient struct{ Table }
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(userClient{}) }
|
||||||
|
|
||||||
|
type UserClientRole = operation.UserCloudRole
|
||||||
|
|
||||||
|
var UserClientRoleList = operation.UserCloudRoleList
|
41
src/development/common.go
Normal file
41
src/development/common.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package development
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/development/model"
|
||||||
|
"shylinux.com/x/operation/src/operation"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Table struct {
|
||||||
|
operation.Table
|
||||||
|
list string `name:"list repos_uid uid auto" role:"void"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case model.USER_REPOS_ROLE:
|
||||||
|
s.InputsListRole(m, UserReposRoleList, arg...)
|
||||||
|
case model.REPOS_TYPE:
|
||||||
|
s.InputsList(m, ReposTypeList, arg...)
|
||||||
|
default:
|
||||||
|
s.Table.Inputs(m, arg...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||||
|
m.RewriteAppend(func(value, key string, index int) string {
|
||||||
|
switch key {
|
||||||
|
case model.USER_REPOS_ROLE:
|
||||||
|
value = UserReposRole(kit.Int(value)).String()
|
||||||
|
case model.REPOS_TYPE:
|
||||||
|
value = ReposType(kit.Int(value)).String()
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
})
|
||||||
|
return s.Table.RewriteAppend(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tables struct{ Table }
|
||||||
|
|
||||||
|
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
|
35
src/development/model/model.go
Normal file
35
src/development/model/model.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "shylinux.com/x/mysql-story/src/db"
|
||||||
|
|
||||||
|
const (
|
||||||
|
UID = "uid"
|
||||||
|
NAME = "name"
|
||||||
|
TYPE = "type"
|
||||||
|
ROLE = "role"
|
||||||
|
TITLE = "title"
|
||||||
|
CONTENT = "content"
|
||||||
|
USER_UID = "user_uid"
|
||||||
|
USER_REPOS_ROLE = "user_repos_role"
|
||||||
|
REPOS_UID = "repos_uid"
|
||||||
|
REPOS_NAME = "repos_name"
|
||||||
|
REPOS_TYPE = "repos_type"
|
||||||
|
VERSION_UID = "version_uid"
|
||||||
|
COMPANY_UID = "company_uid"
|
||||||
|
CITY_UID = "city_uid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserRepos struct {
|
||||||
|
db.ModelUserPlace
|
||||||
|
ReposUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
type Repos struct {
|
||||||
|
db.ModelPlace
|
||||||
|
CompanyUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
type Version struct {
|
||||||
|
db.ModelContent
|
||||||
|
ReposUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { db.CmdModels("", &UserRepos{}, &Repos{}, &Version{}) }
|
13
src/development/portal.go
Normal file
13
src/development/portal.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package development
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/community/src/gonganxitong"
|
||||||
|
"shylinux.com/x/operation/src/operation"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Portal struct {
|
||||||
|
operation.Portal
|
||||||
|
placeCreate string `name:"placeCreate city_name* company_name* repos_type*:select repos_name*" role:"void"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { gonganxitong.PortalCmd(Portal{Portal: operation.NewPortal(userRepos{}, repos{})}) }
|
30
src/development/portal.json
Normal file
30
src/development/portal.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"portal": "软件开发",
|
||||||
|
"version": "版本",
|
||||||
|
"icons": {
|
||||||
|
"version": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||||
|
},
|
||||||
|
"input": {
|
||||||
|
"My Repos": "我的源码",
|
||||||
|
"user_repos_role": "用户角色",
|
||||||
|
"repos_name": "源码名称",
|
||||||
|
"repos_type": "源码类型"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"user_repos_role": {
|
||||||
|
"visitor": "访客",
|
||||||
|
"creator": "创建人",
|
||||||
|
"leader": "管理人员",
|
||||||
|
"worker": "工作人员",
|
||||||
|
"server": "服务人员",
|
||||||
|
"style": {
|
||||||
|
"creator": "danger",
|
||||||
|
"leader": "danger"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"repos_type": {
|
||||||
|
"local": "本地库",
|
||||||
|
"remote": "远程库"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
src/development/repos.go
Normal file
21
src/development/repos.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package development
|
||||||
|
|
||||||
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
|
type repos struct{ Table }
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(repos{}) }
|
||||||
|
|
||||||
|
type ReposType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
ReposLocal ReposType = iota
|
||||||
|
ReposRemote
|
||||||
|
)
|
||||||
|
|
||||||
|
var ReposTypeList = map[ReposType]string{
|
||||||
|
ReposLocal: "local",
|
||||||
|
ReposRemote: "remote",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s ReposType) String() string { return ReposTypeList[s] }
|
15
src/development/userRepos.go
Normal file
15
src/development/userRepos.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package development
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/operation"
|
||||||
|
)
|
||||||
|
|
||||||
|
type userRepos struct{ Table }
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(userRepos{}) }
|
||||||
|
|
||||||
|
type UserReposRole = operation.UserCloudRole
|
||||||
|
|
||||||
|
var UserReposRoleList = operation.UserCloudRoleList
|
25
src/development/version.go
Normal file
25
src/development/version.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package development
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/development/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type version struct {
|
||||||
|
Table
|
||||||
|
repos repos
|
||||||
|
userRepos userRepos
|
||||||
|
create string `name:"create title* content*" role:"leader"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s version) Create(m *ice.Message, arg ...string) {
|
||||||
|
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.REPOS_UID))...)
|
||||||
|
s.RecordEventWithName(m, "")
|
||||||
|
}
|
||||||
|
func (s version) List(m *ice.Message, arg ...string) {
|
||||||
|
s.TablesWithRole(m, arg, s.userRepos, s.repos, s, model.TITLE, model.CONTENT).Display("")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(version{}) }
|
9
src/development/version.js
Normal file
9
src/development/version.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Volcanos(chat.ONIMPORT, {
|
||||||
|
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
|
||||||
|
can.onimport.itemcards(can, msg, function(value) { return [
|
||||||
|
{view: html.TITLE, list: [value.title]},
|
||||||
|
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
|
||||||
|
{view: html.OUTPUT, list: [value.content]},
|
||||||
|
] })
|
||||||
|
},
|
||||||
|
})
|
@ -3,7 +3,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"shylinux.com/x/ice"
|
"shylinux.com/x/ice"
|
||||||
|
|
||||||
_ "shylinux.com/x/community/src/gonganxitong"
|
_ "shylinux.com/x/operation/src/dashboard"
|
||||||
|
_ "shylinux.com/x/operation/src/development"
|
||||||
|
_ "shylinux.com/x/operation/src/operation"
|
||||||
|
_ "shylinux.com/x/operation/src/production"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() { print(ice.Run()) }
|
func main() { print(ice.Run()) }
|
||||||
|
BIN
src/main.jpg
Normal file
BIN
src/main.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
21
src/operation/cloud.go
Normal file
21
src/operation/cloud.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package operation
|
||||||
|
|
||||||
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
|
type cloud struct{ Table }
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(cloud{}) }
|
||||||
|
|
||||||
|
type CloudType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
CloudAliyun CloudType = iota
|
||||||
|
CloudTencent
|
||||||
|
)
|
||||||
|
|
||||||
|
var CloudTypeList = map[CloudType]string{
|
||||||
|
CloudAliyun: "aliyun",
|
||||||
|
CloudTencent: "tencent",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s CloudType) String() string { return CloudTypeList[s] }
|
51
src/operation/common.go
Normal file
51
src/operation/common.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package operation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/community/src/gonganxitong"
|
||||||
|
"shylinux.com/x/enterprise/src/guanlixitong"
|
||||||
|
"shylinux.com/x/operation/src/operation/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Table struct {
|
||||||
|
guanlixitong.Table
|
||||||
|
list string `name:"list cloud_uid uid auto" role:"void"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case model.USER_CLOUD_ROLE:
|
||||||
|
s.InputsListRole(m, UserCloudRoleList, arg...)
|
||||||
|
case model.CLOUD_TYPE:
|
||||||
|
s.InputsList(m, CloudTypeList, arg...)
|
||||||
|
default:
|
||||||
|
s.Table.Inputs(m, arg...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||||
|
m.RewriteAppend(func(value, key string, index int) string {
|
||||||
|
switch key {
|
||||||
|
case model.USER_CLOUD_ROLE:
|
||||||
|
value = UserCloudRole(kit.Int(value)).String()
|
||||||
|
case model.CLOUD_TYPE:
|
||||||
|
value = CloudType(kit.Int(value)).String()
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
})
|
||||||
|
return s.Table.RewriteAppend(m)
|
||||||
|
}
|
||||||
|
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
|
||||||
|
role := UserCloudRole(s.UserPlaceRole(m))
|
||||||
|
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserCloudCreator.String())...), role.String())
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tables struct{ Table }
|
||||||
|
|
||||||
|
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
|
||||||
|
|
||||||
|
func NewPortal(userPlace gonganxitong.UserPlacer, place gonganxitong.Placer) Portal {
|
||||||
|
return Portal{Portal: guanlixitong.NewPortal(userPlace, place)}
|
||||||
|
}
|
35
src/operation/model/model.go
Normal file
35
src/operation/model/model.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "shylinux.com/x/mysql-story/src/db"
|
||||||
|
|
||||||
|
const (
|
||||||
|
UID = "uid"
|
||||||
|
NAME = "name"
|
||||||
|
TYPE = "type"
|
||||||
|
ROLE = "role"
|
||||||
|
TITLE = "title"
|
||||||
|
CONTENT = "content"
|
||||||
|
USER_UID = "user_uid"
|
||||||
|
USER_CLOUD_ROLE = "user_cloud_role"
|
||||||
|
CLOUD_UID = "cloud_uid"
|
||||||
|
CLOUD_NAME = "cloud_name"
|
||||||
|
CLOUD_TYPE = "cloud_type"
|
||||||
|
RELEASE_UID = "release_uid"
|
||||||
|
COMPANY_UID = "company_uid"
|
||||||
|
CITY_UID = "city_uid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserCloud struct {
|
||||||
|
db.ModelUserPlace
|
||||||
|
CloudUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
type Cloud struct {
|
||||||
|
db.ModelPlace
|
||||||
|
CompanyUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
type Release struct {
|
||||||
|
db.ModelContent
|
||||||
|
CloudUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { db.CmdModels("", &UserCloud{}, &Cloud{}, &Release{}) }
|
13
src/operation/portal.go
Normal file
13
src/operation/portal.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package operation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/community/src/gonganxitong"
|
||||||
|
"shylinux.com/x/enterprise/src/guanlixitong"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Portal struct {
|
||||||
|
guanlixitong.Portal
|
||||||
|
placeCreate string `name:"placeCreate city_name* company_name* cloud_type*:select cloud_name*" role:"void"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userCloud{}, cloud{})}) }
|
30
src/operation/portal.json
Normal file
30
src/operation/portal.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"portal": "系统运维",
|
||||||
|
"release": "发布",
|
||||||
|
"icons": {
|
||||||
|
"release": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||||
|
},
|
||||||
|
"input": {
|
||||||
|
"My Cloud": "我的系统",
|
||||||
|
"user_cloud_role": "用户角色",
|
||||||
|
"cloud_name": "系统名称",
|
||||||
|
"cloud_type": "系统类型"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"user_cloud_role": {
|
||||||
|
"visitor": "访客",
|
||||||
|
"creator": "创建人",
|
||||||
|
"leader": "管理人员",
|
||||||
|
"worker": "工作人员",
|
||||||
|
"server": "服务人员",
|
||||||
|
"style": {
|
||||||
|
"creator": "danger",
|
||||||
|
"leader": "danger"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cloud_type": {
|
||||||
|
"aliyun": "阿里云",
|
||||||
|
"tencent": "腾讯云"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
src/operation/release.go
Normal file
25
src/operation/release.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package operation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/operation/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type release struct {
|
||||||
|
Table
|
||||||
|
cloud cloud
|
||||||
|
userCloud userCloud
|
||||||
|
create string `name:"create title* content*" role:"leader"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s release) Create(m *ice.Message, arg ...string) {
|
||||||
|
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CLOUD_UID))...)
|
||||||
|
s.RecordEventWithName(m, "")
|
||||||
|
}
|
||||||
|
func (s release) List(m *ice.Message, arg ...string) {
|
||||||
|
s.TablesWithRole(m, arg, s.userCloud, s.cloud, s, model.TITLE, model.CONTENT).Display("")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(release{}) }
|
9
src/operation/release.js
Normal file
9
src/operation/release.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Volcanos(chat.ONIMPORT, {
|
||||||
|
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
|
||||||
|
can.onimport.itemcards(can, msg, function(value) { return [
|
||||||
|
{view: html.TITLE, list: [value.title]},
|
||||||
|
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
|
||||||
|
{view: html.OUTPUT, list: [value.content]},
|
||||||
|
] })
|
||||||
|
},
|
||||||
|
})
|
27
src/operation/userCloud.go
Normal file
27
src/operation/userCloud.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package operation
|
||||||
|
|
||||||
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
|
type userCloud struct{ Table }
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(userCloud{}) }
|
||||||
|
|
||||||
|
type UserCloudRole int
|
||||||
|
|
||||||
|
const (
|
||||||
|
UserCloudVisitor UserCloudRole = iota
|
||||||
|
UserCloudCreator
|
||||||
|
UserCloudLeader
|
||||||
|
UserCloudWorker
|
||||||
|
UserCloudServer
|
||||||
|
)
|
||||||
|
|
||||||
|
var UserCloudRoleList = map[UserCloudRole]string{
|
||||||
|
UserCloudVisitor: "visitor",
|
||||||
|
UserCloudCreator: "creator",
|
||||||
|
UserCloudLeader: "leader",
|
||||||
|
UserCloudWorker: "worker",
|
||||||
|
UserCloudServer: "server",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s UserCloudRole) String() string { return UserCloudRoleList[s] }
|
5
src/option.go
Normal file
5
src/option.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "shylinux.com/x/mysql-story/src/db/mysql"
|
||||||
|
)
|
41
src/production/common.go
Normal file
41
src/production/common.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package production
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/operation"
|
||||||
|
"shylinux.com/x/operation/src/production/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Table struct {
|
||||||
|
operation.Table
|
||||||
|
list string `name:"list story_uid uid auto" role:"void"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case model.USER_STORY_ROLE:
|
||||||
|
s.InputsListRole(m, UserStoryRoleList, arg...)
|
||||||
|
case model.STORY_TYPE:
|
||||||
|
s.InputsList(m, StoryTypeList, arg...)
|
||||||
|
default:
|
||||||
|
s.Table.Inputs(m, arg...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||||
|
m.RewriteAppend(func(value, key string, index int) string {
|
||||||
|
switch key {
|
||||||
|
case model.USER_STORY_ROLE:
|
||||||
|
value = UserStoryRole(kit.Int(value)).String()
|
||||||
|
case model.STORY_TYPE:
|
||||||
|
value = StoryType(kit.Int(value)).String()
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
})
|
||||||
|
return s.Table.RewriteAppend(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tables struct{ Table }
|
||||||
|
|
||||||
|
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
|
39
src/production/issue.go
Normal file
39
src/production/issue.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package production
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/production/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type issue struct {
|
||||||
|
Table
|
||||||
|
story story
|
||||||
|
userStory userStory
|
||||||
|
create string `name:"create title* content*" role:"leader"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s issue) Create(m *ice.Message, arg ...string) {
|
||||||
|
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.STORY_UID))...)
|
||||||
|
s.RecordEventWithName(m, "")
|
||||||
|
}
|
||||||
|
func (s issue) List(m *ice.Message, arg ...string) {
|
||||||
|
s.TablesWithRole(m, arg, s.userStory, s.story, s, model.TITLE, model.CONTENT).Display("")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(issue{}) }
|
||||||
|
|
||||||
|
type IssueType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
IssueFeature IssueType = iota
|
||||||
|
IssueBugfix
|
||||||
|
)
|
||||||
|
|
||||||
|
var IssueTypeList = map[IssueType]string{
|
||||||
|
IssueFeature: "feature",
|
||||||
|
IssueBugfix: "bugfix",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s IssueType) String() string { return IssueTypeList[s] }
|
9
src/production/issue.js
Normal file
9
src/production/issue.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Volcanos(chat.ONIMPORT, {
|
||||||
|
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
|
||||||
|
can.onimport.itemcards(can, msg, function(value) { return [
|
||||||
|
{view: html.TITLE, list: [value.title]},
|
||||||
|
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
|
||||||
|
{view: html.OUTPUT, list: [value.content]},
|
||||||
|
] })
|
||||||
|
},
|
||||||
|
})
|
35
src/production/model/model.go
Normal file
35
src/production/model/model.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "shylinux.com/x/mysql-story/src/db"
|
||||||
|
|
||||||
|
const (
|
||||||
|
UID = "uid"
|
||||||
|
NAME = "name"
|
||||||
|
TYPE = "type"
|
||||||
|
ROLE = "role"
|
||||||
|
TITLE = "title"
|
||||||
|
CONTENT = "content"
|
||||||
|
USER_UID = "user_uid"
|
||||||
|
USER_STORY_ROLE = "user_story_role"
|
||||||
|
STORY_UID = "story_uid"
|
||||||
|
STORY_NAME = "story_name"
|
||||||
|
STORY_TYPE = "story_type"
|
||||||
|
ISSUE_UID = "issue_uid"
|
||||||
|
COMPANY_UID = "company_uid"
|
||||||
|
CITY_UID = "city_uid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserStory struct {
|
||||||
|
db.ModelUserPlace
|
||||||
|
StoryUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
type Story struct {
|
||||||
|
db.ModelPlace
|
||||||
|
CompanyUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
type Issue struct {
|
||||||
|
db.ModelContent
|
||||||
|
StoryUID string `gorm:"type:char(32);index"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { db.CmdModels("", &UserStory{}, &Story{}, &Issue{}) }
|
13
src/production/portal.go
Normal file
13
src/production/portal.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package production
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/community/src/gonganxitong"
|
||||||
|
"shylinux.com/x/enterprise/src/guanlixitong"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Portal struct {
|
||||||
|
guanlixitong.Portal
|
||||||
|
placeCreate string `name:"placeCreate city_name* company_name* story_type*:select story_name*" role:"void"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userStory{}, story{})}) }
|
35
src/production/portal.json
Normal file
35
src/production/portal.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"portal": "产品迭代",
|
||||||
|
"issue": "场景应用",
|
||||||
|
"icons": {
|
||||||
|
"issue": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||||
|
},
|
||||||
|
"input": {
|
||||||
|
"My Story": "我的场景",
|
||||||
|
"user_story_role": "用户角色",
|
||||||
|
"story_name": "场景名称",
|
||||||
|
"story_type": "场景类型"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"user_story_role": {
|
||||||
|
"visitor": "访客",
|
||||||
|
"creator": "创建人",
|
||||||
|
"leader": "管理人员",
|
||||||
|
"worker": "工作人员",
|
||||||
|
"server": "服务人员",
|
||||||
|
"style": {
|
||||||
|
"creator": "danger",
|
||||||
|
"leader": "danger"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"story_type": {
|
||||||
|
"RD": "研发群",
|
||||||
|
"OP": "运维群",
|
||||||
|
"HR": "人力群"
|
||||||
|
},
|
||||||
|
"issue_type": {
|
||||||
|
"feature": "新功能",
|
||||||
|
"bugfix": "问题修复"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
src/production/story.go
Normal file
23
src/production/story.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package production
|
||||||
|
|
||||||
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
|
type story struct{ Table }
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(story{}) }
|
||||||
|
|
||||||
|
type StoryType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
StoryRD StoryType = iota
|
||||||
|
StoryOP
|
||||||
|
StoryHR
|
||||||
|
)
|
||||||
|
|
||||||
|
var StoryTypeList = map[StoryType]string{
|
||||||
|
StoryRD: "RD",
|
||||||
|
StoryOP: "OP",
|
||||||
|
StoryHR: "HR",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s StoryType) String() string { return StoryTypeList[s] }
|
15
src/production/userStory.go
Normal file
15
src/production/userStory.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package production
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
|
||||||
|
"shylinux.com/x/operation/src/operation"
|
||||||
|
)
|
||||||
|
|
||||||
|
type userStory struct{ Table }
|
||||||
|
|
||||||
|
func init() { ice.TeamCtxCmd(userStory{}) }
|
||||||
|
|
||||||
|
type UserStoryRole = operation.UserCloudRole
|
||||||
|
|
||||||
|
var UserStoryRoleList = operation.UserCloudRoleList
|
Loading…
x
Reference in New Issue
Block a user