mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 08:28:15 -04:00
link-service-to-organisations-tweaks
This commit is contained in:
@@ -3,34 +3,34 @@ from flask import Blueprint
|
|||||||
main = Blueprint('main', __name__) # noqa
|
main = Blueprint('main', __name__) # noqa
|
||||||
|
|
||||||
from app.main.views import ( # noqa
|
from app.main.views import ( # noqa
|
||||||
add_service,
|
|
||||||
api_keys,
|
|
||||||
choose_service,
|
|
||||||
code_not_received,
|
|
||||||
conversation,
|
|
||||||
dashboard,
|
|
||||||
email_branding,
|
|
||||||
feedback,
|
|
||||||
forgot_password,
|
|
||||||
inbound_number,
|
|
||||||
index,
|
index,
|
||||||
invites,
|
|
||||||
jobs,
|
|
||||||
letter_jobs,
|
|
||||||
manage_users,
|
|
||||||
new_password,
|
|
||||||
notifications,
|
|
||||||
organisations,
|
|
||||||
platform_admin,
|
|
||||||
providers,
|
|
||||||
register,
|
|
||||||
send,
|
|
||||||
service_settings,
|
|
||||||
sign_in,
|
sign_in,
|
||||||
sign_out,
|
sign_out,
|
||||||
styleguide,
|
register,
|
||||||
templates,
|
|
||||||
two_factor,
|
two_factor,
|
||||||
|
verify,
|
||||||
|
send,
|
||||||
|
add_service,
|
||||||
|
code_not_received,
|
||||||
|
jobs,
|
||||||
|
dashboard,
|
||||||
|
templates,
|
||||||
|
service_settings,
|
||||||
|
forgot_password,
|
||||||
|
new_password,
|
||||||
|
styleguide,
|
||||||
user_profile,
|
user_profile,
|
||||||
verify
|
choose_service,
|
||||||
|
api_keys,
|
||||||
|
manage_users,
|
||||||
|
invites,
|
||||||
|
feedback,
|
||||||
|
providers,
|
||||||
|
platform_admin,
|
||||||
|
letter_jobs,
|
||||||
|
email_branding,
|
||||||
|
conversation,
|
||||||
|
organisations,
|
||||||
|
notifications,
|
||||||
|
inbound_number
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -789,6 +789,7 @@ def link_service_to_organisation(service_id):
|
|||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'views/service-settings/link-service-to-organisation.html',
|
'views/service-settings/link-service-to-organisation.html',
|
||||||
|
has_organisations=organisations,
|
||||||
form=form,
|
form=form,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<nav class="navigation">
|
<nav class="navigation">
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><a href="{{ url_for('.organisation_dashboard', org_id=current_org.id) }}">Dashboard</a></li>
|
||||||
{% if current_user.has_permissions(admin_override=True) %}
|
{% if current_user.has_permissions(admin_override=True) %}
|
||||||
<li><a href="{{ url_for('.organisation_users', org_id=current_org.id) }}">Team members</a></li>
|
<li><a href="{{ url_for('.organisation_users', org_id=current_org.id) }}">Team members</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% extends "admin_template.html" %}
|
{% extends "admin_template.html" %}
|
||||||
|
|
||||||
{% block per_page_title %}
|
{% block per_page_title %}
|
||||||
{% block service_page_title %}{% endblock %} – {{ current_service.name }}
|
{% block org_page_title %}{% endblock %} – {{ current_org.name }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block fullwidth_content %}
|
{% block fullwidth_content %}
|
||||||
@@ -13,18 +13,10 @@
|
|||||||
<a href="{{ url_for('main.choose_service') }}" class="navigation-service-switch">Switch service</a>
|
<a href="{{ url_for('main.choose_service') }}" class="navigation-service-switch">Switch service</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
{% if help %}
|
<div class="column-one-quarter">
|
||||||
<div class="column-one-third">
|
|
||||||
{% else %}
|
|
||||||
<div class="column-one-quarter">
|
|
||||||
{% endif %}
|
|
||||||
{% include "org_nav.html" %}
|
{% include "org_nav.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% if help %}
|
<main role="main" class="column-three-quarters column-main">
|
||||||
<main role="main" class="column-two-thirds column-main">
|
|
||||||
{% else %}
|
|
||||||
<main role="main" class="column-three-quarters column-main">
|
|
||||||
{% endif %}
|
|
||||||
{% include 'flash_messages.html' %}
|
{% include 'flash_messages.html' %}
|
||||||
{% block maincolumn_content %}{% endblock %}
|
{% block maincolumn_content %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
Create an organisation
|
Create an organisation
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block service_page_title %}
|
{% block org_page_title %}
|
||||||
Create an organisation
|
Create an organisation
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
Organisations
|
Organisations
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block service_page_title %}
|
{% block org_page_title %}
|
||||||
Organisations
|
Organisations
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
{{ current_org.name }}
|
{{ current_org.name }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block service_page_title %}
|
{% block org_page_title %}
|
||||||
{{ current_org.name }}
|
{{ current_org.name }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
Update an organisation
|
Update an organisation
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block service_page_title %}
|
{% block org_page_title %}
|
||||||
Update an organisation
|
Update an organisation
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% extends "org_template.html" %}
|
{% extends "org_template.html" %}
|
||||||
|
|
||||||
{% block service_page_title %}
|
{% block org_page_title %}
|
||||||
Team members
|
Team members
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,6 @@
|
|||||||
{% if current_user.has_permissions(admin_override=True) %}
|
{% if current_user.has_permissions(admin_override=True) %}
|
||||||
|
|
||||||
<h2 class="heading-medium">Platform admin settings</h2>
|
<h2 class="heading-medium">Platform admin settings</h2>
|
||||||
|
|
||||||
{% call mapping_table(
|
{% call mapping_table(
|
||||||
caption='Settings',
|
caption='Settings',
|
||||||
field_headings=['Label', 'Value', 'Action'],
|
field_headings=['Label', 'Value', 'Action'],
|
||||||
@@ -257,7 +256,7 @@
|
|||||||
) %}
|
) %}
|
||||||
{% call row() %}
|
{% call row() %}
|
||||||
{{ text_field('Organisation')}}
|
{{ text_field('Organisation')}}
|
||||||
{{ optional_text_field(organisation or 'Not Set') }}
|
{{ optional_text_field(organisation or None) }}
|
||||||
{{ edit_field('Change', url_for('.link_service_to_organisation', service_id=current_service.id)) }}
|
{{ edit_field('Change', url_for('.link_service_to_organisation', service_id=current_service.id)) }}
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% call row() %}
|
{% call row() %}
|
||||||
|
|||||||
@@ -14,9 +14,13 @@
|
|||||||
Link service to organisation
|
Link service to organisation
|
||||||
</h1>
|
</h1>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{{ radios(form.organisations) }}
|
{% if has_organisations %}
|
||||||
|
{{ radios(form.organisations) }}
|
||||||
|
{% else %}
|
||||||
|
<p> No organisations </p>
|
||||||
|
{% endif %}
|
||||||
{{ page_footer(
|
{{ page_footer(
|
||||||
'Save',
|
'Save' if has_organisations,
|
||||||
back_link=url_for('.service_settings', service_id=current_service.id),
|
back_link=url_for('.service_settings', service_id=current_service.id),
|
||||||
back_link_text='Back to settings'
|
back_link_text='Back to settings'
|
||||||
) }}
|
) }}
|
||||||
|
|||||||
@@ -150,4 +150,4 @@ def test_organisation_services_show(
|
|||||||
assert normalize_spaces(page.select('.browse-list-item')[i].text) == service_name
|
assert normalize_spaces(page.select('.browse-list-item')[i].text) == service_name
|
||||||
assert normalize_spaces(
|
assert normalize_spaces(
|
||||||
page.select('.browse-list-item a')[i]['href']
|
page.select('.browse-list-item a')[i]['href']
|
||||||
) == '/services/{}/dashboard'.format(service_id)
|
) == '/services/{}'.format(service_id)
|
||||||
|
|||||||
@@ -2037,6 +2037,25 @@ def test_select_organisation(
|
|||||||
) == 'Org {}'.format(i + 1)
|
) == 'Org {}'.format(i + 1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_select_organisation_shows_message_if_no_orgs(
|
||||||
|
logged_in_platform_admin_client,
|
||||||
|
service_one,
|
||||||
|
mock_get_service_organisation,
|
||||||
|
mocker
|
||||||
|
):
|
||||||
|
mocker.patch('app.organisations_client.get_organisations', return_value=[])
|
||||||
|
|
||||||
|
response = logged_in_platform_admin_client.get(
|
||||||
|
url_for('.link_service_to_organisation', service_id=service_one['id']),
|
||||||
|
)
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
|
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||||
|
|
||||||
|
assert normalize_spaces(page.select_one('main p').text) == "No organisations"
|
||||||
|
assert not page.select_one('main button')
|
||||||
|
|
||||||
|
|
||||||
def test_update_service_organisation(
|
def test_update_service_organisation(
|
||||||
logged_in_platform_admin_client,
|
logged_in_platform_admin_client,
|
||||||
service_one,
|
service_one,
|
||||||
|
|||||||
Reference in New Issue
Block a user