Skip to content

Commit

Permalink
Make it more standard-compliant
Browse files Browse the repository at this point in the history
- htmx does not allow disinheriting `hx-vals` attribute... :(
  (bigskysoftware/htmx#1119)
  • Loading branch information
achimnol committed Aug 21, 2023
1 parent e0b02c5 commit a0f563d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion aiomonitor/webui/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
type="button"
class="notify-result rounded bg-rose-600 px-2 py-1 text-xs font-semibold text-white shadow-sm hover:bg-rose-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-rose-600 disabled:opacity-50"
hx-delete="/api/task"
hx-vals='{"task_id": "{{ task_id }}"'
hx-disinherit="*"
hx-vals='{"task_id": "{{ task_id }}"}'
hx-swap="none"
hx-sync="closest tbody:drop"
onclick="this.disabled=true"
Expand All @@ -127,6 +128,7 @@
type="button"
class="rounded bg-indigo-600 px-2 py-1 text-xs font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
hx-get="/api/task?task_id={{ task_id }}"
hx-disinherit="*"
hx-swap="none"
hx-sync="closest tbody:drop"
>Trace</button>
Expand Down Expand Up @@ -226,6 +228,7 @@
type="button"
class="rounded bg-indigo-600 px-2 py-1 text-xs font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
hx-get="/api/terminated-task?task_id={{ task_id }}"
hx-disinherit="*"
hx-swap="none"
hx-sync="closest tbody:drop"
>Trace</button>
Expand Down
1 change: 1 addition & 0 deletions aiomonitor/webui/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="htmx-config" content='{"methodsThatUseUrlParams":["get","delete"]}'>
<title>aiomonitor - {{ title }}</title>
<script src="/static/htmx.js"></script>
<script src="/static/mustache.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion aiomonitor/webui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def check_params(
checker: t.Trafaret,
) -> AsyncIterator[Any]:
try:
if request.method == "GET":
if request.method in ("GET", "DELETE"):
params = checker.check(request.query)
else:
body = await request.post()
Expand Down

0 comments on commit a0f563d

Please sign in to comment.