コード例 #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
ファイル: data_router.py プロジェクト: max-block/demo-fastapi
 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
ファイル: ui_router.py プロジェクト: max-block/mb-base1
 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))