diff --git a/public/controllers/dev-tools.js b/public/controllers/dev-tools.js index 7cedf3bf3..3d1d61d54 100644 --- a/public/controllers/dev-tools.js +++ b/public/controllers/dev-tools.js @@ -13,14 +13,15 @@ import { uiModules } from 'ui/modules' import CodeMirror from '../utils/codemirror/lib/codemirror' import jsonLint from '../utils/codemirror/json-lint' import queryString from 'query-string' +import $ from 'jquery' const app = uiModules.get('app/wazuh', []); // Logs controller -app.controller('devToolsController', function($scope, apiReq, $window, appState, errorHandler) { +app.controller('devToolsController', function($scope, apiReq, $window, appState, errorHandler, $document) { let groups = []; - const apiInputBox = CodeMirror.fromTextArea(document.getElementById('api_input'),{ + const apiInputBox = CodeMirror.fromTextArea($document[0].getElementById('api_input'),{ lineNumbers : true, matchBrackets : true, mode : { name: "javascript", json: true }, @@ -135,14 +136,14 @@ app.controller('devToolsController', function($scope, apiReq, $window, appState, jsonLint.parse(item.requestTextJson) } catch(error) { affectedGroups.push(item.requestText); - const msg = document.createElement("div"); + const msg = $document[0].createElement("div"); msg.id = new Date().getTime()/1000; - const icon = msg.appendChild(document.createElement("div")); + const icon = msg.appendChild($document[0].createElement("div")); icon.className = "lint-error-icon"; icon.id = new Date().getTime()/1000; icon.onmouseover = () => { - const advice = msg.appendChild(document.createElement("span")); + const advice = msg.appendChild($document[0].createElement("span")); advice.id = new Date().getTime()/1000; advice.innerText = error.message || 'Error parsing query' advice.className = 'lint-block-wz' @@ -180,7 +181,7 @@ app.controller('devToolsController', function($scope, apiReq, $window, appState, highlightGroup(currentGroup); } - const apiOutputBox = CodeMirror.fromTextArea(document.getElementById('api_output'),{ + const apiOutputBox = CodeMirror.fromTextArea($document[0].getElementById('api_output'),{ lineNumbers : true, matchBrackets : true, mode : { name: "javascript", json: true },