Skip to content

Commit

Permalink
Merge pull request #2802 from actiontech/2028-5
Browse files Browse the repository at this point in the history
feat: support show supported backup strategy tip for db service
  • Loading branch information
LordofAvernus authored Dec 5, 2024
2 parents f0395ca + 2cbab7c commit 15b560b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
17 changes: 10 additions & 7 deletions sqle/api/controller/v1/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/actiontech/sqle/sqle/errors"
"github.com/actiontech/sqle/sqle/log"
"github.com/actiontech/sqle/sqle/model"
"github.com/actiontech/sqle/sqle/server"
opt "github.com/actiontech/sqle/sqle/server/optimization/rule"
"github.com/actiontech/sqle/sqle/utils"

Expand Down Expand Up @@ -416,18 +417,20 @@ func GetInstanceTips(c echo.Context) error {
return controller.JSONBaseErrorReq(c, fmt.Errorf("current project doesn't has workflow template"))
}
instanceTipsResV1 := make([]InstanceTipResV1, 0, len(instances))
svc := server.BackupService{}
for _, inst := range instances {
if operationType == v1.OpPermissionTypeCreateOptimization && !opt.CanOptimizeDbType(inst.DbType) {
continue
}
instanceTipRes := InstanceTipResV1{
ID: inst.GetIDStr(),
Name: inst.Name,
Type: inst.DbType,
Host: inst.Host,
Port: inst.Port,
WorkflowTemplateId: uint32(template.ID),
EnableBackup: inst.EnableBackup,
ID: inst.GetIDStr(),
Name: inst.Name,
Type: inst.DbType,
Host: inst.Host,
Port: inst.Port,
WorkflowTemplateId: uint32(template.ID),
EnableBackup: inst.EnableBackup,
SupportedBackupStrategy: svc.SupportedBackupStrategy(inst.DbType),
}
instanceTipsResV1 = append(instanceTipsResV1, instanceTipRes)
}
Expand Down
5 changes: 5 additions & 0 deletions sqle/server/backup_ce.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ func (BackupService) IsBackupConflictWithInstance(taskEnableBackup, instanceEnab
func (BackupService) CheckCanTaskBackup(task *model.Task) bool {
return false
}


func (BackupService) SupportedBackupStrategy(dbType string) []string {
return []string{}
}

0 comments on commit 15b560b

Please sign in to comment.