From 11690afc05e13b798f1e4f51a4fa5e2f069d4efe Mon Sep 17 00:00:00 2001 From: Moe Date: Tue, 13 Aug 2024 15:53:55 -0700 Subject: [PATCH] prepare timeline and liveGrid for automated controls --- web/assets/js/bs5.liveGrid.js | 25 +++++++++++++++++++++---- web/assets/js/bs5.timeline.js | 19 ++++++++++++++++++- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/web/assets/js/bs5.liveGrid.js b/web/assets/js/bs5.liveGrid.js index d1eaca83..929bbd72 100644 --- a/web/assets/js/bs5.liveGrid.js +++ b/web/assets/js/bs5.liveGrid.js @@ -656,6 +656,11 @@ function closeLiveGridPlayer(monitorId,killElement){ console.log(err) } } +function closeLiveGridPlayers(monitors, killElement){ + $.each(monitors,function(n,v){ + monitorWatchOnLiveGrid(v.mid, killElement) + }) +} function monitorWatchOnLiveGrid(monitorId, watchOff){ return mainSocket.f({f:'monitor',ff:watchOff ? 'watch_off' : 'watch_on',id: monitorId}) } @@ -664,13 +669,20 @@ function monitorsWatchOnLiveGrid(monitorIds, watchOff){ monitorWatchOnLiveGrid(monitorId, watchOff) }) } -function callMonitorToLiveGrid(v){ +function callMonitorToLiveGrid(v, justTry){ var watchedOn = dashboardOptions().watch_on || {} - if(watchedOn[v.ke] && watchedOn[v.ke][v.mid] === 1 && loadedMonitors[v.mid] && loadedMonitors[v.mid].mode !== 'stop'){ + if(justTry || watchedOn[v.ke] && watchedOn[v.ke][v.mid] === 1 && loadedMonitors[v.mid] && loadedMonitors[v.mid].mode !== 'stop'){ mainSocket.f({f:'monitor',ff:'watch_on',id:v.mid}) if(tabTree.name !== 'monitorSettings')openLiveGrid() + console.log('loaded',v.name) } } +function callMonitorsToLiveGrid(monitors, justTry){ + $.each(monitors,function(n,v){ + console.log('loading',v.name) + callMonitorToLiveGrid(v, justTry) + }) +} function loadPreviouslyOpenedLiveGridBlocks(){ $.getJSON(getApiPrefix(`monitor`),function(data){ $.each(data,function(n,v){ @@ -1279,8 +1291,8 @@ $(document).ready(function(e){ var monitorId = d.mid || d.id var loadedMonitor = loadedMonitors[monitorId] var subStreamChannel = d.subStreamChannel - var monitorsPerRow = cycleLiveOptions ? cycleLiveOptions.monitorsPerRow : null; - var monitorHeight = cycleLiveOptions ? cycleLiveOptions.monitorHeight : null; + var monitorsPerRow = null; + var monitorHeight = null; if(!loadedMonitor.subStreamChannel && loadedMonitor.details.stream_type === 'useSubstream'){ toggleSubStream(monitorId,function(){ drawLiveGridBlock(loadedMonitors[monitorId],subStreamChannel,monitorsPerRow,monitorHeight) @@ -1428,4 +1440,9 @@ $(document).ready(function(e){ }) } dashboardSwitchCallbacks.jpegMode = toggleJpegMode + window.openLiveGrid = openLiveGrid; + window.callMonitorToLiveGrid = callMonitorToLiveGrid; + window.monitorsWatchOnLiveGrid = monitorsWatchOnLiveGrid; + window.closeAllLiveGridPlayers = closeAllLiveGridPlayers; + window.closeLiveGridPlayers = closeLiveGridPlayers; }) diff --git a/web/assets/js/bs5.timeline.js b/web/assets/js/bs5.timeline.js index d9456fb3..4a90155e 100644 --- a/web/assets/js/bs5.timeline.js +++ b/web/assets/js/bs5.timeline.js @@ -911,9 +911,25 @@ $(document).ready(function(){ onSelectedMonitorChange() refreshTimeline() } + window.resetTimelineWithMonitors = function(monitorIds, start = new Date(), end = new Date(), tickTime){ + setTimeout(() => { + timeStripSelectedMonitors = monitorIds || []; + onSelectedMonitorChange() + setLoadingMask(true) + dateRangeChanging = true + setTimestripDate(start, end) + setTimeout(() => { + dateRangeChanging = false + refreshTimeline() + var newTickPosition = tickTime || getTimeBetween(start,end,50); + setTickDate(newTickPosition) + },2000) + },1000) + openTab('timeline') + } function refreshTimelineOnAgree(){ var askToLoad = isAllMonitorsSelected(50) - if(askToLoad){ + if(!window.skipTimelineAgree && askToLoad){ $.confirm.create({ title: lang.tooManyMonitorsSelected, body: lang.performanceMayBeAffected, @@ -931,6 +947,7 @@ $(document).ready(function(){ }else{ refreshTimeline() } + window.skipTimelineAgree = false; } function monitorSelectorController(){ var el = $(this)