Merge pull request #302 from dod-ccpo/name-a-request-#160396084
Name a request #160396084
This commit is contained in:
commit
21c724314f
@ -35,7 +35,7 @@ def downgrade():
|
||||
session = Session(bind=op.get_bind())
|
||||
|
||||
owner_and_admin = session.query(Role).filter(Role.name.in_(["owner", "admin"])).all()
|
||||
for role in owner_and_ccpo:
|
||||
for role in owner_and_admin:
|
||||
role.remove_permission(Permissions.EDIT_WORKSPACE_INFORMATION)
|
||||
session.add(role)
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
"""add name to request revision
|
||||
|
||||
Revision ID: a496111da617
|
||||
Revises: 4f4defb7b440
|
||||
Create Date: 2018-09-18 16:45:59.297289
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a496111da617'
|
||||
down_revision = '4f4defb7b440'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('request_revisions', sa.Column('name', sa.String(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('request_revisions', 'name')
|
||||
# ### end Alembic commands ###
|
@ -11,7 +11,7 @@ from .scopes import ScopedWorkspace
|
||||
class Workspaces(object):
|
||||
@classmethod
|
||||
def create(cls, request, name=None):
|
||||
name = name or request.id
|
||||
name = name or request.displayname
|
||||
workspace = WorkspacesQuery.create(request=request, name=name)
|
||||
Workspaces._create_workspace_role(request.creator, workspace, "owner")
|
||||
WorkspacesQuery.add_and_commit(workspace)
|
||||
|
@ -147,6 +147,19 @@ class DetailsOfUseForm(ValidatedForm):
|
||||
format="%m/%d/%Y",
|
||||
)
|
||||
|
||||
name = StringField(
|
||||
"Name Your Request",
|
||||
description="This name serves as a reference for your initial request and the associated workspace that will be created once this request is approved. You may edit this name later.",
|
||||
validators=[
|
||||
Required(),
|
||||
Length(
|
||||
min=4,
|
||||
max=100,
|
||||
message="Request names must be at least 4 and not more than 100 characters",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
class InformationAboutYouForm(ValidatedForm):
|
||||
fname_request = StringField("First Name", validators=[Required(), Alphabet()])
|
||||
|
@ -10,7 +10,7 @@ class WorkspaceForm(ValidatedForm):
|
||||
validators=[
|
||||
Length(
|
||||
min=4,
|
||||
max=50,
|
||||
max=100,
|
||||
message="Workspace names must be at least 4 and not more than 50 characters",
|
||||
)
|
||||
],
|
||||
|
@ -75,6 +75,7 @@ class Request(Base):
|
||||
"average_daily_traffic_gb",
|
||||
"rationalization_software_systems",
|
||||
"organization_providing_assistance",
|
||||
"name",
|
||||
]
|
||||
INFORMATION_ABOUT_YOU_FIELDS = [
|
||||
"citizenship",
|
||||
@ -212,3 +213,7 @@ class Request(Base):
|
||||
or self.is_pending_financial_verification_changes
|
||||
or self.is_approved
|
||||
) and self.task_order
|
||||
|
||||
@property
|
||||
def displayname(self):
|
||||
return self.latest_revision.name or self.id
|
||||
|
@ -51,6 +51,7 @@ class RequestRevision(Base, TimestampsMixin):
|
||||
average_daily_traffic_gb = Column(Integer)
|
||||
rationalization_software_systems = Column(String)
|
||||
organization_providing_assistance = Column(String)
|
||||
name = Column(String)
|
||||
|
||||
# information_about_you
|
||||
citizenship = Column(String)
|
||||
|
@ -81,7 +81,7 @@ class RequestsIndex(object):
|
||||
|
||||
return {
|
||||
"workspace_id": request.workspace.id if request.workspace else None,
|
||||
"order_id": request.id,
|
||||
"name": request.displayname,
|
||||
"is_new": is_new,
|
||||
"status": request.status_displayname,
|
||||
"app_count": app_count,
|
||||
|
@ -81,8 +81,8 @@ export default {
|
||||
},
|
||||
workspaceName: {
|
||||
mask: false,
|
||||
match: /^.{4,50}$/,
|
||||
match: /^.{4,100}$/,
|
||||
unmask: [],
|
||||
validationError: 'Workspace names must be at least 4 and not more than 50 characters'
|
||||
validationError: 'Workspace and request names must be at least 4 and not more than 100 characters'
|
||||
},
|
||||
}
|
||||
|
@ -80,6 +80,8 @@
|
||||
{{ DefinitionReviewField("Total Spend", "details_of_use", "dollar_value", filter="dollars") }}
|
||||
|
||||
{{ DefinitionReviewField("Start Date", "details_of_use", "start_date") }}
|
||||
|
||||
{{ DefinitionReviewField("Request Name", "details_of_use", "name") }}
|
||||
</dl>
|
||||
|
||||
<hr>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<section class='panel'>
|
||||
<header class='panel__heading panel__heading--divider request-approval__heading'>
|
||||
<h1 class='h2'>Request #{{ request.id }}
|
||||
<h1 class='h2'>Request: {{ request.displayname }}
|
||||
</h1>
|
||||
<span class='label label--info'>{{ current_status }}</span>
|
||||
</header>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="panel">
|
||||
<div class="panel__heading">
|
||||
<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 class="panel__content">
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
<div class="panel__heading">
|
||||
<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 class="panel__content">
|
||||
|
@ -90,7 +90,7 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">JEDI Cloud Request ID</th>
|
||||
<th scope="col">JEDI Cloud Request Name</th>
|
||||
<th scope="col">Date Request Submitted</th>
|
||||
{% if extended_view %}
|
||||
<th scope="col">Date Request Last Edited</th>
|
||||
@ -107,7 +107,7 @@
|
||||
{% for r in requests %}
|
||||
<tr>
|
||||
<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 %}
|
||||
</th>
|
||||
<td>{{ r.last_submission_timestamp | formattedDate }}</td>
|
||||
|
@ -78,6 +78,7 @@
|
||||
|
||||
{{ TextInput(f.dollar_value, validation='dollars', placeholder='$0', tooltip='You may specify a different Total Spend amount to cover other JEDI Cloud services that the JEDI Cloud cost calculator was not able to estimate. Examples may include support packages from the cloud service provider.') }}
|
||||
{{ DateInput(f.start_date, placeholder='MM / DD / YYYY', validation='date') }}
|
||||
{{ TextInput(f.name, placeholder='Request Name', validation='workspaceName') }}
|
||||
|
||||
</div>
|
||||
</details-of-use>
|
||||
|
@ -35,8 +35,8 @@ def test_request_is_associated_with_workspace(workspace, request_):
|
||||
assert workspace.request == request_
|
||||
|
||||
|
||||
def test_default_workspace_name_is_request_id(workspace, request_):
|
||||
assert workspace.name == str(request_.id)
|
||||
def test_default_workspace_name_is_request_name(workspace, request_):
|
||||
assert workspace.name == str(request_.displayname)
|
||||
|
||||
|
||||
def test_get_nonexistent_workspace_raises():
|
||||
|
@ -108,6 +108,7 @@ class RequestFactory(Base):
|
||||
def create_initial_revision(cls, request, dollar_value=1000000):
|
||||
user = request.creator
|
||||
default_data = dict(
|
||||
name=factory.Faker("domain_word"),
|
||||
am_poc=False,
|
||||
dodid_poc=user.dod_id,
|
||||
email_poc=user.email,
|
||||
|
@ -14,6 +14,7 @@ class TestDetailsOfUseForm:
|
||||
"number_user_sessions": "6",
|
||||
"average_daily_traffic": "0",
|
||||
"start_date": "12/12/2050",
|
||||
"name": "blue-beluga",
|
||||
}
|
||||
migration_data = {
|
||||
"jedi_migration": "yes",
|
||||
|
Loading…
x
Reference in New Issue
Block a user