mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-04 21:55:48 +08:00
feat: 资源操作统一管理&容器操作
This commit is contained in:
@@ -165,6 +165,106 @@ func V1_10_2() []*gormigrate.Migration {
|
||||
if err := tx.Migrator().AutoMigrate(&msgentity.Msg{}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 机器列表相关菜单权限
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = 'machines'")
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = 'machines-op'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Alw1Xkq3/', pid=94 where ui_path = '12sSjal1/lskeiql1/Alw1Xkq3/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Lsew24Kx/', pid=94 where ui_path = '12sSjal1/lskeiql1/Lsew24Kx/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/exIsqL31/', pid=94 where ui_path = '12sSjal1/lskeiql1/exIsqL31/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Liwakg2x/', pid=94 where ui_path = '12sSjal1/lskeiql1/Liwakg2x/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Lieakenx/', pid=94 where ui_path = '12sSjal1/lskeiql1/Lieakenx/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Keiqkx4L/', pid=94 where ui_path = '12sSjal1/lskeiql1/Keiqkx4L/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Keal2Xke/', pid=94 where ui_path = '12sSjal1/lskeiql1/Keal2Xke/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Ihfs2xaw/', pid=94 where ui_path = '12sSjal1/lskeiql1/Ihfs2xaw/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/3ldkxJDx/', pid=94 where ui_path = '12sSjal1/lskeiql1/3ldkxJDx/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Ljewix43/', pid=94 where ui_path = '12sSjal1/lskeiql1/Ljewix43/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/L12wix43/', pid=94 where ui_path = '12sSjal1/lskeiql1/L12wix43/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Ljewisd3/', pid=94 where ui_path = '12sSjal1/lskeiql1/Ljewisd3/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Ljeew43/', pid=94 where ui_path = '12sSjal1/lskeiql1/Ljeew43/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/ODewix43/', pid=94 where ui_path = '12sSjal1/lskeiql1/ODewix43/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/OJewex43/', pid=94 where ui_path = '12sSjal1/lskeiql1/OJewex43/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/LIEwix43/', pid=94 where ui_path = '12sSjal1/lskeiql1/LIEwix43/'")
|
||||
|
||||
// redis
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = '/redis'")
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = 'data-operation'")
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = 'manage'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/IoxqAd31/', pid=94 where ui_path = 'RedisXq4/Eoaljc12/IoxqAd31/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/IUlxia23/', pid=94 where ui_path = 'RedisXq4/Exitx4al/IUlxia23/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Gxlagheg/', pid=94 where ui_path = 'RedisXq4/Exitx4al/Gxlagheg/'")
|
||||
|
||||
// db
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = 'instances'")
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = 'sql-exec'")
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = 'instances'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/mJlBeTCs/', pid=94 where ui_path = 'dbms23ax/X0f4BxT0/mJlBeTCs/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/D23fUiBr/', pid=94 where ui_path = 'dbms23ax/X0f4BxT0/D23fUiBr/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/Sgg8uPwz/', pid=94 where ui_path = 'dbms23ax/X0f4BxT0/Sgg8uPwz/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/AceXe321/', pid=94 where ui_path = 'dbms23ax/X0f4BxT0/AceXe321/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/leix3Axl/', pid=94 where ui_path = 'dbms23ax/X0f4BxT0/leix3Axl/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/ygjL3sxA/', pid=94 where ui_path = 'dbms23ax/X0f4BxT0/ygjL3sxA/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/TGFPA3Ez/', pid=94 where ui_path = 'dbms23ax/exaeca2x/TGFPA3Ez/'")
|
||||
|
||||
// es
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where name = 'Elasticsearch'")
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where name = 'es.operation'")
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where name = 'es.instance'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/rcKBdxB5/', pid=94 where ui_path = 'lbOU73qg/gZ2MHF0b/rcKBdxB5/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/IMGhLSJK/', pid=94 where ui_path = 'lbOU73qg/gZ2MHF0b/IMGhLSJK/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/SQNFhhhn/', pid=94 where ui_path = 'lbOU73qg/2sDi4isw/SQNFhhhn/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/XAgy5Uvp/', pid=94 where ui_path = 'lbOU73qg/2sDi4isw/XAgy5Uvp/'")
|
||||
|
||||
// mongo
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = '/mongo'")
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = 'mongo-data-operation'")
|
||||
tx.Exec("Update t_sys_resource set is_deleted = 1 where code = 'mongo-manage'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/egljbla3/', pid=94 where ui_path = 'Mongo452/ghxagl43/egljbla3/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/xvpKk36u/', pid=94 where ui_path = 'Mongo452/eggago31/xvpKk36u/'")
|
||||
tx.Exec("Update t_sys_resource set ui_path='Tag3fhad/glxajg23/3sblw1Wb/', pid=94 where ui_path = 'Mongo452/eggago31/3sblw1Wb/'")
|
||||
|
||||
// 新增菜单
|
||||
resources := []*sysentity.Resource{{
|
||||
Model: model.Model{CreateModel: model.CreateModel{DeletedModel: model.DeletedModel{IdModel: model.IdModel{Id: 1756122788}}}},
|
||||
Pid: 0,
|
||||
UiPath: "ocdrUNaa/",
|
||||
Name: "menu.myResource",
|
||||
Code: "/my-resource",
|
||||
Meta: `{"icon":"Menu","isKeepAlive":true,"routeName":"ResourceOp"}`,
|
||||
Type: 1,
|
||||
Weight: 19999998,
|
||||
}, {
|
||||
Model: model.Model{CreateModel: model.CreateModel{DeletedModel: model.DeletedModel{IdModel: model.IdModel{Id: 1756122789}}}},
|
||||
Pid: 2,
|
||||
UiPath: "12sSjal1/OgOqxbnt/",
|
||||
Name: "docker.container",
|
||||
Code: "/container",
|
||||
Meta: `{"icon":"icon docker/docker","isKeepAlive":true,"routeName":"Container"}`,
|
||||
Type: 1,
|
||||
Weight: 1713875843,
|
||||
}}
|
||||
|
||||
now := time.Now()
|
||||
for _, res := range resources {
|
||||
res.Status = 1
|
||||
res.CreateTime = &now
|
||||
res.CreatorId = 1
|
||||
res.Creator = "admin"
|
||||
res.UpdateTime = &now
|
||||
res.ModifierId = 1
|
||||
res.Modifier = "admin"
|
||||
tx.Create(res)
|
||||
}
|
||||
|
||||
roleResource := &sysentity.RoleResource{
|
||||
RoleId: 1,
|
||||
ResourceId: 1756122788,
|
||||
CreateTime: &now,
|
||||
CreatorId: 1,
|
||||
Creator: "admin",
|
||||
}
|
||||
tx.Create(roleResource)
|
||||
|
||||
return nil
|
||||
},
|
||||
Rollback: func(tx *gorm.DB) error {
|
||||
|
||||
Reference in New Issue
Block a user