Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import sentry_sdk
import uvicorn # type: ignore
from fastapi import Body, Depends, FastAPI, Request
from fastapi.encoders import jsonable_encoder
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
Expand Down Expand Up @@ -104,14 +103,16 @@ def bugzilla_webhook(


@app.get("/whiteboard_tags/")
def get_whiteboard_tag(
def get_whiteboard_tags(
whiteboard_tag: Optional[str] = None,
actions: Actions = Depends(configuration.get_actions),
):
"""API for viewing whiteboard_tags and associated data"""
if existing := actions.get(whiteboard_tag):
return {whiteboard_tag: existing}
return actions.by_tag
filtered = {whiteboard_tag: existing}
else:
filtered = actions.by_tag # type: ignore
return {k: v.dict() for k, v in filtered.items()}


@app.get("/jira_projects/")
Expand All @@ -131,7 +132,7 @@ def powered_by_jbi(
context = {
"request": request,
"title": "Powered by JBI",
"actions": jsonable_encoder(actions),
"actions": [action.dict() for action in actions],
"enable_query": enabled,
}
return templates.TemplateResponse("powered_by_template.html", context)
Expand Down
1 change: 1 addition & 0 deletions src/jbi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Config:

extra = Extra.allow
keep_untouched = (functools.cached_property,)
fields = {"callable": {"exclude": True}}


class Actions(YamlModel):
Expand Down