allow selecting detector plugin per monitor
parent
05df08b0fa
commit
1da9547a6b
|
@ -3142,6 +3142,14 @@ module.exports = function(s,config,lang){
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "detail=detector_chosen",
|
||||||
|
"field": lang["Chosen Plugin"],
|
||||||
|
"description": lang.fieldTextChosenPlugin,
|
||||||
|
"attribute": `multiple`,
|
||||||
|
"fieldType": "select",
|
||||||
|
"possible": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "detail=detector_object_ignore_not_move",
|
"name": "detail=detector_object_ignore_not_move",
|
||||||
"field": lang["Ignore Non-Moving"],
|
"field": lang["Ignore Non-Moving"],
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
"accountEditError": "Account Edit Error",
|
"accountEditError": "Account Edit Error",
|
||||||
"Monitor Map": "Monitor Map",
|
"Monitor Map": "Monitor Map",
|
||||||
"Geolocation": "Geolocation",
|
"Geolocation": "Geolocation",
|
||||||
|
"Chosen Plugin": "Chosen Plugin",
|
||||||
|
"fieldTextChosenPlugin": "Detector Plugin to use. Select none to send to all. This field is inactive when Plugins are used in Cluster Mode.",
|
||||||
"fieldTextGeolocation": "The map coordinates of this camera in the real world. This will plot a point for your camera on the Monitor Map.",
|
"fieldTextGeolocation": "The map coordinates of this camera in the real world. This will plot a point for your camera on the Monitor Map.",
|
||||||
"playUntilVideoEnd": "Play until video end",
|
"playUntilVideoEnd": "Play until video end",
|
||||||
"Monitor Saved": "Monitor Saved",
|
"Monitor Saved": "Monitor Saved",
|
||||||
|
|
|
@ -164,6 +164,18 @@ module.exports = function(s,config,lang,app,io){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function sendToSpecificDetector(data, chosenDetectorPlugins){
|
||||||
|
if(s.connectedPlugins[name]){
|
||||||
|
s.connectedPlugins[name].tx(data)
|
||||||
|
}else{
|
||||||
|
console.error('Plugin Not Connected',name, 'used by',data.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s.sendToSpecificDetectors = function(data, chosenDetectorPlugins){
|
||||||
|
chosenDetectorPlugins.forEach(function(name){
|
||||||
|
sendToSpecificDetector(data, name)
|
||||||
|
})
|
||||||
|
}
|
||||||
s.sendDetectorInfoToClient = function(data,txFunction){
|
s.sendDetectorInfoToClient = function(data,txFunction){
|
||||||
s.detectorPluginArray.forEach(function(name){
|
s.detectorPluginArray.forEach(function(name){
|
||||||
var detectorData = Object.assign(data,{
|
var detectorData = Object.assign(data,{
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
module.exports = function(s,config,lang,app,io){
|
||||||
|
/**
|
||||||
|
* API : Get Available Plugins
|
||||||
|
*/
|
||||||
|
app.get(config.webPaths.apiPrefix+':auth/plugins/:ke',function (req,res){
|
||||||
|
var response = {ok: true};
|
||||||
|
res.setHeader('Content-Type', 'application/json');
|
||||||
|
s.auth(req.params,function(user){
|
||||||
|
response.plugins = [
|
||||||
|
...s.detectorPluginArray.map(item => {
|
||||||
|
return {
|
||||||
|
"name": item,
|
||||||
|
"value": item
|
||||||
|
}
|
||||||
|
})
|
||||||
|
];
|
||||||
|
res.end(s.prettyPrint(response));
|
||||||
|
},res,req);
|
||||||
|
})
|
||||||
|
}
|
|
@ -700,6 +700,14 @@ function importIntoMonitorEditor(options){
|
||||||
theAction(monitorConfig)
|
theAction(monitorConfig)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAvailablePlugins(){
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
$.get(getApiPrefix()+'/plugins/'+monitorConfig.ke+'/',function(data){
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
//parse "Automatic" field in "Input" Section
|
//parse "Automatic" field in "Input" Section
|
||||||
monitorEditorWindow.on('change','.auto_host_fill input,.auto_host_fill select',function(e){
|
monitorEditorWindow.on('change','.auto_host_fill input,.auto_host_fill select',function(e){
|
||||||
var theSwitch = monitorEditorWindow.find('[detail="auto_host_enable"]').val()
|
var theSwitch = monitorEditorWindow.find('[detail="auto_host_enable"]').val()
|
||||||
|
@ -1327,11 +1335,12 @@ editorForm.find('[name="type"]').change(function(e){
|
||||||
sideMenuCollapsePoint.collapse('show')
|
sideMenuCollapsePoint.collapse('show')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onTabMove(){
|
async function onTabMove(){
|
||||||
var theSelected = `${monitorsList.val() || ''}`
|
var theSelected = `${monitorsList.val() || ''}`
|
||||||
drawMonitorListToSelector(monitorsList.find('optgroup'),false,'host')
|
drawMonitorListToSelector(monitorsList.find('optgroup'),false,'host')
|
||||||
monitorsList.val(theSelected)
|
monitorsList.val(theSelected)
|
||||||
checkToOpenSideMenu()
|
checkToOpenSideMenu()
|
||||||
|
monitorEditorWindow.find('[detail="detector_chosen"]').val(await getAvailablePlugins())
|
||||||
}
|
}
|
||||||
addOnTabAway('monitorSettings', function(){
|
addOnTabAway('monitorSettings', function(){
|
||||||
if(isSideBarMenuCollapsed()){
|
if(isSideBarMenuCollapsed()){
|
||||||
|
|
Loading…
Reference in New Issue