mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Merge pull request #3821 from alphagov/find-services-by-id
Support service IDs in ‘find services by name’
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
from flask import render_template
|
||||
import uuid
|
||||
from contextlib import suppress
|
||||
|
||||
from flask import redirect, render_template, url_for
|
||||
|
||||
from app import service_api_client
|
||||
from app.main import main
|
||||
@@ -12,6 +15,11 @@ def find_services_by_name():
|
||||
form = SearchByNameForm()
|
||||
services_found = None
|
||||
if form.validate_on_submit():
|
||||
with suppress(ValueError):
|
||||
return redirect(url_for(
|
||||
'main.service_dashboard',
|
||||
service_id=uuid.UUID(form.search.data)
|
||||
))
|
||||
services_found = service_api_client.find_services_by_name(service_name=form.search.data)['data']
|
||||
return render_template(
|
||||
'views/find-services/find-services-by-name.html',
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
) %}
|
||||
<div class="govuk-grid-column-three-quarters">
|
||||
{{ form.search(param_extensions={
|
||||
"label": {"text": "Find services by name, or by partial name"}
|
||||
"label": {"text": "Find services by name, partial name, or service ID"}
|
||||
}) }}
|
||||
</div>
|
||||
<div class="govuk-grid-column-one-quarter">
|
||||
|
||||
Reference in New Issue
Block a user