mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 19:36:02 +00:00
console.js: add the Notify-Type option to the Filter.
git-svn-id: https://svn.fhem.de/fhem/trunk@13585 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e166c491db
commit
d021810900
@ -131,7 +131,6 @@ FHEMWEB_Initialize($)
|
|||||||
$hash->{AttrFn} = "FW_Attr";
|
$hash->{AttrFn} = "FW_Attr";
|
||||||
$hash->{DefFn} = "FW_Define";
|
$hash->{DefFn} = "FW_Define";
|
||||||
$hash->{UndefFn} = "FW_Undef";
|
$hash->{UndefFn} = "FW_Undef";
|
||||||
$hash->{NotifyFn}= "FW_Notify";
|
|
||||||
$hash->{NotifyFn}= ($init_done ? "FW_Notify" : "FW_SecurityCheck");
|
$hash->{NotifyFn}= ($init_done ? "FW_Notify" : "FW_SecurityCheck");
|
||||||
$hash->{AsyncOutputFn} = "FW_AsyncOutput";
|
$hash->{AsyncOutputFn} = "FW_AsyncOutput";
|
||||||
$hash->{ActivateInformFn} = "FW_ActivateInform";
|
$hash->{ActivateInformFn} = "FW_ActivateInform";
|
||||||
@ -2860,8 +2859,17 @@ FW_Notify($$)
|
|||||||
my $max = int(@{$events});
|
my $max = int(@{$events});
|
||||||
my $dt = $dev->{TYPE};
|
my $dt = $dev->{TYPE};
|
||||||
for(my $i = 0; $i < $max; $i++) {
|
for(my $i = 0; $i < $max; $i++) {
|
||||||
my $line = ("$tn $dt $dn ".$events->[$i]."<br>");
|
my $line = "$tn $dt $dn ".$events->[$i]."<br>";
|
||||||
eval { push @data,$line if($line =~ m/$h->{filter}/) }
|
eval {
|
||||||
|
my $ok;
|
||||||
|
if($h->{filterType} && $h->{filterType} eq "notify") {
|
||||||
|
$ok = ($dn =~ m/^$h->{filter}$/ ||
|
||||||
|
"$dn:$events->[$i]" =~ m/^$h->{filter}$/) ;
|
||||||
|
} else {
|
||||||
|
$ok = ($line =~ m/$h->{filter}/) ;
|
||||||
|
}
|
||||||
|
push @data,$line if($ok);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ FW_version["console.js"] = "$Id$";
|
|||||||
|
|
||||||
var consConn;
|
var consConn;
|
||||||
|
|
||||||
var consFilter, oldFilter;
|
var consFilter, oldFilter, consFType="";
|
||||||
var consLastIndex = 0;
|
var consLastIndex = 0;
|
||||||
var withLog = 0;
|
var withLog = 0;
|
||||||
var mustScroll = 1;
|
var mustScroll = 1;
|
||||||
@ -76,7 +76,7 @@ consFill()
|
|||||||
FW_closeConn();
|
FW_closeConn();
|
||||||
|
|
||||||
var query = "?XHR=1"+
|
var query = "?XHR=1"+
|
||||||
"&inform=type=raw;withLog="+withLog+";filter="+consFilter+
|
"&inform=type=raw;withLog="+withLog+";filter="+consFilter+consFType+
|
||||||
"×tamp="+new Date().getTime();
|
"×tamp="+new Date().getTime();
|
||||||
query = addcsrf(query);
|
query = addcsrf(query);
|
||||||
|
|
||||||
@ -130,11 +130,16 @@ consStart()
|
|||||||
$("#eventFilter").click(function(evt){ // Event-Filter Dialog
|
$("#eventFilter").click(function(evt){ // Event-Filter Dialog
|
||||||
$('body').append(
|
$('body').append(
|
||||||
'<div id="evtfilterdlg">'+
|
'<div id="evtfilterdlg">'+
|
||||||
'<div>Filter:</div><br>'+
|
'<div>Filter (Regexp):</div><br>'+
|
||||||
'<div><input id="filtertext" value="'+consFilter+'"></div>'+
|
'<div><input id="filtertext" value="'+consFilter+'"></div><br>'+
|
||||||
|
'<div>'+
|
||||||
|
'<input id="f" type="radio" name="x"> Match the whole line</br>'+
|
||||||
|
'<input id="n" type="radio" name="x"> Notify-Type: deviceName:event'+
|
||||||
|
'</div>'+
|
||||||
'</div>');
|
'</div>');
|
||||||
|
$("#evtfilterdlg input#"+(consFType=="" ? "f" : "n")).prop("checked",true);
|
||||||
|
|
||||||
$('#evtfilterdlg').dialog({ modal:true,
|
$('#evtfilterdlg').dialog({ modal:true, width:'auto',
|
||||||
position:{ my: "left top", at: "right bottom",
|
position:{ my: "left top", at: "right bottom",
|
||||||
of: this, collision: "flipfit" },
|
of: this, collision: "flipfit" },
|
||||||
close:function(){$('#evtfilterdlg').remove();},
|
close:function(){$('#evtfilterdlg').remove();},
|
||||||
@ -148,6 +153,8 @@ consStart()
|
|||||||
return FW_okDialog(e);
|
return FW_okDialog(e);
|
||||||
}
|
}
|
||||||
consFilter = val ? val : ".*";
|
consFilter = val ? val : ".*";
|
||||||
|
consFType= ($("#evtfilterdlg input#n").is(":checked")) ?
|
||||||
|
";filterType=notify" : "";
|
||||||
$(this).dialog('close');
|
$(this).dialog('close');
|
||||||
$("a#eventFilter").html(consFilter);
|
$("a#eventFilter").html(consFilter);
|
||||||
consFill();
|
consFill();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user