Major performance improvements to the Dashboard and Calendar views
* Close the PHP session for writing as early as possible in most AJAX calls for those views * Reduce the number of roundtrips to the server in both the Dashboard and Calendar views by putting the data in our HTML response (this makes a massive difference) * Eliminated a couple of unneccessary AJAX calls * Use lazy loading in full calendar * Fixed a bug in the week view that only occurs near the end of the week (date->gmdate bug!)
This commit is contained in:
parent
b49e98693b
commit
34de6da2c7
|
@ -403,6 +403,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
public function contentsFeedAction()
|
||||
{
|
||||
session_write_close();
|
||||
$params = $this->getRequest()->getParams();
|
||||
|
||||
# terrible name for the method below. it does not only search files.
|
||||
|
|
|
@ -50,6 +50,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$foo = new ScheduleController($this->getRequest(), $this->getResponse());
|
||||
$foo->eventFeedPreloadAction();
|
||||
//$foo->eventFeedAction();
|
||||
$events = json_encode($foo->view->events);
|
||||
//$timescale =
|
||||
//$this->getRequest()->getParam("view", "week");
|
||||
|
||||
$this->view->headScript()->appendScript(
|
||||
"var calendarPref = {};\n".
|
||||
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||
|
@ -58,7 +65,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
|
||||
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
|
||||
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||
"var calendarEvents = null;"
|
||||
"var calendarEvents = $events;"
|
||||
);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
@ -116,6 +123,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function eventFeedAction()
|
||||
{
|
||||
session_write_close();
|
||||
$service_user = new Application_Service_UserService();
|
||||
$currentUser = $service_user->getCurrentUser();
|
||||
|
||||
|
@ -137,6 +145,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$editable = $user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
session_write_close();
|
||||
|
||||
$calendar_interval = Application_Model_Preference::GetCalendarTimeScale();
|
||||
if ($calendar_interval == "agendaDay") {
|
||||
|
@ -155,6 +164,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function getCurrentShowAction()
|
||||
{
|
||||
session_write_close();
|
||||
$currentShow = Application_Model_Show::getCurrentShow();
|
||||
if (!empty($currentShow)) {
|
||||
$this->view->si_id = $currentShow[0]["instance_id"];
|
||||
|
@ -296,6 +306,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function getCurrentPlaylistAction()
|
||||
{
|
||||
session_write_close();
|
||||
$range = Application_Model_Schedule::GetPlayOrderRangeOld();
|
||||
$show = Application_Model_Show::getCurrentShow();
|
||||
|
||||
|
@ -704,6 +715,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
*/
|
||||
public function setTimeScaleAction()
|
||||
{
|
||||
session_write_close();
|
||||
Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale'));
|
||||
}
|
||||
|
||||
|
|
|
@ -246,6 +246,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
public function checkBuilderFeedAction()
|
||||
{
|
||||
session_write_close();
|
||||
$request = $this->getRequest();
|
||||
$show_filter = intval($request->getParam("showFilter", 0));
|
||||
$my_shows = intval($request->getParam("myShows", 0));
|
||||
|
@ -265,6 +266,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
public function builderFeedAction()
|
||||
{
|
||||
session_write_close();
|
||||
$current_time = time();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
|
|
@ -37,6 +37,7 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
|
||||
public function setLibraryDatatableAction()
|
||||
{
|
||||
session_write_close();
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
|
@ -45,6 +46,7 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
|
||||
public function getLibraryDatatableAction()
|
||||
{
|
||||
session_write_close();
|
||||
$data = Application_Model_Preference::getCurrentLibraryTableSetting();
|
||||
if (!is_null($data)) {
|
||||
$this->view->settings = $data;
|
||||
|
@ -53,6 +55,7 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
|
||||
public function setTimelineDatatableAction()
|
||||
{
|
||||
session_write_close();
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
|
@ -61,17 +64,11 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
|
||||
public function getTimelineDatatableAction()
|
||||
{
|
||||
$start = microtime(true);
|
||||
|
||||
session_write_close();
|
||||
$data = Application_Model_Preference::getTimelineDatatableSetting();
|
||||
if (!is_null($data)) {
|
||||
$this->view->settings = $data;
|
||||
}
|
||||
|
||||
$end = microtime(true);
|
||||
|
||||
Logging::debug("getting timeline datatables info took:");
|
||||
Logging::debug(floatval($end) - floatval($start));
|
||||
}
|
||||
|
||||
public function remindmeAction()
|
||||
|
|
|
@ -19,6 +19,23 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|||
})(window,document,'script','dataLayer','GTM-55N6NH');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
|
||||
<script type="text/javascript">
|
||||
//Awful hack to speed up loading - Embed the schedule in the response so that the dashboard
|
||||
//doesn't have to make a separate AJAX request to get this data.
|
||||
var schedulePreLoaded = <?php
|
||||
require_once("ScheduleController.php");
|
||||
$front = Zend_Controller_Front::getInstance();
|
||||
$foo = new ScheduleController($front->getRequest(), $front->getResponse());
|
||||
$foo->getCurrentPlaylistAction();
|
||||
echo(json_encode($foo->view));
|
||||
?>;
|
||||
parseItems(schedulePreLoaded.entries);
|
||||
parseSourceStatus(schedulePreLoaded.source_status);
|
||||
parseSwitchStatus(schedulePreLoaded.switch_status);
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<?php echo $this->partial('partialviews/trialBox.phtml', array("is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?>
|
||||
<div id="Panel">
|
||||
<div class="logo"></div>
|
||||
|
|
|
@ -1446,9 +1446,9 @@ SQL;
|
|||
}
|
||||
|
||||
public static function getStartEndCurrentWeekView() {
|
||||
$first_day_of_calendar_week_view = mktime(0, 0, 0, date("n"), date("j"));
|
||||
$first_day_of_calendar_week_view = mktime(0, 0, 0, gmdate("n"), gmdate("j"));
|
||||
$weekStart = Application_Model_Preference::GetWeekStartDay();
|
||||
while (date('w', $first_day_of_calendar_week_view) != $weekStart) {
|
||||
while (gmdate('w', $first_day_of_calendar_week_view) != $weekStart) {
|
||||
$first_day_of_calendar_week_view -= 60*60*24;
|
||||
}
|
||||
$last_day_of_calendar_view = $first_day_of_calendar_week_view + 3600*24*7;
|
||||
|
@ -1460,7 +1460,7 @@ SQL;
|
|||
}
|
||||
|
||||
public static function getStartEndCurrentDayView() {
|
||||
$today = mktime(0, 0, 0, date("n"), date("j"));
|
||||
$today = mktime(0, 0, 0, gmdate("n"), gmdate("j"));
|
||||
$tomorrow = $today + 3600*24;
|
||||
|
||||
$start = new DateTime("@".$today);
|
||||
|
|
|
@ -395,7 +395,6 @@ function getScheduleFromServer(){
|
|||
parseSourceStatus(data.source_status);
|
||||
parseSwitchStatus(data.switch_status);
|
||||
showName = data.show_name;
|
||||
setTimeout(getScheduleFromServer, serverUpdateInterval);
|
||||
}, error:function(jqXHR, textStatus, errorThrown){}});
|
||||
}
|
||||
|
||||
|
@ -456,8 +455,9 @@ var stream_window = null;
|
|||
|
||||
function init() {
|
||||
//begin producer "thread"
|
||||
getScheduleFromServer();
|
||||
|
||||
//getScheduleFromServer();
|
||||
setInterval(getScheduleFromServer, serverUpdateInterval);
|
||||
|
||||
//begin consumer "thread"
|
||||
secondsTimer();
|
||||
|
||||
|
|
|
@ -890,7 +890,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
});
|
||||
|
||||
checkImportStatus();
|
||||
//checkImportStatus();
|
||||
checkLibrarySCUploadStatus();
|
||||
|
||||
addQtipToSCIcons();
|
||||
|
|
|
@ -362,11 +362,14 @@ function windowResize() {
|
|||
function preloadEventFeed () {
|
||||
var url = baseUrl+'Schedule/event-feed-preload';
|
||||
var d = new Date();
|
||||
createFullCalendar({calendarInit: calendarPref});
|
||||
|
||||
/*
|
||||
$.post(url, {format: "json", cachep: d.getTime()}, function(json){
|
||||
calendarEvents = json.events;
|
||||
createFullCalendar({calendarInit: calendarPref});
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
var initialLoad = true;
|
||||
|
|
|
@ -312,7 +312,7 @@ function createFullCalendar(data){
|
|||
],
|
||||
contentHeight: mainHeight,
|
||||
theme: true,
|
||||
lazyFetching: false,
|
||||
lazyFetching: true,
|
||||
serverTimestamp: parseInt(data.calendarInit.timestamp, 10),
|
||||
serverTimezoneOffset: parseInt(data.calendarInit.timezoneOffset, 10),
|
||||
|
||||
|
|
Loading…
Reference in New Issue