Scheduler comm
authorChrysostomos Kolovos <xrklvs@gmail.com>
Thu, 10 Apr 2014 12:07:22 +0000 (15:07 +0300)
committerChrysostomos Kolovos <xrklvs@gmail.com>
Thu, 10 Apr 2014 12:07:22 +0000 (15:07 +0300)
plugins/scheduler2/static/js/scheduler-SchedulerCtrl.js
plugins/scheduler2/static/js/scheduler2.js

index f39ea54..30bf523 100755 (executable)
@@ -6,7 +6,9 @@ myApp.factory('$exceptionHandler', function () {
     return function (exception, cause) {\r
         if (exception.message.contains('leases')) {\r
             console.log(exception.message);\r
-            angular.element(document.getElementById('SchedulerCtrl')).scope().initSlots(_schedulerCurrentCellPosition, _schedulerCurrentCellPosition + SchedulerTotalVisibleCells);\r
+            \r
+            var tmpScope = angular.element(document.getElementById('SchedulerCtrl')).scope();\r
+            tmpScope.initSlots(_schedulerCurrentCellPosition, _schedulerCurrentCellPosition + SchedulerTotalVisibleCells);\r
         }\r
             \r
     };\r
@@ -72,14 +74,18 @@ myApp.factory('$exceptionHandler', function () {
             });\r
         };\r
 \r
-        $scope.initSlots = function(from, to) {\r
-            //init\r
-            $scope.slots = [];\r
-            for (var k = 0; k < SchedulerData.length; k++) {\r
+        $scope.SetSchedulerResources = function (start, to, filter) {\r
+            for (var k = start; k < to; k++) {\r
                 if ($scope.resources.length < SchedulerData.length)\r
                     $scope.resources.push(jQuery.extend(true, {}, SchedulerData[k]));\r
                 $scope.resources[k].leases = [];\r
             }\r
+            $scope.initSlots(0, SchedulerTotalVisibleCells);\r
+        };\r
+\r
+        $scope.initSlots = function(from, to) {\r
+            //init\r
+            $scope.slots = [];\r
             //set\r
             for (var i = from; i < to; i++) {\r
                 $scope.slots.push(SchedulerSlots[i]);\r
index 4fe2feb..f57774e 100755 (executable)
@@ -124,6 +124,7 @@ var tmpSchedulerLeases = [];
             if (SchedulerData.length < schedulerMaxRows)\r
                 SchedulerData.push({ id: data.urn, index: SchedulerData.length, name: data.hrn, granularity: data.granularity, leases: schedulerGetLeases(60 / schedulerSlotsPerHour), type: data.type });\r
             //alert(data.toSource());\r
+\r
         },\r
         on_all_resources_query_done: function (data) {\r
             _resourcesDone = true;\r
@@ -162,9 +163,9 @@ var tmpSchedulerLeases = [];
 \r
 \r
         // no prefix\r
-\r
         on_filter_added: function (filter) {\r
-\r
+            var tmpScope = angular.element(document.getElementById('SchedulerCtrl')).scope();\r
+            tmpScope.SetSchedulerResources(0, schedulerMaxRows, filter);\r
         },\r
 \r
         // ... be sure to list all events here\r
@@ -190,7 +191,8 @@ var tmpSchedulerLeases = [];
             }\r
         },\r
 \r
-        _initUI : function () {\r
+        _initUI: function () {\r
+            //alert(1);\r
             if (schedulerDebug) console.time("_initUI");\r
             //init DatePicker Start\r
             $("#DateToRes").datepicker({\r
@@ -259,7 +261,8 @@ var tmpSchedulerLeases = [];
             //    SchedulerData.push({ name: 'xyz+ccc', leases: schedulerGetLeases(60 / schedulerSlotsPerHour), urn: 'xyz+ccc', type: 'node' });\r
             //    SchedulerData.push({ name: 'nitos1', leases: schedulerGetLeases(60 / schedulerSlotsPerHour), urn: 'nitos1', type: 'node' });\r
             //}\r
-            angular.element(document.getElementById('SchedulerCtrl')).scope().initSlots(0, SchedulerTotalVisibleCells);\r
+            var tmpScope = angular.element(document.getElementById('SchedulerCtrl')).scope();\r
+            tmpScope.SetSchedulerResources(0, schedulerMaxRows, null);\r
         },\r
         _SetPeriodInPage: function (start, end) {\r
         }\r