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