mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 18:05:20 +00:00
Fixes in dev tools
This commit is contained in:
parent
a905663c66
commit
8c6e438859
@ -83,7 +83,7 @@ export class DevToolsController {
|
||||
}
|
||||
);
|
||||
// Register plugin for code mirror
|
||||
CodeMirror.commands.autocomplete = function(cm) {
|
||||
CodeMirror.commands.autocomplete = function (cm) {
|
||||
CodeMirror.showHint(cm, CodeMirror.hint.dictionaryHint, {
|
||||
completeSingle: false
|
||||
});
|
||||
@ -335,7 +335,7 @@ export class DevToolsController {
|
||||
this.apiInputBox.setSize('auto', '100%');
|
||||
this.apiInputBox.model = [];
|
||||
this.getAvailableMethods();
|
||||
this.apiInputBox.on('keyup', function(cm, e) {
|
||||
this.apiInputBox.on('keyup', function (cm, e) {
|
||||
if (!ExcludedIntelliSenseTriggerKeys[(e.keyCode || e.which).toString()]) {
|
||||
cm.execCommand('autocomplete', null, {
|
||||
completeSingle: false
|
||||
@ -359,22 +359,22 @@ export class DevToolsController {
|
||||
this.highlightGroup(currentGroup);
|
||||
|
||||
// Register our custom Codemirror hint plugin.
|
||||
CodeMirror.registerHelper('hint', 'dictionaryHint', function(editor) {
|
||||
CodeMirror.registerHelper('hint', 'dictionaryHint', function (editor) {
|
||||
const model = editor.model;
|
||||
function getDictionary(line, word) {
|
||||
let hints = [];
|
||||
const exp = line.split(/\s+/g);
|
||||
if (exp[0] && exp[0].match(/^(?:GET|PUT|POST|DELETE).*$/)) {
|
||||
let method = model.find(function(item) {
|
||||
let method = model.find(function (item) {
|
||||
return item.method === exp[0];
|
||||
});
|
||||
const forbidChars = /^[^?{]+$/;
|
||||
if (method && !exp[2] && forbidChars.test(word)) {
|
||||
method.endpoints.forEach(function(endpoint) {
|
||||
method.endpoints.forEach(function (endpoint) {
|
||||
endpoint.path = endpoint.name;
|
||||
if (endpoint.args && endpoint.args.length > 0) {
|
||||
let argSubs = [];
|
||||
endpoint.args.forEach(function(arg) {
|
||||
endpoint.args.forEach(function (arg) {
|
||||
const pathSplitted = endpoint.name.split('/');
|
||||
const arrayIdx = pathSplitted.indexOf(arg.name);
|
||||
const wordSplitted = word.split('/');
|
||||
@ -386,7 +386,7 @@ export class DevToolsController {
|
||||
}
|
||||
});
|
||||
let auxPath = endpoint.name;
|
||||
argSubs.forEach(function(arg) {
|
||||
argSubs.forEach(function (arg) {
|
||||
auxPath = auxPath.replace(arg.id, arg.value);
|
||||
});
|
||||
endpoint.path = auxPath;
|
||||
@ -407,34 +407,34 @@ export class DevToolsController {
|
||||
const whiteSpace = /\s/;
|
||||
while (end < curLine.length && !whiteSpace.test(curLine.charAt(end)))
|
||||
++end;
|
||||
while (start && !whiteSpace.test(curLine.charAt(start - 1))) --start;
|
||||
while (start && !whiteSpace.test(curLine.charAt(start - 1)))--start;
|
||||
const curWord = start !== end && curLine.slice(start, end);
|
||||
return {
|
||||
list: (!curWord
|
||||
? []
|
||||
: getDictionary(curLine, curWord).filter(function(item) {
|
||||
return item.toUpperCase().includes(curWord.toUpperCase());
|
||||
})
|
||||
: getDictionary(curLine, curWord).filter(function (item) {
|
||||
return item.toUpperCase().includes(curWord.toUpperCase());
|
||||
})
|
||||
).sort(),
|
||||
from: CodeMirror.Pos(cur.line, start),
|
||||
to: CodeMirror.Pos(cur.line, end)
|
||||
};
|
||||
});
|
||||
const evtDocument = this.$document[0];
|
||||
$('.wz-dev-column-separator').mousedown(function(e) {
|
||||
$('.wz-dev-column-separator').mousedown(function (e) {
|
||||
e.preventDefault();
|
||||
$('.wz-dev-column-separator').addClass('active');
|
||||
const leftOrigWidth = $('#wz-dev-left-column').width();
|
||||
const rightOrigWidth = $('#wz-dev-right-column').width();
|
||||
$(evtDocument).mousemove(function(e) {
|
||||
const leftWidth = e.pageX - 85 + 14;
|
||||
$(evtDocument).mousemove(function (e) {
|
||||
const leftWidth = e.pageX - 215 + 14;
|
||||
let rightWidth = leftOrigWidth - leftWidth;
|
||||
$('#wz-dev-left-column').css('width', leftWidth);
|
||||
$('#wz-dev-right-column').css('width', rightOrigWidth + rightWidth);
|
||||
});
|
||||
});
|
||||
|
||||
$(evtDocument).mouseup(function() {
|
||||
$(evtDocument).mouseup(function () {
|
||||
$('.wz-dev-column-separator').removeClass('active');
|
||||
$(evtDocument).unbind('mousemove');
|
||||
});
|
||||
@ -454,7 +454,7 @@ export class DevToolsController {
|
||||
const dynamicHeight = () => {
|
||||
const self = this;
|
||||
const window = this.$window;
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
const windows = $(window).height();
|
||||
$('#wz-dev-left-column').height(
|
||||
windows - (self.getPosition($('#wz-dev-left-column')[0]).y + 20)
|
||||
@ -467,7 +467,7 @@ export class DevToolsController {
|
||||
);
|
||||
$('.wz-dev-column-separator span').height(
|
||||
windows -
|
||||
(self.getPosition($('.wz-dev-column-separator span')[0]).y + 20)
|
||||
(self.getPosition($('.wz-dev-column-separator span')[0]).y + 20)
|
||||
);
|
||||
}, 1);
|
||||
};
|
||||
@ -483,10 +483,10 @@ export class DevToolsController {
|
||||
const desiredGroup = firstTime
|
||||
? this.groups.filter(item => item.requestText)
|
||||
: this.groups.filter(
|
||||
item =>
|
||||
item.requestText &&
|
||||
(item.end >= selection.line && item.start <= selection.line)
|
||||
);
|
||||
item =>
|
||||
item.requestText &&
|
||||
(item.end >= selection.line && item.start <= selection.line)
|
||||
);
|
||||
|
||||
// Place play button at first line from the selected group
|
||||
const cords = this.apiInputBox.cursorCoords({
|
||||
@ -542,12 +542,12 @@ export class DevToolsController {
|
||||
const method = desiredGroup.requestText.startsWith('GET')
|
||||
? 'GET'
|
||||
: desiredGroup.requestText.startsWith('POST')
|
||||
? 'POST'
|
||||
: desiredGroup.requestText.startsWith('PUT')
|
||||
? 'PUT'
|
||||
: desiredGroup.requestText.startsWith('DELETE')
|
||||
? 'DELETE'
|
||||
: 'GET';
|
||||
? 'POST'
|
||||
: desiredGroup.requestText.startsWith('PUT')
|
||||
? 'PUT'
|
||||
: desiredGroup.requestText.startsWith('DELETE')
|
||||
? 'DELETE'
|
||||
: 'GET';
|
||||
|
||||
let requestCopy = desiredGroup.requestText.includes(method)
|
||||
? desiredGroup.requestText.split(method)[1].trim()
|
||||
@ -628,4 +628,18 @@ export class DevToolsController {
|
||||
this.errorHandler.handle(error, 'Export JSON');
|
||||
}
|
||||
}
|
||||
|
||||
getPosition(element) {
|
||||
var xPosition = 0;
|
||||
var yPosition = 0;
|
||||
|
||||
while (element) {
|
||||
xPosition +=
|
||||
element.offsetLeft - element.scrollLeft + element.clientLeft;
|
||||
yPosition += element.offsetTop - element.scrollTop + element.clientTop;
|
||||
element = element.offsetParent;
|
||||
}
|
||||
|
||||
return { x: xPosition, y: yPosition };
|
||||
}
|
||||
}
|
||||
|
7
server/wazuh-version.json
Normal file
7
server/wazuh-version.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "Wazuh App",
|
||||
"app-version": "3.10.0",
|
||||
"revision": "0516",
|
||||
"installationDate": "2019-06-18T16:06:11.594Z",
|
||||
"lastRestart": "2019-06-18T16:19:06.012Z"
|
||||
}
|
Loading…
Reference in New Issue
Block a user