Compact interfaces and edit more things inline

This commit is contained in:
2026-02-15 22:20:14 +00:00
parent 981ee56de7
commit b23af9bc7f
8 changed files with 429 additions and 12 deletions

View File

@@ -53,6 +53,21 @@ def _column_field_name(column: "OsintColumn") -> str:
return str(column.key)
def _safe_icon_class(raw: str | None, default: str) -> str:
icon_class = str(raw or "").strip()
if not icon_class:
return default
cleaned_parts = []
for part in icon_class.split():
if not part:
continue
if all(ch.isalnum() or ch in {"-", "_"} for ch in part):
cleaned_parts.append(part)
if not cleaned_parts:
return default
return " ".join(cleaned_parts)
def _url_with_query(base_url: str, query: dict[str, Any]) -> str:
params = {}
for key, value in query.items():
@@ -378,6 +393,13 @@ OSINT_SCOPES: dict[str, OsintScopeConfig] = {
),
}
OSINT_SCOPE_ICONS: dict[str, str] = {
"people": "fa-solid fa-user-group",
"groups": "fa-solid fa-users",
"personas": "fa-solid fa-masks-theater",
"manipulations": "fa-solid fa-sliders",
}
class OSINTListBase(ObjectList):
list_template = "partials/osint/list-table.html"
@@ -511,6 +533,10 @@ class OSINTListBase(ObjectList):
request_type: str,
) -> list[dict[str, Any]]:
context_type = _context_type(request_type)
update_type = "window" if request_type == "widget" else context_type
update_target = (
"#windows-here" if update_type == "window" else f"#{update_type}s-here"
)
rows = []
for item in object_list:
row = {"id": str(item.pk), "cells": [], "actions": []}
@@ -524,7 +550,7 @@ class OSINTListBase(ObjectList):
update_url = reverse(
scope.update_url_name,
kwargs={"type": context_type, "pk": item.pk},
kwargs={"type": update_type, "pk": item.pk},
)
delete_url = reverse(
scope.delete_url_name,
@@ -535,7 +561,7 @@ class OSINTListBase(ObjectList):
{
"mode": "hx-get",
"url": update_url,
"target": f"#{context_type}s-here",
"target": update_target,
"icon": "fa-solid fa-pencil",
"title": "Edit",
}
@@ -653,6 +679,10 @@ class OSINTListBase(ObjectList):
context["osint_show_actions"] = True
context["osint_search_url"] = list_url
context["osint_result_count"] = context["osint_pagination"].get("count", 0)
context["widget_icon"] = _safe_icon_class(
self.request.GET.get("widget_icon"),
OSINT_SCOPE_ICONS.get(scope.key, "fa-solid fa-arrows-minimize"),
)
return context
@@ -1030,6 +1060,10 @@ class OSINTSearch(LoginRequiredMixin, View):
"unique": "osint-search-widget",
"window_content": self.panel_template,
"widget_options": 'gs-w="8" gs-h="14" gs-x="0" gs-y="0" gs-min-w="5"',
"widget_icon": _safe_icon_class(
request.GET.get("widget_icon"),
"fa-solid fa-magnifying-glass",
),
**context,
}
return render(request, self.widget_template, widget_context)
@@ -1054,25 +1088,37 @@ class OSINTWorkspaceTabsWidget(LoginRequiredMixin, View):
"key": "people",
"label": "People",
"icon": "fa-solid fa-user-group",
"widget_url": reverse("people", kwargs={"type": "widget"}),
"widget_url": _url_with_query(
reverse("people", kwargs={"type": "widget"}),
{"widget_icon": "fa-solid fa-user-group"},
),
},
{
"key": "groups",
"label": "Groups",
"icon": "fa-solid fa-users",
"widget_url": reverse("groups", kwargs={"type": "widget"}),
"widget_url": _url_with_query(
reverse("groups", kwargs={"type": "widget"}),
{"widget_icon": "fa-solid fa-users"},
),
},
{
"key": "personas",
"label": "Personas",
"icon": "fa-solid fa-masks-theater",
"widget_url": reverse("personas", kwargs={"type": "widget"}),
"widget_url": _url_with_query(
reverse("personas", kwargs={"type": "widget"}),
{"widget_icon": "fa-solid fa-masks-theater"},
),
},
{
"key": "manipulations",
"label": "Manipulations",
"icon": "fa-solid fa-sliders",
"widget_url": reverse("manipulations", kwargs={"type": "widget"}),
"widget_url": _url_with_query(
reverse("manipulations", kwargs={"type": "widget"}),
{"widget_icon": "fa-solid fa-sliders"},
),
},
]
context = {