update test trigger button to be Motion and Object testers

fix-timezone-by-ui
Moe 2022-10-08 17:54:55 -07:00
parent 4cc9f8f31f
commit 7e3f9589d8
4 changed files with 46 additions and 5 deletions

View File

@ -7432,7 +7432,8 @@ module.exports = function(s,config,lang){
streamBlockHudControlsHtml: `<span title="${lang['Currently viewing']}" class="label label-default">
<span class="viewers"></span>
</span>
<a class="btn btn-sm badge btn-warning run-monitor-detection-trigger-test">${lang['Trigger Event']}</a>
<a class="btn btn-sm badge btn-warning run-monitor-detection-trigger-test">${lang['Test Object Event']}</a>
<a class="btn btn-sm badge btn-warning run-monitor-detection-trigger-test-motion">${lang['Test Motion Event']}</a>
`,
gridBlockAfterContentHtml: `<div class="mdl-card__supporting-text text-center">
<div class="indifference detector-fade">

View File

@ -693,6 +693,8 @@
"Height": "Height",
"Rotate": "Rotate",
"Trigger Event": "Trigger Event",
"Test Object Event": "Test Object Event",
"Test Motion Event": "Test Motion Event",
"Primary Engine": "Primary Engine",
"Video Filter": "Video Filter",
"Font Path": "Font Path",

View File

@ -925,6 +925,24 @@ $(document).ready(function(e){
var monitorId = el.parents('[data-mid]').attr('data-mid')
runTestDetectionTrigger(monitorId)
})
.on('click','.run-monitor-detection-trigger-test-motion',function(){
var el = $(this)
var monitorId = el.parents('[data-mid]').attr('data-mid')
runTestDetectionTrigger(monitorId,{
"name":"Test Motion",
"reason":"motion",
matrices: [
{
x: 5,
y: 5,
width: 150,
height: 150,
tag: 'Motion Test',
confidence: 100,
}
]
});
})
$('.open-all-monitors').click(function(){
$.each(loadedMonitors,function(monitorId,monitor){
mainSocket.f({

View File

@ -171,10 +171,30 @@ function runPtzMove(monitorId,switchChosen,doMove){
ke: $user.ke
})
}
function runTestDetectionTrigger(monitorId,callback){
$.getJSON(getApiPrefix() + '/motion/'+$user.ke+'/'+monitorId+'/?data={"plug":"manual_trigger","name":"Manual Trigger","reason":"Manual","confidence":100}',function(d){
debugLog(d)
if(callback)callback()
function runTestDetectionTrigger(monitorId,customData){
return new Promise((resolve,reject) => {
var detectionData = Object.assign({
"plug":"dashboard",
"name":"Test Object",
"reason":"object",
"confidence": 80,
imgHeight: 640,
imgWidth: 480,
matrices: [
{
x: 15,
y: 15,
width: 50,
height: 50,
tag: 'Object Test',
confidence: 100,
}
]
},customData || {});
$.getJSON(getApiPrefix() + '/motion/'+$user.ke+'/'+monitorId+'/?data=' + JSON.stringify(detectionData),function(d){
debugLog(d)
resolve(d)
})
})
}
function toggleSubStream(monitorId,callback){