| 
									
										
										
										
											2017-11-04 19:38:50 -04:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 14:02:43 -04:00
										 |  |  | const eventLog = (function() { | 
					
						
							| 
									
										
										
										
											2018-02-10 08:44:34 -05:00
										 |  |  |     const $dialog = $("#event-log-dialog"); | 
					
						
							|  |  |  |     const $list = $("#event-log-list"); | 
					
						
							| 
									
										
										
										
											2017-11-03 23:00:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 14:02:43 -04:00
										 |  |  |     async function showDialog() { | 
					
						
							| 
									
										
										
										
											2018-02-10 08:44:34 -05:00
										 |  |  |         glob.activeDialog = $dialog; | 
					
						
							| 
									
										
										
										
											2017-11-04 17:03:15 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-10 08:44:34 -05:00
										 |  |  |         $dialog.dialog({ | 
					
						
							| 
									
										
										
										
											2017-11-04 14:02:43 -04:00
										 |  |  |             modal: true, | 
					
						
							|  |  |  |             width: 800, | 
					
						
							|  |  |  |             height: 700 | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2017-11-03 23:00:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-28 20:52:38 -05:00
										 |  |  |         const result = await server.get('event-log'); | 
					
						
							| 
									
										
										
										
											2017-11-03 23:00:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-10 08:44:34 -05:00
										 |  |  |         $list.html(''); | 
					
						
							| 
									
										
										
										
											2017-11-03 23:00:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 14:02:43 -04:00
										 |  |  |         for (const event of result) { | 
					
						
							| 
									
										
										
										
											2018-01-28 19:30:14 -05:00
										 |  |  |             const dateTime = formatDateTime(parseDate(event.dateAdded)); | 
					
						
							| 
									
										
										
										
											2017-11-03 23:00:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-28 19:30:14 -05:00
										 |  |  |             if (event.noteId) { | 
					
						
							|  |  |  |                 const noteLink = link.createNoteLink(event.noteId).prop('outerHTML'); | 
					
						
							| 
									
										
										
										
											2017-11-03 23:00:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 14:02:43 -04:00
										 |  |  |                 event.comment = event.comment.replace('<note>', noteLink); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2017-11-03 23:00:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 14:02:43 -04:00
										 |  |  |             const eventEl = $('<li>').html(dateTime + " - " + event.comment); | 
					
						
							| 
									
										
										
										
											2017-11-03 23:00:35 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-10 08:44:34 -05:00
										 |  |  |             $list.append(eventEl); | 
					
						
							| 
									
										
										
										
											2017-11-04 14:02:43 -04:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-11-03 23:00:35 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 14:02:43 -04:00
										 |  |  |     return { | 
					
						
							|  |  |  |         showDialog | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | })(); |