This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-10-06 22:18:42 +08:00
parent 2eed8c96c5
commit ae99747748
17 changed files with 70 additions and 234 deletions

View File

@ -2,6 +2,7 @@ package development
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web"
@ -16,6 +17,14 @@ type Table struct {
list string `name:"list repos_uid uid auto" role:"void"`
}
func (s Table) BeforeAction(m *ice.Message, arg ...string) {
if len(arg) == 0 {
return
}
kit.If(len(arg) == 1 || arg[0] != ctx.ACTION, func() { m.Option(model.REPOS_UID, arg[0]) })
msg := m.Cmd(repos{}, s.Select, model.UID, m.Option(model.REPOS_UID), ice.Maps{mdb.TABLE: ""})
m.Options(model.REPOS_NAME, msg.Append(model.NAME), model.REPOS_TYPE, msg.Append(model.TYPE))
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.USER_REPOS_ROLE:
@ -25,18 +34,16 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
case model.REPOS_NAME:
switch ReposType(kit.Int(m.Option(model.REPOS_TYPE))) {
case ReposSystem:
m.Cmdy(web.SPACE, ice.OPS, web.DREAM).CutTo(mdb.NAME, arg[0])
s.SpaceOpsCmdy(m, web.DREAM).CutTo(mdb.NAME, arg[0])
case ReposLibrary:
m.Cmdy(web.CODE_GIT_REPOS).CutTo(nfs.REPOS, arg[0])
case ReposGithub:
}
case model.REPOS_LINK:
switch ReposType(kit.Int(m.Option(model.REPOS_TYPE))) {
case ReposSystem:
m.Cmdy(web.SPACE, ice.OPS, web.DREAM).CutTo(nfs.REPOS, arg[0])
s.SpaceOpsCmdy(m, web.DREAM).CutTo(nfs.REPOS, arg[0])
case ReposLibrary:
m.Cmdy(web.CODE_GIT_REPOS).CutTo(web.ORIGIN, arg[0])
case ReposGithub:
}
default:
s.Table.Inputs(m, arg...)

View File

@ -11,22 +11,21 @@ import (
type history struct {
Tables
repos repos
order string `data:"1"`
list string `name:"list repos_uid commit file auto" role:"void"`
order string `data:"12"`
list string `name:"list repos_uid commit auto" role:"void"`
}
func (s history) List(m *ice.Message, arg ...string) {
msg := m.Cmd(s.repos, s.Select, model.UID, arg[0])
switch ReposType(kit.Int(msg.Append(model.TYPE))) {
switch ReposType(kit.Int(m.Option(model.REPOS_TYPE))) {
case ReposSystem:
m.Cmdy(web.SPACE, ice.OPS, web.CODE_GIT_REPOS, msg.Append(model.NAME), "master", arg[1:])
s.SpaceOpsCmdy(m, web.CODE_GIT_REPOS, m.Option(model.REPOS_NAME), "master", arg[1:])
case ReposLibrary:
m.Cmdy(web.CODE_GIT_REPOS, msg.Append(model.NAME), "master", arg[1:])
m.Cmdy(web.CODE_GIT_REPOS, m.Option(model.REPOS_NAME), "master", arg[1:])
}
if len(arg) == 1 {
m.Display("")
} else {
m.Display("/plugin/table.js")
m.DisplayTable()
}
}

View File

@ -25,7 +25,6 @@ type UserRepos struct {
type Repos struct {
db.ModelPlace
CompanyUID string `gorm:"type:char(32);index"`
Path string `gorm:"type:varchar(255)"`
Link string `gorm:"type:varchar(255)"`
}
type Version struct {

View File

@ -2,7 +2,6 @@ package development
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
@ -20,7 +19,7 @@ type Portal struct {
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
switch ReposType(kit.Int(m.Option(model.REPOS_TYPE))) {
case ReposSystem:
msg := m.Cmd(web.SPACE, ice.OPS, web.DREAM, mdb.CREATE, m.Option(model.REPOS_NAME), m.Option(model.REPOS_LINK), kit.Dict(ice.MSG_USERROLE, aaa.TECH))
msg := s.SpaceOpsCmd(m, web.DREAM, mdb.CREATE, m.Option(model.REPOS_NAME), m.Option(model.REPOS_LINK))
arg = append(arg, model.NAME, msg.Option(model.NAME))
case ReposLibrary:
case ReposGithub:

View File

@ -1,17 +1,18 @@
{
"portal": "软件开发",
"version": "版本",
"history": "记录",
"serve": "服务",
"config": "配置",
"serve": "服务模块",
"history": "提交记录",
"imports": "注入依赖库",
"icons": {
"serve": "https://img.icons8.com/officel/80/activity-grid.png",
"version": "https://img.icons8.com/officel/80/activity-grid.png",
"history": "https://img.icons8.com/officel/80/activity-grid.png"
"serve": "https://img.icons8.com/officel/80/activity-grid.png"
},
"style": {
"open": "notice"
},
"input": {
"My Repos": "我的源码",
"user_repos_role": "用户角色",
"repos_uid": "源码",
"repos_name": "源码名称",
"repos_type": "源码类型",
"repos_link": "源码地址"

View File

@ -1,17 +1,21 @@
package development
import (
"path"
"strings"
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/core/code"
"shylinux.com/x/icebergs/misc/git"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/api"
"shylinux.com/x/operation/src/development/model"
)
@ -23,52 +27,59 @@ type serve struct {
autogen string `name:"autogen name* help* class* table*" icon:"bi bi-plus-square-dotted" role:"leader,worker"`
}
func (s serve) BeforeAction(m *ice.Message, arg ...string) {
if len(arg) == 0 {
return
}
kit.If(len(arg) == 1 || arg[0] != ctx.ACTION, func() { m.Option(model.REPOS_UID, arg[0]) })
msg := m.Cmd(s.repos, s.Select, model.UID, m.Option(model.REPOS_UID), ice.Maps{mdb.TABLE: ""})
m.Options(model.REPOS_NAME, msg.Append(model.NAME), model.REPOS_TYPE, msg.Append(model.TYPE))
}
func (s serve) Imports(m *ice.Message, arg ...string) {
s.spaceCmdy(m, web.CODE_GIT_REPOS, "init", kit.MergeURL2(m.Option(ice.MSG_USERHOST), "/x/"+m.Option(model.REPOS_NAME)))
s.spaceCmdy(m, web.CODE_GIT_REPOS, code.INIT, kit.MergeURL2(m.Option(ice.MSG_USERHOST), web.X(m.Option(model.REPOS_NAME))))
s.spaceImport(m, "gonganxitong", "shylinux.com/x/community")
s.spaceImport(m, "db/mysql", "shylinux.com/x/mysql-story")
s.spaceCompile(m)
}
func (s serve) Autogen(m *ice.Message, arg ...string) {
s.SpaceCmdy(m.SpawnSilent(), ice.OPS, web.CODE_COMPILE, code.DEVPACK)
s.spaceCmdy(m, "web.team.gonganxitong.service", code.AUTOGEN, arg)
s.spaceRepos(m, "add", "src")
s.spaceRepos(m, "commit", "-am", "add some")
s.spaceRepos(m, "push")
defer s.SpaceOpsCmdy(m.SpawnSilent(), web.CODE_GIT_REPOS, mdb.CREATE, path.Join(nfs.USR_LOCAL_WORK, m.Option(model.REPOS_NAME)))
s.SpaceOpsCmdy(m.SpawnSilent(), web.CODE_COMPILE, code.DEVPACK)
s.spaceCmdy(m, api.GONGANXITONG_SERVICE, code.AUTOGEN, arg)
s.spaceRepos(m, git.ADD, nfs.SRC)
s.spaceRepos(m, git.COMMIT, "-am", "add "+m.Option(model.NAME))
s.spaceRepos(m, git.PUSH)
s.spaceCompile(m)
}
func (s serve) List(m *ice.Message, arg ...string) {
if len(arg) == 0 {
return
}
switch ReposType(kit.Int(m.Option(model.REPOS_TYPE))) {
case ReposSystem:
if s.spaceCmd(m, ctx.COMMAND, "web.team.gonganxitong.portal").Length() == 0 {
s.Button(m, "", s.Imports)
if s.spaceCmd(m, ctx.COMMAND, api.GONGANXITONG_SERVICE).Length() == 0 {
if m.IsTech() {
s.Button(m, "请注入依赖库", s.Imports)
} else {
m.Echo("系统未安化")
}
return
}
s.spaceCmd(m, nfs.DIR, nfs.SRC, nfs.PATH, nfs.SIZE, kit.Dict(
nfs.DIR_DEEP, ice.TRUE, nfs.DIR_TYPE, nfs.TYPE_CAT, nfs.DIR_REG, "portal.go",
s.spaceCmdy(m, nfs.DIR, nfs.SRC, nfs.PATH, nfs.SIZE, mdb.TIME, kit.Dict(
nfs.DIR_DEEP, ice.TRUE, nfs.DIR_TYPE, nfs.TYPE_CAT, nfs.DIR_REG, nfs.PORTAL_JSON,
)).Table(func(value ice.Maps) {
m.Push(model.NAME, strings.Split(value[nfs.PATH], "/")[1])
})
m.PushAction(s.Open, s.Config, s.Vimer).Action(s.Autogen).Display("")
s.Button(m, "", s.Autogen)
}).SortStrR(mdb.TIME)
if m.IsTech() {
m.PushAction(s.Open, s.Conf, s.Code, s.Data).Action(s.Autogen).Display("")
s.Button(m, "请创建服务模块", s.Autogen)
} else {
m.Action()
}
}
}
func (s serve) Open(m *ice.Message, arg ...string) {
m.ProcessOpen(s.spaceLink(m))
m.ProcessOpen(s.spaceLink(m, model.REPOS_UID, m.Option(model.REPOS_UID)))
}
func (s serve) Config(m *ice.Message, arg ...string) {
m.ProcessOpen(s.spaceLink(m, "view", "table"))
func (s serve) Conf(m *ice.Message, arg ...string) {
m.ProcessOpen(s.spaceLink(m, mdb.VIEW, mdb.TABLE))
}
func (s serve) Vimer(m *ice.Message, arg ...string) {
m.ProcessOpen(kit.MergeURL(web.S(m.Option(model.REPOS_NAME))+web.C("vimer"), nfs.PATH, "src/", nfs.FILE, m.Option(model.NAME)+"/portal.go"))
func (s serve) Code(m *ice.Message, arg ...string) {
m.ProcessOpen(kit.MergeURL(web.S(m.Option(model.REPOS_NAME))+web.C(code.VIMER), nfs.PATH, nfs.SRC, nfs.FILE, m.Option(model.NAME)+"/"+nfs.PORTAL_GO))
}
func (s serve) Data(m *ice.Message, arg ...string) {
m.ProcessOpen(kit.MergeURL(web.S(m.Option(model.REPOS_NAME))+web.C("web.code.mysql.query"), aaa.SESS, "mysql", mdb.DATABASE, m.Option(model.NAME)))
}
func init() { ice.TeamCtxCmd(serve{}) }
@ -76,8 +87,9 @@ func init() { ice.TeamCtxCmd(serve{}) }
func (s serve) spaceLink(m *ice.Message, arg ...ice.Any) string {
return kit.MergeURL(web.S(m.Option(model.REPOS_NAME))+web.C("web.team."+m.Option(model.NAME)+".portal"), arg...)
}
func (s serve) spaceRepos(m *ice.Message, arg ...string) {
s.spaceCmdy(m, cli.SYSTEM, "git", arg)
func (s serve) spaceRepos(m *ice.Message, arg ...string) serve {
s.spaceCmdy(m, cli.SYSTEM, cli.GIT, arg)
return s
}
func (s serve) spaceImport(m *ice.Message, arg ...string) {
s.spaceCmdy(m, web.CODE_AUTOGEN, code.IMPORT, arg)

View File

@ -1,7 +1,8 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.name]},
{view: html.TITLE, list: [value.name, can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [can.onimport.timeView(can, value)]},
] })
},
})

View File

@ -4,6 +4,7 @@ import "shylinux.com/x/ice"
type version struct {
Table
order string `data:"11"`
fields string `data:"title,content,user_uid"`
create string `name:"create title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`

View File

@ -1,41 +0,0 @@
package h18
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/enterprise/src/guanlixitong"
"shylinux.com/x/operation/src/h18/model"
)
type Table struct {
guanlixitong.Table
list string `name:"list h18_uid uid auto" role:"void"`
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.USER_H18_ROLE:
s.InputsListRole(m, UserH18RoleList, arg...)
case model.H18_TYPE:
s.InputsList(m, H18TypeList, 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_H18_ROLE:
value = UserH18Role(kit.Int(value)).String()
case model.H18_TYPE:
value = H18Type(kit.Int(value)).String()
}
return value
})
return s.Table.RewriteAppend(m)
}
type Tables struct { Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}

View File

@ -1,15 +0,0 @@
package h18
import "shylinux.com/x/ice"
type h0 struct {
Table
order string `data:"1"`
fields string `data:"title,content,user_uid"`
create string `name:"create title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
}
func (s h0) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
func init() { ice.TeamCtxCmd(h0{}) }

View File

@ -1,9 +0,0 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title||value.name]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.OUTPUT, list: [value.content||value.info]},
] })
},
})

View File

@ -1,23 +0,0 @@
package h18
import "shylinux.com/x/ice"
type h18 struct{ Table }
func init() { ice.TeamCtxCmd(h18{}) }
type H18Type int
const (
H18RD H18Type = iota
H18OP
H18HR
)
var H18TypeList = map[H18Type]string{
H18RD: "RD",
H18OP: "OP",
H18HR: "HR",
}
func (s H18Type) String() string { return H18TypeList[s] }

View File

@ -1,34 +0,0 @@
package model
import "shylinux.com/x/mysql-story/src/db"
const (
UID = "uid"
NAME = "name"
INFO = "info"
TYPE = "type"
TITLE = "title"
CONTENT = "content"
USER_UID = "user_uid"
USER_H18_ROLE = "user_h18_role"
H18_UID = "h18_uid"
H18_NAME = "h18_name"
H18_TYPE = "h18_type"
H0_UID = "_uid"
)
type UserH18 struct {
db.ModelUserPlace
H18UID string `gorm:"type:char(32);index"`
}
type H18 struct {
db.ModelPlace
CompanyUID string `gorm:"type:char(32);index"`
}
type H0 struct {
db.ModelContent
H18UID string `gorm:"type:char(32);index"`
}
func init() { db.CmdModels("", &UserH18{}, &H18{}, &H0{}) }

View File

@ -1,13 +0,0 @@
package h18
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* h18_name* h18_type:select" role:"void"`
}
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userH18{}, h18{})}) }

View File

@ -1,31 +0,0 @@
{
"portal": "h18",
"": "场景应用",
"icons": {
"": "https://img.icons8.com/officel/80/activity-grid.png"
},
"input": {
"My H18": "我的场景",
"user_h18_role": "成员角色",
"h18_name": "场景名称",
"h18_type": "场景类型"
},
"value": {
"user_h18_role": {
"visitor": "访客",
"creator": "创建人",
"leader": "管理人员",
"worker": "工作人员",
"server": "服务人员",
"style": {
"creator": "danger",
"leader": "danger"
}
},
"h18_type": {
"RD": "研发群",
"OP": "运维群",
"HR": "人力群"
}
}
}

View File

@ -1,15 +0,0 @@
package h18
import (
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type userH18 struct{ Table }
func init() { ice.TeamCtxCmd(userH18{}) }
type UserH18Role = guanlixitong.UserGroupRole
var UserH18RoleList = guanlixitong.UserGroupRoleList

View File

@ -8,10 +8,8 @@ import (
_ "shylinux.com/x/operation/src/operation"
_ "shylinux.com/x/operation/src/production"
_ "shylinux.com/x/operation/src/storage"
_ "shylinux.com/x/operation/src/h18"
)
func main() { print(ice.Run()) }
func init() { ice.Info.Titles = "云研发" }
func init() { ice.Info.Titles = "云研发" }