示例#1
0
 def workers_page(request: Request):
     form = WorkersFilterForm(request.query_params)
     query = make_query(started=form.data["started"],
                        name=form.data["name"])
     workers = core.db.worker.find(query, "-created_at", form.data["limit"])
     return templates.TemplateResponse("workers.j2",
                                       md(request, form, workers))
示例#2
0
 def dlogs_page(request: Request):
     category_stats = {}
     for category in app.dlog_collection.collection.distinct("category"):
         category_stats[category] = app.dlog_collection.count(md(category))
     form = DLogsFilterForm(request.query_params)
     form.category.choices = form_choices(list(category_stats.keys()), title="category")
     query = make_query(category=form.data["category"])
     dlogs = app.dlog_collection.find(query, "-created_at", form.data["limit"])
     return templates.render("dlogs.j2", md(dlogs, form, category_stats))
示例#3
0
 def get_workers(started: Optional[bool] = None, limit: int = 100):
     return core.db.worker.find(make_query(started=started), "-created_at",
                                limit)
示例#4
0
 def get_dlogs(category: Optional[str] = None, limit: int = 100):
     q = make_query(category=category)
     return app.dlog_collection.find(q, "-created_at", limit=limit)
示例#5
0
 def get_data_list(worker: Optional[str] = None,
                   status: Optional[DataStatus] = None,
                   limit: int = 100):
     return core.db.data.find(make_query(worker=worker, status=status),
                              "-created_at", limit)
示例#6
0
 def data_page(request: Request):
     form = DataFilterForm(request.query_params)
     query = make_query(status=form.data["status"])
     data = app.db.data.find(query, "-created_at", form.data["limit"])
     return templates.render("data.j2", md(form, data))
示例#7
0
 def data_page(request: Request):
     form = DataFilterForm(request.query_params)
     query = make_query(worker=form.data["worker"],
                        status=form.data["status"])
     data = core.db.data.find(query, "-created_at", form.data["limit"])
     return templates.TemplateResponse("data.j2", md(request, form, data))