mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-15 07:18:58 -04:00
Sometimes we get a service ID from a support ticket or a Slack discussion. Rather than having to hack the URL, this PR augments the ‘Find services by name’ page to support service IDs. If a UUID is entered, it assumes that it’s been given a service ID, and redirects straight to the dashboard for that service, without showing any search results (a complete UUID would never match multiple services). If the UUID is not a service ID, the user will get a 404.
54 lines
1.5 KiB
HTML
54 lines
1.5 KiB
HTML
{% extends "views/platform-admin/_base_template.html" %}
|
|
{% from "components/page-footer.html" import page_footer %}
|
|
{% from "components/form.html" import form_wrapper %}
|
|
{% from "components/button/macro.njk" import govukButton %}
|
|
|
|
{% block per_page_title %}
|
|
Find services by name
|
|
{% endblock %}
|
|
|
|
{% block platform_admin_content %}
|
|
|
|
<h1 class="heading-medium">
|
|
Find services by name
|
|
</h1>
|
|
|
|
|
|
{% call form_wrapper(
|
|
action=url_for('.find_services_by_name'),
|
|
class='govuk-grid-row'
|
|
) %}
|
|
<div class="govuk-grid-column-three-quarters">
|
|
{{ form.search(param_extensions={
|
|
"label": {"text": "Find services by name, partial name, or service ID"}
|
|
}) }}
|
|
</div>
|
|
<div class="govuk-grid-column-one-quarter">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
{{ govukButton({
|
|
"text": "Search",
|
|
"classes": "search-form__button"
|
|
}) }}
|
|
</div>
|
|
{% endcall %}
|
|
|
|
{% call form_wrapper(id='search-form' ) %}
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
{% endcall %}
|
|
|
|
{% if services_found %}
|
|
<nav class="browse-list">
|
|
<ul>
|
|
{% for service in services_found %}
|
|
<li class="browse-list-item">
|
|
<a href="{{url_for('.service_dashboard', service_id=service.id)}}" class="govuk-link govuk-link--no-visited-state">{{ service.name }}</a>
|
|
</li>
|
|
<hr>
|
|
{% endfor %}
|
|
</ul>
|
|
</nav>
|
|
{% elif services_found == [] %}
|
|
<p class="browse-list-hint">No services found.</p>
|
|
{% endif %}
|
|
{% endblock %}
|