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:
Albert Santoni 2015-03-13 18:22:27 -04:00
parent b49e98693b
commit 34de6da2c7
10 changed files with 48 additions and 16 deletions

View file

@ -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.

View file

@ -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'));
}

View file

@ -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();

View file

@ -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()