From 908fe73ebbc9674315b315a7272cd133bfbebc49 Mon Sep 17 00:00:00 2001 From: Ian Roquebert <72234714+gzpcho@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:38:27 +0000 Subject: [PATCH 1/6] Redesign host healthcheck display mode --- .../deploy_board/static/css/deploy-board.css | 50 +++++++++ .../templates/deploys/deploy_progress.html | 31 ++++-- .../deploy_board/webapp/templatetags/utils.py | 100 +++++++++++++++++- 3 files changed, 169 insertions(+), 12 deletions(-) diff --git a/deploy-board/deploy_board/static/css/deploy-board.css b/deploy-board/deploy_board/static/css/deploy-board.css index 5e626625f9..d929734081 100644 --- a/deploy-board/deploy_board/static/css/deploy-board.css +++ b/deploy-board/deploy_board/static/css/deploy-board.css @@ -59,6 +59,56 @@ body { font-family: Menlo, Monaco, Consolas, "Courier New", monospace; } +.btn-critical { + background-color: #bf4046; + color: white; +} + +.btn-critical:hover { + background-color: #d2464d; + color: white; +} + +.btn-outline-danger { + border: 1px solid #de606d; + color: #de606d +} + +.btn-info { + background-color: #17a2b8; + color: white; +} + +.btn-outline-info { + border: 2px dashed #17a2b8; + color: #17a2b8; + animation: blink-border 1s infinite; +} + +.btn-outline-warning { + border: 2px dashed #ffc107; + animation: blink-border 1s infinite; + /* box-shadow: inset 0 0 5px #ffc107; */ +} +/* +.diagonal-stripes { + background-image: linear-gradient(135deg, + rgba(255, 255, 255, 0.2) 25%, + transparent 25%, + transparent 50%, + rgba(255, 255, 255, 0.2) 50%, + rgba(255, 255, 255, 0.2) 75%, + transparent 75%, + transparent); + background-size: 40px 40px; +} */ + +@keyframes blink-border { + 50% { + border-color: #fff; + } +} + .row-centered { text-align:center; } diff --git a/deploy-board/deploy_board/templates/deploys/deploy_progress.html b/deploy-board/deploy_board/templates/deploys/deploy_progress.html index fbff32f367..cfb29343ca 100644 --- a/deploy-board/deploy_board/templates/deploys/deploy_progress.html +++ b/deploy-board/deploy_board/templates/deploys/deploy_progress.html @@ -192,17 +192,26 @@

{% endif %} {% elif report.account == "all" %} - - {% if report.showMode != "compact" %}{{ agentStat.agent.hostName }}{% endif %} - {% if report.showMode == "containerStatus" %} - {% include "deploys/_container_status.html" with healthStatus=agentStat.agent.containerHealthStatus %} - {% else %} - - {% endif %} - + {% if report.showMode == "containerStatus" %} + {% comment %} {%with agentStat=agentStat|_pick_random_state|_pick_random_healthcheck%} {% endcomment %} + + {{ agentStat.agent.hostName }}-{{agentStat.agent.state}} + + + {% comment %} {% endwith %} {% endcomment %} + {% else %} + + {% if report.showMode != "compact" %}{{ agentStat.agent.hostName }}{% endif %} + + + + {% endif %} {% endif %} {% endfor %} diff --git a/deploy-board/deploy_board/webapp/templatetags/utils.py b/deploy-board/deploy_board/webapp/templatetags/utils.py index b81a3235c4..e411297e51 100644 --- a/deploy-board/deploy_board/webapp/templatetags/utils.py +++ b/deploy-board/deploy_board/webapp/templatetags/utils.py @@ -31,6 +31,7 @@ from deploy_board.webapp.helpers.tags_helper import TagValue from deploy_board.settings import AWS_PRIMARY_ACCOUNT, AWS_SUB_ACCOUNT import ast +from deploy_board.webapp.agent_report import AgentStatistics register = template.Library() logger = logging.getLogger(__name__) @@ -544,7 +545,6 @@ def branchAndCommit(build): def percentize(deploy): return "%d%%" % round(deploy.succeeded * 100 / deploy.reported) - @register.filter("agentTip") def agentTip(agentStats): agent = agentStats.agent @@ -611,6 +611,104 @@ def agentButton(agentStats): return 'btn-warning' +# yellow solid blinking = paused_by_user / paused_by_system +# light blue w/o healthcheck w/ trash icon = delete +# light blue dotted spining = reset +# dark red = unreachable +# yellow dotted spinning = stop +# diagonal lines through, muted = stale + +# import random +# @register.filter +# def _pick_random_state(agentStat): +# states = [ +# "PAUSED_BY_SYSTEM", +# "PAUSED_BY_USER", +# "DELETE", +# "RESET", +# "STOP", +# "UNREACHABLE" +# ] + ["ACTIVE"]*10 +# agentStat.agent['state'] = random.choice(states) +# agentStat.isCurrent = True +# return agentStat + +# @register.filter +# def _pick_random_healthcheck(agentStat): +# healthcheckStatus = [ +# "healthy", +# "unhealthy", +# "" +# ] +# agentStat.agent['containerHealthStatus'] = random.choice(healthcheckStatus) +# return agentStat + +def _is_agent_failed(agent) -> bool: + return agent['status'] != "SUCCEEDED" and agent['status'] != "UNKNOWN" or agent['state'] == "PAUSED_BY_SYSTEM" + +@register.filter("hostButtonHtmlClass") +def hostButtonHtmlClass(agentStat: AgentStatistics) -> str: + state = agentStat.agent['state'] + if state == "UNREACHABLE": + return "btn btn-default btn-xs host-stale btn-critical" + elif _is_agent_failed(agentStat.agent): + return "btn btn-default btn-xs btn-outline-danger" + elif state == "DELETE" or state == "RESET": + return "btn btn-default btn-xs btn-info" + elif state == "STOP": + return "btn btn-default btn-xs btn-outline-info" + elif state == "PAUSED_BY_USER": + return "btn btn-default btn-xs btn-outline-warning" + return "btn btn-default btn-xs" + +@register.filter("hostHealthcheckIcon") +def hostHealthcheckIcon(agentStat: AgentStatistics) -> str: + state = agentStat.agent['state'] + if state == "DELETE": + return "fa fa-trash" + elif state == "RESET": + return "fa fa-repeat fa-spin" + elif state == "UNREACHABLE": + return "fa fa-question" + elif state == "STOP": + return "fa fa-stop" + healthcheckResponse: str = agentStat.agent.get("containerHealthStatus", "") + if "unhealthy" in healthcheckResponse: + return "fa fa-circle color-red" + elif "healthy" in healthcheckResponse: + return "fa fa-circle color-green" + return "" + +@register.filter("hostTooltipTitle") +def hostTooltipTitle(agentStat: AgentStatistics) -> str: + state = agentStat.agent['state'] + if state == "PAUSED_BY_USER": + return "Agent is explicitly paused for any deploys" + elif state == "PAUSED_BY_SYSTEM": + return "Agent failed to deploy and is paused by the system" + elif state == "DELETE": + return "Agent is removed from the current environment" + elif state == "UNREACHABLE": + return "Agent is unreachable after not responding to ping from teletraan server" + elif state == "STOP": + return "Agent is gracefully shutting down the service" + elif state == "RESET": + return "Agent is restarting the deployment" + elif not agentStat.isCurrent: + if state == "SERVING_BUILD": + return "Agent is serving older build and waiting for deploy" + elif _is_agent_failed(agentStat.agent): + return "Agent is serving older build with failures. Click for details" + else: + return "Agent is serving older build with failures. Click for details" + else: + if agentStat.agent['deployStage'] == "SERVING_BUILD": + return "Agent is serving the current build successfully" + elif _is_agent_failed(agentStat.agent): + return "Agent is deploying current build with failures. Click for details" + else: + return "Agent is deploying current build" + @register.filter("agentIcon") def agentIcon(agentStats): agent = agentStats.agent From 7e19d6486a11a0356f04209bd0e44128167a4e1d Mon Sep 17 00:00:00 2001 From: Ian Roquebert <72234714+gzpcho@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:42:01 +0000 Subject: [PATCH 2/6] Remove unused CSS classes --- .../deploy_board/static/css/deploy-board.css | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/deploy-board/deploy_board/static/css/deploy-board.css b/deploy-board/deploy_board/static/css/deploy-board.css index d929734081..4d65d4af95 100644 --- a/deploy-board/deploy_board/static/css/deploy-board.css +++ b/deploy-board/deploy_board/static/css/deploy-board.css @@ -88,20 +88,7 @@ body { .btn-outline-warning { border: 2px dashed #ffc107; animation: blink-border 1s infinite; - /* box-shadow: inset 0 0 5px #ffc107; */ -} -/* -.diagonal-stripes { - background-image: linear-gradient(135deg, - rgba(255, 255, 255, 0.2) 25%, - transparent 25%, - transparent 50%, - rgba(255, 255, 255, 0.2) 50%, - rgba(255, 255, 255, 0.2) 75%, - transparent 75%, - transparent); - background-size: 40px 40px; -} */ +} @keyframes blink-border { 50% { From c0cf8f811f1d6cc2e33cf6788ecc8cfc9f91162d Mon Sep 17 00:00:00 2001 From: Ian Roquebert <72234714+gzpcho@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:45:19 +0000 Subject: [PATCH 3/6] Uncomment state randomization --- .../templates/deploys/deploy_progress.html | 4 +- .../deploy_board/webapp/templatetags/utils.py | 48 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/deploy-board/deploy_board/templates/deploys/deploy_progress.html b/deploy-board/deploy_board/templates/deploys/deploy_progress.html index cfb29343ca..e5a5906740 100644 --- a/deploy-board/deploy_board/templates/deploys/deploy_progress.html +++ b/deploy-board/deploy_board/templates/deploys/deploy_progress.html @@ -193,7 +193,7 @@

{% elif report.account == "all" %} {% if report.showMode == "containerStatus" %} - {% comment %} {%with agentStat=agentStat|_pick_random_state|_pick_random_healthcheck%} {% endcomment %} + {%with agentStat=agentStat|_pick_random_state|_pick_random_healthcheck%} {{ agentStat.agent.hostName }}-{{agentStat.agent.state}} - {% comment %} {% endwith %} {% endcomment %} + {% endwith %} {% else %} bool: return agent['status'] != "SUCCEEDED" and agent['status'] != "UNKNOWN" or agent['state'] == "PAUSED_BY_SYSTEM" From 70d2dbca0568073f01e35ffdba337595fb5a65d8 Mon Sep 17 00:00:00 2001 From: Ian Roquebert <72234714+gzpcho@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:46:47 +0000 Subject: [PATCH 4/6] Remove state randomization --- .../templates/deploys/deploy_progress.html | 2 -- .../deploy_board/webapp/templatetags/utils.py | 32 ------------------- 2 files changed, 34 deletions(-) diff --git a/deploy-board/deploy_board/templates/deploys/deploy_progress.html b/deploy-board/deploy_board/templates/deploys/deploy_progress.html index e5a5906740..4a4e97b137 100644 --- a/deploy-board/deploy_board/templates/deploys/deploy_progress.html +++ b/deploy-board/deploy_board/templates/deploys/deploy_progress.html @@ -193,7 +193,6 @@

{% elif report.account == "all" %} {% if report.showMode == "containerStatus" %} - {%with agentStat=agentStat|_pick_random_state|_pick_random_healthcheck%} {{ agentStat.agent.hostName }}-{{agentStat.agent.state}} - {% endwith %} {% else %} bool: return agent['status'] != "SUCCEEDED" and agent['status'] != "UNKNOWN" or agent['state'] == "PAUSED_BY_SYSTEM" From 1076284a67c913cfe18cb3b06ace3cb046fbbe92 Mon Sep 17 00:00:00 2001 From: Ian Roquebert <72234714+gzpcho@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:48:33 +0000 Subject: [PATCH 5/6] Remove state from hostname button --- .../deploy_board/templates/deploys/deploy_progress.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy-board/deploy_board/templates/deploys/deploy_progress.html b/deploy-board/deploy_board/templates/deploys/deploy_progress.html index 4a4e97b137..00e0728550 100644 --- a/deploy-board/deploy_board/templates/deploys/deploy_progress.html +++ b/deploy-board/deploy_board/templates/deploys/deploy_progress.html @@ -197,7 +197,7 @@

type="button" class="deployToolTip host-btn btn-default {{ agentStat|hostButtonHtmlClass }}" title="{% if agentStat.isStale %}Stale agent. Last recorded state: {% endif %}{{ agentStat|hostTooltipTitle }}"> - {{ agentStat.agent.hostName }}-{{agentStat.agent.state}} + {{ agentStat.agent.hostName }} {% else %} From 99bc4f0065c5718a7875887ad45a68e31e220f39 Mon Sep 17 00:00:00 2001 From: Ian Roquebert <72234714+gzpcho@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:10:28 +0000 Subject: [PATCH 6/6] Update unreachable host tooltip message --- deploy-board/deploy_board/webapp/templatetags/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy-board/deploy_board/webapp/templatetags/utils.py b/deploy-board/deploy_board/webapp/templatetags/utils.py index 4c5c4baeef..63b64e9e98 100644 --- a/deploy-board/deploy_board/webapp/templatetags/utils.py +++ b/deploy-board/deploy_board/webapp/templatetags/utils.py @@ -657,7 +657,7 @@ def hostTooltipTitle(agentStat: AgentStatistics) -> str: elif state == "DELETE": return "Agent is removed from the current environment" elif state == "UNREACHABLE": - return "Agent is unreachable after not responding to ping from teletraan server" + return "Agent is unreachable after not pinging Teletraan control plane within the threshold" elif state == "STOP": return "Agent is gracefully shutting down the service" elif state == "RESET":