Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions agent/app/service/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"github.com/1Panel-dev/1Panel/agent/utils/common"
"github.com/1Panel-dev/1Panel/agent/utils/files"
"github.com/1Panel-dev/1Panel/agent/utils/req_helper"
"github.com/1Panel-dev/1Panel/agent/xpack/xglobal"
"github.com/1Panel-dev/1Panel/agent/utils/xpack"
)

type AgentService struct{}
Expand Down Expand Up @@ -85,7 +85,7 @@
openclawTrustedProxyLoopback = "127.0.0.1/32"
)

func (a AgentService) Create(req dto.AgentCreateReq) (*dto.AgentItem, error) {

Check failure on line 88 in agent/app/service/agents.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 70 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=1Panel-dev_1Panel&issues=AZz6j2m7bxe3g1zpKsK6&open=AZz6j2m7bxe3g1zpKsK6&pullRequest=12199
agentType := normalizeAgentType(req.AgentType)
if !isSupportedAgentType(agentType) {
return nil, fmt.Errorf("agent type is invalid")
Expand All @@ -99,7 +99,7 @@
if installs, _ := appInstallRepo.ListBy(context.Background(), repo.WithByLowerName(req.Name)); len(installs) > 0 {
return nil, buserr.New("ErrNameIsExist")
}
if !xglobal.IsXpack {
if !xpack.IsXpack() {
count, _, err := agentRepo.Page(1, 1)
if err != nil {
return nil, err
Expand Down
4 changes: 4 additions & 0 deletions agent/utils/xpack/community.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func IsUseCustomApp() bool {
return false
}

func IsXpack() bool {
return false
}

func CreateTaskScanSMSAlertLog(alert dto.AlertDTO, alertType string, create dto.AlertLogCreate, pushAlert dto.PushAlert, method string) error {
return nil
}
Expand Down
Loading