Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group enterprise tile #35604

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions corehq/apps/enterprise/templates/enterprise/project_dashboard.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
{% extends "hqwebapp/bootstrap5/base_section.html" %}
{% load hq_shared_tags %}
{% load i18n %}

{% block page_title %}{{ current_page.title }}{% endblock %}

{% js_entry 'enterprise/js/project_dashboard' %}

{% block page_content %}
{% registerurl "enterprise_dashboard_email" domain "---" %}
{% registerurl "enterprise_dashboard_total" domain "---" %}

{% initial_page_data 'max_date_range_days' max_date_range_days %}
{% initial_page_data 'metric_type' metric_type %}

<div class="row mt-4">
{% for report in reports %}
<div class="col-md-6 col-lg-6 col-xl-3 mb-3">
{% include 'enterprise/partials/project_tile.html' with report=report uses_date_range=uses_date_range %}
</div>
{% endfor %}
</div>

{% for group in groups %}
<div class="row {% if not forloop.first %}mt-4{% endif %}">
<h3 class="mb-3">{{ group.name }}</h3>
{% for report in group.reports %}
<div class="col-md-6 col-lg-6 col-xl-3 mb-3">
{% include 'enterprise/partials/project_tile.html' with report=report uses_date_range=uses_date_range %}
</div>
{% endfor %}
</div>
{% endfor %}
{% include 'enterprise/partials/date_range_modal.html' %}
{% endblock %}
38 changes: 23 additions & 15 deletions corehq/apps/enterprise/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def platform_overview(request, domain):

context = get_page_context(
page_url=reverse('platform_overview', args=(domain,)),
page_title=_('Platform Overview for {}').format(request.account.name),
page_name=_('Platform Overview'),
page_title='',
domain=domain,
section=Section(
_('Enterprise Console'),
Expand All @@ -84,15 +84,21 @@ def platform_overview(request, domain):

context.update({
'max_date_range_days': EnterpriseFormReport.MAX_DATE_RANGE_DAYS,
'reports': [EnterpriseReport.create(slug, request.account.id, request.couch_user) for slug in (
EnterpriseReport.DOMAINS,
EnterpriseReport.WEB_USERS,
EnterpriseReport.MOBILE_USERS,
EnterpriseReport.FORM_SUBMISSIONS,
EnterpriseReport.ODATA_FEEDS,
EnterpriseReport.COMMCARE_VERSION_COMPLIANCE,
EnterpriseReport.SMS,
)],
'groups': [
{'name': 'Projects Overview',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we want to translate the group names here. Otherwise looks good!

'reports': [EnterpriseReport.create(slug, request.account.id, request.couch_user)
for slug in (EnterpriseReport.DOMAINS,
EnterpriseReport.FORM_SUBMISSIONS,
EnterpriseReport.SMS,)]},
{'name': 'User Management',
'reports': [EnterpriseReport.create(slug, request.account.id, request.couch_user)
for slug in (EnterpriseReport.WEB_USERS,
EnterpriseReport.MOBILE_USERS,
EnterpriseReport.COMMCARE_VERSION_COMPLIANCE,)]},
{'name': 'Data Management & Export',
'reports': [EnterpriseReport.create(slug, request.account.id, request.couch_user)
for slug in (EnterpriseReport.ODATA_FEEDS,)]},
],
'uses_date_range': [EnterpriseReport.FORM_SUBMISSIONS, EnterpriseReport.SMS],
'metric_type': 'Platform Overview',
})
Expand All @@ -111,7 +117,7 @@ def security_center(request, domain):

context = get_page_context(
page_url=reverse('security_center', args=(domain,)),
page_title=_('Security Center for {}').format(request.account.name),
page_title='',
page_name=_('Security Center'),
domain=domain,
section=Section(
Expand All @@ -121,10 +127,12 @@ def security_center(request, domain):
)

context.update({
'reports': [EnterpriseReport.create(slug, request.account.id, request.couch_user) for slug in (
EnterpriseReport.API_USAGE,
EnterpriseReport.TWO_FACTOR_AUTH,
)],
'groups': [
{'name': '',
'reports': [EnterpriseReport.create(slug, request.account.id, request.couch_user)
for slug in (EnterpriseReport.API_USAGE,
EnterpriseReport.TWO_FACTOR_AUTH)]},
],
'metric_type': 'Security Center',
'max_date_range_days': EnterpriseFormReport.MAX_DATE_RANGE_DAYS,
'uses_date_range': [],
Expand Down
Loading