From 0c78cb5c97de11dd2eb0b50623294f2b7c0bcf25 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Fri, 11 Nov 2022 16:56:26 +0100 Subject: [PATCH] show debug_kit iframe error nicely --- webroot/css/style.css | 4 ++++ webroot/js/inject-iframe.js | 5 +++++ webroot/js/modules/Toolbar.js | 9 ++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/webroot/css/style.css b/webroot/css/style.css index 09661b80..ce5224b4 100644 --- a/webroot/css/style.css +++ b/webroot/css/style.css @@ -574,6 +574,10 @@ strong { display: block; } +.c-panel-content-container__content { + height: 100%; +} + .c-panel-content-container__content .o-loader { display: none; } diff --git a/webroot/js/inject-iframe.js b/webroot/js/inject-iframe.js index 5eeea63e..3e293fad 100644 --- a/webroot/js/inject-iframe.js +++ b/webroot/js/inject-iframe.js @@ -27,6 +27,11 @@ if (elem) { iframe.height = '100%'; doc.body.style.overflow = 'hidden'; } + if (event.data === 'error') { + iframe.width = '40%'; + iframe.height = '40%'; + doc.body.style.overflow = bodyOverflow; + } }; const onReady = () => { diff --git a/webroot/js/modules/Toolbar.js b/webroot/js/modules/Toolbar.js index 569aefe3..7f6fe22d 100644 --- a/webroot/js/modules/Toolbar.js +++ b/webroot/js/modules/Toolbar.js @@ -152,7 +152,14 @@ export default class Toolbar { // This initializes the panel specific JS logic (if there is any) document.dispatchEvent(new CustomEvent('initPanel', { detail: `panel${panelType}` })); that.bindDebugBlock(); - }); + }) + .fail((response) => { + clearTimeout(timer); + contentArea.html(response.responseText); + $('.o-loader').removeClass('is-loading'); + $('.c-panel-content-container').addClass('is-active'); + window.parent.postMessage('error', window.location.origin); + }); } // This re-inits the collapsible Debugger::exportVar() content of the Variables tab