trilium/src/public/javascripts/dialogs/event_log.js

40 lines
843 B
JavaScript
Raw Normal View History

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