From 1bcdf080709111a8bf864306cc94873f0d83a04c Mon Sep 17 00:00:00 2001 From: liyaqin1 <42289525+liyaqin1@users.noreply.github.com> Date: Fri, 16 Jun 2023 17:14:00 -0700 Subject: [PATCH] Improve health check display (#1209) * improve health check status display * add more cases * show pass or not according to error_message * fix typo --- .../templates/groups/health_check_activities.tmpl | 10 ++++++++-- .../templates/groups/health_check_details.html | 8 +++++++- deploy-board/deploy_board/webapp/templatetags/utils.py | 8 +++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/deploy-board/deploy_board/templates/groups/health_check_activities.tmpl b/deploy-board/deploy_board/templates/groups/health_check_activities.tmpl index 092cbf39b9..8f42150567 100644 --- a/deploy-board/deploy_board/templates/groups/health_check_activities.tmpl +++ b/deploy-board/deploy_board/templates/groups/health_check_activities.tmpl @@ -14,7 +14,7 @@ Details {% for health_check in health_checks %} - + {{ health_check.start_time | convertTimestamp }} @@ -44,7 +44,13 @@ STATE SUCCEEDED {% elif health_check.status == "QUALIFIED" %} QUALIFIED (pending termination) - {% elif health_check.status == "TELETRAAN_STOP_REQUESTED" and health_check.state == "COMPLETED" %} + {% elif health_check.error_message and health_check.host_terminated == 1 %} + FAILED (terminated) + {% elif health_check.error_message and health_check.status == "TELETRAAN_STOP_REQUESTED" %} + FAILED (terminating) + {% elif health_check.error_message %} + FAILED (pending termination) + {% elif health_check.status == "TELETRAAN_STOP_REQUESTED" and health_check.host_terminated == 1 %} QUALIFIED (terminated) {% elif health_check.status == "TELETRAAN_STOP_REQUESTED" %} QUALIFIED (terminating) diff --git a/deploy-board/deploy_board/templates/groups/health_check_details.html b/deploy-board/deploy_board/templates/groups/health_check_details.html index 22ef73fdde..acf887b6bd 100644 --- a/deploy-board/deploy_board/templates/groups/health_check_details.html +++ b/deploy-board/deploy_board/templates/groups/health_check_details.html @@ -109,7 +109,13 @@

STATE SUCCEEDED {% elif health_check.status == "QUALIFIED" %} QUALIFIED (pending termination) - {% elif health_check.status == "TELETRAAN_STOP_REQUESTED" and health_check.state == "COMPLETED" %} + {% elif health_check.error_message and health_check.host_terminated == 1 %} + FAILED (terminated) + {% elif health_check.error_message and health_check.status == "TELETRAAN_STOP_REQUESTED" %} + FAILED (terminating) + {% elif health_check.error_message %} + FAILED (pending termination) + {% elif health_check.status == "TELETRAAN_STOP_REQUESTED" and health_check.host_terminated == 1 %} QUALIFIED (terminated) {% elif health_check.status == "TELETRAAN_STOP_REQUESTED" %} QUALIFIED (terminating) diff --git a/deploy-board/deploy_board/webapp/templatetags/utils.py b/deploy-board/deploy_board/webapp/templatetags/utils.py index 7ed26a2a28..e0be1e0eff 100644 --- a/deploy-board/deploy_board/webapp/templatetags/utils.py +++ b/deploy-board/deploy_board/webapp/templatetags/utils.py @@ -905,13 +905,11 @@ def genImageInfo(value): @register.filter("healthCheckStatusClass") -def healthCheckStatusClass(status): - if status == "FAILED": +def healthCheckStatusClass(error_message): + if error_message: return "danger" - elif status == "TELETRAAN_STOP_REQUESTED": - return "success" else: - return "" + return "success" @register.filter("healthCheckStatusIcon")