mirror of
https://gitee.com/goploy/goploy.git
synced 2024-11-29 18:57:59 +08:00
Added: exec time
This commit is contained in:
parent
04513f3bc5
commit
82ad700f86
@ -451,6 +451,7 @@ func (Deploy) FileDiff(gp *server.Goploy) server.Response {
|
||||
// @Success 200 {object} response.JSON{data=deploy.ManageProcess.RespData}
|
||||
// @Router /deploy/manageProcess [post]
|
||||
func (Deploy) ManageProcess(gp *server.Goploy) server.Response {
|
||||
startTime := time.Now().Format(time.DateTime)
|
||||
type ReqData struct {
|
||||
ServerID int64 `json:"serverId" validate:"required,gt=0"`
|
||||
ProjectProcessID int64 `json:"projectProcessId" validate:"required,gt=0"`
|
||||
@ -511,12 +512,20 @@ func (Deploy) ManageProcess(gp *server.Goploy) server.Response {
|
||||
err = session.Run(script)
|
||||
log.Trace(fmt.Sprintf("%s exec cmd %s, result %t, stdout: %s, stderr: %s", gp.UserInfo.Name, script, err == nil, sshOutbuf.String(), sshErrbuf.String()))
|
||||
type RespData struct {
|
||||
ExecRes bool `json:"execRes"`
|
||||
Stdout string `json:"stdout"`
|
||||
Stderr string `json:"stderr"`
|
||||
ExecRes bool `json:"execRes"`
|
||||
Stdout string `json:"stdout"`
|
||||
Stderr string `json:"stderr"`
|
||||
StartTime string `json:"startTime"`
|
||||
EndTime string `json:"endTime"`
|
||||
}
|
||||
return response.JSON{
|
||||
Data: RespData{ExecRes: err == nil, Stdout: sshOutbuf.String(), Stderr: sshErrbuf.String()},
|
||||
Data: RespData{
|
||||
ExecRes: err == nil,
|
||||
Stdout: sshOutbuf.String(),
|
||||
Stderr: sshErrbuf.String(),
|
||||
StartTime: startTime,
|
||||
EndTime: time.Now().Format(time.DateTime),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,6 +227,8 @@ export class ManageProcess extends Request {
|
||||
execRes: boolean
|
||||
stdout: string
|
||||
stderr: string
|
||||
startTime: string
|
||||
endTime: string
|
||||
}
|
||||
constructor(param: ManageProcess['param']) {
|
||||
super()
|
||||
|
@ -396,6 +396,7 @@
|
||||
"processManager": "Process manager",
|
||||
"execTips": "Exec command {command}?",
|
||||
"execRes": "Exec result",
|
||||
"execTime": "Exec time",
|
||||
"deleteProcessTips": "This action will delete the process, continue?",
|
||||
"resetStateTips": "This action will reset project state, continue?",
|
||||
"reviewDeploy": "Review deploy",
|
||||
|
@ -370,6 +370,7 @@
|
||||
"fileCompare": "文件对比",
|
||||
"processManager": "进程管理",
|
||||
"execRes": "执行结果",
|
||||
"execTime": "执行时间",
|
||||
"execTips": "执行{command}命令?",
|
||||
"deleteProcessTips": "此操作删除该进程配置, 是否继续?",
|
||||
"resetStateTips": "此操作将重置项目的构建状态, 是否继续?",
|
||||
|
@ -53,17 +53,31 @@
|
||||
>
|
||||
<el-table-column type="expand">
|
||||
<template #default="{}">
|
||||
<el-row>
|
||||
{{ $t('deployPage.execRes') }}:
|
||||
<span
|
||||
:class="commandRes.execRes ? 'exec-success' : 'exec-fail'"
|
||||
style="padding-left: 5px"
|
||||
>
|
||||
{{ commandRes.execRes }}
|
||||
</span>
|
||||
<el-row
|
||||
v-if="commandRes.hasOwnProperty('execRes')"
|
||||
style="padding: 8px 16px; flex-direction: column; line-height: 20px"
|
||||
>
|
||||
<el-row>
|
||||
{{ $t('deployPage.execRes') }}:
|
||||
<span
|
||||
:class="commandRes.execRes ? 'exec-success' : 'exec-fail'"
|
||||
style="padding-left: 5px"
|
||||
>
|
||||
{{ commandRes.execRes ? $t('success') : $t('fail') }}
|
||||
</span>
|
||||
</el-row>
|
||||
<el-row style="white-space: pre-wrap">
|
||||
{{ $t('deployPage.execTime') }}: {{ commandRes.startTime }} -
|
||||
{{ commandRes.endTime }}
|
||||
</el-row>
|
||||
<el-row style="white-space: pre-wrap">
|
||||
{{ commandRes.stdout }}
|
||||
</el-row>
|
||||
<el-row style="white-space: pre-wrap">
|
||||
{{ commandRes.stderr }}
|
||||
</el-row>
|
||||
</el-row>
|
||||
<el-row style="white-space: pre-wrap">{{ commandRes.stdout }}</el-row>
|
||||
<el-row style="white-space: pre-wrap">{{ commandRes.stderr }}</el-row>
|
||||
<el-row v-else style="padding: 0 8px"> {{ 'not run' }} </el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Server">
|
||||
@ -272,11 +286,9 @@ const handleProcessChange = (processId: number) => {
|
||||
tableLoading.value = false
|
||||
})
|
||||
}
|
||||
const commandRes = ref<ManageProcess['datagram']>({
|
||||
execRes: true,
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
})
|
||||
const commandRes = ref<ManageProcess['datagram']>(
|
||||
{} as ManageProcess['datagram']
|
||||
)
|
||||
const commandLoading = ref(false)
|
||||
const handleProcessCmd = (data: ProjectServerData, command: string) => {
|
||||
ElMessageBox.confirm(t('deployPage.execTips', { command }), t('tips'), {
|
||||
|
Loading…
Reference in New Issue
Block a user