Merge pull request #310 from dod-ccpo/report-empty-states

Report empty states
This commit is contained in:
andrewdds 2018-09-21 09:24:50 -04:00 committed by GitHub
commit 4f26768fe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
{% from "components/alert.html" import Alert %}
{% from "components/icon.html" import Icon %}
{% from "components/empty_state.html" import EmptyState %}
{% block workspace_content %}
@ -102,6 +103,23 @@
{% set two_months_ago_index = two_months_ago.strftime('%m/%Y') %}
{% set reports_url = url_for("workspaces.workspace_reports", workspace_id=workspace.id) %}
{% if not monthly_totals['environments'] %}
{% set can_create_projects = user_can(permissions.ADD_APPLICATION_IN_WORKSPACE) %}
{% set message = 'This Workspace has no Cloud Environments setup, hence there is no spending data to report. Create a Project with some Cloud Environments to get started.'
if can_create_projects
else 'This Workspace has no Cloud Environments setup, hence there is no spending data to report. Contact the Workspace Owner to set up some Cloud Environments.'
%}
{{ EmptyState(
'Nothing to report',
action_label='Add a New Project' if can_create_projects else None,
action_href=url_for('workspaces.new_project', workspace_id=workspace.id) if can_create_projects else None,
icon='chart',
sub_message=message
) }}
{% else %}
<budget-chart
budget={{ budget }}
current-month='{{ current_month_index }}'
@ -402,41 +420,10 @@
<td class='table-cell--expand current-month'></td>
</tr>
</tbody>
{# {% for project_name, project_totals in monthly_totals['projects'].items() %}
<tbody is='tbody-toggler' class='spend-table__project'>
<tr>
<th scope='rowgroup'>
<button v-on:click='props.toggle' class='icon-link icon-link--large spend-table__project__toggler'>
<template v-if='props.isVisible'>{{ Icon('caret_down') }}</template>
<template v-else>{{ Icon('caret_right') }}</template>
{{ project_name }}
</button>
</th>
<td class='table-cell--align-right previous-month'>{{ project_totals.get(two_months_ago_index, 0) | dollars }}</td>
<td class='table-cell--align-right previous-month'>{{ project_totals.get(prev_month_index, 0) | dollars }}</td>
<td class='table-cell--align-right current-month'>{{ project_totals.get(current_month_index, 0) | dollars }}</td>
<td class='table-cell--expand current-month meter-cell'>
<span class='spend-table__meter-value'>{{ (100 * (project_totals.get(current_month_index, 0) / workspace_totals.get(current_month_index, 1))) | round | int }}%</span>
<meter value='{{ project_totals.get(current_month_index, 0) }}' min='0' max='{{ workspace_totals.get(current_month_index, 0) }}'></meter>
</td>
</tr>
{% for env_name, env_totals in monthly_totals['environments'][project_name].items() %}
<tr v-show='props.isVisible'>
<th scope='rowgroup'><a href='#' class='icon-link spend-table__project__env'>{{ Icon('link') }} {{ env_name }}</a></th>
<td class='table-cell--align-right previous-month'>{{ env_totals.get(two_months_ago_index, 0) | dollars }}</td>
<td class='table-cell--align-right previous-month'>{{ env_totals.get(prev_month_index, 0) | dollars }}</td>
<td class='table-cell--align-right current-month'>{{ env_totals.get(current_month_index, 0) | dollars }}</td>
<td class='table-cell--expand current-month'></td>
</tr>
{% endfor %}
</template>
</tbody>
{% endfor %} #}
</table>
</spend-table>
</div>
{% endif %}
{% endblock %}