Commit c95a9ee8 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

provide new structurized log information in the Gui

parent bd6f29a0
......@@ -48,7 +48,13 @@ LogListDialog.prototype.createLogListDialogGui = function () {
type: "thead",
content: "<tr>" +
"<th>ID</th>" +
"<th>Type</th>" +
"<th>Severity</th>" +
"<th>Object ID</th>" +
"<th>Object Class</th>" +
"<th>Map name</th>" +
"<th>Content</th>" +
"<th>Source</th>" +
"</tr>"
});
var body = Functions.createElement({
......@@ -85,11 +91,8 @@ LogListDialog.prototype.createLogListDialogGui = function () {
});
var FileSaver = require("file-saver");
return FileSaver.saveAs(blob, self._projectId + "-logs.txt");
}).then(function () {
}).catch(GuiConnector.alert).finally(function () {
GuiConnector.hideProcessing();
}, function (error) {
GuiConnector.hideProcessing();
GuiConnector.alert(error);
});
},
xss: false
......@@ -98,6 +101,34 @@ LogListDialog.prototype.createLogListDialogGui = function () {
};
function removeNull(object) {
if (object === null || object === undefined) {
return "";
}
return object;
}
function extractTypeName(type) {
if (type === undefined || type === null) {
return "";
}
var result = type.toLowerCase().replace("_", " ");
return result[0].toUpperCase() + result.slice(1);
}
function entryToRow(entry) {
var row = [];
row[0] = removeNull(entry.id);
row[1] = removeNull(extractTypeName(entry.type));
row[2] = removeNull(entry.level);
row[3] = removeNull(entry.objectIdentifier);
row[4] = removeNull(entry.objectClass);
row[5] = removeNull(entry.mapName);
row[6] = removeNull(entry.content);
row[7] = removeNull(entry.source);
return row;
}
/**
*
* @param {Object} data
......@@ -121,12 +152,11 @@ LogListDialog.prototype._dataTableAjaxCall = function (data, callback) {
projectId: self._projectId
}).then(function (logEntries) {
var out = [];
for (var i = 0; i < logEntries.data.length; i++) {
var entry = logEntries.data[i];
var row = [];
row[0] = entry.id;
row[1] = entry.content;
var row = entryToRow(entry);
out.push(row);
}
callback({
......@@ -150,7 +180,7 @@ LogListDialog.prototype.downloadAll = function () {
}).then(function (logEntries) {
var tmp = [];
for (var i = 0; i < logEntries.data.length; i++) {
tmp.push(logEntries.data[i].content);
tmp.push(entryToRow(logEntries.data[i]).join("\t"));
}
return tmp.join("\n");
});
......@@ -196,8 +226,20 @@ LogListDialog.prototype.open = function () {
LogListDialog.prototype.getColumnsDefinition = function () {
return [{
name: "id"
}, {
name: "type"
}, {
name: "level"
}, {
name: "objectIdentifier"
}, {
name: "objectClass"
}, {
name: "mapName"
}, {
name: "content"
}, {
name: "source"
}];
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment