stub functionality for individual workspaces with projects

This commit is contained in:
dandds 2018-07-26 13:34:46 -04:00
parent 34a1743b7a
commit c594d88804
5 changed files with 126 additions and 16 deletions

View File

@ -7,6 +7,7 @@ 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.request import Request
from atst.handlers.request_financial_verification import RequestFinancialVerification
@ -46,7 +47,7 @@ def make_app(config, deps, **kwargs):
),
url(
r"/workspaces",
Workspace,
Workspaces,
{"page": "workspaces", "authz_client": deps["authz_client"]},
name="workspaces",
),
@ -111,6 +112,7 @@ 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+)", Workspace, {}, name="workspace"),
]
if not ENV == "production":

67
atst/domain/workspaces.py Normal file
View File

@ -0,0 +1,67 @@
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 update(self, request_id, request_delta):
pass

View File

@ -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)

View File

@ -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)

View File

@ -0,0 +1,26 @@
{% extends "base.html.to" %}
{% block content %}
<div class="panel">
<div class='responsive-table-wrapper'>
<table>
<thead>
<tr>
<th scope="col">Name</th>
</tr>
</thead>
<tbody>
{% for p in projects %}
<tr>
<td>{{ p['name'] }}</td>
</tr>
{% end %}
</tbody>
</table>
</div>
</div>
{% end %}