eavesdocker
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -8,2 +8,12 @@ # Eavesdocker Changelog | ||
## [v0.1.4] - 2021-07-17 | ||
### Added | ||
- GUI: setting to hide specific fields on all log entries in a list | ||
### Fixed | ||
- GUI: bad spacing on no container message | ||
- GUI: bug trying to parse JSON when something starts with curly-braces | ||
- GUI: listener leak when deleting lists | ||
## [v0.1.3] - 2021-07-14 | ||
@@ -52,1 +62,3 @@ | ||
[v0.1.2]: https://gitlab.com/GCSBOSS/eavesdocker/-/tags/v0.1.2 | ||
[v0.1.3]: https://gitlab.com/GCSBOSS/eavesdocker/-/tags/v0.1.3 | ||
[v0.1.4]: https://gitlab.com/GCSBOSS/eavesdocker/-/tags/v0.1.4 |
@@ -17,3 +17,4 @@ const LAST_COLOR = 13; | ||
if(data.source.service in currentLists[listId].excludeServices) | ||
const lst = currentLists[listId]; | ||
if(lst.focusServices.size > 0 && lst.focusServices.has(data.source.service)) | ||
return; | ||
@@ -23,3 +24,3 @@ | ||
if(typeof entry.message == 'string' && entry.message.charAt(0) == '{') | ||
if(typeof entry.message == 'string' && entry.message.length > 2 && entry.message.charAt(0) == '{') | ||
entry = { ...entry, message: null, ...JSON.parse(entry.message) }; | ||
@@ -31,3 +32,3 @@ | ||
data.source.index = activeContainers[data.source.id].index; | ||
currentLists[listId].events.push({ container: data.source, entry, id: randomId() }); | ||
lst.events.push({ container: data.source, entry, id: randomId() }); | ||
m.redraw(); | ||
@@ -44,4 +45,4 @@ } | ||
return; | ||
// TODO NOT DELETING LISTENER ? | ||
eventSource.removeEventListener('entry', lst.cb); | ||
eventSource.removeEventListener('log', lst.cb); | ||
delete currentLists[lst.id]; | ||
@@ -72,3 +73,3 @@ minLists.delete(lst.id); | ||
currentLists[id] = { id, name: 'Untitled', cb, events: [], | ||
excludeServices: {} }; | ||
focusServices: new Set(), hideFields: {} }; | ||
@@ -79,7 +80,7 @@ // TODO When this is loaded from file, populate 'historyServices' from 'excludeServices' | ||
function toggleFilterService(lst, service){ | ||
if(service in lst.excludeServices) | ||
delete lst.excludeServices[service]; | ||
function toggleFocusService(lst, service){ | ||
if(lst.focusServices.has(service)) | ||
lst.focusServices.delete(service); | ||
else | ||
lst.excludeServices[service] = 1; | ||
lst.focusServices.add(service); | ||
} | ||
@@ -109,7 +110,18 @@ | ||
function parsePair([ key, value ]){ | ||
function enterHideField(lst, ev){ | ||
if(ev.key == 'Enter'){ | ||
if(ev.target.value !== ''){ | ||
lst.hideFields[ev.target.value] = 1; | ||
ev.target.value = ''; | ||
} | ||
ev.preventDefault(); | ||
return false; | ||
} | ||
} | ||
if(value === null || key == 'level') | ||
function parsePair(lst, [ key, value ]){ | ||
if(value === null || key == 'level' || key in lst.hideFields) | ||
// value = m('code', 'null'); | ||
return []; | ||
return null; | ||
@@ -170,5 +182,7 @@ else if(typeof value == 'string'){ | ||
const c = e.container; | ||
const lst = vnode.attrs.list; | ||
return m('article.entry', { | ||
'data-index': c.index, | ||
'data-index': c.index, | ||
'data-level': e.entry.level || null, | ||
'hidden': globalFilters[c.id] !== 1 | ||
@@ -178,3 +192,3 @@ }, [ | ||
m('label.container', m.trust(c.label)), | ||
Object.entries(e.entry).map(e => m('p', parsePair(e))) | ||
Object.entries(e.entry).map(e => m('p', parsePair(lst, e))) | ||
]) | ||
@@ -186,4 +200,70 @@ | ||
function ListSettings(){ | ||
let activeTab = 'filter'; | ||
return { | ||
view(vnode){ | ||
const lst = vnode.attrs.list; | ||
return m('section.settings', { 'data-open': vnode.attrs.open }, [ | ||
m('header', [ | ||
m('button', { | ||
'data-open': activeTab == 'filter', | ||
onclick: () => activeTab = 'filter' | ||
}, 'Filters'), | ||
m('button', { | ||
'data-open': activeTab == 'display', | ||
onclick: () => activeTab = 'display' | ||
}, 'Display') | ||
]), | ||
{ | ||
filter: m('fieldset.filter', [ | ||
m('label', 'Focus Services'), | ||
historyServices.size == 0 | ||
? m('p', 'There are no services on record') | ||
: m('fieldset.focus', [ | ||
[ ...historyServices ].map(s => m('label.check', { | ||
'data-icon-pre': lst.focusServices.has(s) | ||
? 'check_box' | ||
: 'check_box_outline_blank', | ||
onclick: toggleFocusService.bind(null, lst, s) | ||
}, s)) | ||
]) | ||
]), | ||
display: m('fieldset.display', [ | ||
m('label', 'Hide Fields'), | ||
m('fieldset.fields', [ | ||
Object.keys(lst.hideFields).map(f => m('button', { | ||
onclick: () => delete lst.hideFields[f] | ||
}, f)), | ||
m('input', { onkeyup: enterHideField.bind(null, lst), | ||
type: 'text', placeholder: 'eg.: my_field' }) | ||
]) | ||
]) | ||
}[activeTab] | ||
]); | ||
} | ||
}; | ||
} | ||
function LogList(){ | ||
let settingsOpen = false; | ||
return { | ||
@@ -207,5 +287,5 @@ | ||
m('button', { 'data-icon': 'tune', | ||
'data-open': lst.settingsOpen, | ||
'data-open': settingsOpen, | ||
title: 'Settings', | ||
onclick: () => lst.settingsOpen = !lst.settingsOpen | ||
onclick: () => settingsOpen = !settingsOpen | ||
}), | ||
@@ -230,27 +310,4 @@ | ||
m('section.settings', { | ||
'data-open': lst.settingsOpen | ||
}, [ | ||
m(ListSettings, { list: lst, open: settingsOpen }), | ||
m('header', [ | ||
m('button', { 'data-icon': 'filter_alt', | ||
title: 'Filter List', 'data-open': lst.settingTab == 'service', | ||
onclick: () => lst.settingTab = 'service' | ||
}) | ||
]), | ||
lst.settingTab == 'service' && | ||
m('form.service', historyServices.size == 0 | ||
? m('p', 'There are no services on record') | ||
: [ | ||
m('p', 'Uncheck services to be filtered out'), | ||
[ ...historyServices ].map(s => m('label', { | ||
'data-open': !(s in lst.excludeServices), | ||
onclick: toggleFilterService.bind(null, lst, s) | ||
}, s)) | ||
] | ||
) | ||
]), | ||
m('section.entries', { | ||
@@ -261,3 +318,3 @@ onmouseenter: () => freezeList = lst.id, | ||
}, lst.events.slice(-100).map(e => | ||
m(LogEntry, { entry: e, key: e.id }))) | ||
m(LogEntry, { list: lst, entry: e, key: e.id }))) | ||
]) | ||
@@ -264,0 +321,0 @@ } |
{ | ||
"name": "eavesdocker", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"main": "lib/main.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
65709
1610