From 0dd350112cf439a5c91869b86f36e8355596a538 Mon Sep 17 00:00:00 2001 From: Andrew Croce Date: Mon, 27 Aug 2018 14:17:58 -0400 Subject: [PATCH] Display Empty State component on workspace project Adjust button and message depending on user permissions --- templates/workspace_projects.html | 71 ++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/templates/workspace_projects.html b/templates/workspace_projects.html index d2af0e17..fc9a0eb1 100644 --- a/templates/workspace_projects.html +++ b/templates/workspace_projects.html @@ -1,36 +1,57 @@ {% from "components/icon.html" import Icon %} {% from "components/alert.html" import Alert %} +{% from "components/empty_state.html" import EmptyState %} {% extends "base_workspace.html" %} + {% block workspace_content %} -{% for project in workspace.projects %} -
-
-

{{ project.name }} ({{ project.environments|length }} environments)

- - {{ Icon('edit') }} - edit - -
- -
-{% endfor %} + {% set can_create_projects = user_can(permissions.ADD_APPLICATION_IN_WORKSPACE) %} + {% set sub_message = None if can_create_projects else 'Please contact your workspace administrator to set up a new project.' %} + {% set action_label = 'Add a New Project' if can_create_projects else None %} + {% set action_href = url_for('workspaces.new_project', workspace_id=workspace.id) if can_create_projects else None %} + + {{ EmptyState( + 'This workspace doesn’t have any projects yet.', + action_label=action_label, + action_href=action_href, + icon='cloud', + sub_message=sub_message + ) }} + +{% else %} + + {% for project in workspace.projects %} +
+
+

{{ project.name }} ({{ project.environments|length }} environments)

+ + {{ Icon('edit') }} + edit + +
+ +
+ {% endfor %} + +{% endif %} {% endblock %}