- Timestamp:
- 05/03/16 17:13:50 (9 years ago)
- Location:
- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/css/site.min.css
r13805 r13827 1 @import url(http://fonts.googleapis.com/css?family=Roboto:400);.wrapper,h4{text-align:center}.label,sub,sup{vertical-align:baseline}[role=button],div[data-tree-model] li,div[data-tree-model] li i{cursor:pointer}.fc table,table{border-spacing:0}body,figure{margin:0}.btn-group>.btn-group,.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.dropdown-menu{float:left}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.pre-scrollable{max-height:340px}.fa,.glyphicon{-moz-osx-font-smoothing:grayscale}body{-webkit-font-smoothing:antialiased;font:400 14px Roboto,arial,sans-serif}.container{padding:25px;position:fixed}.form-login{background-color:#EDEDED;border-radius:15px;border-color:#d2d2d2;border-width:5px;box-shadow:0 1px 0 #cfcfcf;padding:10px 20px 20px;padding:10px 20px 20px}h4{border:0 solid #fff;border-bottom-width:1px;padding-bottom:10px}.panel-warning>.panel-heading{background-image:linear-gradient(to bottom,#eb9114 0,#f1b25b 100%)!important;color:#fff!important}.panel-danger>.panel-heading{background-image:linear-gradient(to bottom,#c12e2a 0,#d9534f 100%)!important;color:#fff!important}.label-as-badge{border-radius:1em}.bar-off{fill:#c2c2d6}.bar-off:hover{fill:#e0e0eb}.bar-wait{fill:#f0a742}.bar-wait:hover{fill:#f4bd71}.bar-trans{fill:#80d4ff}.bar-trans:hover{fill:#9df}.bar-calc{fill:#2f6fa6}.bar-calc:hover{fill:#3884c7}.bar-paus{fill:#47476b}.bar-paus:hover{fill:#5c5c8a}.bar-fin{fill:#5cb85c}.bar-fin:hover{fill:#71c171}.bar-abo{fill:#c2302c}.bar-abo:hover{fill:#d54944}.bar-fail{fill:#c2302c}.bar-fail:hover{fill:#d54944}rect.selection{stroke:gray;stroke-dasharray:4px;stroke-opacity:.5;fill:transparent}svg ::selection{background:0 0}svg ::-moz-selection{background:0 0}svg ::-webkit-selection{background:0 0}.btn-danger:focus,.btn-danger:hover,.btn-default:focus,.btn-default:hover,.btn-info:focus,.btn-info:hover,.btn-primary:focus,.btn-primary:hover,.btn-success:focus,.btn-success:hover,.btn-warning:focus,.btn-warning:hover{background-position:0 -15px}[animate-on-change]{transition:all 1s;-webkit-transition:all 1s}[animate-on-change].changed{background-color:#add8e6;transition:none;-webkit-transition:none}[animate-on-change].changedshut{background-color:#ffa07a;transition:none;-webkit-transition:none}.panel-heading .nav-justified.nav-pills li.active>a{background-color:#74a9d8!important} div[data-angular-treeview]{-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-weight:600;color:#fff;text-decoration:none;text-shadow:1px 1px #000}div[data-tree-model] ul{padding:5px;list-style:none;border:#778899;overflow:hidden}div[data-tree-model] li{position:relative;padding:0 0 0 20px;line-height:20px;margin-top:3px;border:#add8e6;border-radius:10px;box-shadow:2px 3px 5px rgba(0,0,0,.6),inset 1px 10px 300px 51px rgba(33,151,184,1)}div[data-tree-model] li .expanded{padding:1px 10px;background-image:url(../img/folder.png);background-repeat:no-repeat}div[data-tree-model] li .collapsed{padding:1px 10px;background-image:url(../img/folder-closed.png);background-repeat:no-repeat}div[data-tree-model] li .normal{padding:1px 10px;color:#000;background-image:url(../img/file.png);background-repeat:no-repeat}div[data-tree-model] li.selected{box-shadow:2px 3px 5px rgba(0,0,0,.6),inset 1px 10px 300px 51px #5cb85c!important}div[data-tree-model] span.selected{color:#fff!important;text-shadow:1px 1px #000!important;font-weight:700;padding:1px 5px}div[data-tree-model] li.changed{box-shadow:2px 3px 5px rgba(0,0,0,.6),inset 1px 10px 300px 51px rgba(250,250,210,1)}div[data-tree-model] span.changed{color:#000;text-shadow:1px 1px #fff;font-weight:700;padding:1px 5px}div[data-tree-model] span.loaded{text-decoration:underline;font-style:oblique}/*!1 @import url(http://fonts.googleapis.com/css?family=Roboto:400);.wrapper,h4{text-align:center}.label,sub,sup{vertical-align:baseline}[role=button],div[data-tree-model] li,div[data-tree-model] li i{cursor:pointer}.fc table,table{border-spacing:0}body,figure{margin:0}.btn-group>.btn-group,.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.dropdown-menu{float:left}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.pre-scrollable{max-height:340px}.fa,.glyphicon{-moz-osx-font-smoothing:grayscale}body{-webkit-font-smoothing:antialiased;font:400 14px Roboto,arial,sans-serif}.container{padding:25px;position:fixed}.form-login{background-color:#EDEDED;border-radius:15px;border-color:#d2d2d2;border-width:5px;box-shadow:0 1px 0 #cfcfcf;padding:10px 20px 20px;padding:10px 20px 20px}h4{border:0 solid #fff;border-bottom-width:1px;padding-bottom:10px}.panel-warning>.panel-heading{background-image:linear-gradient(to bottom,#eb9114 0,#f1b25b 100%)!important;color:#fff!important}.panel-danger>.panel-heading{background-image:linear-gradient(to bottom,#c12e2a 0,#d9534f 100%)!important;color:#fff!important}.label-as-badge{border-radius:1em}.bar-off{fill:#c2c2d6}.bar-off:hover{fill:#e0e0eb}.bar-wait{fill:#f0a742}.bar-wait:hover{fill:#f4bd71}.bar-trans{fill:#80d4ff}.bar-trans:hover{fill:#9df}.bar-calc{fill:#2f6fa6}.bar-calc:hover{fill:#3884c7}.bar-paus{fill:#47476b}.bar-paus:hover{fill:#5c5c8a}.bar-fin{fill:#5cb85c}.bar-fin:hover{fill:#71c171}.bar-abo{fill:#c2302c}.bar-abo:hover{fill:#d54944}.bar-fail{fill:#c2302c}.bar-fail:hover{fill:#d54944}rect.selection{stroke:gray;stroke-dasharray:4px;stroke-opacity:.5;fill:transparent}svg ::selection{background:0 0}svg ::-moz-selection{background:0 0}svg ::-webkit-selection{background:0 0}.btn-danger:focus,.btn-danger:hover,.btn-default:focus,.btn-default:hover,.btn-info:focus,.btn-info:hover,.btn-primary:focus,.btn-primary:hover,.btn-success:focus,.btn-success:hover,.btn-warning:focus,.btn-warning:hover{background-position:0 -15px}[animate-on-change]{transition:all 1s;-webkit-transition:all 1s}[animate-on-change].changed{background-color:#add8e6;transition:none;-webkit-transition:none}[animate-on-change].changedshut{background-color:#ffa07a;transition:none;-webkit-transition:none}.panel-heading .nav-justified.nav-pills li.active>a{background-color:#74a9d8!important}rect{-webkit-box-shadow:10px 10px 5px 0 rgba(0,0,0,.75);-moz-box-shadow:10px 10px 5px 0 rgba(0,0,0,.75);box-shadow:10px 10px 5px 0 rgba(0,0,0,.75)}div[data-angular-treeview]{-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-weight:600;color:#fff;text-decoration:none;text-shadow:1px 1px #000}div[data-tree-model] ul{padding:5px;list-style:none;border:#778899;overflow:hidden}div[data-tree-model] li{position:relative;padding:0 0 0 20px;line-height:20px;margin-top:3px;border:#add8e6;border-radius:10px;box-shadow:2px 3px 5px rgba(0,0,0,.6),inset 1px 10px 300px 51px rgba(33,151,184,1)}div[data-tree-model] li .expanded{padding:1px 10px;background-image:url(../img/folder.png);background-repeat:no-repeat}div[data-tree-model] li .collapsed{padding:1px 10px;background-image:url(../img/folder-closed.png);background-repeat:no-repeat}div[data-tree-model] li .normal{padding:1px 10px;color:#000;background-image:url(../img/file.png);background-repeat:no-repeat}div[data-tree-model] li.selected{box-shadow:2px 3px 5px rgba(0,0,0,.6),inset 1px 10px 300px 51px #5cb85c!important}div[data-tree-model] span.selected{color:#fff!important;text-shadow:1px 1px #000!important;font-weight:700;padding:1px 5px}div[data-tree-model] li.changed{box-shadow:2px 3px 5px rgba(0,0,0,.6),inset 1px 10px 300px 51px rgba(250,250,210,1)}div[data-tree-model] span.changed{color:#000;text-shadow:1px 1px #fff;font-weight:700;padding:1px 5px}div[data-tree-model] span.loaded{text-decoration:underline;font-style:oblique}/*! 2 2 * Bootstrap v3.3.6 (http://getbootstrap.com) 3 3 * Copyright 2011-2015 Twitter, Inc. -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/hubs/calendarhubber.js
r13805 r13827 12 12 var hubber = $.connection.calendarHub; 13 13 14 vm.alertMessage = "No alerts"; 15 vm.currentcal = []; 16 $scope.permissionview = false; 17 $scope.resaddview = false; 18 vm.selectedEventId = -1; 19 vm.groups = []; 20 vm.clients = []; 14 vm.currentcal = [];//Reference to current calendar (treeview.currentNode.calendar) 15 $scope.permissionview = false;//Show permissions or not 16 $scope.resaddview = false;//Show add resources or not 17 vm.selectedEventId = -1;//Selected downtime (-1 for none) 18 vm.groups = []; //All resource groups 19 vm.clients = []; //All resources 21 20 vm.init = function () { 22 23 // $.connection.hub.logging = true;24 25 21 26 22 var v = document.getElementById("userId").innerHTML; 27 23 $.connection.hub.qs = { 'userid': v }; 24 //Connection string set to identify the unique session ID for the user 28 25 $.connection.hub.start().done(function () { 29 hubber.server.requestInfo(); 30 }); 26 hubber.server.requestInfo();//initial data request 27 }); 28 29 //Process all initial data needed (heavy load) 31 30 hubber.client.processData = function (data, users, groups) { 32 31 vm.data = JSON.parse(data); … … 37 36 $scope.$apply(); 38 37 }; 38 39 //Saving from current graph is done -> refresh it 39 40 hubber.client.savingCurrentDone = function () { 40 41 vm.calendarSaver = false; … … 42 43 $scope.$apply(); 43 44 }; 45 46 //Saving all graphs done -> clear everything 44 47 hubber.client.savingAllDone = function () { 45 48 vm.calendarSaver = false; … … 47 50 $scope.$apply(); 48 51 }; 52 53 //Dispose toggle refresh for current 49 54 hubber.client.processDispose = function (disp) { 50 55 vm.treeview.currentNode.IsDisposable = disp; … … 52 57 $scope.$apply(); 53 58 } 59 60 //Permissions refresh for specific resource 54 61 hubber.client.processPermissions = function (id, perm) { 55 62 var json = JSON.parse(perm); … … 60 67 $scope.$apply(); 61 68 } 69 70 //Process downtimes for a resource. Data conversion 62 71 hubber.client.processDowntime = function (id, down) { 63 72 var json = JSON.parse(down); … … 99 108 } 100 109 110 //Initial function to build the resource tree 111 $scope.buildTree = function () { 112 vm.tree = []; 113 vm.temptree = []; 114 vm.top = false; 115 var ungrouped = { 116 children: [], 117 Name: 'Ungrouped' 118 } 119 for (; vm.data.length > 0;) { 120 121 if (vm.data[0].ParentResourceId == null && vm.data[0].IsDisposable !== undefined) { 122 var curr = $scope.seekChildren(vm.data.splice(0, 1)[0]); 123 vm.clients.push(curr); 124 ungrouped.children.push(curr); 125 } 126 else if (vm.data[0].ParentResourceId == null) { 127 var curr = $scope.seekChildren(vm.data.splice(0, 1)[0]); 128 vm.groups.push(curr); 129 vm.tree.push(curr); 130 } 131 else { 132 var curr = $scope.seekChildren(vm.data.splice(0, 1)[0]); 133 if (curr.IsDisposable !== undefined) 134 vm.clients.push(curr); 135 else 136 vm.groups.push(curr); 137 vm.temptree.push(curr); 138 } 139 } 140 vm.tree.push(ungrouped); 141 142 };//End for hubber init 143 144 //menu navigation 145 $scope.menuchange = function (i) { 146 switch (i) { 147 case 0: 148 $scope.permissionview = false; 149 $scope.resaddview = false; 150 break; 151 case 1: 152 $scope.permissionview = true; 153 $scope.resaddview = false; 154 break; 155 case 2: 156 $scope.permissionview = false; 157 $scope.resaddview = true; 158 break; 159 } 160 } 161 162 //Seeks for children, used recursively for building the treeview 163 $scope.seekChildren = function (current) { 164 current.calendar = []; 165 current.children = []; 166 current.todelete = []; 167 current.changes = false; 168 current.collapsed = true; 169 for (var t = 0; t < vm.temptree.length;) { 170 if (current.Id == vm.temptree[t].ParentResourceId) { 171 current.children.push(vm.temptree.splice(t, 1)[0]); 172 } 173 else { 174 t++; 175 } 176 } 177 var childc = current.children.length;//Remembers count of children received from temp tree; 178 for (var t = 0; t < vm.data.length;) { 179 if (current.Id == vm.data[t].ParentResourceId) { 180 if (vm.data[t].IsDisposable !== undefined) 181 vm.clients.push(vm.data[t]); 182 else 183 vm.groups.push(vm.data[t]); 184 current.children.push(vm.data.splice(t, 1)[0]); 185 } 186 else { 187 t++; 188 } 189 } 190 for (var t = childc; t < current.children.length; t++) { 191 current.children[t] = $scope.seekChildren(current.children[t]); 192 } 193 return current; 194 } 195 196 //Change to another resource 101 197 $scope.$watch("treeview.currentNode", function (newValue, oldValue) { 102 198 $scope.currentcal = []; … … 105 201 $scope.selectedEventId = -1; 106 202 203 //Check if resource already has downtime data loaded 107 204 if ($scope.treeview.currentNode != null && $scope.treeview.currentNode.Id != undefined) { 108 205 if ($scope.treeview.currentNode.calendar.length === 0) { 206 //Reach out to server to receive resource data 109 207 hubber.server.requestPermissions(vm.treeview.currentNode.Id); 110 208 hubber.server.requestDownTime(vm.treeview.currentNode.Id); … … 114 212 $timeout(function () { 115 213 refreshPermissions(); 116 214 //set previously loaded data 117 215 $scope.currentcal = $scope.treeview.currentNode.calendar; 118 216 }, 0); … … 124 222 }); 125 223 } 224 225 //Resets the add resources menu 126 226 $scope.refreshAdds = function() { 127 227 for (var i = 0; i < $scope.clients.length; i++) { … … 133 233 } 134 234 } 235 236 //Resets the permissions menu 135 237 function refreshPermissions() { 136 238 for (var i = 0; i < $scope.permUsers.length; i++){ … … 149 251 } 150 252 } 253 254 //Add resource group show by clearing the tree 151 255 $scope.clearTreeSelect = function () { 152 256 if (vm.treeview.currentNode != undefined) { … … 156 260 } 157 261 } 158 $scope.buildTree = function () { 159 vm.tree = []; 160 vm.temptree = []; 161 vm.top = false; 162 var ungrouped = { 163 children: [], 164 Name: 'Ungrouped' 165 } 166 for (; vm.data.length > 0;) { 167 168 if (vm.data[0].ParentResourceId == null && vm.data[0].IsDisposable !== undefined) { 169 var curr = $scope.seekChildren(vm.data.splice(0, 1)[0]); 170 vm.clients.push(curr); 171 ungrouped.children.push(curr); 172 } 173 else if (vm.data[0].ParentResourceId == null) { 174 var curr = $scope.seekChildren(vm.data.splice(0, 1)[0]); 175 vm.groups.push(curr); 176 vm.tree.push(curr); 177 } 178 else { 179 var curr = $scope.seekChildren(vm.data.splice(0, 1)[0]); 180 if (curr.IsDisposable !== undefined) 181 vm.clients.push(curr); 182 else 183 vm.groups.push(curr); 184 vm.temptree.push(curr); 185 } 186 } 187 vm.tree.push(ungrouped); 188 189 }; 190 191 $scope.seekChildren = function (current) { 192 current.calendar = []; 193 current.children = []; 194 current.todelete = []; 195 current.changes = false; 196 current.collapsed = true; 197 for (var t = 0; t < vm.temptree.length;) { 198 if (current.Id == vm.temptree[t].ParentResourceId) { 199 current.children.push(vm.temptree.splice(t, 1)[0]); 200 } 201 else { 202 t++; 203 } 204 } 205 var childc = current.children.length;//Remembers count of children received from temp tree; 206 for (var t = 0; t < vm.data.length;) { 207 if (current.Id == vm.data[t].ParentResourceId) { 208 if (vm.data[t].IsDisposable !== undefined) 209 vm.clients.push(vm.data[t]); 210 else 211 vm.groups.push(vm.data[t]); 212 current.children.push(vm.data.splice(t, 1)[0]); 213 } 214 else { 215 t++; 216 } 217 } 218 for (var t = childc; t < current.children.length; t++) { 219 current.children[t] = $scope.seekChildren(current.children[t]); 220 } 221 return current; 222 } 262 263 //Reach out to server to toggle disposable for current calendar 223 264 $scope.toggleDisposable = function () { 224 265 $scope.calendarDispose = true; 225 266 hubber.server.toggleDisposable(vm.treeview.currentNode.Id); 226 267 } 268 269 //Pushes permissions to server 227 270 $scope.pushPermissions = function () { 228 271 var perms = []; … … 239 282 hubber.server.changePermissions(perms, node.Id); 240 283 } 284 285 //Collects all data from a single resource to save to the server 241 286 function collectInfoToSave(node, refresh, last) { 242 287 var arr = node.calendar.down[0]; … … 246 291 for (var i = 0; i < arr.length; i++) { 247 292 if (arr[i].id === '00000000-0000-0000-0000-000000000000') { 293 //NEW DOWNTIME 248 294 var t = arr[i].allDay.toString(); 249 295 toadd.push([ … … 263 309 } 264 310 else if (arr[i].changed === true) { 311 //EDIT EXISTING DOWNTIME 265 312 var t = arr[i].allDay.toString(); 266 313 toupd.push([ … … 282 329 hubber.server.saveCalendar(node.Id, todel, toadd, toupd, refresh, last); 283 330 } 331 332 //Save current calendar 284 333 $scope.saveCurrentCalendar = function () { 285 334 vm.calendarSaver = true; 286 collectInfoToSave(vm.treeview.currentNode, true, false); 335 collectInfoToSave(vm.treeview.currentNode, true, false);//true for refresh, false for save all 287 336 //true for refresh, false for showing it's only one calendar saved. 288 337 } 338 339 //Save all changed calendars 289 340 $scope.saveAllCalendars = function () { 290 341 … … 302 353 }).then(function (success) { 303 354 vm.calendarSaver = true; 355 304 356 for (var i = 0; i < $scope.allSave.length; i++) { 305 357 if (i >= $scope.allSave.length - 1) … … 312 364 313 365 } 366 367 //Checks treeview for edits and builds new array containing these (recurse for children) 314 368 function createSaveRequests(node) { 315 369 if (node.changes === true) … … 319 373 } 320 374 } 375 376 //Clears and refreshes calendar for current resource (delete current changes) 321 377 $scope.clearCurrentCalendar = function () { 322 378 … … 332 388 333 389 } 390 391 //Clears all calendars and refreshes current (Deletes all changes) 334 392 $scope.clearAllCalendars = function () { 335 393 ngDialog.openConfirm({ … … 346 404 347 405 } 406 407 //Function that clears all calendar (separate so dialog is not called when saveAll is finished) 348 408 function clearAllCalendarsFunc() { 349 409 $(".ng-binding.changed").removeClass('changed'); … … 360 420 $(".selected.ng-scope").addClass('loaded'); 361 421 } 422 423 //Recurse trough tree view 362 424 function clearCalendarsRecurse(node) { 363 425 … … 369 431 } 370 432 } 433 434 //Delete all downtimes from current resource 371 435 $scope.deleteAllEvents = function () { 372 436 vm.calendarDeleter = true; … … 386 450 }); 387 451 } 452 453 //Delete all past events 388 454 $scope.deleteAllPreviousEvents = function () { 389 455 vm.calendarDeleter = true; … … 408 474 } 409 475 410 476 //Sets the status of a downtime AND the current resource to changed 411 477 $scope.setChanged = function (id) { 412 478 if (id != -1) { … … 421 487 $(".selected").addClass('changed'); 422 488 } 423 //*Add event by click 489 490 //Adds event by click on empty space 424 491 $scope.calendarClick = function (date, jsEvent, view) { 425 492 … … 431 498 end.setHours(dat.getHours() + 2); 432 499 vm.treeview.currentNode.calendar.down[0].push({ 433 id: '00000000-0000-0000-0000-000000000000', 500 id: '00000000-0000-0000-0000-000000000000',//Makes it recognizable as new for the server 434 501 title: 'Unavailable', 435 502 start: dat, … … 453 520 454 521 } 522 523 //Finds array index for specific _id 455 524 function checkId(id) { 456 525 for (var i = 0; i < vm.treeview.currentNode.calendar.down[0].length ; i++) { … … 460 529 return -1; 461 530 } 462 / * alert on eventClick */531 //Set selected downtime 463 532 $scope.eventClick = function (date, jsEvent, view) { 464 533 vm.selectedEventId = checkId(date._id); 465 534 }; 535 //Sets selected downtime by clicking on the button at bottom on the page, moves to date 466 536 $scope.eventClickBtn = function (id) { 467 537 vm.selectedEventId = checkId(id); 468 538 vm.goToDate(); 469 539 }; 470 /* alert on Drop */ 540 541 //Drag and drop downtime 471 542 $scope.dragandDrop = function (event, delta, revertFunc, jsEvent, ui, view) { 472 543 vm.selectedEventId = checkId(event._id); … … 487 558 vm.treeview.currentNode.calendar.down[0][vm.selectedEventId].end = new Date(event.end); 488 559 }; 489 / * alert on Resize */560 //Resize downtime 490 561 $scope.resizeEvent = function (event, delta, revertFunc, jsEvent, ui, view) { 491 562 vm.selectedEventId = checkId(event._id); … … 495 566 }; 496 567 497 / * remove event */568 //Removes a downtime from client (existing downtime gets referenced in todelete 498 569 $scope.remove = function (index) { 499 570 vm.selectedEventId = -1; … … 506 577 507 578 }; 579 //Remove trough list view at bottom 508 580 $scope.removeList = function (id) { 509 581 var index = checkId(id); … … 517 589 518 590 }; 519 591 //Check if start is before end AND start is after now (recursion) 520 592 $scope.checkDateStartEnd = function () { 521 593 if ($scope.currentcal.down[0][vm.selectedEventId].rec.start > $scope.currentcal.down[0][vm.selectedEventId].rec.end || … … 528 600 $scope.currentcal.down[0][vm.selectedEventId].rec.start = new Date(); 529 601 } 530 //pushes all changes to other recurs602 //pushes all changes to other existing recurs and creates new downtimes where needed 531 603 $scope.pushRecurChanges = function (recid) { 532 604 ngDialog.openConfirm({ … … 539 611 plain: true 540 612 }).then(function (success) { 613 541 614 var arr = vm.treeview.currentNode.calendar.down[0]; 615 //Deep copy of downtime for referencing 542 616 var ob = $.extend(true, {}, arr[vm.selectedEventId]); 543 for (var i = 0; i < arr.length;) { 617 618 for (var i = 0; i < arr.length;) {//Go trough downtimes and find all recurrences 544 619 if (arr[i].rec.recid === recid) { 545 620 if (new Date(arr[i].start) < new Date(ob.rec.start) || 546 621 new Date(arr[i].end) > new Date(ob.rec.end) || 547 622 !ob.rec.days[new Date(arr[i].start).getDay()]) { 548 vm.remove(i); 623 //Downtime is out of recurrence boundaries 624 //Before start date OR After end date OR Not on right day of the week 625 vm.remove(i);//NO I++ -> REMOVE SPLICES ARRAY 549 626 vm.selectedEventId = -1; 550 627 551 628 } 552 629 else { 553 630 //Edit downtime when it is within the bounds 554 631 arr[i].start.setHours(ob.start.getHours(), ob.start.getMinutes()); 555 632 arr[i].end.setHours(ob.end.getHours(), ob.end.getMinutes()); … … 564 641 i++; 565 642 } 643 //init for new downtimes. 566 644 var start = new Date(ob.rec.start); 567 start.setHours(2, 0, 0, 0); 645 start.setHours(2, 0, 0, 0);//Beginning of the day + time conversion +02 568 646 var end = new Date(ob.rec.end); 569 end = new Date(end.setHours(24, 0, 0, 0) + 1000 * 3600 * 2); 570 571 loop1: 647 end = new Date(end.setHours(24, 0, 0, 0) + 1000 * 3600 * 2);//End of the day + time conversion +02 648 649 loop1: //Loop start to end with single day increment 572 650 for (var d = (start.getTime()) ; d < (end.getTime()) ;) { 573 651 var tog = ob.rec.days[new Date(d).getDay()]; 652 //Check if day of the week is included in recursion 574 653 if (tog) { 575 loop2: 654 loop2://Loop checking existing downtime array to see if day is already filled or not 576 655 for (var i = 0; i < arr.length; i++) { 577 656 … … 580 659 if (arr[i].start.getTime() >= d && 581 660 arr[i].end.getTime() <= dend) { 582 d += (1000 * 3600 * 24); 583 continue loop1; 661 d += (1000 * 3600 * 24);//add day to loop 1 662 continue loop1;//breaks out of loop2 and skips to next day 584 663 } 585 664 } 586 665 } 587 666 //Made it here = new event needed: init 588 667 var ts = new Date(d); 589 668 ts.setHours(new Date(ob.start).getHours(), new Date(ob.start).getMinutes()); … … 602 681 } 603 682 604 d += (1000 * 3600 * 24);// 1 day 605 606 } 607 }); 608 } 683 d += (1000 * 3600 * 24);// adds one day 684 685 } 686 }); 687 } 688 689 //Delete all bound recurrences 609 690 $scope.deleteAllRecurrences = function (recid) { 610 691 ngDialog.openConfirm({ … … 627 708 } 628 709 710 //Moves calendar to selected date 629 711 $scope.goToDate = function () { 630 712 $("#resourcecalendar").fullCalendar('gotoDate', vm.currentcal.down[0][vm.selectedEventId].start); 631 713 } 632 /* Render Tooltip */714 /* Renders Tooltip */ 633 715 $scope.eventRender = function (event, element, view) { 634 716 element.attr({ … … 638 720 //$compile(element)($scope); 639 721 }; 640 / * config object */722 //Calendar configuration 641 723 $scope.uiConfig = { 642 724 calendar: { … … 663 745 }; 664 746 665 $scope.menuchange = function (i) { 666 switch(i) { 667 case 0: 668 $scope.permissionview = false; 669 $scope.resaddview = false; 670 break; 671 case 1: 672 $scope.permissionview = true; 673 $scope.resaddview = false; 674 break; 675 case 2: 676 $scope.permissionview = false; 677 $scope.resaddview = true; 678 break; 679 } 680 } 747 681 748 682 749 683 750 684 751 }).filter('disp', function () { 685 return function (input) { 752 return function (input) {//Filter boolean to string 686 753 return input ? 'Disposable' : 'Not disposable'; 687 754 } 688 755 }).directive('animateOnChange', function ($timeout) { 689 return function (scope, element, attr) { 756 return function (scope, element, attr) {//Animation on downtime info to show change 690 757 scope.$watch(attr.animateOnChange, function (nv, ov) { 691 758 … … 695 762 $timeout(function () { 696 763 element.removeClass('changed'); 697 }, 250); // Could be enhanced to take duration as a parameter764 }, 250); 698 765 } 699 766 else { … … 701 768 $timeout(function () { 702 769 element.removeClass('changedshut'); 703 }, 250); // Could be enhanced to take duration as a parameter770 }, 250); 704 771 } 705 772 } -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/hubs/progresshubber.js
r13754 r13827 1 function addtoHive(){var a=document.getElementById("jname").value,b=document.getElementById("jresource").value;a&&""!=a&&null!=a?(hubber.server.changeNameResource(a,b),document.getElementById("fakehiveadd").style.display="none",document.getElementById("progdiv").style.display="",document.getElementById("result").style.display="",document.getElementById("realhiveadd").click()):alert("Job name not set!")}function toggleChild(a,b){console.log(a+" toggled"),hubber.server.toggleChild(a),"none"==$("#childs"+b).css("display")?$("#childs"+b).css("display",""):$("#childs"+b).css("display","none"),$("body").click()}function changePriority(a,b,c){switch(console.log(a+" to priority "+b),hubber.server.changePriority(a,b),resetPrior(c),b){case 0:document.getElementById("prior"+c).className+="btn-default",document.getElementById("prior"+c).innerHTML="Low";break;case 1:document.getElementById("prior"+c).className+="btn-info",document.getElementById("prior"+c).innerHTML="Normal";break;case 2:document.getElementById("prior"+c).className+="btn-warning",document.getElementById("prior"+c).innerHTML="Urgent";break;case 3:document.getElementById("prior"+c).className+="btn-danger",document.getElementById("prior"+c).innerHTML="Critical"}document.getElementById("prior"+c).innerHTML+="<span class='caret'></span>"}function resetPrior(a){document.getElementById("prior"+a).className="btn dropdown-toggle "} var hubber=$.connection.progressHub;$(function(){var a=document.getElementById("userId").innerHTML;console.log(a),$.connection.hub.qs={userid:a},$.connection.hub.start().done(function(){$("#progress").css("width","0%"),$("#progress").attr("aria-valuenow",0),hubber.server.handleMessage("Looking for connection...")}),hubber.client.processMessage=function(a,b){b>$("#progress").attr("aria-valuenow")&&($("#progress").css("width",b+"%"),$("#progress").attr("aria-valuenow",b),$("#progress").html(b+"%"),$("#result").html(a))}});1 function addtoHive(){var a=document.getElementById("jname").value,b=document.getElementById("jresource").value;a&&""!=a&&null!=a?(hubber.server.changeNameResource(a,b),document.getElementById("fakehiveadd").style.display="none",document.getElementById("progdiv").style.display="",document.getElementById("result").style.display="",document.getElementById("realhiveadd").click()):alert("Job name not set!")}function toggleChild(a,b){console.log(a+" toggled"),hubber.server.toggleChild(a),"none"==$("#childs"+b).css("display")?$("#childs"+b).css("display",""):$("#childs"+b).css("display","none"),$("body").click()}function changePriority(a,b,c){switch(console.log(a+" to priority "+b),hubber.server.changePriority(a,b),resetPrior(c),b){case 0:document.getElementById("prior"+c).className+="btn-default",document.getElementById("prior"+c).innerHTML="Low";break;case 1:document.getElementById("prior"+c).className+="btn-info",document.getElementById("prior"+c).innerHTML="Normal";break;case 2:document.getElementById("prior"+c).className+="btn-warning",document.getElementById("prior"+c).innerHTML="Urgent";break;case 3:document.getElementById("prior"+c).className+="btn-danger",document.getElementById("prior"+c).innerHTML="Critical"}document.getElementById("prior"+c).innerHTML+="<span class='caret'></span>"}function resetPrior(a){document.getElementById("prior"+a).className="btn dropdown-toggle "}function paraEdit(a,b,c,d,e){hubber.server.paraEdit(a,b,c,d,e)}var hubber=$.connection.progressHub;$(function(){var a=document.getElementById("userId").innerHTML;console.log(a),$.connection.hub.qs={userid:a},$.connection.hub.start().done(function(){$("#progress").css("width","0%"),$("#progress").attr("aria-valuenow",0),hubber.server.handleMessage("Looking for connection...")}),hubber.client.processMessage=function(a,b){b>$("#progress").attr("aria-valuenow")&&($("#progress").css("width",b+"%"),$("#progress").attr("aria-valuenow",b),$("#progress").html(b+"%"),$("#result").html(a))}}); -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/hubs/userinfohubber.js
r13805 r13827 1 function resetPass(a){hubber.server.resetPassword(a)}var hubber=$.connection.userInfoHub;$(function(){var a=document.getElementById("userId").innerHTML;console.log(a),$.connection.hub.qs={userid:a},$.connection.hub.start(),hubber.client.showNewPass=function(a){$("#inppassreset").html("<label class=' control-label' style='text-align:left'> An email has been sent to the user containing the new password</label>")}});1 function resetPass(a){hubber.server.resetPassword(a)}var hubber=$.connection.userInfoHub;$(function(){var a=document.getElementById("userId").innerHTML;console.log(a),$.connection.hub.qs={userid:a},$.connection.hub.start(),hubber.client.showNewPass=function(a){$("#inppassreset").html("<label class=' control-label' style='text-align:left'>New pass: "+a+". An email has been sent to the user containing the new password</label>")}});
Note: See TracChangeset
for help on using the changeset viewer.