limit videos in live Grid display
parent
21b6088855
commit
d9c3a49717
|
@ -45,61 +45,6 @@ $(document).ready(function(){
|
|||
</div>
|
||||
</div>`)
|
||||
}
|
||||
function createMonitorVideosTab(monitor){
|
||||
var startDate = moment().subtract(32, 'hour').utc()
|
||||
var endDate = moment().add(1, 'hour').utc()
|
||||
var newTabId = `monitorVideos-${monitor.mid}`
|
||||
var tabLabel = `<b>${lang['Videos']}</b> : ${monitor.name}`
|
||||
var baseHtml = `<main class="container page-tab" id="tab-${newTabId}">
|
||||
<div class="my-3 p-3 ${definitions.Theme.isDark ? 'bg-dark text-white' : 'bg-light text-dark'} rounded shadow-sm">
|
||||
<h6 class="border-bottom-dotted border-bottom-dark pb-2 mb-0 row">
|
||||
<div class="col-md-8">${lang['Videos']} : ${monitor.name}</div>
|
||||
<div class="col-md-4"><input class="form-control form-control-sm btn-dark text-md-end text-sm-center" type="text" id="daterange-${newTabId}" value="01/01/2018 - 01/15/2018" /></div>
|
||||
</h6>
|
||||
<div class="video-list flex-table flex-table-dark mx-n3 pt-2 px-3 row">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>`
|
||||
createNewTab(newTabId,tabLabel,baseHtml,{},null,'videosList')
|
||||
getVideos({
|
||||
monitorId: monitor.mid,
|
||||
startDate: startDate._d,
|
||||
endDate: endDate._d,
|
||||
},function(data){
|
||||
var videos = data.videos
|
||||
if(videos.length === 0){
|
||||
getVideos({
|
||||
monitorId: monitor.mid,
|
||||
limit: 20,
|
||||
},function(data){
|
||||
var videos = data.videos
|
||||
drawVideoRowsToList(`#tab-monitorVideos-${monitor.mid} .video-list`,videos)
|
||||
})
|
||||
}else{
|
||||
drawVideoRowsToList(`#tab-monitorVideos-${monitor.mid} .video-list`,videos)
|
||||
}
|
||||
})
|
||||
$(`#daterange-${newTabId}`).daterangepicker({
|
||||
timePicker: true,
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
locale: {
|
||||
format: 'YYYY-MM-DD hh:mm:ss A'
|
||||
}
|
||||
}, function(start, end, label) {
|
||||
var startDate = start.clone().utc()
|
||||
var endDate = end.clone().utc()
|
||||
getVideos({
|
||||
monitorId: monitor.mid,
|
||||
startDate: startDate._d,
|
||||
endDate: endDate._d,
|
||||
},function(data){
|
||||
var videos = data.videos
|
||||
drawVideoRowsToList(`#tab-monitorVideos-${monitor.mid} .video-list`,videos)
|
||||
})
|
||||
})
|
||||
}
|
||||
function loadMonitorsFromMemory(options,callback){
|
||||
theList.empty();
|
||||
$.each(getLoadedMonitorsAlphabetically(),function(n,row){
|
||||
|
@ -168,12 +113,6 @@ $(document).ready(function(){
|
|||
console.log(data)
|
||||
})
|
||||
})
|
||||
.on('click','.open-videos',function(){
|
||||
var monitorId = getRowsMonitorId(this)
|
||||
var monitor = loadedMonitors[monitorId]
|
||||
createMonitorVideosTab(monitor)
|
||||
console.log(monitorId)
|
||||
})
|
||||
.on('click','.export-this-monitor-settings',function(){
|
||||
var monitorId = getRowsMonitorId(this)
|
||||
downloadMonitorConfigurationsToDisk([
|
||||
|
|
|
@ -457,7 +457,9 @@ function getVideos(options,callback){
|
|||
var monitorId = options.monitorId
|
||||
var archived = options.archived
|
||||
var customVideoSet = options.customVideoSet
|
||||
var limit = options.limit || 300
|
||||
var limit = options.limit
|
||||
var eventLimit = options.eventLimit || 300
|
||||
var doLimitOnFames = options.doLimitOnFames || false
|
||||
var eventStartTime
|
||||
var eventEndTime
|
||||
// var startDate = options.startDate
|
||||
|
@ -476,14 +478,14 @@ function getVideos(options,callback){
|
|||
if(archived){
|
||||
requestQueries.push(`archived=1`)
|
||||
}
|
||||
$.getJSON(`${getApiPrefix(customVideoSet ? customVideoSet : searchQuery ? `videosByEventTag` : `videos`)}${monitorId ? `/${monitorId}` : ''}?${requestQueries.concat([`noLimit=1`]).join('&')}`,function(data){
|
||||
$.getJSON(`${getApiPrefix(customVideoSet ? customVideoSet : searchQuery ? `videosByEventTag` : `videos`)}${monitorId ? `/${monitorId}` : ''}?${requestQueries.concat([limit ? `limit=${limit}` : `noLimit=1`]).join('&')}`,function(data){
|
||||
var videos = data.videos.map((video) => {
|
||||
return Object.assign({},video,{
|
||||
href: getFullOrigin(true) + video.href
|
||||
})
|
||||
})
|
||||
$.getJSON(`${getApiPrefix(`timelapse`)}${monitorId ? `/${monitorId}` : ''}?${requestQueries.concat([`noLimit=1`]).join('&')}`,function(timelapseFrames){
|
||||
$.getJSON(`${getApiPrefix(`events`)}${monitorId ? `/${monitorId}` : ''}?${requestQueries.concat([`limit=${limit}`]).join('&')}`,function(eventData){
|
||||
$.getJSON(`${getApiPrefix(`events`)}${monitorId ? `/${monitorId}` : ''}?${requestQueries.concat([`limit=${eventLimit}`]).join('&')}`,function(eventData){
|
||||
var theEvents = eventData.events || eventData;
|
||||
var newVideos = applyDataListToVideos(videos,theEvents)
|
||||
newVideos = applyTimelapseFramesListToVideos(newVideos,timelapseFrames.frames || timelapseFrames,'timelapseFrames',true).map((video) => {
|
||||
|
|
Loading…
Reference in New Issue