Hook up Edit Project page
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
from atst.database import db
|
||||
from atst.domain.exceptions import NotFoundError
|
||||
from atst.models.project import Project
|
||||
from atst.domain.authz import Authorization
|
||||
from atst.domain.environments import Environments
|
||||
from atst.domain.exceptions import NotFoundError
|
||||
from atst.models.permissions import Permissions
|
||||
from atst.models.project import Project
|
||||
|
||||
|
||||
class Projects(object):
|
||||
@@ -19,7 +21,10 @@ class Projects(object):
|
||||
def get(cls, user, workspace, project_id):
|
||||
# TODO: this should check permission for this particular project
|
||||
Authorization.check_workspace_permission(
|
||||
user, workspace, Permissions.VIEW_APPLICATION_IN_WORKSPACE,
|
||||
user,
|
||||
workspace,
|
||||
Permissions.VIEW_APPLICATION_IN_WORKSPACE,
|
||||
"view project in workspace",
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
@@ -105,7 +105,7 @@ def new_project(workspace_id):
|
||||
|
||||
|
||||
@bp.route("/workspaces/<workspace_id>/projects/new", methods=["POST"])
|
||||
def update_project(workspace_id):
|
||||
def create_project(workspace_id):
|
||||
workspace = Workspaces.get_for_update(g.current_user, workspace_id)
|
||||
form = NewProjectForm(http_request.form)
|
||||
|
||||
@@ -126,6 +126,21 @@ def update_project(workspace_id):
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/workspaces/<workspace_id>/projects/<project_id>/edit")
|
||||
def edit_project(workspace_id, project_id):
|
||||
workspace = Workspaces.get_for_update(g.current_user, workspace_id)
|
||||
project = Projects.get(g.current_user, workspace, project_id)
|
||||
form = NewProjectForm(
|
||||
name=project.name,
|
||||
environment_names=[env.name for env in project.environments],
|
||||
description=project.description,
|
||||
)
|
||||
|
||||
return render_template(
|
||||
"workspaces/projects/edit.html", workspace=workspace, project=project, form=form
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/workspaces/<workspace_id>/members/new")
|
||||
def new_member(workspace_id):
|
||||
workspace = Workspaces.get(g.current_user, workspace_id)
|
||||
|
||||
Reference in New Issue
Block a user