38 lines
902 B
JavaScript
Raw Normal View History

"use strict";
2017-11-04 14:02:43 -04:00
const eventLog = (function() {
const $dialog = $("#event-log-dialog");
const $list = $("#event-log-list");
2017-11-03 23:00:35 -04:00
2017-11-04 14:02:43 -04:00
async function showDialog() {
glob.activeDialog = $dialog;
2017-11-04 17:03:15 -04:00
$dialog.dialog({
2017-11-04 14:02:43 -04:00
modal: true,
width: 800,
height: 700
});
2017-11-03 23:00:35 -04:00
const result = await server.get('event-log');
2017-11-03 23:00:35 -04:00
$list.html('');
2017-11-03 23:00:35 -04:00
2017-11-04 14:02:43 -04:00
for (const event of result) {
2018-03-24 23:37:55 -04:00
const dateTime = utils.formatDateTime(utils.parseDate(event.dateAdded));
2017-11-03 23:00:35 -04:00
2018-01-28 19:30:14 -05:00
if (event.noteId) {
const noteLink = link.createNoteLink(event.noteId).prop('outerHTML');
2017-11-03 23:00:35 -04:00
2017-11-04 14:02:43 -04:00
event.comment = event.comment.replace('<note>', noteLink);
}
2017-11-03 23:00:35 -04:00
2017-11-04 14:02:43 -04:00
const eventEl = $('<li>').html(dateTime + " - " + event.comment);
2017-11-03 23:00:35 -04:00
$list.append(eventEl);
2017-11-04 14:02:43 -04:00
}
2017-11-03 23:00:35 -04:00
}
2017-11-04 14:02:43 -04:00
return {
showDialog
};
})();