mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	removed event log
This commit is contained in:
		
							
								
								
									
										1
									
								
								db/migrations/0143__drop_event_log.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								db/migrations/0143__drop_event_log.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| DROP TABLE event_log; | ||||
| @@ -1,32 +0,0 @@ | ||||
| import linkService from '../services/link.js'; | ||||
| import utils from '../services/utils.js'; | ||||
| import server from '../services/server.js'; | ||||
|  | ||||
| const $dialog = $("#event-log-dialog"); | ||||
| const $list = $("#event-log-list"); | ||||
|  | ||||
| export async function showDialog() { | ||||
|     utils.closeActiveDialog(); | ||||
|  | ||||
|     glob.activeDialog = $dialog; | ||||
|  | ||||
|     $dialog.modal(); | ||||
|  | ||||
|     const result = await server.get('event-log'); | ||||
|  | ||||
|     $list.empty(); | ||||
|  | ||||
|     for (const event of result) { | ||||
|         const dateTime = utils.formatDateTime(utils.parseDate(event.utcDateCreated)); | ||||
|  | ||||
|         if (event.noteId) { | ||||
|             const noteLink = await linkService.createNoteLink(event.noteId).prop('outerHTML'); | ||||
|  | ||||
|             event.comment = event.comment.replace('<note>', noteLink); | ||||
|         } | ||||
|  | ||||
|         const eventEl = $('<li>').html(dateTime + " - " + event.comment); | ||||
|  | ||||
|         $list.append(eventEl); | ||||
|     } | ||||
| } | ||||
| @@ -1,11 +0,0 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const sql = require('../../services/sql'); | ||||
|  | ||||
| async function getEventLog() { | ||||
|     return await sql.getRows("SELECT * FROM event_log ORDER BY utcDateCreated DESC"); | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|     getEventLog | ||||
| }; | ||||
| @@ -16,7 +16,6 @@ const optionsApiRoute = require('./api/options'); | ||||
| const passwordApiRoute = require('./api/password'); | ||||
| const syncApiRoute = require('./api/sync'); | ||||
| const loginApiRoute = require('./api/login'); | ||||
| const eventLogRoute = require('./api/event_log'); | ||||
| const recentNotesRoute = require('./api/recent_notes'); | ||||
| const appInfoRoute = require('./api/app_info'); | ||||
| const exportRoute = require('./api/export'); | ||||
| @@ -189,8 +188,6 @@ function register(app) { | ||||
|     route(POST, '/api/sync/finished', [auth.checkApiAuth], syncApiRoute.syncFinished, apiResultHandler); | ||||
|     route(GET, '/api/sync/stats', [], syncApiRoute.getStats, apiResultHandler); | ||||
|  | ||||
|     apiRoute(GET, '/api/event-log', eventLogRoute.getEventLog); | ||||
|  | ||||
|     apiRoute(POST, '/api/recent-notes', recentNotesRoute.addRecentNote); | ||||
|     apiRoute(GET, '/api/app-info', appInfoRoute.getAppInfo); | ||||
|  | ||||
|   | ||||
| @@ -4,7 +4,7 @@ const build = require('./build'); | ||||
| const packageJson = require('../../package'); | ||||
| const {TRILIUM_DATA_DIR} = require('./data_dir'); | ||||
|  | ||||
| const APP_DB_VERSION = 142; | ||||
| const APP_DB_VERSION = 143; | ||||
| const SYNC_VERSION = 10; | ||||
| const CLIPPER_PROTOCOL_VERSION = "1.0"; | ||||
|  | ||||
|   | ||||
| @@ -3,7 +3,6 @@ | ||||
| const sql = require('./sql'); | ||||
| const utils = require('./utils'); | ||||
| const log = require('./log'); | ||||
| const eventLogService = require('./event_log'); | ||||
| const ws = require('./ws.js'); | ||||
| const ApiToken = require('../entities/api_token'); | ||||
| const Branch = require('../entities/branch'); | ||||
| @@ -56,8 +55,6 @@ async function checkContentHashes(otherHashes) { | ||||
|         if (hashes[key] !== otherHashes[key]) { | ||||
|             allChecksPassed = false; | ||||
|  | ||||
|             await eventLogService.addEvent(`Content hash check for ${key} FAILED. Local is ${hashes[key]}, remote is ${otherHashes[key]}`); | ||||
|  | ||||
|             if (key !== 'recent_notes') { | ||||
|                 // let's not get alarmed about recent notes which get updated often and can cause failures in race conditions | ||||
|                 await ws.sendMessageToAllClients({type: 'sync-hash-check-failed'}); | ||||
|   | ||||
| @@ -1,23 +0,0 @@ | ||||
| const sql = require('./sql'); | ||||
| const dateUtils = require('./date_utils'); | ||||
| const utils = require('./utils'); | ||||
| const log = require('./log'); | ||||
|  | ||||
| async function addEvent(comment) { | ||||
|     await addNoteEvent(null, comment); | ||||
| } | ||||
|  | ||||
| async function addNoteEvent(noteId, comment) { | ||||
|     await sql.insert('event_log', { | ||||
|         eventId: utils.newEntityId(), | ||||
|         noteId : noteId, | ||||
|         comment: comment, | ||||
|         utcDateCreated: dateUtils.utcNowDateTime() | ||||
|     }); | ||||
|  | ||||
|     log.info("Event log for " + noteId + ": " + comment); | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|     addEvent | ||||
| }; | ||||
| @@ -1,6 +1,5 @@ | ||||
| const sql = require('./sql'); | ||||
| const log = require('./log'); | ||||
| const eventLogService = require('./event_log'); | ||||
| const syncTableService = require('./sync_table'); | ||||
| const eventService = require('./events'); | ||||
|  | ||||
| @@ -138,8 +137,6 @@ async function updateOptions(entity, sourceId) { | ||||
|             await sql.replace('options', entity); | ||||
|  | ||||
|             await syncTableService.addOptionsSync(entity.name, sourceId); | ||||
|  | ||||
|             await eventLogService.addEvent("Synced option " + entity.name); | ||||
|         } | ||||
|     }); | ||||
| } | ||||
|   | ||||
| @@ -156,7 +156,6 @@ | ||||
|     <% include dialogs/add_link.ejs %> | ||||
|     <% include dialogs/attributes.ejs %> | ||||
|     <% include dialogs/branch_prefix.ejs %> | ||||
|     <% include dialogs/event_log.ejs %> | ||||
|     <% include dialogs/export.ejs %> | ||||
|     <% include dialogs/import.ejs %> | ||||
|     <% include dialogs/jump_to_note.ejs %> | ||||
|   | ||||
| @@ -1,15 +0,0 @@ | ||||
| <div id="event-log-dialog" class="modal fade mx-auto" tabindex="-1" role="dialog"> | ||||
|     <div class="modal-dialog" role="document"> | ||||
|         <div class="modal-content"> | ||||
|             <div class="modal-header"> | ||||
|                 <h5 class="modal-title">Event log</h5> | ||||
|                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||||
|                     <span aria-hidden="true">×</span> | ||||
|                 </button> | ||||
|             </div> | ||||
|             <div class="modal-body"> | ||||
|                 <ul id="event-log-list"></ul> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
		Reference in New Issue
	
	Block a user