Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

UN-3741 [FIX] Show created/modified metadata on adapter and Prompt Studio list pages (#2182)

Athul714b903d25f7
diff --git a/backend/adapter_processor_v2/serializers.py b/backend/adapter_processor_v2/serializers.py
index 7537aa15a..a5f2c492d 100644
--- a/backend/adapter_processor_v2/serializers.py
+++ b/backend/adapter_processor_v2/serializers.py
@@ -170,6 +170,8 @@ class AdapterListSerializer(BaseAdapterSerializer):
"adapter_name",
"adapter_type",
"created_by",
+ "created_at",
+ "modified_at",
"description",
) # type: ignore
diff --git a/backend/adapter_processor_v2/tests/test_adapter_api.py b/backend/adapter_processor_v2/tests/test_adapter_api.py
index 5df0d748f..7a187b46e 100644
--- a/backend/adapter_processor_v2/tests/test_adapter_api.py
+++ b/backend/adapter_processor_v2/tests/test_adapter_api.py
@@ -7,6 +7,7 @@ encryption, org-scoped persistence — with only the SDK context-window lookup
from __future__ import annotations
import secrets
+from datetime import timedelta
from unittest.mock import patch
import pytest
@@ -59,3 +60,59 @@ class AdapterRegisterLLMAPITest(TestCase):
# metadata stored encrypted (binary), decrypts back via .metadata
assert instance.adapter_metadata_b is not None
assert instance.metadata["model"] == "gpt-4o-mini"
+
+ @patch.object(AdapterInstance, "get_context_window_size", return_value=4096)
+ def test_list_serves_timestamps_and_rename_bumps_modified(self, _ctx) -> None:
+ """The list endpoint must serve created_at/modified_at, and a
+ rename must advance modified_at while created_at stays stable — the
+ Meta.fields tuple is hand-maintained, so this pins the two lines.
+ """
+ payload = {
+ "adapter_id": "openai|test-llm",
+ "adapter_name": "list-me",
+ "adapter_type": "LLM",
+ "adapter_metadata": {"api_key": "sk-test", "model": "gpt-4o-mini"},
+ }
+ request = APIRequestFactory().post("/api/v1/adapter/", payload, format="json")
+ force_authenticate(request, user=self.user)
+ created = self.create_view(request)
+ assert created.status_code == status.HTTP_201_CREATED, created.data
+ adapter_id = created.data["id"]
+
+ list_view = AdapterInstanceViewSet.as_view({"get": "list"})
+
+ def _list_row():
+ request = APIRequestFactory().get("/api/v1/adapter/")
+ force_authenticate(request, user=self.user)
+ response = list_view(request)
+ assert response.status_code == status.HTTP_200_OK, response.data
+ rows = response.data
+ if isinstance(rows, dict): # paginated response
+ rows = rows["results"]
+ return next(r for r in rows if str(r["id"]) == str(adapter_id))
+
+ row = _list_row()
+ assert row["created_at"] is not None
+ assert row["modified_at"] is not None
+ created_at_before = row["created_at"]
+
+ # Backdate so the rename's auto_now bump is strictly observable
+ instance = AdapterInstance.objects.get(pk=adapter_id)
+ AdapterInstance.objects.filter(pk=adapter_id).update(
+ modified_at=instance.modified_at - timedelta(hours=1)
+ )
+ modified_at_before = _list_row()["modified_at"]
+
+ update_view = AdapterInstanceViewSet.as_view({"patch": "partial_update"})
+ request = APIRequestFactory().patch(
+ f"/api/v1/adapter/{adapter_id}/",
+ {"adapter_name": "renamed-adapter"},
+ format="json",
+ )
+ force_authenticate(request, user=self.user)
+ updated = update_view(request, pk=adapter_id)
+ assert updated.status_code == status.HTTP_200_OK, updated.data
+
+ row = _list_row()
+ assert row["modified_at"] > modified_at_before, "rename must bump"
+ assert row["created_at"] == created_at_before, "created_at is stable"
diff --git a/backend/prompt_studio/prompt_studio_core_v2/prompt_studio_helper.py b/backend/prompt_studio/prompt_studio_core_v2/prompt_studio_helper.py
index ff46d14a3..9746a26ef 100644
--- a/backend/prompt_studio/prompt_studio_core_v2/prompt_studio_helper.py
+++ b/backend/prompt_studio/prompt_studio_core_v2/prompt_studio_helper.py
@@ -11,6 +11,7 @@ from account_v2.models import User
from adapter_processor_v2.models import AdapterInstance, UserDefaultAdapter
from django.conf import settings
from django.db import transaction
+from django.utils import timezone
from permissions.permission import (
_is_resource_owner,
_is_resource_viewer,
@@ -3101,8 +3102,18 @@ class PromptStudioHelper:
)
with transaction.atomic():
- # Delete all existing prompts
- deleted_count, _ = ToolStudioPrompt.objects.filter(tool_id=tool).delete()
+ # Delete all existing prompts. QuerySet.delete() returns the
+ # cascade total (outputs ride along via CASCADE) — report only
+ # the prompt rows to the API client
+ _, per_model = ToolStudioPrompt.objects.filter(tool_id=tool).delete()
+ deleted_count = per_model.get(ToolStudioPrompt._meta.label, 0)
+ if deleted_count:
+ # QuerySet.delete() bypasses ToolStudioPrompt.delete(), so
+ # bump the parent explicitly — clearing prompts is still a
+ # modification (_base_manager: see ToolStudioPrompt._touch_tool)
+ CustomTool._base_manager.filter(pk=tool.tool_id).update(
+ modified_at=timezone.now()
+ )
# Create new prompts from export data
PromptStudioHelper.import_prompts(prompts_data, tool, user)
diff --git a/backend/prompt_studio/prompt_studio_core_v2/tests/test_prompt_studio_author.py b/backend/prompt_studio/prompt_studio_core_v2/tests/test_prompt_studio_author.py
index 1b5946ab9..6fe203af2 100644
--- a/backend/prompt_studio/prompt_studio_core_v2/tests/test_prompt_studio_author.py
+++ b/backend/prompt_studio/prompt_studio_core_v2/tests/test_prompt_studio_author.py
@@ -10,17 +10,29 @@ to their project. Needs a live DB (integration tier).
from __future__ import annotations
import secrets
+from datetime import timedelta
import pytest
from account_v2.models import Organization, User
from django.test import TestCase
+from django.utils.dateparse import parse_datetime
from rest_framework import status
from rest_framework.test import APIRequestFactory, force_authenticate
from tenant_account_v2.models import OrganizationMember
from utils.user_context import UserContext
+from adapter_processor_v2.models import AdapterInstance
+
+from prompt_studio.prompt_profile_manager_v2.models import ProfileManager
from prompt_studio.prompt_studio_core_v2.models import CustomTool
+from prompt_studio.prompt_studio_core_v2.prompt_studio_helper import (
+ PromptStudioHelper,
+)
from prompt_studio.prompt_studio_core_v2.views import PromptStudioCoreView
+from prompt_studio.prompt_studio_document_manager_v2.models import DocumentManager
+from prompt_studio.prompt_studio_output_manager_v2.models import (
+ PromptStudioOutputManager,
+)
from prompt_studio.prompt_studio_v2.models import ToolStudioPrompt
@@ -83,3 +95,187 @@ class PromptStudioAuthorAPITest(TestCase):
persisted = ToolStudioPrompt.objects.get(prompt_id=prompt.data["prompt_id"])
assert persisted.tool_id_id == tool.tool_id
assert persisted.active
+
+ def _create_project(self, name: str) -> CustomTool:
+ """Create via the API so ownership membership rows exist — a bare
+ objects.create() is invisible to the list queryset."""
+ create_project = PromptStudioCoreView.as_view({"post": "create"})
+ project = self._call(
+ create_project,
+ "post",
+ "/api/v1/prompt-studio/",
+ {"tool_name": name, "description": f"{name} desc", "author": "test"},
+ )
+ assert project.status_code == status.HTTP_201_CREATED, project.data
+ return CustomTool.objects.get(tool_id=project.data["tool_id"])
+
+ @staticmethod
+ def _backdate_tool(tool: CustomTool, minutes: int) -> None:
+ """Move the tool row's modified_at into the past, bypassing auto_now."""
+ CustomTool.objects.filter(pk=tool.pk).update(
+ modified_at=tool.modified_at - timedelta(minutes=minutes)
+ )
+ tool.refresh_from_db()
+
+ def test_prompt_writes_bump_tool_modified_at(self) -> None:
+ """Prompt create, edit and DELETE all bump the parent CustomTool row —
+ modified_at is maintained at the source, so it stays honest (never
+ travels backwards) and identical across list/detail endpoints.
+ """
+ tool = self._create_project("quote-parser")
+
+ self._backdate_tool(tool, minutes=60)
+ before = tool.modified_at
+ prompt = ToolStudioPrompt.objects.create(
+ tool_id=tool,
+ prompt_key="quote_number",
+ prompt="What is the quote number?",
+ prompt_type=ToolStudioPrompt.PromptType.PROMPT,
+ sequence_number=1,
+ )
+ tool.refresh_from_db()
+ assert tool.modified_at > before, "prompt create must bump the tool"
+
+ self._backdate_tool(tool, minutes=60)
+ before = tool.modified_at
+ prompt.prompt = "What is the quotation number?"
+ prompt.save()
+ tool.refresh_from_db()
+ assert tool.modified_at > before, "prompt edit must bump the tool"
+
+ self._backdate_tool(tool, minutes=60)
+ before = tool.modified_at
+ prompt.delete()
+ tool.refresh_from_db()
+ assert tool.modified_at > before, "prompt delete must bump the tool"
+
+ def test_prompt_bump_only_touches_its_own_tool(self) -> None:
+ """A prompt write must not disturb other tools' modified_at."""
+ tool_a = self._create_project("tool-a")
+ tool_b = self._create_project("tool-b")
+ untouched = tool_b.modified_at
+
+ ToolStudioPrompt.objects.create(
+ tool_id=tool_a,
+ prompt_key="k",
+ prompt="p",
+ prompt_type=ToolStudioPrompt.PromptType.PROMPT,
+ sequence_number=1,
+ )
+ tool_b.refresh_from_db()
+ assert tool_b.modified_at == untouched
+
+ def test_sync_prompts_clear_bumps_tool_modified_at(self) -> None:
+ """sync_prompts clears prompts with a QuerySet.delete(), which
+ bypasses ToolStudioPrompt.delete() — the sync must bump the tool
+ explicitly, or a prompts-clearing sync with no tool settings leaves
+ modified_at stale.
+ """
+ tool = self._create_project("sync-me")
+ adapters = [
+ AdapterInstance.objects.create(
+ adapter_name=f"sync-{kind}",
+ adapter_id="openai|x",
+ adapter_type=kind,
+ created_by=self.user,
+ )
+ for kind in ("LLM", "VECTOR_DB", "EMBEDDING", "X2TEXT")
+ ]
+ ProfileManager.objects.create(
+ prompt_studio_tool=tool,
+ is_default=True,
+ profile_name="default",
+ created_by=self.user,
+ llm=adapters[0],
+ vector_store=adapters[1],
+ embedding_model=adapters[2],
+ x2text=adapters[3],
+ )
+ prompt = ToolStudioPrompt.objects.create(
+ tool_id=tool,
+ prompt_key="k",
+ prompt="p",
+ prompt_type=ToolStudioPrompt.PromptType.PROMPT,
+ sequence_number=1,
+ )
+ # A prompt that has been run carries CASCADE output rows — the
+ # reported count must be prompts only, not the cascade total
+ document = DocumentManager.objects.create(
+ document_name="d.pdf", tool=tool, created_by=self.user
+ )
+ PromptStudioOutputManager.objects.create(
+ prompt_id=prompt,
+ document_manager=document,
+ profile_manager=ProfileManager.objects.get(prompt_studio_tool=tool),
+ tool_id=tool,
+ created_by=self.user,
+ )
+
+ self._backdate_tool(tool, minutes=60)
+ before = tool.modified_at
+ result = PromptStudioHelper.sync_prompts(tool, {"prompts": []}, self.user)
+ assert result["prompts_deleted"] == 1, "prompts only, not cascaded rows"
+
+ tool.refresh_from_db()
+ assert tool.modified_at > before, "prompt-clearing sync must bump"
+
+ def test_prompt_bump_survives_missing_org_context(self) -> None:
+ """The parent bump must not depend on the thread-local org context —
+ an org-scoped manager would silently match zero rows outside a
+ request.
+ """
+ tool = self._create_project("ctx-free")
+ prompt = ToolStudioPrompt.objects.create(
+ tool_id=tool,
+ prompt_key="k",
+ prompt="p",
+ prompt_type=ToolStudioPrompt.PromptType.PROMPT,
+ sequence_number=1,
+ )
+ self._backdate_tool(tool, minutes=60)
+ before = tool.modified_at
+
+ UserContext.set_organization_identifier(None)
+ try:
+ prompt.prompt = "edited outside request context"
+ prompt.save()
+ finally:
+ UserContext.set_organization_identifier(self.org.organization_id)
+
+ tool.refresh_from_db()
+ assert tool.modified_at > before, "bump must not require org context"
+
+ def test_list_serves_bumped_modified_at(self) -> None:
+ """The list endpoint serves the real row value — which, thanks to the
+ parent bump, already reflects prompt activity. A promptless project
+ serves its own timestamp (no annotation involved).
+ """
+ tool = self._create_project("fresh-project")
+
+ list_view = PromptStudioCoreView.as_view({"get": "list"})
+ response = self._call(list_view, "get", "/api/v1/prompt-studio/", {})
+ assert response.status_code == status.HTTP_200_OK, response.data
+ rows = response.data
+ if isinstance(rows, dict): # paginated response
+ rows = rows["results"]
+ row = next(r for r in rows if str(r["tool_id"]) == str(tool.tool_id))
+ assert parse_datetime(row["modified_at"]) == tool.modified_at
+ assert row["created_at"] is not None
+
+ self._backdate_tool(tool, minutes=60)
+ ToolStudioPrompt.objects.create(
+ tool_id=tool,
+ prompt_key="quote_number",
+ prompt="What is the quote number?",
+ prompt_type=ToolStudioPrompt.PromptType.PROMPT,
+ sequence_number=1,
+ )
+ tool.refresh_from_db()
+
+ response = self._call(list_view, "get", "/api/v1/prompt-studio/", {})
+ rows = response.data
+ if isinstance(rows, dict):
+ rows = rows["results"]
+ row = next(r for r in rows if str(r["tool_id"]) == str(tool.tool_id))
+ assert parse_datetime(row["modified_at"]) == tool.modified_at
+ assert row["prompt_count"] == 1
diff --git a/backend/prompt_studio/prompt_studio_core_v2/views.py b/backend/prompt_studio/prompt_studio_core_v2/views.py
index 2443aecb4..7faf3a23c 100644
--- a/backend/prompt_studio/prompt_studio_core_v2/views.py
+++ b/backend/prompt_studio/prompt_studio_core_v2/views.py
@@ -164,8 +164,13 @@ class PromptStudioCoreView(
.annotate(cnt=Count("prompt_id"))
.values("cnt")
)
+ # modified_at needs no annotation: prompt writes bump the parent
+ # row at the source (ToolStudioPrompt.save/delete, sync_prompts),
+ # keeping the plain field orderable. Only prompt writes bump —
+ # profile/document edits and queryset-level prompt writes do not;
+ # any new write path must bump CustomTool itself
qs = qs.select_related("created_by").annotate(
- _prompt_count=Subquery(prompt_count_sq)
+ _prompt_count=Subquery(prompt_count_sq),
)
return qs
diff --git a/backend/prompt_studio/prompt_studio_v2/models.py b/backend/prompt_studio/prompt_studio_v2/models.py
index b4c64f091..faaf7b031 100644
--- a/backend/prompt_studio/prompt_studio_v2/models.py
+++ b/backend/prompt_studio/prompt_studio_v2/models.py
@@ -2,6 +2,7 @@ import uuid
from account_v2.models import User
from django.db import models
+from django.utils import timezone
from utils.models.base_model import BaseModel
from prompt_studio.prompt_profile_manager_v2.models import ProfileManager
@@ -153,6 +154,29 @@ class ToolStudioPrompt(BaseModel):
eval_guidance_completeness = models.BooleanField(default=True)
#
+ def _touch_tool(self) -> None:
+ """Bump the parent tool's modified_at to reflect prompt activity.
+
+ Queryset update avoids save() recursion; ``_base_manager`` bypasses
+ the org-scoped default manager (thread-local dependent) so the bump
+ also works outside request context — pk alone is globally unique.
+ """
+ if self.tool_id_id:
+ CustomTool._base_manager.filter(pk=self.tool_id_id).update(
+ modified_at=timezone.now()
+ )
+
+ def save(self, *args, **kwargs) -> None:
+ super().save(*args, **kwargs)
+ self._touch_tool()
+
+ def delete(self, *args, **kwargs):
+ # Django's collector nulls only the instance PK on delete, never FK
+ # attnames, so tool_id_id survives super().delete()
+ result = super().delete(*args, **kwargs)
+ self._touch_tool()
+ return result
+
class Meta:
verbose_name = "Tool Studio Prompt"
verbose_name_plural = "Tool Studio Prompts"
diff --git a/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx b/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx
index db6b88ae8..38fb925a9 100644
--- a/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx
+++ b/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx
@@ -193,8 +193,10 @@ function ListOfTools({ segmentOptions, segmentValue, onSegmentChange }) {
let tools = [...listOfTools];
if (isEdit) {
+ // Merge — the PATCH response (CustomToolSerializer) lacks list-only
+ // fields like prompt_count; replacing wholesale would drop them
tools = tools.map((item) =>
- item?.tool_id === data?.tool_id ? data : item,
+ item?.tool_id === data?.tool_id ? { ...item, ...data } : item,
);
setEditItem(null);
} else {
@@ -424,6 +426,7 @@ function ListOfTools({ segmentOptions, segmentValue, onSegmentChange }) {
type="Prompt Project"
handleShare={handleShare}
handleCoOwner={handleCoOwner}
+ showModified
/>
</div>
);
diff --git a/frontend/src/components/custom-tools/view-tools/ViewTools.jsx b/frontend/src/components/custom-tools/view-tools/ViewTools.jsx
index 5dbf92d8f..d5dca6283 100644
--- a/frontend/src/components/custom-tools/view-tools/ViewTools.jsx
+++ b/frontend/src/components/custom-tools/view-tools/ViewTools.jsx
@@ -21,6 +21,7 @@ function ViewTools({
handleShare,
handleCoOwner,
showOwner,
+ showModified,
type,
}) {
if (isLoading) {
@@ -61,6 +62,7 @@ function ViewTools({
handleShare={handleShare}
handleCoOwner={handleCoOwner}
showOwner={showOwner}
+ showModified={showModified}
type={type}
/>
);
@@ -82,6 +84,7 @@ ViewTools.propTypes = {
centered: PropTypes.bool,
isClickable: PropTypes.bool,
showOwner: PropTypes.bool,
+ showModified: PropTypes.bool,
type: PropTypes.string,
};
diff --git a/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx b/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx
index e8cf142e2..04f41d769 100644
--- a/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx
+++ b/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx
@@ -339,6 +339,7 @@ function ToolSettings({ type }) {
handleShare={handleShare}
handleCoOwner={handleCoOwner}
showOwner={true}
+ showModified
type="Adapter"
/>
</div>
diff --git a/frontend/src/components/widgets/list-view/ListView.css b/frontend/src/components/widgets/list-view/ListView.css
index 62f7711c2..0e7ea8c8c 100644
--- a/frontend/src/components/widgets/list-view/ListView.css
+++ b/frontend/src/components/widgets/list-view/ListView.css
@@ -17,7 +17,7 @@
}
.cur-pointer {
- padding: 10px 0 !important;
+ padding: 16px 0 !important;
z-index: 1;
overflow: hidden;
}
@@ -37,18 +37,39 @@
transition: color 0.2s ease;
}
-.cur-pointer .ant-list-item-meta {
- align-self: flex-start;
+.list-view-description {
+ font-size: 13px;
+ margin-bottom: 0 !important;
+ /* keep rows uniform; full text is in the ellipsis tooltip */
+ max-width: 520px;
}
-.cur-pointer.centered .ant-list-item-meta {
- align-self: center !important;
+.list-view-row {
+ width: 100%;
}
-.list-view-description {
- font-size: 13px;
- margin-bottom: 0;
- max-width: 40%;
+/* Left column: title + description stacked; shrinks with ellipsis */
+.list-view-left {
+ display: flex;
+ flex: 1 1 45%;
+ flex-direction: column;
+ gap: 4px;
+ min-width: 0;
+}
+
+/* Middle column: owner + updated. align-items only centers the badge and
+ the updated-text against each other — the column's own vertical position
+ comes from the row Flex's align in ListView.jsx */
+.list-view-meta {
+ align-items: center;
+ display: flex;
+ flex: 0 1 auto;
+ gap: 20px;
+ min-width: 0;
+}
+
+.list-view-meta .shared-username {
+ max-width: 200px;
}
.list-view-divider {
@@ -66,11 +87,16 @@
align-items: center;
display: flex;
justify-content: center;
+ /* let this shrink below its content width so the email ellipsizes
+ instead of forcing the row wider (the email itself never wraps —
+ it's nowrap + capped at 200px) */
+ min-width: 0;
}
.adapters-list-user-prefix {
margin: 0 5px;
font-weight: 500;
+ white-space: nowrap;
}
.adapters-list-title {
@@ -83,18 +109,25 @@
gap: 5px;
}
-.list-view-content {
+/* flex item: allow the title to shrink so its ellipsis can engage */
+.adapter-cover-img .adapters-list-title {
+ min-width: 0;
+}
+
+.list-view-modified-container {
+ align-items: center;
display: flex;
- width: 80%;
+ gap: 6px;
+ white-space: nowrap;
}
-.adapters-list-title-container {
- width: 50%;
- padding-right: 12px;
+.list-view-modified-text {
+ font-size: 12px;
}
-.list-item-desc {
- padding-bottom: 10px;
+.list-view-info-icon {
+ color: #8c8c8c;
+ font-size: 13px;
}
.edit-icon:hover {
diff --git a/frontend/src/components/widgets/list-view/ListView.jsx b/frontend/src/components/widgets/list-view/ListView.jsx
index dc747d4f9..14407c69c 100644
--- a/frontend/src/components/widgets/list-view/ListView.jsx
+++ b/frontend/src/components/widgets/list-view/ListView.jsx
@@ -12,14 +12,33 @@ import "./ListView.css";
import {
DeleteOutlined,
EditOutlined,
+ InfoCircleOutlined,
QuestionCircleOutlined,
ShareAltOutlined,
UserOutlined,
} from "@ant-design/icons";
import { useNavigate } from "react-router-dom";
+import { formattedDateTime, timeAgo } from "../../../helpers/GetStaticData";
import { useSessionStore } from "../../../store/session-store";
+// Tooltip lines render when the value is present (`!= null`: 0 shows,
+// null/undefined hide). The "Updated" block itself is opt-in via
+// showModified — field presence alone doesn't prove the page's value is
+// an honest "last modified".
+const renderItemMetadata = (item) => (
+ <div>
+ {item?.created_at && (
+ <div>Created: {formattedDateTime(item.created_at)}</div>
+ )}
+ {item?.modified_at && (
+ <div>Modified: {formattedDateTime(item.modified_at)}</div>
+ )}
+ {item?.model != null && <div>Model: {item.model}</div>}
+ {item?.prompt_count != null && <div>Prompts: {item.prompt_count}</div>}
+ </div>
+);
+
function ListView({
listOfTools,
handleEdit,
@@ -33,6 +52,7 @@ function ListView({
centered,
isClickable = true,
showOwner = true,
+ showModified = false,
type,
}) {
const navigate = useNavigate();
@@ -80,7 +100,10 @@ function ListView({
<Typography.Text disabled className="adapters-list-user-prefix">
Owned By:
</Typography.Text>
- <Typography.Text className="shared-username">
+ <Typography.Text
+ className="shared-username"
+ ellipsis={{ tooltip: true }}
+ >
{ownerLabel}
</Typography.Text>
</>
@@ -117,95 +140,132 @@ function ListView({
title = (
<div className="adapter-cover-img">
<Image src={item[iconProp]} preview={false} className="fit-cover" />
- <Typography.Text className="adapters-list-title">
+ <Typography.Text
+ className="adapters-list-title"
+ ellipsis={{ tooltip: true }}
+ >
{item[titleProp]}
</Typography.Text>
</div>
);
} else if (iconProp) {
title = (
- <Typography.Text className="adapters-list-title">
+ <Typography.Text
+ className="adapters-list-title"
+ ellipsis={{ tooltip: true }}
+ >
{`${item[iconProp]} ${item[titleProp]}`}
</Typography.Text>
);
} else {
title = (
- <Typography.Text className="adapters-list-title">
+ <Typography.Text
+ className="adapters-list-title"
+ ellipsis={{ tooltip: true }}
+ >
{item[titleProp]}
</Typography.Text>
);
}
+ return title;
+ };
+
+ const renderMeta = (item) => {
+ // Empty on malformed input — hide the label instead of "Invalid date"
+ const updatedAgo = showModified ? timeAgo(item?.modified_at) : "";
+ if (!showOwner && !updatedAgo) {
+ return null;
+ }
+ // No click handler here: the co-owner button stops its own propagation,
+ // and everything else should bubble to the row like the rest of it
return (
- <Flex
- gap={20}
- align="center"
- justify="space-between"
- className="list-view-container"
- >
- <div className="list-view-content">
- <div className="adapters-list-title-container display-flex-left">
- {title}
- </div>
- {showOwner && renderOwnerBadge(item)}
- </div>
- <div
- className="action-button-container"
- onClick={(event) => event.stopPropagation()}
- role="none"
- >
- <Tooltip
- title={item?.is_deprecated ? "This adapter is deprecated" : ""}
- >
- <EditOutlined
- key={`${item.id}-edit`}
- onClick={(event) => handleEdit(event, item)}
- className={`action-icon-buttons edit-icon ${
- item?.is_deprecated ? "disabled-icon" : ""
- }`}
- style={{
- cursor: item?.is_deprecated ? "not-allowed" : "pointer",
- opacity: item?.is_deprecated ? 0.4 : 1,
- }}
- />
- </Tooltip>
- {handleShare && (
- <Tooltip
- title={item?.is_deprecated ? "This adapter is deprecated" : ""}
+ <div className="list-view-meta">
+ {showOwner && renderOwnerBadge(item)}
+ {updatedAgo && (
+ <div className="list-view-modified-container">
+ <Typography.Text
+ type="secondary"
+ className="list-view-modified-text"
>
- <ShareAltOutlined
- key={`${item.id}-share`}
- className={`action-icon-buttons share-icon ${
- item?.is_deprecated ? "disabled-icon" : ""
- }`}
- onClick={(event) => handleShareClick(event, item, true)}
- style={{
- cursor: item?.is_deprecated ? "not-allowed" : "pointer",
- opacity: item?.is_deprecated ? 0.4 : 1,
- }}
+ Updated {updatedAgo}
+ </Typography.Text>
+ <Tooltip title={() => renderItemMetadata(item)}>
+ <InfoCircleOutlined
+ className="list-view-info-icon"
+ aria-label="Creation and modification details"
/>
</Tooltip>
- )}
- <Popconfirm
- key={`${item.id}-delete`}
- title={`Delete the ${type}`}
- description={`Are you sure to delete ${item[titleProp]}`}
- okText="Yes"
- cancelText="No"
- icon={<QuestionCircleOutlined />}
- onConfirm={(event) => {
- handleDeleteClick(event, item);
- }}
- >
- <Typography.Text>
- <DeleteOutlined className="action-icon-buttons delete-icon" />
- </Typography.Text>
- </Popconfirm>
- </div>
- </Flex>
+ </div>
+ )}
+ </div>
);
};
+ const renderActions = (item) => (
+ <div
+ className="action-button-container"
+ onClick={(event) => event.stopPropagation()}
+ role="none"
+ >
+ <Tooltip title={item?.is_deprecated ? "This adapter is deprecated" : ""}>
+ <EditOutlined
+ key={`${item.id}-edit`}
+ onClick={(event) => {
+ if (item?.is_deprecated) {
+ return;
+ }
+ handleEdit(event, item);
+ }}
+ className={`action-icon-buttons edit-icon ${
+ item?.is_deprecated ? "disabled-icon" : ""
+ }`}
+ style={{
+ cursor: item?.is_deprecated ? "not-allowed" : "pointer",
+ opacity: item?.is_deprecated ? 0.4 : 1,
+ }}
+ />
+ </Tooltip>
+ {handleShare && (
+ <Tooltip
+ title={item?.is_deprecated ? "This adapter is deprecated" : ""}
+ >
+ <ShareAltOutlined
+ key={`${item.id}-share`}
+ className={`action-icon-buttons share-icon ${
+ item?.is_deprecated ? "disabled-icon" : ""
+ }`}
+ onClick={(event) => {
+ if (item?.is_deprecated) {
+ return;
+ }
+ handleShareClick(event, item, true);
+ }}
+ style={{
+ cursor: item?.is_deprecated ? "not-allowed" : "pointer",
+ opacity: item?.is_deprecated ? 0.4 : 1,
+ }}
+ />
+ </Tooltip>
+ )}
+ <Popconfirm
+ key={`${item.id}-delete`}
+ title={`Delete the ${type}`}
+ description={`Are you sure to delete ${item[titleProp]}`}
+ okText="Yes"
+ cancelText="No"
+ icon={<QuestionCircleOutlined />}
+ onConfirm={(event) => {
+ handleDeleteClick(event, item);
+ }}
+ >
+ <Typography.Text>
+ <DeleteOutlined className="action-icon-buttons delete-icon" />
+ </Typography.Text>
+ </Popconfirm>
+ </div>
+ );
+
return (
<List
size="large"
@@ -226,13 +286,17 @@ function ListView({
? navigate(`${item[idProp]}`)
: handleShareClick(event, item, false);
}}
- className={`cur-pointer ${centered ? "centered" : ""}`}
+ className="cur-pointer"
>
- <List.Item.Meta
- className="list-item-desc"
- title={renderTitle(item)}
- description={
- item[descriptionProp] ? (
+ <Flex
+ gap={24}
+ align={centered ? "center" : "flex-start"}
+ justify="space-between"
+ className="list-view-row"
+ >
+ <div className="list-view-left">
+ {renderTitle(item)}
+ {item[descriptionProp] ? (
<Typography.Paragraph
type="secondary"
ellipsis={{ rows: 1, tooltip: true }}
@@ -240,9 +304,11 @@ function ListView({
>
{item[descriptionProp]}
</Typography.Paragraph>
- ) : null
- }
- ></List.Item.Meta>
+ ) : null}
+ </div>
+ {renderMeta(item)}
+ {renderActions(item)}
+ </Flex>
</List.Item>
);
}}
@@ -263,6 +329,7 @@ ListView.propTypes = {
centered: PropTypes.bool,
isClickable: PropTypes.bool,
showOwner: PropTypes.bool,
+ showModified: PropTypes.bool,
type: PropTypes.string,
};
diff --git a/frontend/src/helpers/GetStaticData.js b/frontend/src/helpers/GetStaticData.js
index 00e2f7343..10b0fdb58 100644
--- a/frontend/src/helpers/GetStaticData.js
+++ b/frontend/src/helpers/GetStaticData.js
@@ -402,6 +402,23 @@ const formattedDateTime = (ISOdateTime) => {
}
};
+/**
+ * Relative time for a backend timestamp ("3 days ago").
+ *
+ * Strict ISO parsing: malformed input returns "" (callers should hide the
+ * label) instead of moment's literal "Invalid date". Clamped to now so a
+ * slightly-fast server clock never renders "in a few seconds".
+ * @param {string} ISOdateTime ISO-8601 timestamp
+ * @returns {string} relative time, or "" when absent/malformed
+ */
+const timeAgo = (ISOdateTime) => {
+ const parsed = moment(ISOdateTime, moment.ISO_8601, true);
+ if (!parsed.isValid()) {
+ return "";
+ }
+ return moment.min(parsed, moment()).fromNow();
+};
+
const getBackendErrorDetail = (attr, backendErrors) => {
if (backendErrors) {
// Handle structured error response with errors array
@@ -763,6 +780,7 @@ export {
formatSecondsToHMS,
formatTimeDisplay,
formattedDateTime,
+ timeAgo,
formattedDateTimeWithSeconds,
generateApiRunStatusId,
generateCoverageKey,