mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Find services by name or partial name
This commit is contained in:
@@ -12,6 +12,7 @@ from app.main.views import ( # noqa isort:skip
|
||||
dashboard,
|
||||
email_branding,
|
||||
feedback,
|
||||
find_services,
|
||||
find_users,
|
||||
forgot_password,
|
||||
inbound_number,
|
||||
|
||||
23
app/main/views/find_services.py
Normal file
23
app/main/views/find_services.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from flask import render_template, request
|
||||
|
||||
from app import service_api_client
|
||||
from app.main import main
|
||||
from app.main.forms import SearchByNameForm
|
||||
from app.utils import user_is_platform_admin
|
||||
|
||||
|
||||
@main.route("/find-services-by-name", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def find_services_by_name():
|
||||
form = SearchByNameForm()
|
||||
services_found = None
|
||||
status = 200
|
||||
if form.validate_on_submit():
|
||||
services_found = service_api_client.find_services_by_name(service_name=form.search.data)['data']
|
||||
elif request.method == 'POST':
|
||||
status = 400
|
||||
return render_template(
|
||||
'views/find-services/find-services-by-name.html',
|
||||
form=form,
|
||||
services_found=services_found
|
||||
), status
|
||||
@@ -23,7 +23,6 @@ from app.main.forms import (
|
||||
PDFUploadForm,
|
||||
RequiredDateFilterForm,
|
||||
ReturnedLettersForm,
|
||||
SearchByNameForm,
|
||||
)
|
||||
from app.statistics_utils import (
|
||||
get_formatted_percentage,
|
||||
@@ -190,23 +189,6 @@ def platform_admin_services():
|
||||
)
|
||||
|
||||
|
||||
@main.route("/find-services-by-name", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def find_services_by_name():
|
||||
form = SearchByNameForm()
|
||||
services_found = None
|
||||
status = 200
|
||||
if form.validate_on_submit():
|
||||
services_found = service_api_client.get_service({"name": form.search.data})['data']
|
||||
elif request.method == 'POST':
|
||||
status = 400
|
||||
return render_template(
|
||||
'views/find-services/find-services-by-name.html',
|
||||
form=form,
|
||||
services_found=services_found
|
||||
), status
|
||||
|
||||
|
||||
@main.route("/platform-admin/reports")
|
||||
@user_is_platform_admin
|
||||
def platform_admin_reports():
|
||||
|
||||
Reference in New Issue
Block a user