From 67c9e8a9f6fbb8d9dcce7f3d2611a99b4363ae99 Mon Sep 17 00:00:00 2001 From: Chrysostomos Kolovos Date: Thu, 10 Apr 2014 15:07:22 +0300 Subject: [PATCH] Scheduler comm --- .../static/js/scheduler-SchedulerCtrl.js | 16 +++++++++++----- plugins/scheduler2/static/js/scheduler2.js | 11 +++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/plugins/scheduler2/static/js/scheduler-SchedulerCtrl.js b/plugins/scheduler2/static/js/scheduler-SchedulerCtrl.js index f39ea54d..30bf5232 100755 --- a/plugins/scheduler2/static/js/scheduler-SchedulerCtrl.js +++ b/plugins/scheduler2/static/js/scheduler-SchedulerCtrl.js @@ -6,7 +6,9 @@ myApp.factory('$exceptionHandler', function () { return function (exception, cause) { if (exception.message.contains('leases')) { console.log(exception.message); - angular.element(document.getElementById('SchedulerCtrl')).scope().initSlots(_schedulerCurrentCellPosition, _schedulerCurrentCellPosition + SchedulerTotalVisibleCells); + + var tmpScope = angular.element(document.getElementById('SchedulerCtrl')).scope(); + tmpScope.initSlots(_schedulerCurrentCellPosition, _schedulerCurrentCellPosition + SchedulerTotalVisibleCells); } }; @@ -72,14 +74,18 @@ myApp.factory('$exceptionHandler', function () { }); }; - $scope.initSlots = function(from, to) { - //init - $scope.slots = []; - for (var k = 0; k < SchedulerData.length; k++) { + $scope.SetSchedulerResources = function (start, to, filter) { + for (var k = start; k < to; k++) { if ($scope.resources.length < SchedulerData.length) $scope.resources.push(jQuery.extend(true, {}, SchedulerData[k])); $scope.resources[k].leases = []; } + $scope.initSlots(0, SchedulerTotalVisibleCells); + }; + + $scope.initSlots = function(from, to) { + //init + $scope.slots = []; //set for (var i = from; i < to; i++) { $scope.slots.push(SchedulerSlots[i]); diff --git a/plugins/scheduler2/static/js/scheduler2.js b/plugins/scheduler2/static/js/scheduler2.js index 4fe2feb3..f57774e0 100755 --- a/plugins/scheduler2/static/js/scheduler2.js +++ b/plugins/scheduler2/static/js/scheduler2.js @@ -124,6 +124,7 @@ var tmpSchedulerLeases = []; if (SchedulerData.length < schedulerMaxRows) SchedulerData.push({ id: data.urn, index: SchedulerData.length, name: data.hrn, granularity: data.granularity, leases: schedulerGetLeases(60 / schedulerSlotsPerHour), type: data.type }); //alert(data.toSource()); + }, on_all_resources_query_done: function (data) { _resourcesDone = true; @@ -162,9 +163,9 @@ var tmpSchedulerLeases = []; // no prefix - on_filter_added: function (filter) { - + var tmpScope = angular.element(document.getElementById('SchedulerCtrl')).scope(); + tmpScope.SetSchedulerResources(0, schedulerMaxRows, filter); }, // ... be sure to list all events here @@ -190,7 +191,8 @@ var tmpSchedulerLeases = []; } }, - _initUI : function () { + _initUI: function () { + //alert(1); if (schedulerDebug) console.time("_initUI"); //init DatePicker Start $("#DateToRes").datepicker({ @@ -259,7 +261,8 @@ var tmpSchedulerLeases = []; // SchedulerData.push({ name: 'xyz+ccc', leases: schedulerGetLeases(60 / schedulerSlotsPerHour), urn: 'xyz+ccc', type: 'node' }); // SchedulerData.push({ name: 'nitos1', leases: schedulerGetLeases(60 / schedulerSlotsPerHour), urn: 'nitos1', type: 'node' }); //} - angular.element(document.getElementById('SchedulerCtrl')).scope().initSlots(0, SchedulerTotalVisibleCells); + var tmpScope = angular.element(document.getElementById('SchedulerCtrl')).scope(); + tmpScope.SetSchedulerResources(0, schedulerMaxRows, null); }, _SetPeriodInPage: function (start, end) { } -- 2.43.0