Update the template to show real data
This commit is contained in:
parent
79c357dcab
commit
5a5d81eb7f
@ -4,7 +4,6 @@ from atst.database import db
|
|||||||
from atst.models.environment import Environment
|
from atst.models.environment import Environment
|
||||||
from atst.models.environment_role import EnvironmentRole, CSPRole
|
from atst.models.environment_role import EnvironmentRole, CSPRole
|
||||||
from atst.models.project import Project
|
from atst.models.project import Project
|
||||||
from atst.domain.users import Users
|
|
||||||
|
|
||||||
from .exceptions import NotFoundError
|
from .exceptions import NotFoundError
|
||||||
|
|
||||||
@ -59,13 +58,13 @@ class Environments(object):
|
|||||||
new_role = environment_data["user_role_name"]
|
new_role = environment_data["user_role_name"]
|
||||||
environment = Environments.get(cls=cls, environment_id=environment_data["id"])
|
environment = Environments.get(cls=cls, environment_id=environment_data["id"])
|
||||||
if workspace_user.has_environment_roles:
|
if workspace_user.has_environment_roles:
|
||||||
env_role = EnvironmentRole.get(workspace_user.user_id, environment.id)
|
env_role = EnvironmentRole.get(
|
||||||
|
workspace_user.user_id, environment_data["id"]
|
||||||
|
)
|
||||||
env_role.role = new_role
|
env_role.role = new_role
|
||||||
else:
|
else:
|
||||||
env_role = EnvironmentRole(
|
env_role = EnvironmentRole(
|
||||||
user=workspace_user.user,
|
user=workspace_user.user, environment=environment, role=new_role
|
||||||
environment=environment,
|
|
||||||
role=new_role
|
|
||||||
)
|
)
|
||||||
db.session.add(env_role)
|
db.session.add(env_role)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
@ -49,3 +49,21 @@ class Projects(object):
|
|||||||
.filter(EnvironmentRole.user_id == user.id)
|
.filter(EnvironmentRole.user_id == user.id)
|
||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_all(cls, workspace_user, workspace):
|
||||||
|
Authorization.check_workspace_permission(
|
||||||
|
workspace_user.user,
|
||||||
|
workspace,
|
||||||
|
Permissions.VIEW_APPLICATION_IN_WORKSPACE,
|
||||||
|
"view project in workspace",
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
projects = (
|
||||||
|
db.session.query(Project).filter_by(workspace_id=workspace.id).all()
|
||||||
|
)
|
||||||
|
except NoResultFound:
|
||||||
|
raise NotFoundError("projects")
|
||||||
|
|
||||||
|
return projects
|
||||||
|
@ -214,9 +214,14 @@ def view_member(workspace_id, member_id):
|
|||||||
"edit this workspace user",
|
"edit this workspace user",
|
||||||
)
|
)
|
||||||
member = WorkspaceUsers.get(workspace_id, member_id)
|
member = WorkspaceUsers.get(workspace_id, member_id)
|
||||||
|
projects = Projects.get_all(member, workspace)
|
||||||
form = EditMemberForm(workspace_role=member.role, environment_role="")
|
form = EditMemberForm(workspace_role=member.role, environment_role="")
|
||||||
return render_template(
|
return render_template(
|
||||||
"workspaces/members/edit.html", form=form, workspace=workspace, member=member
|
"workspaces/members/edit.html",
|
||||||
|
workspace=workspace,
|
||||||
|
member=member,
|
||||||
|
projects=projects,
|
||||||
|
form=form,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,83 +88,39 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
|
{% for project in projects %}
|
||||||
<div is='toggler' default-visible class='block-list project-list-item'>
|
<div is='toggler' default-visible class='block-list project-list-item'>
|
||||||
<template slot-scope='{ isVisible, toggle }'>
|
<template slot-scope='{ isVisible, toggle }'>
|
||||||
<header class='block-list__header'>
|
<header class='block-list__header'>
|
||||||
<button v-on:click='toggle' class='icon-link icon-link--large icon-link--default spend-table__project__toggler'>
|
<button v-on:click='toggle' class='icon-link icon-link--large icon-link--default spend-table__project__toggler'>
|
||||||
<template v-if='isVisible'>{{ Icon('caret_down') }}</template>
|
<template v-if='isVisible'>{{ Icon('caret_down') }}</template>
|
||||||
<template v-else>{{ Icon('caret_right') }}</template>
|
<template v-else>{{ Icon('caret_right') }}</template>
|
||||||
<h3 class="block-list__title">Code.mil</h3>
|
<h3 class="block-list__title">{{ project.name }}</h3>
|
||||||
</button>
|
</button>
|
||||||
<span><a href="#" class="icon-link icon-link--danger">revoke all access</a></span>
|
<span><a href="#" class="icon-link icon-link--danger">revoke all access</a></span>
|
||||||
</header>
|
</header>
|
||||||
<ul v-show='isVisible'>
|
<ul v-show='isVisible'>
|
||||||
|
{% for env in project.environments %}
|
||||||
<li class='block-list__item project-list-item__environment'>
|
<li class='block-list__item project-list-item__environment'>
|
||||||
<span class='project-list-item__environment'>
|
<span class='project-list-item__environment'>
|
||||||
Development
|
{{ env.name }}
|
||||||
</span>
|
</span>
|
||||||
<div class='project-list-item__environment__actions'>
|
<div class='project-list-item__environment__actions'>
|
||||||
<span class="label">no access </span><button v-on:click="openModal('rolesModal')" type="button" class="icon-link">set role</button>
|
{% set role = 'no access' %}
|
||||||
|
{% set label = 'label' %}
|
||||||
|
{% for er in member.user.environment_roles %}
|
||||||
|
{% if er.get(member.user_id, env.id) %}
|
||||||
|
{% set role = er.get(member.user_id, env.id).role %}
|
||||||
|
{% set label = 'label label--success' %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
<span class="{{ label }}">{{ role }}</span><button v-on:click="openModal('rolesModal')" type="button" class="icon-link">set role</button>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
{% endfor %}
|
||||||
<li class='block-list__item project-list-item__environment'>
|
|
||||||
<span class='project-list-item__environment'>
|
|
||||||
Sandbox
|
|
||||||
</span>
|
|
||||||
<div class='project-list-item__environment__actions'>
|
|
||||||
<span class="label">no access</span><button v-on:click="openModal('rolesModal')" type="button" class="icon-link">set role</button>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class='block-list__item project-list-item__environment'>
|
|
||||||
<span class='project-list-item__environment'>
|
|
||||||
Production
|
|
||||||
</span>
|
|
||||||
<div class='project-list-item__environment__actions'>
|
|
||||||
<span class="label label--success">Billing</span><button v-on:click="openModal('rolesModal')" type="button" class="icon-link">set role</button>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div is="toggler" class='block-list project-list-item'>
|
|
||||||
<template slot-scope='{ isVisible, toggle }'>
|
|
||||||
<header class='block-list__header'>
|
|
||||||
<button v-on:click='toggle' class='icon-link icon-link--large icon-link--default spend-table__project__toggler'>
|
|
||||||
<template v-if='isVisible'>{{ Icon('caret_down') }}</template>
|
|
||||||
<template v-else>{{ Icon('caret_right') }}</template>
|
|
||||||
<h3 class="block-list__title">Digital Dojo</h3>
|
|
||||||
</button>
|
|
||||||
<span class="label">no access</span>
|
|
||||||
</header>
|
|
||||||
<ul v-show='isVisible'>
|
|
||||||
<li class='block-list__item project-list-item__environment'>
|
|
||||||
<span class='project-list-item__environment'>
|
|
||||||
Development
|
|
||||||
</span>
|
|
||||||
<div class='project-list-item__environment__actions'>
|
|
||||||
<span class="label">no access </span><button v-on:click="openModal('rolesModal')" type="button" class="icon-link">set role</button>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class='block-list__item project-list-item__environment'>
|
|
||||||
<span class='project-list-item__environment'>
|
|
||||||
Sandbox
|
|
||||||
</span>
|
|
||||||
<div class='project-list-item__environment__actions'>
|
|
||||||
<span class="label">no access</span><button v-on:click="openModal('rolesModal')" type="button" class="icon-link">set role</button>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class='block-list__item project-list-item__environment'>
|
|
||||||
<span class='project-list-item__environment'>
|
|
||||||
Production
|
|
||||||
</span>
|
|
||||||
<div class='project-list-item__environment__actions'>
|
|
||||||
<span class="label">no access</span><button v-on:click="openModal('rolesModal')" type="button" class="icon-link">set role</button>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
<div class='action-group'>
|
<div class='action-group'>
|
||||||
<button class='action-group__action usa-button usa-button-big'>
|
<button class='action-group__action usa-button usa-button-big'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user