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
5 changes: 1 addition & 4 deletions agent/app/service/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"net/url"
"os"
"os/exec"
"path"
"path/filepath"
"sort"
"strconv"
Expand Down Expand Up @@ -343,8 +342,7 @@ func (u *ContainerService) ContainerCreateByCommand(req dto.ContainerCreateByCom
}
go func() {
taskItem.AddSubTask(i18n.GetWithName("ContainerCreate", containerName), func(t *task.Task) error {
logPath := path.Join(global.Dir.LogDir, task.TaskScopeContainer, req.TaskID+".log")
return cmd.ExecShell(logPath, 5*time.Minute, "bash", "-c", req.Command)
return cmd.ExecShellWithTask(taskItem, 5*time.Minute, "bash", "-c", req.Command)
}, nil)
_ = taskItem.Execute()
}()
Expand Down Expand Up @@ -507,7 +505,6 @@ func (u *ContainerService) ContainerCreate(req dto.ContainerOperate) error {
return err
}
con, err := client.ContainerCreate(ctx, config, hostConf, networkConf, &v1.Platform{}, req.Name)
taskItem.LogWithStatus(i18n.GetMsgByKey("ContainerCreate"), err)
if err != nil {
taskItem.Log(i18n.GetMsgByKey("ContainerCreateFailed"))
_ = client.ContainerRemove(ctx, req.Name, container.RemoveOptions{RemoveVolumes: true, Force: true})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry but you have not provided any code to review. Could you please share the code that needs analysis?

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/terminal/host/operate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const rules = reactive({
name: [{ validator: checkName, trigger: 'blur' }],
});
function checkName(rule: any, value: any, callback: any) {
if (value === 'local') {
if (value === 'local' && dialogData.value.title !== 'edit') {
return callback(new Error(i18n.global.t('terminal.localHelper')));
}
callback();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't any significant difference between the original code snippet and my translated version. The current versions appear to have no differences; all checks and calls should continue as expected.

In terms of optimization/suggestions, this code has been written efficiently. However, since there were no issues mentioned or concerns raised during the translation process, no further recommendations can be made at this point.

Expand Down
Loading