- Timestamp:
- 04/26/16 11:30:46 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/hubs/calendarhubber.js
r13782 r13795 14 14 vm.alertMessage = "No alerts"; 15 15 vm.currentcal = []; 16 $scope.permission = false; 16 17 vm.selectedEventId = -1; 17 18 vm.groups = []; … … 27 28 hubber.server.requestInfo(); 28 29 }); 29 hubber.client.processData = function (data ) {30 hubber.client.processData = function (data, users, groups) { 30 31 vm.data = JSON.parse(data); 32 vm.permUsers = JSON.parse(users); 33 vm.permGroups = JSON.parse(groups); 31 34 $scope.buildTree(); 32 35 33 36 $scope.$apply(); 34 37 }; … … 48 51 $scope.$apply(); 49 52 } 53 hubber.client.processPermissions = function (id, perm) { 54 var json = JSON.parse(perm); 55 56 $scope.treeview.currentNode.permissions = json; 57 refreshPermissions(); 58 $scope.permissionLoader = false; 59 $scope.$apply(); 60 } 50 61 hubber.client.processDowntime = function (id, down) { 51 62 var json = JSON.parse(down); … … 91 102 $(".selected.ng-binding").addClass('loaded'); 92 103 $scope.selectedEventId = -1; 104 93 105 if ($scope.treeview.currentNode != null && $scope.treeview.currentNode.Id != undefined) { 94 106 if ($scope.treeview.currentNode.calendar.length === 0) { 107 hubber.server.requestPermissions(vm.treeview.currentNode.Id); 95 108 hubber.server.requestDownTime(vm.treeview.currentNode.Id); 96 109 vm.permissionLoader = true; 97 110 } 98 111 else { 99 112 $timeout(function () { 113 refreshPermissions(); 100 114 $scope.currentcal = $scope.treeview.currentNode.calendar; 101 102 115 }, 0); 103 116 … … 106 119 107 120 }); 121 } 122 function refreshPermissions() { 123 for (var i = 0; i < $scope.permUsers.length; i++){ 124 $scope.permUsers[i].state = false; 125 for (var j = 0; j < $scope.treeview.currentNode.permissions.length; j++) { 126 if($scope.permUsers[i].Id === $scope.treeview.currentNode.permissions[j].GrantedUserId) 127 $scope.permUsers[i].state = true; 128 } 129 } 130 for (var i = 0; i < $scope.permGroups.length; i++) { 131 $scope.permGroups[i].state = false; 132 for (var j = 0; j < $scope.treeview.currentNode.permissions.length; j++) { 133 if ($scope.permGroups[i].Id === $scope.treeview.currentNode.permissions[j].GrantedUserId) 134 $scope.permGroups[i].state = true; 135 } 136 } 108 137 } 109 138 $scope.clearTreeSelect = function () { … … 179 208 return current; 180 209 } 181 182 210 $scope.toggleDisposable = function () { 183 211 $scope.calendarDispose = true; 184 212 hubber.server.toggleDisposable(vm.treeview.currentNode.Id); 185 213 } 186 214 $scope.pushPermissions = function () { 215 var perms = []; 216 $scope.permissionLoader = true; 217 var node = $scope.treeview.currentNode; 218 for (var i = 0; i < $scope.permGroups.length; i++) { 219 if ($scope.permGroups[i].state === true) 220 perms.push($scope.permGroups[i].Id); 221 } 222 for (var i = 0; i < $scope.permUsers.length; i++) { 223 if ($scope.permUsers[i].state === true) 224 perms.push($scope.permUsers[i].Id); 225 } 226 hubber.server.changePermissions(perms, node.Id); 227 } 187 228 function collectInfoToSave(node, refresh, last) { 188 229 var arr = node.calendar.down[0]; … … 273 314 $scope.currentcal = []; 274 315 hubber.server.requestDownTime(vm.treeview.currentNode.Id); 316 $(".selected.ng-scope").removeClass('changed'); 275 317 $(".selected.ng-binding").removeClass('changed'); 276 318 … … 293 335 function clearAllCalendarsFunc() { 294 336 $(".ng-binding.changed").removeClass('changed'); 337 $(".ng-scope.changed").removeClass('changed'); 295 338 $(".ng-binding.loaded").removeClass('loaded'); 339 $(".ng-scope.loaded").removeClass('loaded'); 296 340 $scope.selectedEventId = -1; 297 341 $scope.treeview.currentNode.calendar = null; … … 301 345 hubber.server.requestDownTime(vm.treeview.currentNode.Id); 302 346 $(".selected.ng-binding").addClass('loaded'); 347 $(".selected.ng-scope").addClass('loaded'); 303 348 } 304 349 function clearCalendarsRecurse(node) { … … 361 406 } 362 407 vm.treeview.currentNode.changes = true; 363 $(".selected .ng-binding").addClass('changed');408 $(".selected").addClass('changed'); 364 409 } 365 410 //*Add event by click
Note: See TracChangeset
for help on using the changeset viewer.