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

35 lines
842 B
JavaScript
Raw Normal View History

import linkService from '../services/link.js';
import utils from '../services/utils.js';
import server from '../services/server.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.modal();
2017-11-04 11:00:35 +08:00
const result = await server.get('event-log');
2017-11-04 11:00:35 +08:00
2018-08-28 20:26:11 +08:00
$list.empty();
2017-11-04 11:00:35 +08:00
for (const event of result) {
2018-05-27 00:38:25 +08:00
const dateTime = utils.formatDateTime(utils.parseDate(event.dateCreated));
2017-11-04 11:00:35 +08:00
if (event.noteId) {
2018-04-20 08:59:44 +08:00
const noteLink = await linkService.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
};