Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/03/16 17:13:50 (8 years ago)
Author:
jlodewyc
Message:

#2582 Parameter changing busy, save file, download file and email on pass reset

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}/*!
    22 * Bootstrap v3.3.6 (http://getbootstrap.com)
    33 * Copyright 2011-2015 Twitter, Inc.
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/hubs/calendarhubber.js

    r13805 r13827  
    1212               var hubber = $.connection.calendarHub;
    1313
    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
    2120               vm.init = function () {
    22 
    23                    //  $.connection.hub.logging = true;
    24 
    2521
    2622                   var v = document.getElementById("userId").innerHTML;
    2723                   $.connection.hub.qs = { 'userid': v };
     24                   //Connection string set to identify the unique session ID for the user
    2825                   $.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)
    3130                   hubber.client.processData = function (data, users, groups) {
    3231                       vm.data = JSON.parse(data);
     
    3736                       $scope.$apply();
    3837                   };
     38
     39                   //Saving from current graph is done -> refresh it
    3940                   hubber.client.savingCurrentDone = function () {
    4041                       vm.calendarSaver = false;
     
    4243                       $scope.$apply();
    4344                   };
     45
     46                   //Saving all graphs done -> clear everything
    4447                   hubber.client.savingAllDone = function () {
    4548                       vm.calendarSaver = false;
     
    4750                       $scope.$apply();
    4851                   };
     52
     53                   //Dispose toggle refresh for current
    4954                   hubber.client.processDispose = function (disp) {
    5055                       vm.treeview.currentNode.IsDisposable = disp;
     
    5257                       $scope.$apply();
    5358                   }
     59
     60                   //Permissions refresh for specific resource
    5461                   hubber.client.processPermissions = function (id, perm) {
    5562                       var json = JSON.parse(perm);
     
    6067                       $scope.$apply();
    6168                   }
     69
     70                   //Process downtimes for a resource. Data conversion
    6271                   hubber.client.processDowntime = function (id, down) {
    6372                       var json = JSON.parse(down);
     
    99108                   }
    100109
     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
    101197                   $scope.$watch("treeview.currentNode", function (newValue, oldValue) {
    102198                       $scope.currentcal = [];
     
    105201                       $scope.selectedEventId = -1;
    106202                       
     203                       //Check if resource already has downtime data loaded
    107204                       if ($scope.treeview.currentNode != null && $scope.treeview.currentNode.Id != undefined) {
    108205                           if ($scope.treeview.currentNode.calendar.length === 0) {
     206                               //Reach out to server to receive resource data
    109207                               hubber.server.requestPermissions(vm.treeview.currentNode.Id);
    110208                               hubber.server.requestDownTime(vm.treeview.currentNode.Id);
     
    114212                               $timeout(function () {
    115213                                   refreshPermissions();
    116                                    
     214                                   //set previously loaded data
    117215                                   $scope.currentcal = $scope.treeview.currentNode.calendar;
    118216                               }, 0);
     
    124222                   });
    125223               }
     224
     225               //Resets the add resources menu
    126226               $scope.refreshAdds = function() {
    127227                   for (var i = 0; i < $scope.clients.length; i++) {
     
    133233                   }
    134234               }
     235
     236               //Resets the permissions menu
    135237               function refreshPermissions() {
    136238                   for (var i = 0; i < $scope.permUsers.length; i++){
     
    149251                   }
    150252               }
     253
     254               //Add resource group show by clearing the tree
    151255               $scope.clearTreeSelect = function () {
    152256                   if (vm.treeview.currentNode != undefined) {
     
    156260                   }
    157261               }
    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
    223264               $scope.toggleDisposable = function () {
    224265                   $scope.calendarDispose = true;
    225266                   hubber.server.toggleDisposable(vm.treeview.currentNode.Id);
    226267               }
     268
     269               //Pushes permissions to server
    227270               $scope.pushPermissions = function () {
    228271                   var perms = [];
     
    239282                   hubber.server.changePermissions(perms, node.Id);
    240283               }
     284
     285               //Collects all data from a single resource to save to the server
    241286               function collectInfoToSave(node, refresh, last) {
    242287                   var arr = node.calendar.down[0];
     
    246291                   for (var i = 0; i < arr.length; i++) {
    247292                       if (arr[i].id === '00000000-0000-0000-0000-000000000000') {
     293                           //NEW DOWNTIME
    248294                           var t = arr[i].allDay.toString();
    249295                           toadd.push([
     
    263309                       }
    264310                       else if (arr[i].changed === true) {
     311                           //EDIT EXISTING DOWNTIME
    265312                           var t = arr[i].allDay.toString();
    266313                           toupd.push([
     
    282329                   hubber.server.saveCalendar(node.Id, todel, toadd, toupd, refresh, last);
    283330               }
     331
     332               //Save current calendar
    284333               $scope.saveCurrentCalendar = function () {
    285334                   vm.calendarSaver = true;
    286                    collectInfoToSave(vm.treeview.currentNode, true, false);
     335                   collectInfoToSave(vm.treeview.currentNode, true, false);//true for refresh, false for save all
    287336                   //true for refresh, false for showing it's only one calendar saved.
    288337               }
     338
     339               //Save all changed calendars
    289340               $scope.saveAllCalendars = function () {
    290341
     
    302353                   }).then(function (success) {
    303354                       vm.calendarSaver = true;
     355
    304356                       for (var i = 0; i < $scope.allSave.length; i++) {
    305357                           if (i >= $scope.allSave.length - 1)
     
    312364
    313365               }
     366
     367               //Checks treeview for edits and builds new array containing these (recurse for children)
    314368               function createSaveRequests(node) {
    315369                   if (node.changes === true)
     
    319373                   }
    320374               }
     375
     376               //Clears and refreshes calendar for current resource (delete current changes)
    321377               $scope.clearCurrentCalendar = function () {
    322378
     
    332388
    333389               }
     390
     391               //Clears all calendars and refreshes current (Deletes all changes)
    334392               $scope.clearAllCalendars = function () {
    335393                   ngDialog.openConfirm({
     
    346404
    347405               }
     406
     407               //Function that clears all calendar (separate so dialog is not called when saveAll is finished)
    348408               function clearAllCalendarsFunc() {
    349409                   $(".ng-binding.changed").removeClass('changed');
     
    360420                   $(".selected.ng-scope").addClass('loaded');
    361421               }
     422
     423               //Recurse trough tree view
    362424               function clearCalendarsRecurse(node) {
    363425
     
    369431                   }
    370432               }
     433
     434               //Delete all downtimes from current resource
    371435               $scope.deleteAllEvents = function () {
    372436                   vm.calendarDeleter = true;
     
    386450                   });
    387451               }
     452
     453               //Delete all past events
    388454               $scope.deleteAllPreviousEvents = function () {
    389455                   vm.calendarDeleter = true;
     
    408474               }
    409475
    410 
     476               //Sets the status of a downtime AND the current resource to changed
    411477               $scope.setChanged = function (id) {
    412478                   if (id != -1) {
     
    421487                   $(".selected").addClass('changed');
    422488               }
    423                //*Add event by click
     489
     490               //Adds event by click on empty space
    424491               $scope.calendarClick = function (date, jsEvent, view) {
    425492
     
    431498                   end.setHours(dat.getHours() + 2);
    432499                   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
    434501                       title: 'Unavailable',
    435502                       start: dat,
     
    453520
    454521               }
     522
     523               //Finds array index for specific _id
    455524               function checkId(id) {
    456525                   for (var i = 0; i < vm.treeview.currentNode.calendar.down[0].length ; i++) {
     
    460529                   return -1;
    461530               }
    462                /* alert on eventClick */
     531               //Set selected downtime
    463532               $scope.eventClick = function (date, jsEvent, view) {
    464533                   vm.selectedEventId = checkId(date._id);
    465534               };
     535               //Sets selected downtime by clicking on the button at bottom on the page, moves to date
    466536               $scope.eventClickBtn = function (id) {
    467537                   vm.selectedEventId = checkId(id);
    468538                   vm.goToDate();
    469539               };
    470                /* alert on Drop */
     540
     541               //Drag and drop downtime
    471542               $scope.dragandDrop = function (event, delta, revertFunc, jsEvent, ui, view) {
    472543                   vm.selectedEventId = checkId(event._id);
     
    487558                   vm.treeview.currentNode.calendar.down[0][vm.selectedEventId].end = new Date(event.end);
    488559               };
    489                /* alert on Resize */
     560               //Resize downtime
    490561               $scope.resizeEvent = function (event, delta, revertFunc, jsEvent, ui, view) {
    491562                   vm.selectedEventId = checkId(event._id);
     
    495566               };
    496567
    497                /* remove event */
     568               //Removes a downtime from client (existing downtime gets referenced in todelete
    498569               $scope.remove = function (index) {
    499570                   vm.selectedEventId = -1;
     
    506577
    507578               };
     579               //Remove trough list view at bottom
    508580               $scope.removeList = function (id) {
    509581                   var index = checkId(id);
     
    517589
    518590               };
    519 
     591               //Check if start is before end AND start is after now (recursion)
    520592               $scope.checkDateStartEnd = function () {
    521593                   if ($scope.currentcal.down[0][vm.selectedEventId].rec.start > $scope.currentcal.down[0][vm.selectedEventId].rec.end ||
     
    528600                       $scope.currentcal.down[0][vm.selectedEventId].rec.start = new Date();
    529601               }
    530                //pushes all changes to other recurs
     602               //pushes all changes to other existing recurs and creates new downtimes where needed
    531603               $scope.pushRecurChanges = function (recid) {
    532604                   ngDialog.openConfirm({
     
    539611                       plain: true
    540612                   }).then(function (success) {
     613
    541614                       var arr = vm.treeview.currentNode.calendar.down[0];
     615                       //Deep copy of downtime for referencing
    542616                       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
    544619                           if (arr[i].rec.recid === recid) {
    545620                               if (new Date(arr[i].start) < new Date(ob.rec.start) ||
    546621                                        new Date(arr[i].end) > new Date(ob.rec.end) ||
    547622                                        !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
    549626                                   vm.selectedEventId = -1;
    550627
    551628                               }
    552629                               else {
    553 
     630                                   //Edit downtime when it is within the bounds
    554631                                   arr[i].start.setHours(ob.start.getHours(), ob.start.getMinutes());
    555632                                   arr[i].end.setHours(ob.end.getHours(), ob.end.getMinutes());
     
    564641                               i++;
    565642                       }
     643                       //init for new downtimes.
    566644                       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
    568646                       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
    572650                           for (var d = (start.getTime()) ; d < (end.getTime()) ;) {
    573651                               var tog = ob.rec.days[new Date(d).getDay()];
     652                               //Check if day of the week is included in recursion
    574653                               if (tog) {
    575                                    loop2:
     654                                   loop2://Loop checking existing downtime array to see if day is already filled or not
    576655                                       for (var i = 0; i < arr.length; i++) {
    577656
     
    580659                                               if (arr[i].start.getTime() >= d &&
    581660                                                   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
    584663                                               }
    585664                                           }
    586665                                       }
    587 
     666                                   //Made it here = new event needed: init
    588667                                   var ts = new Date(d);
    589668                                   ts.setHours(new Date(ob.start).getHours(), new Date(ob.start).getMinutes());
     
    602681                               }
    603682
    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
    609690               $scope.deleteAllRecurrences = function (recid) {
    610691                   ngDialog.openConfirm({
     
    627708               }
    628709
     710               //Moves calendar to selected date
    629711               $scope.goToDate = function () {
    630712                   $("#resourcecalendar").fullCalendar('gotoDate', vm.currentcal.down[0][vm.selectedEventId].start);
    631713               }
    632                /* Render Tooltip */
     714               /* Renders Tooltip */
    633715               $scope.eventRender = function (event, element, view) {
    634716                   element.attr({
     
    638720                   //$compile(element)($scope);
    639721               };
    640                /* config object */
     722               //Calendar configuration
    641723               $scope.uiConfig = {
    642724                   calendar: {
     
    663745               };
    664746
    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               
    681748
    682749
    683750
    684751           }).filter('disp', function () {
    685                return function (input) {
     752               return function (input) {//Filter boolean to string
    686753                   return input ? 'Disposable' : 'Not disposable';
    687754               }
    688755           }).directive('animateOnChange', function ($timeout) {
    689                return function (scope, element, attr) {
     756               return function (scope, element, attr) {//Animation on downtime info to show change
    690757                   scope.$watch(attr.animateOnChange, function (nv, ov) {
    691758
     
    695762                               $timeout(function () {
    696763                                   element.removeClass('changed');
    697                                }, 250); // Could be enhanced to take duration as a parameter
     764                               }, 250);
    698765                           }
    699766                           else {
     
    701768                               $timeout(function () {
    702769                                   element.removeClass('changedshut');
    703                                }, 250); // Could be enhanced to take duration as a parameter
     770                               }, 250);
    704771                           }
    705772                       }
  • 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))}});
     1function 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>")}});
     1function 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.