Skip to content

Commit

Permalink
fix: 解决容器编排路径为空时无法删除的问题 (1Panel-dev#6862)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu authored Oct 27, 2024
1 parent 2372281 commit 126aea9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/app/dto/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ type ComposeCreate struct {
}
type ComposeOperation struct {
Name string `json:"name" validate:"required"`
Path string `json:"path" validate:"required"`
Path string `json:"path"`
Operation string `json:"operation" validate:"required,oneof=up start stop down delete"`
WithFile bool `json:"withFile"`
}
Expand Down
4 changes: 4 additions & 0 deletions backend/app/service/container_compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ func (u *ContainerService) CreateCompose(req dto.ComposeCreate) (string, error)
}

func (u *ContainerService) ComposeOperation(req dto.ComposeOperation) error {
if len(req.Path) == 0 && req.Operation == "delete" {
_ = composeRepo.DeleteRecord(commonRepo.WithByName(req.Name))
return nil
}
if cmd.CheckIllegal(req.Path, req.Operation) {
return buserr.New(constant.ErrCmdIllegal)
}
Expand Down

0 comments on commit 126aea9

Please sign in to comment.