mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-04 16:11:11 -04:00
Combine scheduled and already-sent jobs
I’m hoping that if I can design something that clearly differentiates them then we won’t need to do so by putting them in separate tables, which then need labelling, which would clutter up the page.
This commit is contained in:
@@ -52,14 +52,16 @@ def uploads(service_id):
|
||||
if uploads.prev_page:
|
||||
next_page = generate_next_dict('main.uploads', service_id, uploads.current_page)
|
||||
|
||||
if uploads.current_page == 1:
|
||||
listed_uploads = current_service.scheduled_jobs + uploads
|
||||
else:
|
||||
listed_uploads = uploads
|
||||
|
||||
return render_template(
|
||||
'views/jobs/jobs.html',
|
||||
jobs=uploads,
|
||||
jobs=listed_uploads,
|
||||
prev_page=prev_page,
|
||||
next_page=next_page,
|
||||
show_scheduled_jobs=(
|
||||
uploads.current_page == 1 and current_service.scheduled_jobs
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -76,5 +76,13 @@ class ModelList(ABC, Sequence):
|
||||
return list(self) + list(other)
|
||||
|
||||
|
||||
class EmptyModelList(ModelList):
|
||||
|
||||
client_method = model = None
|
||||
|
||||
def __init__(self, *args):
|
||||
self.items = []
|
||||
|
||||
|
||||
class InviteTokenError(Exception):
|
||||
pass
|
||||
|
||||
@@ -5,7 +5,7 @@ from flask import abort, current_app
|
||||
from notifications_utils.timezones import local_timezone
|
||||
from werkzeug.utils import cached_property
|
||||
|
||||
from app.models import JSONModel
|
||||
from app.models import EmptyModelList, JSONModel
|
||||
from app.models.job import (
|
||||
ImmediateJobs,
|
||||
PaginatedJobs,
|
||||
@@ -123,13 +123,13 @@ class Service(JSONModel):
|
||||
@cached_property
|
||||
def immediate_jobs(self):
|
||||
if not self.has_jobs:
|
||||
return []
|
||||
return EmptyModelList()
|
||||
return ImmediateJobs(self.id)
|
||||
|
||||
@cached_property
|
||||
def scheduled_jobs(self):
|
||||
if not self.has_jobs:
|
||||
return []
|
||||
return EmptyModelList()
|
||||
return ScheduledJobs(self.id)
|
||||
|
||||
@cached_property
|
||||
|
||||
Reference in New Issue
Block a user