CC-3174 : showbuilder
only updating the timeline view if it is needed.
This commit is contained in:
parent
a4d07b3060
commit
e9627bca07
7 changed files with 160 additions and 12 deletions
|
@ -14,6 +14,32 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
}
|
||||
|
||||
mod.resetTimestamp = function() {
|
||||
var timestamp = $("#sb_timestamp");
|
||||
//reset timestamp value since input values could have changed.
|
||||
timestamp.val(-1);
|
||||
};
|
||||
|
||||
mod.setTimestamp = function(timestamp) {
|
||||
$("#sb_timestamp").val(timestamp);
|
||||
};
|
||||
|
||||
mod.getTimestamp = function() {
|
||||
var timestamp = $("#sb_timestamp"),
|
||||
val;
|
||||
|
||||
//if the timestamp field is on the page return it, or give the default of -1
|
||||
//to ensure a page refresh.
|
||||
if (timestamp.length === 1) {
|
||||
val = timestamp.val();
|
||||
}
|
||||
else {
|
||||
val = -1;
|
||||
}
|
||||
|
||||
return val;
|
||||
};
|
||||
|
||||
mod.fnAdd = function(aMediaIds, aSchedIds) {
|
||||
var oLibTT = TableTools.fnGetInstance('library_display');
|
||||
|
||||
|
@ -47,6 +73,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
};
|
||||
|
||||
fnServerData = function ( sSource, aoData, fnCallback ) {
|
||||
|
||||
aoData.push( { name: "timestamp", value: AIRTIME.showbuilder.getTimestamp()} );
|
||||
aoData.push( { name: "format", value: "json"} );
|
||||
|
||||
if (fnServerData.hasOwnProperty("start")) {
|
||||
|
@ -65,7 +93,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
"type": "GET",
|
||||
"url": sSource,
|
||||
"data": aoData,
|
||||
"success": fnCallback
|
||||
"success": function(json) {
|
||||
AIRTIME.showbuilder.setTimestamp(json.timestamp);
|
||||
fnCallback(json);
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
|
@ -302,6 +333,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
aData = tr.data("aData");
|
||||
|
||||
setTimeout(function(){
|
||||
AIRTIME.showbuilder.resetTimestamp();
|
||||
oTable.fnDraw();
|
||||
}, aData.refresh * 1000); //need refresh in milliseconds
|
||||
}
|
||||
|
@ -311,7 +343,9 @@ var AIRTIME = (function(AIRTIME){
|
|||
},
|
||||
//remove any selected nodes before the draw.
|
||||
"fnPreDrawCallback": function( oSettings ) {
|
||||
var oTT = TableTools.fnGetInstance('show_builder_table');
|
||||
var oTT;
|
||||
|
||||
oTT = TableTools.fnGetInstance('show_builder_table');
|
||||
oTT.fnSelectNone();
|
||||
},
|
||||
|
||||
|
|
|
@ -109,6 +109,9 @@ $(document).ready(function(){
|
|||
op,
|
||||
oTable = $('#show_builder_table').dataTable();
|
||||
|
||||
//reset timestamp value since input values could have changed.
|
||||
AIRTIME.showbuilder.resetTimestamp();
|
||||
|
||||
oRange = fnGetScheduleRange();
|
||||
|
||||
fn = oTable.fnSettings().fnServerData;
|
||||
|
@ -136,6 +139,9 @@ $(document).ready(function(){
|
|||
|
||||
if ($button.hasClass("sb-edit")) {
|
||||
|
||||
//reset timestamp to redraw the cursors.
|
||||
AIRTIME.showbuilder.resetTimestamp();
|
||||
|
||||
$lib.show();
|
||||
$lib.width(Math.floor(screenWidth * 0.5));
|
||||
$builder.width(Math.floor(screenWidth * 0.5));
|
||||
|
@ -154,8 +160,7 @@ $(document).ready(function(){
|
|||
$button.val("Add Files");
|
||||
}
|
||||
|
||||
oTable.fnDraw();
|
||||
|
||||
oTable.fnDraw();
|
||||
});
|
||||
|
||||
oRange = fnGetScheduleRange();
|
||||
|
@ -165,8 +170,35 @@ $(document).ready(function(){
|
|||
AIRTIME.library.libraryInit();
|
||||
AIRTIME.showbuilder.builderDataTable();
|
||||
|
||||
//check if the timeline viewed needs updating.
|
||||
setInterval(function(){
|
||||
var oTable = $('#show_builder_table').dataTable();
|
||||
oTable.fnDraw();
|
||||
}, 20 * 1000); //need refresh in milliseconds
|
||||
var data = {},
|
||||
oTable = $('#show_builder_table').dataTable(),
|
||||
fn = oTable.fnSettings().fnServerData,
|
||||
start = fn.start,
|
||||
end = fn.end;
|
||||
|
||||
data["format"] = "json";
|
||||
data["start"] = start;
|
||||
data["end"] = end;
|
||||
data["timestamp"] = AIRTIME.showbuilder.getTimestamp();
|
||||
|
||||
if (fn.hasOwnProperty("ops")) {
|
||||
data["myShows"] = fn.ops.myShows;
|
||||
data["showFilter"] = fn.ops.showFilter;
|
||||
}
|
||||
|
||||
$.ajax( {
|
||||
"dataType": "json",
|
||||
"type": "GET",
|
||||
"url": "/showbuilder/check-builder-feed",
|
||||
"data": data,
|
||||
"success": function(json) {
|
||||
if (json.update === true) {
|
||||
oTable.fnDraw();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
}, 5 * 1000); //need refresh in milliseconds
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue