Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

highlight sidecars with matching host environment #1483

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions deploy-board/deploy_board/templates/hosts/host_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,21 @@

{% if agent_wrappers %}
<div class="panel panel-default">
{% if has_host_env_sidecar_agents %}
{% include "panel_heading.tmpl" with panel_title="Sidecar Agent Details" panel_body_id="sidecarAgentDetailsId" direction="down" copy_host_name_button=True %}
<div id="sidecarAgentDetailsId" class="collapse in panel-body">
<span>This is a sidecar deployment on the host. The relevant sidecar has been marked with a <span class="bg-info">blue background</span> for visibility.</span>
{% else %}
{% include "panel_heading.tmpl" with panel_title="Sidecar Agent Details" panel_body_id="sidecarAgentDetailsId" direction="right" copy_host_name_button=True %}
<div id="sidecarAgentDetailsId" class="collapse panel-body">
{% endif %}
{% for agent_wrapper in agent_wrappers.sidecars %}
{% with env=agent_wrapper.env agent=agent_wrapper.agent hostdetailsvalue=host_details|getValue:"Phobos Link" %}
{% if env and env_name == env.envName and stage_name == env.stageName %}
{% include "hosts/host_details.tmpl" with agent=agent env=env hostdetailsvalue=hostdetailsvalue host_related_sidecar=1%}
{% else %}
{% include "hosts/host_details.tmpl" with agent=agent env=env hostdetailsvalue=hostdetailsvalue%}
{% endif %}
{% endwith %}
{% endfor %}
</div>
Expand Down
11 changes: 11 additions & 0 deletions deploy-board/deploy_board/templates/hosts/host_details.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{% load utils %}
<div id="hostInfo" class="panel panel-default">
{% if host_related_sidecar %}
<div class="panel-heading host-related-sidecar">
{% else %}
<div class="panel-heading">
{% endif %}
<strong>Environment:</strong><a href="/env/{{ env.envName }}/{{ env.stageName }}"> {{ env.envName }}/{{ env.stageName }}</a>
<strong>Deploy:</strong><a href="/deploy/{{ agent.deployId }}"> {{ agent.deployId }}</a>
</div>
Expand Down Expand Up @@ -83,6 +87,13 @@
</div>
</div>
</div>
<style>
#hostInfo>.panel-heading.host-related-sidecar {
background-image: none;
background-color: #d9edf7;
font-weight: bold;
}
</style>
<script>
$(function () {
$('.deployToolTip').tooltip();
Expand Down
9 changes: 9 additions & 0 deletions deploy-board/deploy_board/webapp/host_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ def get(self, request, name, stage, hostname):
is_protected = autoscaling_groups_helper.is_hosts_protected(request, asg, [host_id])

agent_wrappers, is_unreachable = get_agent_wrapper(request, hostname)
has_host_env_sidecar_agents = any(
agent for agent in agent_wrappers['sidecars']
if agent['env'] and agent['env']['envName'] and
agent['env']['stageName'] and
agent['env']['envName'] == name and
agent['env']['stageName'] == stage
)

host_details = get_host_details(host_id)

termination_limit = environs_helper.get_env_by_stage(request, name, stage).get('terminationLimit')
Expand All @@ -212,6 +220,7 @@ def get(self, request, name, stage, hostname):
'host_details': host_details,
'duplicate_stage': duplicate_stage,
'termination_limit': termination_limit,
'has_host_env_sidecar_agents': has_host_env_sidecar_agents,
})


Expand Down
Loading