Changeset 13844
- Timestamp:
- 05/11/16 16:50:29 (9 years ago)
- 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 70 70 { 71 71 loader(); 72 bool change = false; 73 string name = ""; 72 74 HiveTask current = fileopener.Job.HiveTasks.ToList()[0]; 73 75 if (arr.Length == 0) 74 76 {//check if upper job 75 77 current.ItemTask.ComputeInParallel = !current.ItemTask.ComputeInParallel; 76 78 change = current.ItemTask.ComputeInParallel; 79 name = current.ItemTask.Name; 77 80 } 78 81 else … … 87 90 { 88 91 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; 89 94 } 90 95 else if (current.ItemTask.Item is Experiment) 91 96 { 92 97 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; 93 100 } 94 101 … … 103 110 } 104 111 } 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); 106 116 } 107 117 public void changeName(int[][] arr, string name, int idname) … … 111 121 { 112 122 loader(); 113 123 string old = ""; 114 124 HiveTask current = fileopener.Job.HiveTasks.ToList()[0]; 115 125 if (arr.Length == 0) 116 126 {//check if upper job 127 old = current.ItemTask.Name; 117 128 current.ItemTask.Name = name; 118 129 … … 126 137 if (current.ItemTask.Item is BatchRun) 127 138 { 139 old = current.ChildHiveTasks[arr[i][1]].ItemTask.Name; 128 140 current.ChildHiveTasks[arr[i][1]].ItemTask.Name = name; 129 141 } 130 142 else if (current.ItemTask.Item is Experiment) 131 143 { 144 old = current.ChildHiveTasks[arr[i][0]].ItemTask.Name; 132 145 current.ChildHiveTasks[arr[i][0]].ItemTask.Name = name; 133 146 } … … 144 157 } 145 158 Clients.Caller.processName(name, idname); 159 Clients.Caller.saveComplete( old + " renamed to " + name); 146 160 } 147 161 } … … 183 197 } 184 198 } 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); 186 203 187 204 } … … 196 213 public void ChangePriority(int[][] arr, int prior) 197 214 { 215 string name = ""; 198 216 loader(); 199 217 HiveTask current = fileopener.Job.HiveTasks.ToList()[0]; … … 201 219 {//check if upper job 202 220 current.Task.Priority = prior; 203 221 name = current.ItemTask.Name; 204 222 } 205 223 else … … 214 232 { 215 233 current.ChildHiveTasks[arr[i][1]].Task.Priority = prior; 234 name = current.ChildHiveTasks[arr[i][0]].ItemTask.Name; 216 235 } 217 236 else if (current.ItemTask.Item is Experiment) 218 237 { 219 238 current.ChildHiveTasks[arr[i][0]].Task.Priority = prior; 239 name = current.ChildHiveTasks[arr[i][0]].ItemTask.Name; 220 240 } 221 241 … … 230 250 } 231 251 } 252 Clients.Caller.saveComplete("Priority changed for " + name); 232 253 } 233 254 /// <summary> … … 356 377 alg.Parameters[name].ActualValue = (IItem)val; 357 378 } 379 Clients.Caller.saveComplete("Parameter saved for " + name); 358 380 } 359 381 catch (NullReferenceException e) … … 367 389 catch (NotSupportedException e) 368 390 { 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"); 370 392 } 371 393 } 372 394 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"); 374 396 375 397 -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Scripts/Hubs/ProgressHubber.js
r13841 r13844 2 2 3 3 $(function () { 4 // $.connection.hub.logging = true; 4 // $.connection.hub.logging = true; 5 $("#success-alert").hide(); 6 5 7 var v = document.getElementById("userId").innerHTML; 6 8 console.log(v); … … 27 29 28 30 }; 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 }); 35 38 } 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'>×</span> </button> " + text + "</div>" + $("#logs").html()); 38 43 } 39 44 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"); 41 46 } 42 47 }); -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/AccessAdministrationClient.cs
r13805 r13844 28 28 using HeuristicLab.Clients.Hive.WebJobManager.Services; 29 29 using System.Collections.Generic; 30 using System.ServiceModel.Security; 30 31 31 32 namespace HeuristicLab.Clients.Access.Administration … … 58 59 weblog = WebLoginService.Instance; 59 60 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; 60 82 } 61 83 -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/OpenFile.cshtml
r13841 r13844 153 153 154 154 <!-- Progress--> 155 155 156 156 <h4 id="result" style="display:none">Start uploading experiment...</h4> 157 157 <div class="progress" id="progdiv" style="display:none"> … … 168 168 <p style="text-align:center;font-style:italic">Changed parameters get saved but child distribution and task priority get lost in the process.</p> 169 169 <form asp-controller="Job" 170 asp-action="saveToFile"170 asp-action="saveToFile" 171 171 method="post"> 172 172 <div class="col-sm-6" … … 191 191 <h5>Directory: /HiveChanged</h5> 192 192 </div> 193 <button class="btn btn-success btn-block" type="submit" 193 <button class="btn btn-success btn-block" type="submit" 194 194 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); 195 195 text-shadow:2px 2px black;"> 196 Save to file</button> 196 Save to file 197 </button> 197 198 </form> 198 199 </div> … … 202 203 </div> 203 204 <!-- Side scrolling menu--> 204 <nav 205 class="col-md-2" id="scrolly"> 205 <nav class="col-md-2" id="scrolly"> 206 206 <ul class="nav nav-pills nav-stacked" 207 207 data-spy="affix" … … 219 219 <li><a onclick="shower()" href="#tasks"><i class="fa fa-eye"></i> Show all tasks</a></li> 220 220 <li><a onclick="collapser()" href="#tasks"><i class="fa fa-eye-slash"></i> Hide all tasks</a></li> 221 221 222 222 } 223 223 <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> 224 232 </ul> 233 225 234 </nav> 226 235 227 236 <script src="~/js/hubs/progresshubber.js"></script> 228 237 229 238 <script> 230 239 showScrolly = function () { … … 246 255 }); 247 256 $('body').click(function () { 248 if ($("#ctasks").length > 0) 257 if ($("#ctasks").length > 0) 249 258 $("#ctasks").html("<i class='fa fa-sitemap'></i> Tasks (" + $('a[href^="#collapseExample"]').length + ")"); 250 259 }); 251 260 $('body').click(); 252 261 253 262 }); 254 263 collapser = function () { -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/OpenFilePartials/_BatchRun.cshtml
r13841 r13844 26 26 <h4 id="tasks"> 27 27 Repeats: 28 <input type="number" 28 <input type="number" 29 29 class="form-control" 30 30 style="width:80px;display:initial" 31 min="1" 31 min="1" 32 32 value="@Model.SelectedBatchRun.Repetitions" 33 33 onchange="changeRepit([],this.value,@randy)" /> 34 34 x 35 35 36 36 </h4> … … 45 45 </p> 46 46 <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) 50 49 { 51 50 @Html.Partial("OpenFilePartials/_AlgorithmSmall", 52 51 new HeuristicLab.Clients.Hive.WebJobManager.Models.AlgorithmContainer( 53 52 ((HeuristicLab.Optimization.IAlgorithm)Model.SelectedBatchRun.Optimizer), 54 53 new List<int[]>(), 55 new int[] { 0, k},54 new int[] { 0, 0 }, 56 55 randomizer)); 57 56 … … 59 58 else if (Model.SelectedBatchRun.Optimizer is HeuristicLab.Optimization.BatchRun) 60 59 { 61 60 @Html.Partial("OpenFilePartials/_BatchRunSmall", 62 61 new HeuristicLab.Clients.Hive.WebJobManager.Models.BatchRunContainer( 63 62 ((HeuristicLab.Optimization.BatchRun)Model.SelectedBatchRun.Optimizer), 64 63 new List<int[]>(), 65 new int[] { 0, k},64 new int[] { 0, 0 }, 66 65 randomizer)); 67 66 … … 69 68 else if (Model.SelectedBatchRun.Optimizer is HeuristicLab.Optimization.Experiment) 70 69 { 71 70 @Html.Partial("OpenFilePartials/_ExperimentSmall", 72 71 new HeuristicLab.Clients.Hive.WebJobManager.Models.ExperimentContainer( 73 72 ((HeuristicLab.Optimization.Experiment)Model.SelectedBatchRun.Optimizer), 74 73 new List<int[]>(), 75 new int[] { 0, k},74 new int[] { 0, 0 }, 76 75 randomizer)); 77 76 78 77 } 79 } 78 80 79 </div> 81 80 </div> -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/OpenFilePartials/_BatchRunSmall.cshtml
r13841 r13844 18 18 aria-expanded="false" 19 19 aria-controls="collapseExample@(randombr)" 20 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); 21 21 text-shadow:2px 2px black;"> 22 22 @Model.batch.Name … … 24 24 25 25 </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" 32 30 style="width:100%" /> 33 31 34 <div class="panel panel-warning" 32 <div class="panel panel-warning" 35 33 style="border-color:#f6cd94!important; border-width:2px!important; 36 34 box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); … … 57 55 58 56 Distribute child tasks 59 <input type="checkbox" 60 checked 61 data-toggle="toggle" 57 <input type="checkbox" 58 checked 59 data-toggle="toggle" 62 60 data-onstyle="warning" 63 61 onchange="toggleChild(@builder, @randombr)" /> 64 62 65 63 66 64 </p> 67 <div class="btn-group" 65 <div class="btn-group" 68 66 style="text-shadow:none"> 69 67 … … 72 70 class="btn btn-info dropdown-toggle" 73 71 data-toggle="dropdown" 74 aria-haspopup="true" 72 aria-haspopup="true" 75 73 aria-expanded="false"> 76 74 Normal <span class="caret"></span> … … 85 83 </div> 86 84 <div id="childs@(randombr)"> 87 @ for (var k = 0; k < Model.batch.Repetitions; k++)85 @if (Model.batch.Optimizer is HeuristicLab.Optimization.IAlgorithm) 88 86 { 89 @if (Model.batch.Optimizer is HeuristicLab.Optimization.IAlgorithm) 90 { 91 @Html.Partial("OpenFilePartials/_AlgorithmSmall", 87 @Html.Partial("OpenFilePartials/_AlgorithmSmall", 92 88 new HeuristicLab.Clients.Hive.WebJobManager.Models.AlgorithmContainer( 93 89 ((HeuristicLab.Optimization.IAlgorithm)Model.batch.Optimizer), 94 90 Model.depth.ToList(), 95 new int[] { 0, k},91 new int[] { 0, 0 }, 96 92 Model.randy)) 97 93 98 99 100 101 94 } 95 else if (Model.batch.Optimizer is HeuristicLab.Optimization.BatchRun) 96 { 97 @Html.Partial("OpenFilePartials/_BatchRunSmall", 102 98 new HeuristicLab.Clients.Hive.WebJobManager.Models.BatchRunContainer( 103 99 ((HeuristicLab.Optimization.BatchRun)Model.batch.Optimizer), 104 100 Model.depth.ToList(), 105 new int[] { 0, k},101 new int[] { 0, 0 }, 106 102 Model.randy)) ; 107 103 108 109 110 111 104 } 105 else if (Model.batch.Optimizer is HeuristicLab.Optimization.Experiment) 106 { 107 @Html.Partial("OpenFilePartials/_ExperimentSmall", 112 108 new HeuristicLab.Clients.Hive.WebJobManager.Models.ExperimentContainer( 113 109 ((HeuristicLab.Optimization.Experiment)Model.batch.Optimizer), 114 110 Model.depth.ToList(), 115 new int[] { 0, k},111 new int[] { 0, 0 }, 116 112 Model.randy)) ; 117 113 118 }119 114 } 115 120 116 </div> 121 117 </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")}});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(){$("#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'>×</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.