X-Git-Url: http://spangdorfia.com/code/?p=kismet-logviewer.git;a=blobdiff_plain;f=logviewer%2Fstatic%2Fjs%2Fkismet.ui.alerts.js;fp=logviewer%2Fstatic%2Fjs%2Fkismet.ui.alerts.js;h=1b98f68b73952496d01f8324567aef96426873d0;hp=d864aaa7d72ec50e9d1eda85a818ebde209d8a66;hb=d4fe9834a60132f118a1e8ee68e5221b28e10ccc;hpb=662453a92f419012cde6a79dc38df89c5be4d91b diff --git a/logviewer/static/js/kismet.ui.alerts.js b/logviewer/static/js/kismet.ui.alerts.js index d864aaa..1b98f68 100644 --- a/logviewer/static/js/kismet.ui.alerts.js +++ b/logviewer/static/js/kismet.ui.alerts.js @@ -32,19 +32,36 @@ function severity_to_string(sev) { } function severity_to_color(sev) { - switch (sev) { - case 0: - return "#03e3fc"; - case 5: - return "#fbff00"; - case 10: - return "#fce303"; - case 15: - return "#fcba03"; - case 20: - return "#fc031c"; - default: - return "UNKNOWN"; + if (kismet_theme.theme === 'dark') { + switch (sev) { + case 0: + return ["#015761", "#FFFFFF"]; + case 5: + return ["#5f6100", "#FFFFFF"]; + case 10: + return ["#706500", "#FFFFFF"]; + case 15: + return ["#B9770E", "#FFFFFF"]; + case 20: + return ["#5c010a", "#FFFFFF"]; + default: + return ["UNKNOWN", "#FFFFFF"]; + } + } else { + switch (sev) { + case 0: + return ["#03e3fc", "#000000"]; + case 5: + return ["#fbff00", "#000000"]; + case 10: + return ["#fce303", "#000000"]; + case 15: + return ["#fcba03", "#000000"]; + case 20: + return ["#fc031c", "#000000"]; + default: + return ["UNKNOWN", "#000000"]; + } } } @@ -355,7 +372,8 @@ function InitializeAlertTable() { } } - $('td', this.node()).css('background-color', severity_to_color(this.data()['kismet.alert.severity'])); + $('td', this.node()).css('background-color', severity_to_color(this.data()['kismet.alert.severity'])[0]); + $('td', this.node()).css('color', severity_to_color(this.data()['kismet.alert.severity'])[1]); }); }, }); @@ -662,7 +680,11 @@ exports.AddAlertDetail("alert", "Alert", 0, { { field: 'kismet.alert.location/kismet.common.location.geopoint', filter: function(opts) { - return opts['data']['kismet.alert.location']['kismet.common.location.fix'] >= 2; + try { + return opts['data']['kismet.alert.location']['kismet.common.location.fix'] >= 2; + } catch (_error) { + return false; + } }, title: 'Location', draw: function(opts) {