diff --git a/ui/app/controllers/CControllerHostViewRefresh.php b/ui/app/controllers/CControllerHostViewRefresh.php index 4c638c652a0..65176bbac21 100644 --- a/ui/app/controllers/CControllerHostViewRefresh.php +++ b/ui/app/controllers/CControllerHostViewRefresh.php @@ -60,7 +60,8 @@ class CControllerHostViewRefresh extends CControllerHostView { 'sort' => $filter['sort'], 'sortorder' => $filter['sortorder'], 'allowed_ui_latest_data' => $this->checkAccess(CRoleHelper::UI_MONITORING_LATEST_DATA), - 'allowed_ui_problems' => $this->checkAccess(CRoleHelper::UI_MONITORING_PROBLEMS) + 'allowed_ui_problems' => $this->checkAccess(CRoleHelper::UI_MONITORING_PROBLEMS), + 'user' => ['debug_mode' => $this->getDebugMode()] ] + $this->getData($filter); $response = new CControllerResponseData($data); diff --git a/ui/app/views/js/monitoring.host.view.js.php b/ui/app/views/js/monitoring.host.view.js.php index 60fb4697efa..22773d7ab58 100644 --- a/ui/app/views/js/monitoring.host.view.js.php +++ b/ui/app/views/js/monitoring.host.view.js.php @@ -162,6 +162,10 @@ return this.bindDataEvents(this.deferred); }, + getCurrentDebugBlock() { + return document.querySelector('.wrapper > .debug-output'); + }, + setLoading() { this.host_view_form.addClass('is-loading is-loading-fadein delayed-15s'); }, @@ -183,6 +187,12 @@ return deferred; }, + refreshDebug(debug) { + this.getCurrentDebugBlock().replaceWith( + new DOMParser().parseFromString(debug, 'text/html').body.firstElementChild + ); + }, + onDataDone(response) { this.clearLoading(); this._removeRefreshMessage(); @@ -196,6 +206,8 @@ if ('messages' in response) { this._addRefreshMessage(response.messages); } + + ('debug' in response) && this.refreshDebug(response.debug); }, onDataFail(jqXHR) { diff --git a/ui/app/views/monitoring.host.view.refresh.php b/ui/app/views/monitoring.host.view.refresh.php index 25409caabe0..4c17e7f7f6e 100644 --- a/ui/app/views/monitoring.host.view.refresh.php +++ b/ui/app/views/monitoring.host.view.refresh.php @@ -22,4 +22,9 @@ if (($messages = getMessages()) !== null) { $output['messages'] = $messages->toString(); } +if ($data['user']['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) { + CProfiler::getInstance()->stop(); + $output['debug'] = CProfiler::getInstance()->make()->toString(); +} + echo json_encode($output);