diff --git a/atst/app.py b/atst/app.py index bf6eb385..75ba7d63 100644 --- a/atst/app.py +++ b/atst/app.py @@ -7,7 +7,9 @@ from redis import StrictRedis from atst.handlers.main import Main from atst.handlers.root import Root from atst.handlers.login_redirect import LoginRedirect +from atst.handlers.workspaces import Workspaces from atst.handlers.workspace import Workspace +from atst.handlers.workspace_members import WorkspaceMembers from atst.handlers.request import Request from atst.handlers.request_financial_verification import RequestFinancialVerification from atst.handlers.request_new import RequestNew @@ -46,7 +48,7 @@ def make_app(config, deps, **kwargs): ), url( r"/workspaces", - Workspace, + Workspaces, {"page": "workspaces", "authz_client": deps["authz_client"]}, name="workspaces", ), @@ -111,6 +113,8 @@ def make_app(config, deps, **kwargs): url(r"/users", Main, {"page": "users"}, name="users"), url(r"/reports", Main, {"page": "reports"}, name="reports"), url(r"/calculator", Main, {"page": "calculator"}, name="calculator"), + url(r"/workspaces/(\S+)/members", WorkspaceMembers, {}, name="workspace_members"), + url(r"/workspaces/(\S+)", Workspace, {}, name="workspace"), ] if not ENV == "production": diff --git a/atst/domain/workspaces.py b/atst/domain/workspaces.py new file mode 100644 index 00000000..41b88194 --- /dev/null +++ b/atst/domain/workspaces.py @@ -0,0 +1,92 @@ +import tornado.gen + + +class Projects(object): + + def __init__(self): + pass + + def create(self, creator_id, body): + pass + + def get(self, project_id): + pass + + def get_many(self, workspace_id): + return [ + { + "id": "187c9bea-9541-45d7-801f-cf8e7a642e93", + "name": "Code.mil", + "environments": [ + { + "id": "b1154fdd-31c9-437f-b580-2e4d757de5cb", + "name": "Development", + }, + {"id": "b1e2077a-6a3d-4e7f-a80c-bf1143433adf", "name": "Sandbox"}, + { + "id": "8ea95eea-7cc0-4500-adf7-8a13eaa6b752", + "name": "production", + }, + ], + }, + { + "id": "ececfd73-b19d-45aa-9199-a950ba2c7269", + "name": "Digital Dojo", + "environments": [ + { + "id": "f56167cb-ca3d-4e29-8b60-91052957a118", + "name": "Development", + }, + { + "id": "7c18689c-5b77-4b68-8d64-d4d8a830bf47", + "name": "production", + }, + ], + }, + ] + + def update(self, request_id, request_delta): + pass + + +class Members(object): + + def __init__(self): + pass + + def create(self, creator_id, body): + pass + + def get(self, request_id): + pass + + def get_many(self, workspace_id): + return [ + { + "first_name": "Danny", + "last_name": "Knight", + "email": "dknight@thenavy.mil", + "dod_id": "1257892124", + "workspace_role": "Developer", + "status": "Pending", + }, + { + "first_name": "Mario", + "last_name": "Hudson", + "email": "mhudson@thearmy.mil", + "dod_id": "4357892125", + "workspace_role": "CCPO", + "status": "Active", + }, + { + "first_name": "Louise", + "last_name": "Greer", + "email": "lgreer@theairforce.mil", + "dod_id": "7257892125", + "workspace_role": "Admin", + "status": "Pending", + }, + ] + + def update(self, request_id, request_delta): + pass diff --git a/atst/handlers/workspace.py b/atst/handlers/workspace.py index d6672843..5a1f80ec 100644 --- a/atst/handlers/workspace.py +++ b/atst/handlers/workspace.py @@ -1,22 +1,15 @@ -from atst.handler import BaseHandler import tornado -mock_workspaces = [ - { - "name": "Unclassified IaaS and PaaS for Defense Digital Service (DDS)", - "id": "5966187a-eff9-44c3-aa15-4de7a65ac7ff", - "task_order": {"number": 123456}, - "user_count": 23, - } -] +from atst.handler import BaseHandler +from atst.domain.workspaces import Projects class Workspace(BaseHandler): - def initialize(self, page, authz_client): - self.page = page - self.authz_client = authz_client + def initialize(self): + self.projects_repo = Projects() - @tornado.gen.coroutine @tornado.web.authenticated - def get(self): - self.render("workspaces.html.to", page=self.page, workspaces=mock_workspaces) + @tornado.gen.coroutine + def get(self, workspace_id): + projects = self.projects_repo.get_many(workspace_id) + self.render("workspace.html.to", projects=projects) diff --git a/atst/handlers/workspace_members.py b/atst/handlers/workspace_members.py new file mode 100644 index 00000000..c9b12fdf --- /dev/null +++ b/atst/handlers/workspace_members.py @@ -0,0 +1,15 @@ +import tornado + +from atst.handler import BaseHandler +from atst.domain.workspaces import Members + + +class WorkspaceMembers(BaseHandler): + def initialize(self): + self.members_repo = Members() + + @tornado.web.authenticated + @tornado.gen.coroutine + def get(self, workspace_id): + members = self.members_repo.get_many(workspace_id) + self.render("workspace_members.html.to", members=members) diff --git a/atst/handlers/workspaces.py b/atst/handlers/workspaces.py new file mode 100644 index 00000000..c7e06451 --- /dev/null +++ b/atst/handlers/workspaces.py @@ -0,0 +1,22 @@ +from atst.handler import BaseHandler +import tornado + +mock_workspaces = [ + { + "name": "Unclassified IaaS and PaaS for Defense Digital Service (DDS)", + "id": "5966187a-eff9-44c3-aa15-4de7a65ac7ff", + "task_order": {"number": 123456}, + "user_count": 23, + } +] + + +class Workspaces(BaseHandler): + def initialize(self, page, authz_client): + self.page = page + self.authz_client = authz_client + + @tornado.gen.coroutine + @tornado.web.authenticated + def get(self): + self.render("workspaces.html.to", page=self.page, workspaces=mock_workspaces) diff --git a/templates/workspace.html.to b/templates/workspace.html.to new file mode 100644 index 00000000..838ddfde --- /dev/null +++ b/templates/workspace.html.to @@ -0,0 +1,26 @@ +{% extends "base.html.to" %} + +{% block content %} + +
+
+ + + + + + + + {% for p in projects %} + + + + {% end %} + +
Name
{{ p['name'] }}
+
+
+ + +{% end %} + diff --git a/templates/workspace_members.html.to b/templates/workspace_members.html.to new file mode 100644 index 00000000..9d66ee83 --- /dev/null +++ b/templates/workspace_members.html.to @@ -0,0 +1,26 @@ +{% extends "base.html.to" %} + +{% block content %} + +
+
+ + + + + + + + {% for m in members %} + + + + {% end %} + +
Name
{{ m['first_name'] }} {{ m['last_name'] }}
+
+
+ + +{% end %} +