Using $document instead document. Importing jQuery

This commit is contained in:
Jesús Ángel 2018-07-31 16:19:13 +02:00 committed by Javier Castro
parent 23a3cc7b29
commit d0f0e47a66

View File

@ -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 },