diff --git a/app/ui.py b/app/ui.py index 7dfaf90..eba8a85 100644 --- a/app/ui.py +++ b/app/ui.py @@ -1301,12 +1301,14 @@ def object_versions(bucket_name: str, object_key: str): for v in resp.get("Versions", []): if v.get("Key") != object_key: continue + if v.get("IsLatest", False): + continue versions.append({ "version_id": v.get("VersionId", ""), "last_modified": v["LastModified"].isoformat() if v.get("LastModified") else None, "size": v.get("Size", 0), "etag": v.get("ETag", "").strip('"'), - "is_latest": v.get("IsLatest", False), + "is_latest": False, }) return jsonify({"versions": versions}) except (ClientError, EndpointConnectionError, ConnectionClosedError) as exc: diff --git a/app/version.py b/app/version.py index fc8981e..b156699 100644 --- a/app/version.py +++ b/app/version.py @@ -1,6 +1,6 @@ from __future__ import annotations -APP_VERSION = "0.3.0" +APP_VERSION = "0.3.1" def get_version() -> str: diff --git a/static/js/bucket-detail-main.js b/static/js/bucket-detail-main.js index 3ff9871..8e326fb 100644 --- a/static/js/bucket-detail-main.js +++ b/static/js/bucket-detail-main.js @@ -1537,7 +1537,7 @@ const confirmVersionRestore = (row, version, label = null, onConfirm) => { if (!version) return; - const timestamp = version.archived_at ? new Date(version.archived_at).toLocaleString() : version.version_id; + const timestamp = (version.archived_at || version.last_modified) ? new Date(version.archived_at || version.last_modified).toLocaleString() : version.version_id; const sizeLabel = formatBytes(Number(version.size) || 0); const reasonLabel = describeVersionReason(version.reason); const targetLabel = label || row?.dataset.key || 'this object'; @@ -1610,7 +1610,7 @@ const latestCell = document.createElement('td'); if (item.latest) { - const ts = item.latest.archived_at ? new Date(item.latest.archived_at).toLocaleString() : item.latest.version_id; + const ts = (item.latest.archived_at || item.latest.last_modified) ? new Date(item.latest.archived_at || item.latest.last_modified).toLocaleString() : item.latest.version_id; const sizeLabel = formatBytes(Number(item.latest.size) || 0); latestCell.innerHTML = `
${ts}
${sizeLabel} ยท ${describeVersionReason(item.latest.reason)}
`; } else { @@ -1785,7 +1785,7 @@ badge.textContent = `#${versionNumber}`; const title = document.createElement('div'); title.className = 'fw-semibold small'; - const timestamp = entry.archived_at ? new Date(entry.archived_at).toLocaleString() : entry.version_id; + const timestamp = (entry.archived_at || entry.last_modified) ? new Date(entry.archived_at || entry.last_modified).toLocaleString() : entry.version_id; title.textContent = timestamp; heading.appendChild(badge); heading.appendChild(title); @@ -2816,7 +2816,16 @@ uploadFileInput.value = ''; } - loadObjects(false); + const previousKey = activeRow?.dataset.key || null; + loadObjects(false).then(() => { + if (previousKey) { + const newRow = document.querySelector(`[data-object-row][data-key="${CSS.escape(previousKey)}"]`); + if (newRow) { + selectRow(newRow); + if (versioningEnabled) loadObjectVersions(newRow, { force: true }); + } + } + }); const successCount = uploadSuccessFiles.length; const errorCount = uploadErrorFiles.length;