From 39f6a55e28f838908b1bad2a46c62264514dba4e Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 10 May 2022 17:59:27 +0800 Subject: [PATCH] no show empty message --- templates/repo/cloudbrain/show.tmpl | 16 ++++++++++------ templates/repo/cloudbrain/trainjob/show.tmpl | 22 ++++++++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/templates/repo/cloudbrain/show.tmpl b/templates/repo/cloudbrain/show.tmpl index 932a588c3..63c947477 100755 --- a/templates/repo/cloudbrain/show.tmpl +++ b/templates/repo/cloudbrain/show.tmpl @@ -516,17 +516,21 @@ td, th { let podEventArray = podEvents[task0]; if(podEventArray != null){ for(var i=0; i < podEventArray.length;i++){ - html +="

[" +podEventArray[i]["reason"] + "]

"; - html +="

" +podEventArray[i]["message"] + "

"; - html +="

" +podEventArray[i]["action"] + "

"; + if (podEventArray[i]["reason"]!="") { + html +="

[" +podEventArray[i]["reason"] + "]

"; + html +="

" +podEventArray[i]["message"] + "

"; + html +="

" +podEventArray[i]["action"] + "

"; + } } } let extras= jsonObj["extras"]; if(extras != null){ for(var i=0; i < extras.length;i++){ - html +="

[" +extras[i]["reason"] + "]

"; - html +="

" +extras[i]["message"] + "

"; - html +="

" +extras[i]["action"] + "

"; + if (extras[i]["reason"]!="") { + html +="

[" +extras[i]["reason"] + "]

"; + html +="

" +extras[i]["message"] + "

"; + html +="

" +extras[i]["action"] + "

"; + } } } } diff --git a/templates/repo/cloudbrain/trainjob/show.tmpl b/templates/repo/cloudbrain/trainjob/show.tmpl index 03b3904a7..3ddeeb247 100755 --- a/templates/repo/cloudbrain/trainjob/show.tmpl +++ b/templates/repo/cloudbrain/trainjob/show.tmpl @@ -680,17 +680,21 @@ td, th { let podEventArray = podEvents[task0]; if(podEventArray != null){ for(var i=0; i < podEventArray.length;i++){ - html +="

[" +podEventArray[i]["reason"] + "]

"; - html +="

" +podEventArray[i]["message"] + "

"; - html +="

" +podEventArray[i]["action"] + "

"; + if (podEventArray[i]["reason"]!="") { + html +="

[" +podEventArray[i]["reason"] + "]

"; + html +="

" +podEventArray[i]["message"] + "

"; + html +="

" +podEventArray[i]["action"] + "

"; + } } } let extras= jsonObj["extras"]; if(extras != null){ for(var i=0; i < extras.length;i++){ - html +="

[" +extras[i]["reason"] + "]

"; - html +="

" +extras[i]["message"] + "

"; - html +="

" +extras[i]["action"] + "

"; + if (extras[i]["reason"]!="") { + html +="

[" +extras[i]["reason"] + "]

"; + html +="

" +extras[i]["message"] + "

"; + html +="

" +extras[i]["action"] + "

"; + } } } } @@ -700,8 +704,10 @@ td, th { string = string.replace(/\n/g,"
"); string = string.replace(/(\r\n)|(\n)/g,'
'); - html +="

[ExitDiagnostics]

"; - html +="

" +string + "

"; + if (string!=""){ + html +="

[ExitDiagnostics]

"; + html +="

" +string + "

"; + } document.getElementById("info_display").innerHTML=html; }