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

add drop down menu for showing main account and sub account #1240

Merged
merged 32 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6b1b776
add drop down menu for showing main account and sub account
liyaqin1 Aug 23, 2023
2b284f0
missed an import
liyaqin1 Aug 23, 2023
8ebd7b7
missed an argument
liyaqin1 Aug 23, 2023
6ea1045
missed something in the query path
liyaqin1 Aug 23, 2023
7d2a956
debug
liyaqin1 Aug 23, 2023
295c884
debug
liyaqin1 Aug 23, 2023
eab0086
show the hosts correctly
liyaqin1 Aug 23, 2023
be16f76
improve the ui
liyaqin1 Aug 23, 2023
8f05216
update another place
liyaqin1 Aug 23, 2023
50ddae6
consider no account id situation
liyaqin1 Aug 23, 2023
68485ed
debug
liyaqin1 Aug 23, 2023
a89109b
debug
liyaqin1 Aug 23, 2023
9d5c787
generate host_id and account_id map for each env/stage
liyaqin1 Aug 24, 2023
e49ccf4
debug
liyaqin1 Aug 24, 2023
16fb2eb
debug
liyaqin1 Aug 24, 2023
4bea711
debug
liyaqin1 Aug 24, 2023
b3d6550
debug
liyaqin1 Aug 24, 2023
38e9c24
use agent helper instead of environs helper
liyaqin1 Aug 24, 2023
b7e413a
test
liyaqin1 Aug 24, 2023
e1d168d
debug
liyaqin1 Aug 24, 2023
b07ed7e
debug
liyaqin1 Aug 24, 2023
21c18da
debug
liyaqin1 Aug 24, 2023
583c7f2
debug
liyaqin1 Aug 24, 2023
27a9661
debug
liyaqin1 Aug 24, 2023
3976da8
debug
liyaqin1 Aug 24, 2023
5093b21
debug
liyaqin1 Aug 24, 2023
e6dedf8
debug
liyaqin1 Aug 24, 2023
0567bb1
debug
liyaqin1 Aug 24, 2023
d3fb7d6
debug
liyaqin1 Aug 24, 2023
32f99e4
call an existing api to get host_id and account_id mapping
liyaqin1 Aug 24, 2023
4bb14ab
use string instead of int to compare
liyaqin1 Aug 24, 2023
0aadfa2
remove unnecessary code
liyaqin1 Aug 24, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,69 @@
{% for agentStat in report.agentStats %}
{% for hostTag in hostTags %}
{% if agentStat.agent.hostName == hostTag.hostName %}
{% if report.showMode == "complete" or report.showMode == "compact" %}
<a href="/env/{{env.envName}}/{{env.stageName}}/host/{{ agentStat.agent.hostName }}"
type="button" class="deployToolTip btn btn-xs {{ agentStat | agentButton }} host-btn"
title="{{ agentStat | agentTip }}">
{% if report.showMode == "complete" %}
<small>{{ agentStat.agent.hostName }}</small>
{% endif %}
<i class="fa fa-fw {{ agentStat | agentIcon }}"></i>
type="button" class="deployToolTip btn btn-xs {{ agentStat | agentButton }} host-btn"
title="{{ agentStat | agentTip }}">
{% if report.showMode != "compact" %}
<small>{{ agentStat.agent.hostName }}</small>
{% endif %}
<i class="fa fa-fw {{ agentStat | agentIcon }}"></i>
</a>
{% elif report.showMode == "main" %}
liyaqin1 marked this conversation as resolved.
Show resolved Hide resolved
{% if not agentStat.agent.accountId or agentStat.agent.accountId == 998131032990 %}
liyaqin1 marked this conversation as resolved.
Show resolved Hide resolved
<a href="/env/{{env.envName}}/{{env.stageName}}/host/{{ agentStat.agent.hostName }}"
type="button" class="deployToolTip btn btn-xs {{ agentStat | agentButton }} host-btn"
title="{{ agentStat | agentTip }}">
<small>{{ agentStat.agent.hostName }}</small>
<i class="fa fa-fw {{ agentStat | agentIcon }}"></i>
</a>
{% endif %}
{% elif report.showMode == "sub" %}
{% if agentStat.agent.accountId and agentStat.agent.accountId != 998131032990 %}
<a href="/env/{{env.envName}}/{{env.stageName}}/host/{{ agentStat.agent.hostName }}"
type="button" class="deployToolTip btn btn-xs {{ agentStat | agentButton }} host-btn"
title="{{ agentStat | agentTip }}">
<small>{{ agentStat.agent.hostName }}</small>
<i class="fa fa-fw {{ agentStat | agentIcon }}"></i>
</a>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</div>
{% endfor %}
{% else %}
{% for agentStat in report.agentStats %}
<a href="/env/{{env.envName}}/{{env.stageName}}/host/{{ agentStat.agent.hostName }}"
{% if report.showMode == "complete" or report.showMode == "compact" %}
<a href="/env/{{env.envName}}/{{env.stageName}}/host/{{ agentStat.agent.hostName }}"
type="button" class="deployToolTip btn btn-xs {{ agentStat | agentButton }} host-btn"
title="{{ agentStat | agentTip }}">
{% if report.showMode == "complete" %}
{% if report.showMode != "compact" %}
<small>{{ agentStat.agent.hostName }}</small>
{% endif %}
<i class="fa fa-fw {{ agentStat | agentIcon }}"></i>
</a>
</a>
{% elif report.showMode == "main" %}
{% if not agentStat.agent.accountId or agentStat.agent.accountId == 998131032990 %}
<a href="/env/{{env.envName}}/{{env.stageName}}/host/{{ agentStat.agent.hostName }}"
type="button" class="deployToolTip btn btn-xs {{ agentStat | agentButton }} host-btn"
title="{{ agentStat | agentTip }}">
<small>{{ agentStat.agent.hostName }}</small>
<i class="fa fa-fw {{ agentStat | agentIcon }}"></i>
</a>
{% endif %}
{% elif report.showMode == "sub" %}
{% if agentStat.agent.accountId and agentStat.agent.accountId != 998131032990 %}
<a href="/env/{{env.envName}}/{{env.stageName}}/host/{{ agentStat.agent.hostName }}"
type="button" class="deployToolTip btn btn-xs {{ agentStat | agentButton }} host-btn"
title="{{ agentStat | agentTip }}">
<small>{{ agentStat.agent.hostName }}</small>
<i class="fa fa-fw {{ agentStat | agentIcon }}"></i>
</a>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}

