diff --git a/static/js/mithril/editor.js b/static/js/mithril/editor.js index da2f8ad..3262d6a 100644 --- a/static/js/mithril/editor.js +++ b/static/js/mithril/editor.js @@ -580,6 +580,7 @@ const Editor = { responseTime: this.responseTime, responseSize: this.responseSize, envEditorValue: this.jsonValue, + isTimer: this.isTimer, onClose: () => { this.response = null; }, diff --git a/static/js/mithril/responseView.js b/static/js/mithril/responseView.js index 3c6b0f8..a0d4ce3 100644 --- a/static/js/mithril/responseView.js +++ b/static/js/mithril/responseView.js @@ -11,11 +11,17 @@ const ResponseView = { responseSize, // #bytes in the raw response envEditorValue, // The JSON environment from the editor (string) onClose, // Callback to clear or close this view + isTimer, // Whether this is a timer response } = vnode.attrs; // If there's no response, nothing to show if (!response) return null; + // If isTimer is true and we're on a hidden tab, switch to logs + if (isTimer && (this.tabIndex === 1 || this.tabIndex === 2)) { + this.tabIndex = 3; + } + return m("div", { class: "mt-2 p-1 rounded-md bg-gray-200 min-h-40" }, [ /* ───────────────────────────────────────────────────────────────── TAB HEADERS @@ -61,7 +67,7 @@ const ResponseView = { ), // Raw (tabIndex=2) - m( + !isTimer && m( "div", { class: @@ -125,7 +131,7 @@ const ResponseView = { ), // Preview (tabIndex=1) - m( + !isTimer && m( "div", { class: @@ -162,7 +168,7 @@ const ResponseView = { m("span", "Preview"), ] ), - ] + ].filter(Boolean) ), // Right: Close icon @@ -325,8 +331,8 @@ const ResponseView = { ─────────────────────────────────────────────────────────────────*/ m("div", { class: "flex justify-end p-1" }, [ m("div", { class: "text-sm font-medium text-gray-600 space-x-4" }, [ - // Status - m("span", [ + // Status (hidden if isTimer) + !isTimer && m("span", [ "Status: ", m( "span", @@ -339,14 +345,14 @@ const ResponseView = { response?.result?.status || "Error" ), ]), - // Time + // Time (always shown) responseTime != null && m("span", [ "Time: ", m("span", { class: "text-green-600" }, `${responseTime}ms`), ]), - // Size - responseSize != null && + // Size (hidden if isTimer) + !isTimer && responseSize != null && m("span", [ "Size: ", m("span", { class: "text-green-600" }, `${responseSize} bytes`),