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" 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) 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: s.InputsListRole(m, UserReposRoleList, arg...) case model.REPOS_TYPE: s.InputsList(m, ReposTypeList, arg...) case model.REPOS_NAME: switch ReposType(kit.Int(m.Option(model.REPOS_TYPE))) { case ReposSystem: s.SpaceOpsCmdy(m, web.DREAM).CutTo(mdb.NAME, arg[0]) case ReposLibrary: m.Cmdy(web.CODE_GIT_REPOS).CutTo(nfs.REPOS, arg[0]) } case model.REPOS_LINK: switch ReposType(kit.Int(m.Option(model.REPOS_TYPE))) { case ReposSystem: s.SpaceOpsCmdy(m, web.DREAM).CutTo(nfs.REPOS, arg[0]) case ReposLibrary: m.Cmdy(web.CODE_GIT_REPOS).CutTo(web.ORIGIN, arg[0]) } 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) {}