Workspace now response to .members

This commit is contained in:
richard-dds 2018-08-22 11:49:05 -04:00
parent 379461e6fb
commit 9875a11860
4 changed files with 39 additions and 57 deletions

View File

@ -69,52 +69,3 @@ class Workspaces(object):
)
db.session.add(workspace_role)
return workspace_role
class Members(object):
def __init__(self):
pass
@classmethod
def create(cls, creator_id, body):
pass
@classmethod
def get(cls, request_id):
pass
@classmethod
def get_many(cls, workspace_id):
return [
{
"first_name": "Danny",
"last_name": "Knight",
"email": "dknight@thenavy.mil",
"dod_id": "1257892124",
"workspace_role": "Developer",
"status": "Pending",
"num_projects": "4",
},
{
"first_name": "Mario",
"last_name": "Hudson",
"email": "mhudson@thearmy.mil",
"dod_id": "4357892125",
"workspace_role": "CCPO",
"status": "Active",
"num_projects": "0",
},
{
"first_name": "Louise",
"last_name": "Greer",
"email": "lgreer@theairforce.mil",
"dod_id": "7257892125",
"workspace_role": "Admin",
"status": "Pending",
"num_projects": "43",
},
]
@classmethod
def update(cls, request_id, request_delta):
pass

View File

@ -6,6 +6,37 @@ from atst.models.types import Id
from atst.models.mixins import TimestampsMixin
MOCK_MEMBERS = [
{
"first_name": "Danny",
"last_name": "Knight",
"email": "dknight@thenavy.mil",
"dod_id": "1257892124",
"workspace_role": "Developer",
"status": "Pending",
"num_projects": "4",
},
{
"first_name": "Mario",
"last_name": "Hudson",
"email": "mhudson@thearmy.mil",
"dod_id": "4357892125",
"workspace_role": "CCPO",
"status": "Active",
"num_projects": "0",
},
{
"first_name": "Louise",
"last_name": "Greer",
"email": "lgreer@theairforce.mil",
"dod_id": "7257892125",
"workspace_role": "Admin",
"status": "Pending",
"num_projects": "43",
},
]
class Workspace(Base, TimestampsMixin):
__tablename__ = "workspaces"
@ -38,3 +69,7 @@ class Workspace(Base, TimestampsMixin):
@property
def task_order(self):
return {"number": "task-order-number"}
@property
def members(self):
return MOCK_MEMBERS

View File

@ -7,7 +7,7 @@ from flask import (
url_for,
)
from atst.domain.workspaces import Workspaces, Members
from atst.domain.workspaces import Workspaces
from atst.domain.projects import Projects
from atst.domain.environments import Environments
from atst.forms.new_project import NewProjectForm
@ -45,11 +45,7 @@ def show_workspace(workspace_id):
@bp.route("/workspaces/<workspace_id>/members")
def workspace_members(workspace_id):
workspace = Workspaces.get(g.current_user, workspace_id)
members_repo = Members()
members = members_repo.get_many(workspace_id)
return render_template(
"workspace_members.html", workspace=workspace, members=members
)
return render_template("workspace_members.html", workspace=workspace)
@bp.route("/workspaces/<workspace_id>/reports")

View File

@ -4,7 +4,7 @@
{% block workspace_content %}
{% if not members %}
{% if not workspace.members %}
{{ EmptyState(
'There are currently no members in this Workspace.',
@ -58,7 +58,7 @@
</tr>
</thead>
<tbody>
{% for m in members %}
{% for m in workspace.members %}
<tr>
<td><a href="/workspaces/123456/members/789/edit" class="icon-link icon-link--large">{{ m['first_name'] }} {{ m['last_name'] }}</a></td>
<td class='table-cell--shrink'>{% if m['num_projects'] == '0' %} <span class="label label--info">No Project Access</span> {% endif %}</td>