feat(notify): support cloudphone (#19960)

Co-authored-by: 马鸿飞 <mahongfei@yunion.cn>
This commit is contained in:
gouqi11
2024-04-12 15:16:27 +08:00
committed by GitHub
co-authored by 马鸿飞
parent ee44f7ea92
commit 0bbf9a9374
4 changed files with 48 additions and 0 deletions
+1
View File
@@ -138,6 +138,7 @@ const (
TOPIC_RESOURCE_SERVICE = "service"
TOPIC_RESOURCE_VM_INTEGRITY_CHECK = "vm_integrity"
TOPIC_RESOURCE_PROJECT = "project"
TOPIC_RESOURCE_CLOUDPHONE = "cloudphone"
SUBSCRIBER_TYPE_ROLE = "role"
SUBSCRIBER_TYPE_ROBOT = "robot"
+4
View File
@@ -66,6 +66,10 @@ var (
ActionIsolatedDeviceUpdate SAction = "isolated_device_update"
ActionIsolatedDeviceDelete SAction = "isolated_device_delete"
ActionStatusChanged SAction = "status_changed"
ActionStart SAction = "start"
ActionStop SAction = "stop"
ActionReset SAction = "reset"
ActionRestart SAction = "restart"
ResultFailed SResult = "failed"
ResultSucceed SResult = "succeed"
+25
View File
@@ -309,6 +309,11 @@ func init() {
"user",
"用户",
},
sI18nElme{
api.TOPIC_RESOURCE_CLOUDPHONE,
"cloudphone",
"云手机",
},
sI18nElme{
string(api.ActionCreate),
"created",
@@ -414,5 +419,25 @@ func init() {
"add_backup_server",
"添加主机备份",
},
sI18nElme{
string(api.ActionStart),
"start",
"开机",
},
sI18nElme{
string(api.ActionStop),
"stop",
"关机",
},
sI18nElme{
string(api.ActionRestart),
"restart",
"重启",
},
sI18nElme{
string(api.ActionReset),
"reset",
"重置",
},
)
}
+18
View File
@@ -277,8 +277,15 @@ func (sm *STopicManager) InitializeData() error {
notify.TOPIC_RESOURCE_LOADBALANCER,
notify.TOPIC_RESOURCE_DBINSTANCE,
notify.TOPIC_RESOURCE_ELASTICCACHE,
notify.TOPIC_RESOURCE_CLOUDPHONE,
)
t.addAction(
notify.ActionStart,
notify.ActionStop,
notify.ActionRestart,
notify.ActionReset,
notify.ActionAttach,
notify.ActionDetach,
notify.ActionCreate,
notify.ActionSyncStatus,
notify.ActionRebuildRoot,
@@ -292,8 +299,13 @@ func (sm *STopicManager) InitializeData() error {
case DefaultResourceOperationSuccessed:
t.addResources(
notify.TOPIC_RESOURCE_SERVER,
notify.TOPIC_RESOURCE_CLOUDPHONE,
)
t.addAction(
notify.ActionStart,
notify.ActionStop,
notify.ActionRestart,
notify.ActionReset,
notify.ActionCreateBackupServer,
)
t.Results = tristate.True
@@ -505,6 +517,7 @@ func (sm *STopicManager) InitializeData() error {
case DefaultAttachOrDetach:
t.addResources(
notify.TOPIC_RESOURCE_HOST,
notify.TOPIC_RESOURCE_CLOUDPHONE,
)
t.addAction(
notify.ActionAttach,
@@ -839,6 +852,7 @@ func init() {
notify.TOPIC_RESOURCE_SERVICE: 40,
notify.TOPIC_RESOURCE_VM_INTEGRITY_CHECK: 41,
notify.TOPIC_RESOURCE_PROJECT: 42,
notify.TOPIC_RESOURCE_CLOUDPHONE: 43,
},
)
converter.registerAction(
@@ -879,6 +893,10 @@ func init() {
notify.ActionIsolatedDeviceUpdate: 33,
notify.ActionIsolatedDeviceDelete: 34,
notify.ActionStatusChanged: 35,
notify.ActionStart: 36,
notify.ActionStop: 37,
notify.ActionRestart: 38,
notify.ActionReset: 39,
},
)
}