mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
converted event log to module
This commit is contained in:
parent
1d0e96a314
commit
fd48a97c6d
@ -1,41 +1,47 @@
|
|||||||
async function showEventLog() {
|
const eventLog = (function() {
|
||||||
$("#event-log-dialog").dialog({
|
const dialogEl = $("#event-log-dialog");
|
||||||
modal: true,
|
const listEl = $("#event-log-list");
|
||||||
width: 800,
|
|
||||||
height: 700
|
|
||||||
});
|
|
||||||
|
|
||||||
const result = await $.ajax({
|
async function showDialog() {
|
||||||
url: baseApiUrl + 'event-log',
|
dialogEl.dialog({
|
||||||
type: 'GET',
|
modal: true,
|
||||||
error: () => error("Error getting event log.")
|
width: 800,
|
||||||
});
|
height: 700
|
||||||
|
});
|
||||||
|
|
||||||
const eventLogList = $("#event-log-list");
|
const result = await $.ajax({
|
||||||
eventLogList.html('');
|
url: baseApiUrl + 'event-log',
|
||||||
|
type: 'GET',
|
||||||
|
error: () => error("Error getting event log.")
|
||||||
|
});
|
||||||
|
|
||||||
for (const event of result) {
|
listEl.html('');
|
||||||
const dateTime = formatDateTime(getDateFromTS(event.date_added));
|
|
||||||
|
|
||||||
if (event.note_id) {
|
for (const event of result) {
|
||||||
const noteLink = $("<a>", {
|
const dateTime = formatDateTime(getDateFromTS(event.date_added));
|
||||||
href: 'app#' + event.note_id,
|
|
||||||
text: getFullName(event.note_id)
|
|
||||||
}).prop('outerHTML');
|
|
||||||
|
|
||||||
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 => {
|
$(document).on('click', '#event-log-dialog a', e => {
|
||||||
goToInternalNote(e, () => {
|
goToInternalNote(e, () => {
|
||||||
$("#event-log-dialog").dialog('close');
|
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="recentChanges.showDialog();">Recent changes</button>
|
||||||
<button class="btn btn-xs" onclick="recentNotes.showDialog();">Recent notes</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="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>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user