Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13844


Ignore:
Timestamp:
05/11/16 16:50:29 (9 years ago)
Author:
jlodewyc
Message:

#2582 Optimizing open file view by cutting down batches to 1. Logging system in navbar. Start authenticationCheck

Location:
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Hubs/ProgressHub.cs

    r13841 r13844  
    7070        {
    7171            loader();
     72            bool change = false;
     73            string name = "";
    7274            HiveTask current = fileopener.Job.HiveTasks.ToList()[0];
    7375            if (arr.Length == 0)
    7476            {//check if upper job
    7577                current.ItemTask.ComputeInParallel = !current.ItemTask.ComputeInParallel;
    76 
     78                change = current.ItemTask.ComputeInParallel;
     79                name = current.ItemTask.Name;
    7780            }
    7881            else
     
    8790                        {
    8891                            current.ChildHiveTasks[arr[i][1]].ItemTask.ComputeInParallel = !current.ChildHiveTasks[arr[i][1]].ItemTask.ComputeInParallel;
     92                            change = current.ChildHiveTasks[arr[i][1]].ItemTask.ComputeInParallel;
     93                            name = current.ChildHiveTasks[arr[i][1]].ItemTask.Name;
    8994                        }
    9095                        else if (current.ItemTask.Item is Experiment)
    9196                        {
    9297                            current.ChildHiveTasks[arr[i][0]].ItemTask.ComputeInParallel = !current.ChildHiveTasks[arr[i][0]].ItemTask.ComputeInParallel;
     98                            change = current.ChildHiveTasks[arr[i][0]].ItemTask.ComputeInParallel;
     99                            name = current.ChildHiveTasks[arr[i][0]].ItemTask.Name;
    93100                        }
    94101
     
    103110                }
    104111            }
    105             Clients.Caller.processMessage("Connection Established");
     112            if (change)
     113                Clients.Caller.saveComplete("Child distribution activated for " + name);
     114            else
     115                Clients.Caller.saveComplete("Child distribution deactivated for " + name);
    106116        }
    107117        public void changeName(int[][] arr, string name, int idname)
     
    111121            {
    112122                loader();
    113 
     123                string old = "";
    114124                HiveTask current = fileopener.Job.HiveTasks.ToList()[0];
    115125                if (arr.Length == 0)
    116126                {//check if upper job
     127                    old = current.ItemTask.Name;
    117128                    current.ItemTask.Name = name;
    118129
     
    126137                            if (current.ItemTask.Item is BatchRun)
    127138                            {
     139                                old = current.ChildHiveTasks[arr[i][1]].ItemTask.Name;
    128140                                current.ChildHiveTasks[arr[i][1]].ItemTask.Name = name;
    129141                            }
    130142                            else if (current.ItemTask.Item is Experiment)
    131143                            {
     144                                old = current.ChildHiveTasks[arr[i][0]].ItemTask.Name;
    132145                                current.ChildHiveTasks[arr[i][0]].ItemTask.Name = name;
    133146                            }
     
    144157                }
    145158                Clients.Caller.processName(name, idname);
     159                Clients.Caller.saveComplete( old + " renamed to " + name);
    146160            }
    147161        }
     
    183197                }
    184198            }
    185             Clients.Caller.processRepit(Name, repit);
     199            if (Name == "failed")
     200                Clients.Caller.createAlert("Something went wrong while changing the repititions, please try again", "danger");
     201            else
     202                Clients.Caller.saveComplete("Repititions changed to "+repit+ " for " + Name);
    186203
    187204        }
     
    196213        public void ChangePriority(int[][] arr, int prior)
    197214        {
     215            string name = "";
    198216            loader();
    199217            HiveTask current = fileopener.Job.HiveTasks.ToList()[0];
     
    201219            {//check if upper job
    202220                current.Task.Priority = prior;
    203 
     221                name = current.ItemTask.Name;
    204222            }
    205223            else
     
    214232                        {
    215233                            current.ChildHiveTasks[arr[i][1]].Task.Priority = prior;
     234                            name = current.ChildHiveTasks[arr[i][0]].ItemTask.Name;
    216235                        }
    217236                        else if (current.ItemTask.Item is Experiment)
    218237                        {
    219238                            current.ChildHiveTasks[arr[i][0]].Task.Priority = prior;
     239                            name = current.ChildHiveTasks[arr[i][0]].ItemTask.Name;
    220240                        }
    221241
     
    230250                }
    231251            }
     252            Clients.Caller.saveComplete("Priority changed for " + name);
    232253        }
    233254        /// <summary>
     
    356377                            alg.Parameters[name].ActualValue = (IItem)val;
    357378                        }
     379                        Clients.Caller.saveComplete("Parameter saved for " + name);
    358380                    }
    359381                    catch (NullReferenceException e)
     
    367389                    catch (NotSupportedException e)
    368390                    {
    369                         Clients.Caller.dataNotSupported(name);
     391                        Clients.Caller.createAlert("Parameter " + name + " could not be changed for it is a fixed parameter. All changes done in this view are not saved to Hive.", "danger");
    370392                    }
    371393                }
    372394                else
    373                     Clients.Caller.formatWrong(name, type);
     395                    Clients.Caller.createAlert("Format wrong for " + name + " of type " + type + ". Make sure you follow the right format pattern.", "warning");
    374396
    375397
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Scripts/Hubs/ProgressHubber.js

    r13841 r13844  
    22
    33$(function () {
    4    // $.connection.hub.logging = true;
     4    // $.connection.hub.logging = true;
     5    $("#success-alert").hide();
     6
    57    var v = document.getElementById("userId").innerHTML;
    68    console.log(v);
     
    2729       
    2830    };
    29     hubber.client.processRepit = function (name, repit) {
    30         if (name === "failed") {
    31             window.alert("Something went wrong while changing the repititions, please try again")
    32         }
    33         else
    34             window.alert("Repititions for " + name + " has been changed to " + repit + ". These changes are not shown in the interface but happen directly after uploading or saving.");
     31   
     32    hubber.client.saveComplete = function (text) {
     33        $("#succText").html(text);
     34        $("#success-alert").alert();
     35        $("#success-alert").fadeTo(2000, 500).slideUp(500, function () {
     36            $("#success-alert").hide();
     37        });
    3538    }
    36     hubber.client.dataNotSupported = function (name) {
    37         window.alert("Parameter " + name + " could not be changed for it is a fixed parameter. All changes done in this view are not saved to Hive.");
     39    hubber.client.createAlert = function (text, type) {
     40        $("#logs").html(
     41           "<div class='alert alert-" + type + " alert-dismissible fade in' role='alert'> <button type='button' class='close' data-dismiss='alert' aria-label='Close'> " +
     42   "<span aria-hidden='true'>&times;</span> </button> " + text + "</div>" + $("#logs").html());
    3843    }
    3944    hubber.client.formatWrong = function (name, type) {
    40         window.alert("Parameter " + name + " could not be changed, the format for "+type+ " was wrong. Make sure you follow the example exactly. No changes made on Hive");
     45        addAlert("Format wrong for " + name + " of type " + type + ". Make sure you follow the right format pattern.", "warning");
    4146    }
    4247});
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/AccessAdministrationClient.cs

    r13805 r13844  
    2828using HeuristicLab.Clients.Hive.WebJobManager.Services;
    2929using System.Collections.Generic;
     30using System.ServiceModel.Security;
    3031
    3132namespace HeuristicLab.Clients.Access.Administration
     
    5859            weblog = WebLoginService.Instance;
    5960            userId = u;
     61        }
     62
     63        public bool checkAuthorised()
     64        {
     65            if (client != null)
     66            {
     67                try
     68                {
     69                    client.GetAllUsers();
     70                    return true;
     71                }
     72                catch (Exception e)
     73                {
     74                    if (e is MessageSecurityException || e is InvalidOperationException)
     75                    {
     76                        return false;
     77                    }
     78                    throw;
     79                }
     80            }
     81            return false;
    6082        }
    6183
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/OpenFile.cshtml

    r13841 r13844  
    153153
    154154                <!-- Progress-->
    155                
     155
    156156                <h4 id="result" style="display:none">Start uploading experiment...</h4>
    157157                <div class="progress" id="progdiv" style="display:none">
     
    168168                <p style="text-align:center;font-style:italic">Changed parameters get saved but child distribution and task priority get lost in the process.</p>
    169169                <form asp-controller="Job"
    170                    asp-action="saveToFile"
     170                      asp-action="saveToFile"
    171171                      method="post">
    172172                    <div class="col-sm-6"
     
    191191                        <h5>Directory: /HiveChanged</h5>
    192192                    </div>
    193                     <button class="btn btn-success btn-block" type="submit" 
     193                    <button class="btn btn-success btn-block" type="submit"
    194194                            style="margin:10px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    195195                            text-shadow:2px 2px black;">
    196                     Save to file</button>
     196                        Save to file
     197                    </button>
    197198                </form>
    198199            </div>
     
    202203    </div>
    203204    <!-- Side scrolling menu-->
    204     <nav
    205          class="col-md-2" id="scrolly">
     205    <nav class="col-md-2" id="scrolly">
    206206        <ul class="nav nav-pills nav-stacked"
    207207            data-spy="affix"
     
    219219                <li><a onclick="shower()" href="#tasks"><i class="fa fa-eye"></i> Show all tasks</a></li>
    220220                <li><a onclick="collapser()" href="#tasks"><i class="fa fa-eye-slash"></i> Hide all tasks</a></li>
    221                
     221
    222222            }
    223223            <li><a href="#finish"><i class="fa fa-flag-checkered"></i> Add to Hive or save to file</a></li>
     224            <li>
     225                <div class="alert alert-success" id="success-alert">
     226                    <span id="succText"></span>
     227                </div>
     228                <p id="logs">
     229                   
     230                </p>
     231            </li>
    224232        </ul>
     233
    225234    </nav>
    226235
    227236    <script src="~/js/hubs/progresshubber.js"></script>
    228    
     237
    229238    <script>
    230239        showScrolly = function () {
     
    246255            });
    247256            $('body').click(function () {
    248                 if ($("#ctasks").length > 0) 
     257                if ($("#ctasks").length > 0)
    249258                    $("#ctasks").html("<i class='fa fa-sitemap'></i> Tasks (" + $('a[href^="#collapseExample"]').length + ")");
    250259            });
    251260            $('body').click();
    252            
     261
    253262        });
    254263        collapser = function () {
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/OpenFilePartials/_BatchRun.cshtml

    r13841 r13844  
    2626    <h4 id="tasks">
    2727        Repeats:
    28         <input type="number" 
     28        <input type="number"
    2929               class="form-control"
    3030               style="width:80px;display:initial"
    31                min="1" 
     31               min="1"
    3232               value="@Model.SelectedBatchRun.Repetitions"
    3333               onchange="changeRepit([],this.value,@randy)" />
    34           x
     34        x
    3535
    3636    </h4>
     
    4545    </p>
    4646    <div id="childs@(randy)">
    47         @for (var k = 0; k < Model.SelectedBatchRun.Repetitions; k++)
    48         {
    49             @if (Model.SelectedBatchRun.Optimizer is HeuristicLab.Optimization.IAlgorithm)
     47
     48        @if (Model.SelectedBatchRun.Optimizer is HeuristicLab.Optimization.IAlgorithm)
    5049            {
    51                 @Html.Partial("OpenFilePartials/_AlgorithmSmall",
     50            @Html.Partial("OpenFilePartials/_AlgorithmSmall",
    5251                new HeuristicLab.Clients.Hive.WebJobManager.Models.AlgorithmContainer(
    5352                    ((HeuristicLab.Optimization.IAlgorithm)Model.SelectedBatchRun.Optimizer),
    5453                    new List<int[]>(),
    55                     new int[] { 0, k },
     54                    new int[] { 0, 0 },
    5655                    randomizer));
    5756
     
    5958            else if (Model.SelectedBatchRun.Optimizer is HeuristicLab.Optimization.BatchRun)
    6059            {
    61                 @Html.Partial("OpenFilePartials/_BatchRunSmall",
     60            @Html.Partial("OpenFilePartials/_BatchRunSmall",
    6261                new HeuristicLab.Clients.Hive.WebJobManager.Models.BatchRunContainer(
    6362                    ((HeuristicLab.Optimization.BatchRun)Model.SelectedBatchRun.Optimizer),
    6463                    new List<int[]>(),
    65                     new int[] { 0, k },
     64                    new int[] { 0, 0 },
    6665                    randomizer));
    6766
     
    6968            else if (Model.SelectedBatchRun.Optimizer is HeuristicLab.Optimization.Experiment)
    7069            {
    71                 @Html.Partial("OpenFilePartials/_ExperimentSmall",
     70            @Html.Partial("OpenFilePartials/_ExperimentSmall",
    7271                new HeuristicLab.Clients.Hive.WebJobManager.Models.ExperimentContainer(
    7372                    ((HeuristicLab.Optimization.Experiment)Model.SelectedBatchRun.Optimizer),
    7473                    new List<int[]>(),
    75                     new int[] { 0, k },
     74                    new int[] { 0, 0 },
    7675                    randomizer));
    7776
    7877            }
    79         }
     78
    8079    </div>
    8180</div>
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/OpenFilePartials/_BatchRunSmall.cshtml

    r13841 r13844  
    1818       aria-expanded="false"
    1919       aria-controls="collapseExample@(randombr)"
    20         style="margin:10px;margin-bottom:0; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
     20       style="margin:10px;margin-bottom:0; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    2121                            text-shadow:2px 2px black;">
    2222        @Model.batch.Name
     
    2424
    2525</p>
    26 <div class="collapse"
    27      id="collapseExample@(randombr)"
    28      style="margin-left:10px;margin-right:10px;margin-top:-10px "
    29      
    30      >
    31     <img src="~/img/accoladebatch.png"
     26<div class="collapse"
     27     id="collapseExample@(randombr)"
     28     style="margin-left:10px;margin-right:10px;margin-top:-10px ">
     29    <img src="~/img/accoladebatch.png"
    3230         style="width:100%" />
    3331
    34     <div class="panel panel-warning" 
     32    <div class="panel panel-warning"
    3533         style="border-color:#f6cd94!important; border-width:2px!important;
    3634            box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
     
    5755
    5856                Distribute child tasks
    59                 <input type="checkbox" 
    60                        checked 
    61                        data-toggle="toggle" 
     57                <input type="checkbox"
     58                       checked
     59                       data-toggle="toggle"
    6260                       data-onstyle="warning"
    6361                       onchange="toggleChild(@builder, @randombr)" />
    64                
     62
    6563
    6664            </p>
    67             <div class="btn-group" 
     65            <div class="btn-group"
    6866                 style="text-shadow:none">
    6967
     
    7270                        class="btn btn-info dropdown-toggle"
    7371                        data-toggle="dropdown"
    74                         aria-haspopup="true" 
     72                        aria-haspopup="true"
    7573                        aria-expanded="false">
    7674                    Normal <span class="caret"></span>
     
    8583        </div>
    8684        <div id="childs@(randombr)">
    87             @for (var k = 0; k < Model.batch.Repetitions; k++)
     85            @if (Model.batch.Optimizer is HeuristicLab.Optimization.IAlgorithm)
    8886            {
    89                 @if (Model.batch.Optimizer is HeuristicLab.Optimization.IAlgorithm)
    90                 {
    91                     @Html.Partial("OpenFilePartials/_AlgorithmSmall",
     87                @Html.Partial("OpenFilePartials/_AlgorithmSmall",
    9288                    new HeuristicLab.Clients.Hive.WebJobManager.Models.AlgorithmContainer(
    9389                        ((HeuristicLab.Optimization.IAlgorithm)Model.batch.Optimizer),
    9490                        Model.depth.ToList(),
    95                         new int[] { 0, k },
     91                        new int[] { 0, 0 },
    9692                        Model.randy))
    9793
    98                 }
    99                 else if (Model.batch.Optimizer is HeuristicLab.Optimization.BatchRun)
    100                 {
    101                     @Html.Partial("OpenFilePartials/_BatchRunSmall",
     94            }
     95            else if (Model.batch.Optimizer is HeuristicLab.Optimization.BatchRun)
     96            {
     97                @Html.Partial("OpenFilePartials/_BatchRunSmall",
    10298                    new HeuristicLab.Clients.Hive.WebJobManager.Models.BatchRunContainer(
    10399                        ((HeuristicLab.Optimization.BatchRun)Model.batch.Optimizer),
    104100                        Model.depth.ToList(),
    105                         new int[] { 0, k },
     101                        new int[] { 0, 0 },
    106102                        Model.randy)) ;
    107103
    108                 }
    109                 else if (Model.batch.Optimizer is HeuristicLab.Optimization.Experiment)
    110                 {
    111                     @Html.Partial("OpenFilePartials/_ExperimentSmall",
     104            }
     105            else if (Model.batch.Optimizer is HeuristicLab.Optimization.Experiment)
     106            {
     107                @Html.Partial("OpenFilePartials/_ExperimentSmall",
    112108                    new HeuristicLab.Clients.Hive.WebJobManager.Models.ExperimentContainer(
    113109                        ((HeuristicLab.Optimization.Experiment)Model.batch.Optimizer),
    114110                        Model.depth.ToList(),
    115                         new int[] { 0, k },
     111                        new int[] { 0, 0 },
    116112                        Model.randy)) ;
    117113
    118                 }
    119114            }
     115
    120116        </div>
    121117    </div>
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/hubs/progresshubber.js

    r13841 r13844  
    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(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 changeName(a,b,c){hubber.server.changeName(a,b,c)}function changeRepit(a,b){hubber.server.changeRepit(a,b)}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))},hubber.client.processName=function(a,b){$("#nameCarrier"+b).html(a)},hubber.client.processRepit=function(a,b){"failed"===a?window.alert("Something went wrong while changing the repititions, please try again"):window.alert("Repititions for "+a+" has been changed to "+b+". These changes are not shown in the interface but happen directly after uploading or saving.")},hubber.client.dataNotSupported=function(a){window.alert("Parameter "+a+" could not be changed for it is a fixed parameter. All changes done in this view are not saved to Hive.")},hubber.client.formatWrong=function(a,b){window.alert("Parameter "+a+" could not be changed, the format for "+b+" was wrong. Make sure you follow the example exactly. No changes made on Hive")}});
     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(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 changeName(a,b,c){hubber.server.changeName(a,b,c)}function changeRepit(a,b){hubber.server.changeRepit(a,b)}function paraEdit(a,b,c,d,e){hubber.server.paraEdit(a,b,c,d,e)}var hubber=$.connection.progressHub;$(function(){$("#success-alert").hide();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))},hubber.client.processName=function(a,b){$("#nameCarrier"+b).html(a)},hubber.client.saveComplete=function(a){$("#succText").html(a),$("#success-alert").alert(),$("#success-alert").fadeTo(2e3,500).slideUp(500,function(){$("#success-alert").hide()})},hubber.client.createAlert=function(a,b){$("#logs").html("<div class='alert alert-"+b+" alert-dismissible fade in' role='alert'> <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>&times;</span> </button> "+a+"</div>"+$("#logs").html())},hubber.client.formatWrong=function(a,b){addAlert("Format wrong for "+a+" of type "+b+". Make sure you follow the right format pattern.","warning")}});
Note: See TracChangeset for help on using the changeset viewer.