This commit is contained in:
2023-08-31 16:27:32 +08:00
parent a15d5568ef
commit b0ad4f0a19

View File

@@ -399,23 +399,25 @@ func ParseRawMsg2Html(w http.ResponseWriter, r *http.Request) {
return return
} }
log.Trace("traceData:", traceData) log.Trace("traceData:", traceData)
htmlFile := fmt.Sprintf("traceDecMessage-%d-%d.html", traceData.TaskID, traceData.ID) pathFile := traceData.DecMsg
pathFile := config.GetYamlConfig().OMC.FrontTraceDir + "/" + htmlFile if traceData.DecMsg == "" {
command := fmt.Sprintf("ipdata2html -f %s -t %d -i N%d -d %x", pathFile, traceData.Timestamp, traceData.IfType, traceData.RawMsg) htmlFile := fmt.Sprintf("traceDecMessage-%d-%d.html", traceData.TaskID, traceData.ID)
out, err := run.ExecCmd(command, "/") pathFile = config.GetYamlConfig().OMC.FrontTraceDir + "/" + htmlFile
log.Tracef("Exec output: %v", string(out)) command := fmt.Sprintf("ipdata2html -f %s -t %d -i N%d -d %x", pathFile, traceData.Timestamp, traceData.IfType, traceData.RawMsg)
if err != nil { out, err := run.ExecCmd(command, "/")
log.Errorf("Faile to ipdate2html:", err) log.Tracef("Exec output: %v", string(out))
services.ResponseInternalServerError500ProcessError(w, err) if err != nil {
return log.Errorf("Faile to ipdate2html:", err)
services.ResponseInternalServerError500ProcessError(w, err)
return
}
traceData.DecMsg = pathFile
_, err = dborm.XormUpdateTraceData(id, traceData)
if err != nil {
log.Errorf("Faile to XormUpdateTraceData:", err)
services.ResponseInternalServerError500ProcessError(w, err)
return
}
} }
traceData.DecMsg = pathFile
_, err = dborm.XormUpdateTraceData(id, traceData)
if err != nil {
log.Errorf("Faile to XormUpdateTraceData:", err)
services.ResponseInternalServerError500ProcessError(w, err)
return
}
services.ResponseHtmlContent(w, http.StatusOK, pathFile) services.ResponseHtmlContent(w, http.StatusOK, pathFile)
} }