2017-11-05 07:38:50 +08:00
|
|
|
"use strict";
|
|
|
|
|
2018-03-26 01:02:39 +08:00
|
|
|
import link from '../services/link.js';
|
|
|
|
import utils from '../services/utils.js';
|
2017-11-04 11:00:35 +08:00
|
|
|
|
2018-03-25 23:09:17 +08:00
|
|
|
const $dialog = $("#event-log-dialog");
|
|
|
|
const $list = $("#event-log-list");
|
2017-11-05 05:03:15 +08:00
|
|
|
|
2018-03-25 23:09:17 +08:00
|
|
|
async function showDialog() {
|
|
|
|
glob.activeDialog = $dialog;
|
2017-11-04 11:00:35 +08:00
|
|
|
|
2018-03-25 23:09:17 +08:00
|
|
|
$dialog.dialog({
|
|
|
|
modal: true,
|
|
|
|
width: 800,
|
|
|
|
height: 700
|
|
|
|
});
|
2017-11-04 11:00:35 +08:00
|
|
|
|
2018-03-25 23:09:17 +08:00
|
|
|
const result = await server.get('event-log');
|
2017-11-04 11:00:35 +08:00
|
|
|
|
2018-03-25 23:09:17 +08:00
|
|
|
$list.html('');
|
2017-11-04 11:00:35 +08:00
|
|
|
|
2018-03-25 23:09:17 +08:00
|
|
|
for (const event of result) {
|
|
|
|
const dateTime = utils.formatDateTime(utils.parseDate(event.dateAdded));
|
2017-11-04 11:00:35 +08:00
|
|
|
|
2018-03-25 23:09:17 +08:00
|
|
|
if (event.noteId) {
|
|
|
|
const noteLink = link.createNoteLink(event.noteId).prop('outerHTML');
|
2017-11-04 11:00:35 +08:00
|
|
|
|
2018-03-25 23:09:17 +08:00
|
|
|
event.comment = event.comment.replace('<note>', noteLink);
|
2017-11-05 02:02:43 +08:00
|
|
|
}
|
2018-03-25 23:09:17 +08:00
|
|
|
|
|
|
|
const eventEl = $('<li>').html(dateTime + " - " + event.comment);
|
|
|
|
|
|
|
|
$list.append(eventEl);
|
2017-11-04 11:00:35 +08:00
|
|
|
}
|
2018-03-25 23:09:17 +08:00
|
|
|
}
|
2017-11-04 11:00:35 +08:00
|
|
|
|
2018-03-25 23:09:17 +08:00
|
|
|
export default {
|
|
|
|
showDialog
|
|
|
|
};
|