|
|
@@ -7,6 +7,7 @@ import apiClient from '@/api/client'
|
|
|
import { useWorkspace } from '@/contexts/WorkspaceContext'
|
|
|
import Button from '@/components/Button'
|
|
|
import Input from '@/components/Input'
|
|
|
+import { formatDateTime } from '@/utils/format'
|
|
|
|
|
|
interface SchemaProperty {
|
|
|
type: string
|
|
|
@@ -45,6 +46,10 @@ interface Document {
|
|
|
_id: string
|
|
|
_created_at: string
|
|
|
_updated_at: string
|
|
|
+ _created_by?: string
|
|
|
+ _updated_by?: string
|
|
|
+ _created_by_name?: string
|
|
|
+ _updated_by_name?: string
|
|
|
[key: string]: unknown
|
|
|
}
|
|
|
|
|
|
@@ -515,8 +520,10 @@ function ViewDocumentModal({
|
|
|
// Add metadata fields last
|
|
|
allFields.push(
|
|
|
{ key: '_id', title: 'ID', value: document._id },
|
|
|
- { key: '_created_at', title: 'Created At', value: document._created_at },
|
|
|
- { key: '_updated_at', title: 'Updated At', value: document._updated_at }
|
|
|
+ { key: '_created_at', title: 'Created At', value: formatDateTime(document._created_at) },
|
|
|
+ { key: '_created_by', title: 'Created By', value: document._created_by_name || document._created_by || '-' },
|
|
|
+ { key: '_updated_at', title: 'Updated At', value: formatDateTime(document._updated_at) },
|
|
|
+ { key: '_updated_by', title: 'Updated By', value: document._updated_by_name || document._updated_by || '-' }
|
|
|
)
|
|
|
|
|
|
return allFields
|
|
|
@@ -868,6 +875,29 @@ function Documents() {
|
|
|
)}
|
|
|
</div>
|
|
|
</th>
|
|
|
+ <th
|
|
|
+ onClick={() => handleSort('_updated_at')}
|
|
|
+ className="cursor-pointer px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 hover:bg-gray-100"
|
|
|
+ >
|
|
|
+ <div className="flex items-center gap-1">
|
|
|
+ Updated
|
|
|
+ {sortField === '_updated_at' && (
|
|
|
+ <svg
|
|
|
+ className={`h-4 w-4 transition ${sortOrder === 'desc' ? 'rotate-180' : ''}`}
|
|
|
+ fill="none"
|
|
|
+ viewBox="0 0 24 24"
|
|
|
+ stroke="currentColor"
|
|
|
+ >
|
|
|
+ <path
|
|
|
+ strokeLinecap="round"
|
|
|
+ strokeLinejoin="round"
|
|
|
+ strokeWidth={2}
|
|
|
+ d="M5 15l7-7 7 7"
|
|
|
+ />
|
|
|
+ </svg>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ </th>
|
|
|
<th className="px-6 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500">
|
|
|
Actions
|
|
|
</th>
|
|
|
@@ -890,8 +920,17 @@ function Documents() {
|
|
|
{doc._id.slice(0, 8)}...
|
|
|
</td>
|
|
|
)}
|
|
|
- <td className="whitespace-nowrap px-6 py-4 text-sm text-gray-500">
|
|
|
- {new Date(doc._created_at).toLocaleDateString()}
|
|
|
+ <td className="px-6 py-4 text-sm text-gray-500">
|
|
|
+ <div>{formatDateTime(doc._created_at)}</div>
|
|
|
+ {doc._created_by_name && (
|
|
|
+ <div className="text-xs text-gray-400">by {doc._created_by_name}</div>
|
|
|
+ )}
|
|
|
+ </td>
|
|
|
+ <td className="px-6 py-4 text-sm text-gray-500">
|
|
|
+ <div>{formatDateTime(doc._updated_at)}</div>
|
|
|
+ {doc._updated_by_name && (
|
|
|
+ <div className="text-xs text-gray-400">by {doc._updated_by_name}</div>
|
|
|
+ )}
|
|
|
</td>
|
|
|
<td className="whitespace-nowrap px-6 py-4 text-right">
|
|
|
<div className="flex justify-end gap-2">
|