show request name where appropriate and set as default workspace name

This commit is contained in:
dandds 2018-09-19 09:54:06 -04:00
parent ec5c3e8ce8
commit 8fc5a4a092
9 changed files with 15 additions and 9 deletions

View File

@ -11,7 +11,7 @@ from .scopes import ScopedWorkspace
class Workspaces(object): class Workspaces(object):
@classmethod @classmethod
def create(cls, request, name=None): def create(cls, request, name=None):
name = name or request.id name = name or request.displayname
workspace = WorkspacesQuery.create(request=request, name=name) workspace = WorkspacesQuery.create(request=request, name=name)
Workspaces._create_workspace_role(request.creator, workspace, "owner") Workspaces._create_workspace_role(request.creator, workspace, "owner")
WorkspacesQuery.add_and_commit(workspace) WorkspacesQuery.add_and_commit(workspace)

View File

@ -213,3 +213,7 @@ class Request(Base):
or self.is_pending_financial_verification_changes or self.is_pending_financial_verification_changes
or self.is_approved or self.is_approved
) and self.task_order ) and self.task_order
@property
def displayname(self):
return self.latest_revision.name or self.id

View File

@ -81,7 +81,7 @@ class RequestsIndex(object):
return { return {
"workspace_id": request.workspace.id if request.workspace else None, "workspace_id": request.workspace.id if request.workspace else None,
"order_id": request.id, "name": request.displayname,
"is_new": is_new, "is_new": is_new,
"status": request.status_displayname, "status": request.status_displayname,
"app_count": app_count, "app_count": app_count,

View File

@ -80,6 +80,8 @@
{{ DefinitionReviewField("Total Spend", "details_of_use", "dollar_value", filter="dollars") }} {{ DefinitionReviewField("Total Spend", "details_of_use", "dollar_value", filter="dollars") }}
{{ DefinitionReviewField("Start Date", "details_of_use", "start_date") }} {{ DefinitionReviewField("Start Date", "details_of_use", "start_date") }}
{{ DefinitionReviewField("Request Name", "details_of_use", "name") }}
</dl> </dl>
<hr> <hr>

View File

@ -17,7 +17,7 @@
<section class='panel'> <section class='panel'>
<header class='panel__heading panel__heading--divider request-approval__heading'> <header class='panel__heading panel__heading--divider request-approval__heading'>
<h1 class='h2'>Request #{{ request.id }} <h1 class='h2'>Request: {{ request.displayname }}
</h1> </h1>
<span class='label label--info'>{{ current_status }}</span> <span class='label label--info'>{{ current_status }}</span>
</header> </header>

View File

@ -24,7 +24,7 @@
<div class="panel"> <div class="panel">
<div class="panel__heading"> <div class="panel__heading">
<h1>Request Details</h1> <h1>Request Details</h1>
<h2><span class="subtitle">#{{ request.id }}</span> <span class="label label--info">{{ request.status_displayname }}</span></h2> <h2><span class="subtitle">{{ request.displayname }}</span> <span class="label label--info">{{ request.status_displayname }}</span></h2>
</div> </div>
<div class="panel__content"> <div class="panel__content">

View File

@ -58,7 +58,7 @@
<div class="panel__heading"> <div class="panel__heading">
<h1>Financial Verification</h1> <h1>Financial Verification</h1>
<div class="subtitle" id="financial-verification"><h2>Order #{{ request.id }}</h2></div> <div class="subtitle" id="financial-verification"><h2>Request: {{ request.displayname }}</h2></div>
</div> </div>
<div class="panel__content"> <div class="panel__content">

View File

@ -90,7 +90,7 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th scope="col">JEDI Cloud Request ID</th> <th scope="col">JEDI Cloud Request Name</th>
<th scope="col">Date Request Submitted</th> <th scope="col">Date Request Submitted</th>
{% if extended_view %} {% if extended_view %}
<th scope="col">Date Request Last Edited</th> <th scope="col">Date Request Last Edited</th>
@ -107,7 +107,7 @@
{% for r in requests %} {% for r in requests %}
<tr> <tr>
<th scope="row"> <th scope="row">
<a class='icon-link icon-link--large' href="{{ r.edit_link }}">{{ r.order_id }}</a> <a class='icon-link icon-link--large' href="{{ r.edit_link }}">{{ r.name }}</a>
{% if r.action_required %}<span class="label label--info">Action Required</span>{% endif %} {% if r.action_required %}<span class="label label--info">Action Required</span>{% endif %}
</th> </th>
<td>{{ r.last_submission_timestamp | formattedDate }}</td> <td>{{ r.last_submission_timestamp | formattedDate }}</td>

View File

@ -35,8 +35,8 @@ def test_request_is_associated_with_workspace(workspace, request_):
assert workspace.request == request_ assert workspace.request == request_
def test_default_workspace_name_is_request_id(workspace, request_): def test_default_workspace_name_is_request_name(workspace, request_):
assert workspace.name == str(request_.id) assert workspace.name == str(request_.displayname)
def test_get_nonexistent_workspace_raises(): def test_get_nonexistent_workspace_raises():