Merge branch 'ent-2252-5716-fallos-en-extension-chrome-de-eventos' into 'develop'

Ent 2252 5716 fallos en extension chrome de eventos

See merge request artica/pandorafms!1888
This commit is contained in:
vgilc 2018-11-30 13:35:20 +01:00
commit da662485b0
4 changed files with 25 additions and 20 deletions

View File

@ -247,4 +247,11 @@ button h3 {
}
.sev-Maintenance {
background: #A8A8A8;
}
.sev-Minor {
background: #F099A2;
color: #333;
}
.sev-Major {
background: #C97A4A;
}

View File

@ -29,11 +29,13 @@ function main() {
if (isFetching) return;
isFetching = true;
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=json&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
req = new XMLHttpRequest();
req.onload = handleResponse;
req.onerror = handleError;
req.open("GET", feedUrl, true);
req.withCredentials = true
req.send(null);
}
@ -132,25 +134,23 @@ function fetchNewEvents(A,B){
function parseReplyEvents (reply) {
// Split the API response
var e_array = reply.split("\n");
var data = JSON.parse(reply)
var e_array = JSON.parse(reply).data;
// Form a properly object
var fetchedEvents=new Array();
for(var i=0;i<e_array.length;i++){
// Avoid to parse empty lines
if (e_array[i].length == 0) continue;
var event=e_array[i].split(";");
var event=e_array[i];
fetchedEvents.push({
'id' : event[0],
'agent_name' : event[1],
'agent' : event[2],
'date' : event[5],
'title' : event[6],
'module' : event[9],
'type' : event[14],
'source' : event[17],
'severity' : event[28],
'id' : event.id_evento,
'agent_name' : event.agent_name,
'agent' : event.id_agent,
'date' : event.timestamp,
'title' : event.evento,
'module' : event.id_agentmodule,
'type' : event.event_type,
'source' : event.source,
'severity' : event.criticity_name,
'visited' : false
});
}

View File

@ -1,17 +1,14 @@
console.log("hola");
var url = window.location.href;
var re = /\?event=(\d+)/;
console.log("hola");
if(re.exec(url)) {
if(!isNaN(RegExp.$1)) {
var eventId = RegExp.$1;
document.write(chrome.extension.getBackgroundPage().getNotification(eventId));
}
}
console.log("hola");
window.onload = function () {
setTimeout(function() {
window.close();
}, 10000);
}
console.log("hola");

View File

@ -1,6 +1,6 @@
{
"name": "__MSG_name__",
"version": "2.0",
"version": "2.1",
"manifest_version": 2,
"description": "Pandora FMS Event viewer Chrome extension",
"homepage_url": "http://pandorafms.com",
@ -23,6 +23,7 @@
"tabs",
"notifications",
"http://*/*",
"https://*/*",
"background"
],
"default_locale": "en"