From 2a2f9e7b3e07569505925e30161ee8b5bd3cf5e0 Mon Sep 17 00:00:00 2001 From: shy Date: Sat, 15 Mar 2025 20:27:02 +0800 Subject: [PATCH] add some --- src/operation/gateway.go | 2 +- src/operation/model/model.go | 15 +++++++++------ src/operation/portal.json | 10 +++++----- src/operation/product.go | 6 +++++- src/operation/project.go | 4 ++-- src/operation/template.go | 14 ++++++++------ src/operation/template.js | 2 +- 7 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/operation/gateway.go b/src/operation/gateway.go index da0a995..2d69ba7 100644 --- a/src/operation/gateway.go +++ b/src/operation/gateway.go @@ -16,7 +16,7 @@ type Gateway struct { cluster Cluster travel travel.Travel gateway gateway.Gateway - order string `data:"2"` + order string `data:"3"` fields string `data:"title,content,space,cluster_uid,user_uid"` payfor string `name:"payfor" help:"购买" style:"notice" role:"leader"` createProject string `name:"createProject name* repos binary" help:"创建" style:"notice" role:"worker"` diff --git a/src/operation/model/model.go b/src/operation/model/model.go index 92a822e..58195b4 100644 --- a/src/operation/model/model.go +++ b/src/operation/model/model.go @@ -45,20 +45,23 @@ type Cluster struct { Price int `gorm:"default:0"` Status uint8 `gorm:"default:0"` } +type Template struct { + db.ModelNameInfo + Title string `gorm:"type:varchar(64)"` + Icons string `gorm:"type:varchar(255)"` + Repos string `gorm:"type:varchar(255)"` + Binary string `gorm:"type:varchar(255)"` + Status uint8 `gorm:"default:0"` +} type Gateway struct { db.ModelContent Space string `gorm:"type:varchar(64)"` CloudUID string `gorm:"type:char(32);index"` ClusterUID string `gorm:"type:char(32);index"` } -type Template struct { - db.ModelNameInfo - Repos string `gorm:"type:varchar(255)"` - Binary string `gorm:"type:varchar(255)"` - Status uint8 `gorm:"default:0"` -} type Project struct { db.ModelNameInfo + Icons string `gorm:"type:varchar(255)"` Repos string `gorm:"type:varchar(255)"` Binary string `gorm:"type:varchar(255)"` CloudUID string `gorm:"type:char(32);index"` diff --git a/src/operation/portal.json b/src/operation/portal.json index 56e7b2a..2c6a916 100644 --- a/src/operation/portal.json +++ b/src/operation/portal.json @@ -6,11 +6,11 @@ "offline": "danger" }, "icons": { - "cluster": "https://img.icons8.com/officel/80/activity-grid.png", - "gateway": "https://img.icons8.com/officel/80/activity-grid.png", - "template": "https://img.icons8.com/officel/80/activity-grid.png", - "project": "https://img.icons8.com/officel/80/activity-grid.png", - "product": "https://img.icons8.com/officel/80/activity-grid.png" + "cluster": "activity-grid.png", + "gateway": "activity-grid.png", + "template": "activity-grid.png", + "project": "activity-grid.png", + "product": "activity-grid.png" }, "input": { "My Cloud": "我的系统", diff --git a/src/operation/product.go b/src/operation/product.go index a5e2086..8db5a38 100644 --- a/src/operation/product.go +++ b/src/operation/product.go @@ -34,7 +34,11 @@ func (s product) List(m *ice.Message, arg ...string) { } else { m.PushAction(s.Open) } - m.Display("") + if m.Length() == 0 { + m.SetResult().Echo("请到「云项目」扫描服务") + } else { + m.Display("") + } s.Fields(m, model.UID, s.Keys(s.gateway, model.UID), s.KeyAS(s.project, mdb.NAME)).SelectJoin(m, s.project, s.Keys(s.project, mdb.NAME), s.Keys(s.gateway, model.UID)) s.Fields(m, model.UID, s.Keys(s.cluster, model.UID), s.KeyAS(s.gateway, model.TITLE), s.KeyAS(s.gateway, model.SPACE)).SelectJoin(m, s.gateway, s.Keys(s.cluster, model.UID), s.Keys(s.gateway, model.SPACE), s.Keys(s.gateway, model.TITLE)) s.Fields(m, model.UID, s.KeyAS(s.cluster, model.SPACE)).SelectJoin(m, s.cluster, s.Keys(s.cluster, model.SPACE)) diff --git a/src/operation/project.go b/src/operation/project.go index 69e87a9..a307799 100644 --- a/src/operation/project.go +++ b/src/operation/project.go @@ -16,8 +16,8 @@ type project struct { cluster Cluster gateway Gateway order string `data:"4"` - fields string `data:"name,repos,binary,gateway_uid"` - create string `name:"create name* repos binary" style:"notice" role:"worker"` + fields string `data:"name,icons,repos,binary,gateway_uid"` + create string `name:"create name* icons repos binary" style:"notice" role:"worker"` scanProduct string `name:"scanProduct" help:"扫描" role:"worker"` open string `name:"open" role:"worker"` } diff --git a/src/operation/template.go b/src/operation/template.go index 38b71bb..87b26ca 100644 --- a/src/operation/template.go +++ b/src/operation/template.go @@ -9,11 +9,11 @@ import ( type template struct { Table - order string `data:"3"` - fields string `data:"name,info,repos,binary,template_status"` - create string `name:"create name* info repos* binary*"` - modify string `name:"modify name* info repos* binary*" style:"danger"` - install string `name:"install gateway_uid* name*" style:"notice" role:"worker"` + order string `data:"2"` + fields string `data:"name,info,title,icons,repos,binary,template_status"` + create string `name:"create name* info title icons repos* binary*"` + modify string `name:"modify name* info title icons repos* binary*" style:"danger"` + install string `name:"install name* gateway_uid*" style:"notice" role:"worker"` } func (s template) Create(m *ice.Message, arg ...string) { @@ -49,7 +49,9 @@ func (s template) List(m *ice.Message, arg ...string) { m.Display("") } func (s template) Install(m *ice.Message, arg ...string) { - m.Cmdy(project{}, s.Create, m.OptionSimple("name,repos,binary")) + msg := m.Cmd(Gateway{}, m.Option(model.CLOUD_UID), m.Option(model.GATEWAY_UID)) + m.Option(model.SPACE, kit.Keys(msg.Append(model.CLUSTER_SPACE), msg.Append(model.SPACE))) + m.Cmdy(project{}, s.Create, m.OptionSimple("name,icons,repos,binary")) } func (s template) Offline(m *ice.Message, arg ...string) { s.Update(m, []string{model.STATUS, kit.Format(TemplateOffline)}) diff --git a/src/operation/template.js b/src/operation/template.js index 97495ff..071ce20 100644 --- a/src/operation/template.js +++ b/src/operation/template.js @@ -1,7 +1,7 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onimport.myView(can, msg, function(value) { return [ - {view: html.TITLE, list: [value.name, can.onimport.titleAction(can, value)]}, + {view: html.TITLE, list: [value.title||value.name, can.onimport.titleAction(can, value)]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value)]}, {view: html.OUTPUT, list: [value.info||value.binary||value.repos]}, ] })