mirror of
https://github.com/zadam/trilium.git
synced 2025-01-26 17:07:56 +08:00
converted event log to module
This commit is contained in:
parent
1d0e96a314
commit
fd48a97c6d
2 changed files with 38 additions and 32 deletions
|
@ -1,41 +1,47 @@
|
|||
async function showEventLog() {
|
||||
$("#event-log-dialog").dialog({
|
||||
modal: true,
|
||||
width: 800,
|
||||
height: 700
|
||||
});
|
||||
const eventLog = (function() {
|
||||
const dialogEl = $("#event-log-dialog");
|
||||
const listEl = $("#event-log-list");
|
||||
|
||||
const result = await $.ajax({
|
||||
url: baseApiUrl + 'event-log',
|
||||
type: 'GET',
|
||||
error: () => error("Error getting event log.")
|
||||
});
|
||||
async function showDialog() {
|
||||
dialogEl.dialog({
|
||||
modal: true,
|
||||
width: 800,
|
||||
height: 700
|
||||
});
|
||||
|
||||
const eventLogList = $("#event-log-list");
|
||||
eventLogList.html('');
|
||||
const result = await $.ajax({
|
||||
url: baseApiUrl + 'event-log',
|
||||
type: 'GET',
|
||||
error: () => error("Error getting event log.")
|
||||
});
|
||||
|
||||
for (const event of result) {
|
||||
const dateTime = formatDateTime(getDateFromTS(event.date_added));
|
||||
listEl.html('');
|
||||
|
||||
if (event.note_id) {
|
||||
const noteLink = $("<a>", {
|
||||
href: 'app#' + event.note_id,
|
||||
text: getFullName(event.note_id)
|
||||
}).prop('outerHTML');
|
||||
for (const event of result) {
|
||||
const dateTime = formatDateTime(getDateFromTS(event.date_added));
|
||||
|
||||
console.log(noteLink);
|
||||
if (event.note_id) {
|
||||
const noteLink = $("<a>", {
|
||||
href: 'app#' + event.note_id,
|
||||
text: getFullName(event.note_id)
|
||||
}).prop('outerHTML');
|
||||
|
||||
event.comment = event.comment.replace('<note>', noteLink);
|
||||
event.comment = event.comment.replace('<note>', noteLink);
|
||||
}
|
||||
|
||||
const eventEl = $('<li>').html(dateTime + " - " + event.comment);
|
||||
|
||||
listEl.append(eventEl);
|
||||
}
|
||||
|
||||
const eventEl = $('<li>').html(dateTime + " - " + event.comment);
|
||||
|
||||
eventLogList.append(eventEl);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('click', '#event-log-dialog a', e => {
|
||||
goToInternalNote(e, () => {
|
||||
$("#event-log-dialog").dialog('close');
|
||||
$(document).on('click', '#event-log-dialog a', e => {
|
||||
goToInternalNote(e, () => {
|
||||
dialogEl.dialog('close');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
showDialog
|
||||
};
|
||||
})();
|
|
@ -15,7 +15,7 @@
|
|||
<button class="btn btn-xs" onclick="recentChanges.showDialog();">Recent changes</button>
|
||||
<button class="btn btn-xs" onclick="recentNotes.showDialog();">Recent notes</button>
|
||||
<button class="btn btn-xs" onclick="jumpToNote.showDialog();">Jump to note</button>
|
||||
<button class="btn btn-xs" onclick="showEventLog();">Event log</button>
|
||||
<button class="btn btn-xs" onclick="eventLog.showDialog();">Event log</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
|
Loading…
Reference in a new issue