mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 17:45:32 -04:00
Added current_service to flask context and template context.
Fix all tests and conflicts. Removed comment line.
This commit is contained in:
@@ -12,7 +12,11 @@ from flask_login import login_required
|
||||
from werkzeug.datastructures import MultiDict
|
||||
from utils.template import Template
|
||||
|
||||
from app import (job_api_client, notification_api_client, service_api_client)
|
||||
from app import (
|
||||
job_api_client,
|
||||
notification_api_client,
|
||||
service_api_client,
|
||||
current_service)
|
||||
from app.main import main
|
||||
from app.utils import (
|
||||
get_page_from_request,
|
||||
@@ -38,8 +42,7 @@ def view_jobs(service_id):
|
||||
jobs = job_api_client.get_job(service_id)['data']
|
||||
return render_template(
|
||||
'views/jobs/jobs.html',
|
||||
jobs=jobs,
|
||||
service_id=service_id
|
||||
jobs=jobs
|
||||
)
|
||||
|
||||
|
||||
@@ -47,7 +50,6 @@ def view_jobs(service_id):
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', admin_override=True)
|
||||
def view_job(service_id, job_id):
|
||||
service = service_api_client.get_service(service_id)['data']
|
||||
job = job_api_client.get_job(service_id, job_id)['data']
|
||||
template = service_api_client.get_service_template(service_id, job['template'])['data']
|
||||
notifications = notification_api_client.get_notifications_for_service(service_id, job_id)
|
||||
@@ -64,10 +66,8 @@ def view_job(service_id, job_id):
|
||||
uploaded_file_name=job['original_file_name'],
|
||||
template=Template(
|
||||
template,
|
||||
prefix=service['name']
|
||||
prefix=current_service['name']
|
||||
),
|
||||
service_id=service_id,
|
||||
service=service,
|
||||
job_id=job_id
|
||||
)
|
||||
|
||||
@@ -76,7 +76,6 @@ def view_job(service_id, job_id):
|
||||
@login_required
|
||||
@user_has_permissions('view_activity')
|
||||
def view_job_updates(service_id, job_id):
|
||||
service = service_api_client.get_service(service_id)['data']
|
||||
job = job_api_client.get_job(service_id, job_id)['data']
|
||||
notifications = notification_api_client.get_notifications_for_service(service_id, job_id)
|
||||
finished = job['status'] == 'finished'
|
||||
@@ -135,7 +134,6 @@ def view_notifications(service_id):
|
||||
'page {}'.format(page + 1))
|
||||
return render_template(
|
||||
'views/notifications.html',
|
||||
service_id=service_id,
|
||||
notifications=notifications['notifications'],
|
||||
page=page,
|
||||
prev_page=prev_page,
|
||||
@@ -157,6 +155,5 @@ def view_notification(service_id, job_id, notification_id):
|
||||
][0],
|
||||
delivered_at=now,
|
||||
uploaded_at=now,
|
||||
service_id=service_id,
|
||||
job_id=job_id
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user