Expand Down
18 changes: 18 additions & 0 deletions deploy-board/deploy_board/templates/environs/env_landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,24 @@ <h4 class="panel-title pull-left pointer-cursor">
> Complete
</label></div>
</li>
<li>
<div class="radio"><label>&nbsp;
<input type="radio" name="showMode" value="main"
{% if report.showMode == "main" %}
checked
{% endif %}
> Main Account
</label></div>
</li>
<li>
<div class="radio"><label>&nbsp;
<input type="radio" name="showMode" value="sub"
{% if report.showMode == "sub" %}
checked
{% endif %}
> Sub Account
</label></div>
</li>
<li role="presentation" class="divider"></li>
<li>
<div class="checkbox"><label>&nbsp;
Expand Down
3 changes: 2 additions & 1 deletion deploy-board/deploy_board/webapp/agent_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""Helper functions to help generate agents views
"""
from common import is_agent_failed
from helpers import builds_helper, deploys_helper, environs_helper, clusters_helper, groups_helper
from helpers import builds_helper, deploys_helper, environs_helper, clusters_helper, groups_helper, hosts_helper
from deploy_board.settings import IS_PINTEREST
import time
import service_add_ons
Expand Down Expand Up @@ -148,6 +148,7 @@ def gen_report(request, env, progress, sortByStatus="false"):
deployStats[env['deployId']] = currentDeployStat

for agent in progress["agents"]:
agent["accountId"] = hosts_helper.get_accout_id_by_name(request, agent["hostName"])
liyaqin1 marked this conversation as resolved.
Show resolved Hide resolved
if agent["firstDeploy"]:
firstTimeAgentStats.append(addToEnvReport(request, deployStats, agent, env))
else:
Expand Down
3 changes: 3 additions & 0 deletions deploy-board/deploy_board/webapp/helpers/hosts_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@

def get_hosts_by_name(request, host_name):
return deployclient.get("/hosts/%s" % host_name, request.teletraan_user_id.token)

def get_accout_id_by_name(request, host_name):
return deployclient.get("/hosts/%s/accountId" % host_name, request.teletraan_user_id.token)
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,10 @@ public List<HostBean> get(
public Collection<HostBean> getById(@PathParam("hostId") String hostId) throws Exception {
return hostDAO.getHostsByHostId(hostId);
}

@GET
@Path("/{hostName : [a-zA-Z0-9\\-_]+}/accountId")
public String getAccountIdByHost(@PathParam("hostName") String hostName) throws Exception {
return hostDAO.getAccountIdByHost(hostName);
}
}
Loading