Merge pull request #1175 from dod-ccpo/bugfix/standardize-ordering

Standardize member and env name ordering
This commit is contained in:
graham-dds 2019-11-11 16:08:23 -05:00 committed by GitHub
commit 637a366baf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 16 deletions

View File

@ -25,6 +25,7 @@ class Application(
primaryjoin=and_(
Environment.application_id == id, Environment.deleted == False
),
order_by="Environment.name",
)
roles = relationship(
"ApplicationRole",

View File

@ -30,9 +30,9 @@ def get_environments_obj_for_app(application):
"pending": env.is_pending,
"edit_form": EditEnvironmentForm(obj=env),
"member_count": len(env.roles),
"members": [
env_role.application_role.user_name for env_role in env.roles
],
"members": sorted(
[env_role.application_role.user_name for env_role in env.roles]
),
}
for env in application.environments
],
@ -100,12 +100,11 @@ def get_members_data(application):
form = UpdateMemberForm(
environment_roles=env_roles_form_data, **permission_sets
)
update_invite_form = None
if member.latest_invitation and member.latest_invitation.can_resend:
update_invite_form = MemberForm(obj=member.latest_invitation)
else:
update_invite_form = MemberForm()
update_invite_form = (
MemberForm(obj=member.latest_invitation)
if member.latest_invitation and member.latest_invitation.can_resend
else MemberForm()
)
members_data.append(
{
@ -119,14 +118,17 @@ def get_members_data(application):
}
)
return members_data
return sorted(members_data, key=lambda member: member["user_name"])
def get_new_member_form(application):
env_roles = [
{"environment_id": e.id, "environment_name": e.name}
for e in application.environments
]
env_roles = sorted(
[
{"environment_id": e.id, "environment_name": e.name}
for e in application.environments
],
key=lambda role: role["environment_name"],
)
return NewMemberForm(data={"environment_roles": env_roles})

View File

@ -52,7 +52,10 @@ def serialize_member_form_data(member):
def get_members_data(portfolio):
members = [serialize_member_form_data(member) for member in portfolio.members]
members = sorted(
[serialize_member_form_data(member) for member in portfolio.members],
key=lambda member: member["member_name"],
)
for member in members:
if member["member_id"] == portfolio.owner_role.id:
ppoc = member

View File

@ -342,7 +342,7 @@ portfolios:
</p>
</div>
step_2_header: Add Environments to {application_name}
step_2_description: "Production, Staging, Testing, and Development environments are included by default. However, you can add, edit, and delete environments based on the needs of your Application."
step_2_description: Development, Testing, Staging, and Production environments are included by default. However, you can add, edit, and delete environments based on the needs of your Application.
step_2_button_text: "Next: Add Members"
step_3_header: Add Members to {application_name}
step_3_description: "To proceed, you will need each member's email address and DOD ID. Within this section, you will also assign Application-level permissions and environment-level roles for each member."