Changeset 13871
- Timestamp:
- 06/02/16 12:35:30 (8 years ago)
- Location:
- branches/WebJobManager
- Files:
-
- 5 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/OkbManagementController.cs
r13862 r13871 2 2 using HeuristicLab.Clients.Hive.WebJobManager.Services.Imports; 3 3 using HeuristicLab.Clients.Hive.WebJobManager.ViewModels; 4 using HeuristicLab.Common; 5 using HeuristicLab.Optimization; 4 6 using Microsoft.AspNetCore.Http; 5 7 using Microsoft.AspNetCore.Mvc; 6 8 using System; 9 using System.Collections.Generic; 10 using System.IO; 11 using System.Threading.Tasks; 7 12 8 13 namespace HeuristicLab.Clients.Hive.WebJobManager.Controllers 9 14 { 10 public class OkbManagementController : Controller15 public class OkbManagementController : Controller 11 16 { 12 17 private OkbManagementVM vm; 13 18 private WebLoginService weblog; 14 19 private Guid userId; 15 20 16 21 private bool init() 17 22 { … … 26 31 userId = Guid.Parse(u); 27 32 vm = new OkbManagementVM(weblog.getCurrentUser(userId), weblog.getOkbAdminClient(userId)); 28 if(vm.client != null) 33 if (vm.client != null) 34 { 35 vm.client.Refresh(); 29 36 return true; 37 } 30 38 } 31 39 return false; … … 46 54 } 47 55 } 56 57 [HttpPost] 58 public async Task<IActionResult> Uploader(ICollection<IFormFile> fileupl, string name, int id) 59 { 60 if (init()) 61 { 62 try 63 { 64 byte[] data = null; 65 foreach (var file in fileupl) 66 { 67 if (file.Length > 0) 68 { 69 using (var fileStream = file.OpenReadStream()) 70 using (var ms = new MemoryStream()) 71 { 72 fileStream.CopyTo(ms); 73 data = ms.ToArray(); 74 // act on the Base64 data 75 } 76 } 77 } 78 var deser = PersistenceUtil.Deserialize<IOptimizer>(data); 79 OKB.Administration.IOKBItem obj = null; 80 if (name == "Algorithms" && deser is IAlgorithm) 81 { 82 vm.client.UpdateAlgorithmData((long)id, PersistenceUtil.Serialize(deser)); 83 vm.message = "Upload has been completed, the file is now set as the new algorithm for " + vm.client.Algorithms.Find(x => x.Id == id).Name; 84 obj = vm.client.Algorithms.Find(x => x.Id == id); 85 ((OKB.Administration.Algorithm)obj).DataTypeName = deser.GetType().Name; 86 ((OKB.Administration.Algorithm)obj).DataTypeTypeName = deser.GetType().AssemblyQualifiedName; 87 } 88 else if (name == "Problems" && deser is IProblem) 89 { 90 vm.client.UpdateProblemData((long)id, PersistenceUtil.Serialize(deser)); 91 vm.message = "Upload has been completed, the file is now set as the new problem for " + vm.client.Problems.Find(x => x.Id == id).Name; 92 obj = vm.client.Problems.Find(x => x.Id == id); 93 ((OKB.Administration.Problem)obj).DataTypeName = deser.GetType().Name; 94 ((OKB.Administration.Problem)obj).DataTypeTypeName = deser.GetType().AssemblyQualifiedName; 95 } 96 else 97 { 98 throw new Exception(); 99 } 100 101 vm.client.Store(obj); 102 ViewBag.Title = "Upload complete - OKB Management"; 103 ViewBag.Success = true; 104 105 } 106 catch (Exception e) 107 { 108 109 vm.message = "Upload failed, please try again."; 110 ViewBag.Success = false; 111 ViewBag.Title = "Upload failed - OKB Management"; 112 113 } 114 ViewBag.SessionId = HttpContext.Session.GetString("UserId"); 115 vm.client.Refresh(); 116 return View("Index", vm); 117 } 118 else 119 { 120 return RedirectToAction("Index", "Query"); 121 } 122 } 48 123 } 49 124 } -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/HeuristicLab.Clients.Hive.WebJobManager.xproj.user
r13860 r13871 4 4 <ActiveDebugProfile>RC1toRC2</ActiveDebugProfile> 5 5 <ShowAllFiles>true</ShowAllFiles> 6 <NameOfLastUsedPublishProfile>HLHiveWeb - Web Deploy</NameOfLastUsedPublishProfile> 6 7 </PropertyGroup> 7 8 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Hubs/OkbManagerHub.cs
r13862 r13871 1 1 using HeuristicLab.Clients.Hive.WebJobManager.Services; 2 2 using HeuristicLab.Clients.Hive.WebJobManager.Services.Imports; 3 using HeuristicLab.Clients.OKB.Administration; 3 4 using Microsoft.AspNetCore.SignalR; 5 using Newtonsoft.Json; 6 using Newtonsoft.Json.Linq; 4 7 using System; 5 8 using System.Collections.Generic; … … 31 34 } 32 35 } 36 public void Save(string json, string name) 37 { 38 loader(); 39 JObject obj = JObject.Parse(json); 40 NamedOKBItem tostore = null; 41 Type objtype = null; 42 int id = ((int)obj.GetValue("Id")); 43 switch (name) 44 { 45 case "Algorithms": 46 objtype = typeof(Algorithm); 47 if (id != -1) 48 tostore = adminclient.Algorithms.Find(x => x.Id == id); 49 else 50 tostore = new Algorithm(); 51 break; 52 case "Platforms": 53 objtype = typeof(Platform); 54 if (id != -1) 55 tostore = adminclient.Platforms.Find(x => x.Id == id); 56 else 57 tostore = new Platform(); 58 break; 59 case "Algorithm classes": 60 objtype = typeof(AlgorithmClass); 61 if (id != -1) 62 tostore = adminclient.AlgorithmClasses.Find(x => x.Id == id); 63 else 64 tostore = new AlgorithmClass(); 65 break; 66 case "Problem classes": 67 objtype = typeof(ProblemClass); 68 if (id != -1) 69 tostore = adminclient.ProblemClasses.Find(x => x.Id == id); 70 else 71 tostore = new ProblemClass(); 72 break; 73 case "Problems": 74 objtype = typeof(Problem); 75 if (id != -1) 76 tostore = adminclient.Problems.Find(x => x.Id == id); 77 else 78 tostore = new Problem(); 79 break; 80 } 81 tostore.Name = obj.GetValue("Name").ToString(); 82 tostore.Description = obj.GetValue("Description").ToString(); 83 if (objtype == typeof(Algorithm)) 84 { 85 ((Algorithm)tostore).PlatformId = ((int)obj.GetValue("PlatformId")); 86 ((Algorithm)tostore).AlgorithmClassId = ((int)obj.GetValue("AlgorithmClassId")); 87 88 } 89 else if (objtype == typeof(Problem)) 90 { 91 ((Problem)tostore).PlatformId = ((int)obj.GetValue("PlatformId")); 92 ((Problem)tostore).ProblemClassId = ((int)obj.GetValue("ProblemClassId")); 93 } 94 adminclient.Store(tostore); 95 Clients.Caller.saveComplete("Succesfully saved"); 96 refresh(name); 97 } 98 99 public void Delete(string id, string name) 100 { 101 loader(); 102 IOKBItem todel = null; 103 int todelid = int.Parse(id); 104 switch (name) 105 { 106 case "Algorithms": 107 todel = adminclient.Algorithms.Find(x => x.Id == todelid); 108 break; 109 case "Platforms": 110 todel = adminclient.Platforms.Find(x => x.Id == todelid); 111 break; 112 case "Algorithm classes": 113 todel = adminclient.AlgorithmClasses.Find(x => x.Id == todelid); 114 break; 115 case "Problem classes": 116 todel = adminclient.ProblemClasses.Find(x => x.Id == todelid); 117 break; 118 case "Problems": 119 todel = adminclient.Problems.Find(x => x.Id == todelid); 120 break; 121 } 122 adminclient.Delete(todel); 123 Clients.Caller.deleteComplete("Succesfully deleted"); 124 refresh(name); 125 } 126 private void refresh(string name) 127 { 128 adminclient.Refresh(); 129 switch (name) 130 { 131 case "Algorithms": 132 Clients.Caller.refreshData("algos", JsonConvert.SerializeObject(adminclient.Algorithms)); 133 break; 134 case "Platforms": 135 Clients.Caller.refreshData("platforms", JsonConvert.SerializeObject(adminclient.Platforms)); 136 break; 137 case "Algorithm classes": 138 Clients.Caller.refreshData("algoclass", JsonConvert.SerializeObject(adminclient.AlgorithmClasses)); 139 break; 140 case "Problem classes": 141 Clients.Caller.refreshData("probclass", JsonConvert.SerializeObject(adminclient.ProblemClasses)); 142 break; 143 case "Problems": 144 Clients.Caller.refreshData("problems", JsonConvert.SerializeObject(adminclient.Problems)); 145 break; 146 } 147 } 33 148 } 34 149 } -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Scripts/Hubs/OkbManagerHubber.js
r13862 r13871 22 22 var vm = $scope; 23 23 var hubber = $.connection.okbManagerHub; 24 vm.currentData = {'name' : '', 'data' : null} 24 $("#success-alert").hide(); 25 26 vm.currentData = {'name' : '','type': '' , 'data' : null} 25 27 26 28 vm.init = function () { … … 29 31 $.connection.hub.qs = { 'userid': uid }; 30 32 //Connection string set to identify the unique session ID for the user 31 $.connection.hub.start().done(function () { 32 // hubber.server.requestInfo();//initial data request 33 }); 34 hubber.client.processData = function (filters) { 35 33 $.connection.hub.start().done(); 34 hubber.client.deleteComplete = function (text) { 35 vm.notify(text); 36 $scope.$apply(); 36 37 }; 38 hubber.client.saveComplete = function (text) { 39 vm.notify(text); 40 $scope.$apply(); 41 } 42 hubber.client.refreshData = function ( name, json) { 43 vm.initData(JSON.parse(json), name); 44 vm.selectDataCat(name); 45 $scope.$apply(); 46 } 37 47 38 48 } … … 41 51 switch (name) { 42 52 case "platforms": 43 vm.platforms = {'selected' : null, 'arr' : coll} 53 vm.platforms = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 54 vm.platforms.selected = vm.platforms.new; 44 55 break; 45 56 case "algoclass": 46 vm.algoclass = { 'selected': null, 'arr': coll } 57 vm.algoclass = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 58 vm.algoclass.selected = vm.algoclass.new; 47 59 break; 48 60 case "algos": 49 vm.algos = { 'selected': null, 'arr': coll } 61 vm.algos = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 62 vm.algos.selected = vm.algos.new; 50 63 break; 51 64 case "probclass": 52 vm.probclass = { 'selected': null, 'arr': coll } 65 vm.probclass = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 66 vm.probclass.selected = vm.probclass.new; 53 67 break; 54 68 case "problems": 55 vm.problems = { 'selected': null, 'arr': coll } 69 vm.problems = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 70 vm.problems.selected = vm.problems.new; 56 71 break; 57 72 … … 63 78 case "platforms": 64 79 vm.currentData.name = "Platforms"; 80 vm.currentData.type = "ND"; 65 81 vm.currentData.data = vm.platforms; 66 82 break; 67 83 case "algoclass": 68 84 vm.currentData.name = "Algorithm classes"; 85 vm.currentData.type = "ND"; 69 86 vm.currentData.data = vm.algoclass; 70 87 break; 71 88 case "algos": 72 89 vm.currentData.name = "Algorithms"; 90 vm.currentData.type = "ALG"; 73 91 vm.currentData.data = vm.algos; 74 92 break; 75 93 case "probclass": 76 94 vm.currentData.name = "Problem classes"; 95 vm.currentData.type = "ND"; 77 96 vm.currentData.data = vm.probclass; 78 97 break; 79 98 case "problems": 80 99 vm.currentData.name = "Problems"; 100 vm.currentData.type = "PROB" 81 101 vm.currentData.data = vm.problems; 82 102 break; … … 84 104 } 85 105 } 106 vm.selectDataMember = function (index) { 107 if (index === null) 108 vm.currentData.data.selected = vm.currentData.data.new; 109 else { 110 vm.currentData.data.selected = vm.currentData.data.arr[index]; 111 } 112 } 113 vm.saveCurrent = function () { 114 hubber.server.save(JSON.stringify(vm.currentData.data.selected), vm.currentData.name); 115 } 116 vm.deleteCurrent = function () { 117 hubber.server.delete(vm.currentData.data.selected.Id, vm.currentData.name); 118 } 119 vm.notify = function (text) { 120 $("#succText").html(text); 121 $("#success-alert").alert(); 122 $("#success-alert").fadeTo(2000, 500).slideUp(500, function () { 123 $("#success-alert").hide(); 124 }); 125 } 86 126 }); -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/OpenFile.cshtml
r13862 r13871 252 252 <li><a href="#finish"><i class="fa fa-flag-checkered"></i> Add to Hive or save to file</a></li> 253 253 <li style="position:fixed"> 254 <div class="alert alert-success" id="success-alert" >254 <div class="alert alert-success" id="success-alert" style="display:flex"> 255 255 <span id="succText"></span> 256 256 </div> -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/OkbManagement/Index.cshtml
r13862 r13871 4 4 <div id="userId" style="display:none">@ViewBag.SessionId</div> 5 5 <script src="~/js/hubs/okbmanagerhubber.js"></script> 6 <div ng-app="wjmokbmanager" ng-controller="okbmanangerCtrl" id="controllerdiv" class="animated fadeIn" >6 <div ng-app="wjmokbmanager" ng-controller="okbmanangerCtrl" id="controllerdiv" class="animated fadeIn" ng-init="init()"> 7 7 8 8 9 9 @Html.Partial("Navbar", new NavbarViewModel("OKBAdmin", Model.User)) 10 11 @Html.Partial("_ErrorMessage", Model.message) 10 @if (ViewBag.Success != null && ViewBag.Success) 11 { 12 13 @Html.Partial("_SuccessMessage", Model.message) 14 } 15 else 16 { 17 @Html.Partial("_ErrorMessage", Model.message) 18 19 } 20 12 21 13 22 <ul class="nav nav-pills nav-justified"> … … 15 24 <li role="presentation" 16 25 ng-class="{active: currentData.name === 'Platforms'}"> 17 18 19 26 <a ng-click="selectDataCat('platforms')" href=""> 27 Platforms 28 </a> 20 29 </li> 21 30 <li role="presentation" … … 40 49 ng-class="{active: currentData.name === 'Problems'}"> 41 50 <a ng-click="selectDataCat('problems')" href=""> 42 PlatformsProblems 43 </a> 44 </li> 45 51 Problems 52 </a> 53 </li> 46 54 </ul> 55 <div class="row animated fadeIn" style="padding:10px"> 56 <div class="col-sm-4" ng-if="currentData.name != ''" style="padding-left:15px"> 57 <div class="btn-group btn-group-justified btn-block" 58 role="group" style="margin-bottom:-4px"> 59 <a class="btn btn-info btn-lg disabled" 60 style="width:6%;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 61 text-shadow:2px 2px black;"> 62 <i class="fa fa-list"></i> {{currentData.name}} 63 </a> 64 <a class="btn btn-success" 65 ng-class="{active: currentData.data.selected.Id === -1}" 66 style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 67 text-shadow:2px 2px black;" 68 ng-click="selectDataMember(null)"> 69 <i class="fa fa-plus-circle"></i> 70 </a> 71 </div> 72 <div class="btn-group-vertical btn-block"> 73 <a class="btn btn-default" 74 ng-repeat="dat in currentData.data.arr track by $index" 75 ng-class="{active: currentData.data.selected.Id === dat.Id}" 76 style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); overflow:hidden" 77 ng-click="selectDataMember($index)"> 78 {{dat.Name}} 79 </a> 80 </div> 81 </div> 82 <!--NOTIFICATIONS--> 83 <div class="alert alert-success" id="success-alert" style="display:flex"> 84 <span id="succText"></span> 85 </div> 86 <!--Panel--> 87 <div class="col-sm-8 animated fadeIn" ng-if="currentData.name != ''" 88 id="content" 89 style="padding:5px; padding-left:10px;"> 90 <div class="panel panel-primary" 91 style="border-width:2px!important; 92 box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);"> 93 <div class="panel-heading" style="padding:15px"> 94 <!--Title for new algo class and problem class--> 95 <h1 ng-if="currentData.data.selected.Id === -1 && currentData.name.length > 11">Add new {{currentData.name.slice(0,-2) | lowercase}}</h1> 96 <!--Title for new others--> 97 <h1 ng-if="currentData.data.selected.Id === -1 && currentData.name.length < 11">Add new {{currentData.name.slice(0,-1) | lowercase}}</h1> 98 <!--Title for existing member--> 99 <h1 ng-if="currentData.data.selected.Id != -1"> {{currentData.data.selected.Name}}</h1> 100 </div> 101 <div class="panel-body" style="padding:10px"> 102 <div class="form-group" style="padding-bottom:30px"> 103 104 <label for="inpusername" 105 class="col-sm-3 control-label"> 106 Name 107 </label> 108 <div class="col-sm-8"> 109 <input type="text" 110 class="form-control" 111 id="inpusername" 112 name="inpusername" 113 placeholder="Name" 114 ng-model="currentData.data.selected.Name"> 115 </div> 116 </div> 117 <div class="form-group"> 118 119 <label for="inpdesc" 120 class="col-sm-3 control-label"> 121 Description 122 </label> 123 <div class="col-sm-8"> 124 <textarea style="resize:vertical" 125 class="form-control" 126 id="inpdesc" 127 name="inpdesc" 128 placeholder="Description" 129 ng-model="currentData.data.selected.Description"></textarea> 130 </div> 131 132 </div> 133 <!-- PLATFORM--> 134 <div class="form-group" 135 style="padding-top:30px" 136 ng-if="currentData.type != 'ND'"> 137 138 <label for="inpplat" 139 class="col-sm-3 control-label"> 140 Platform 141 </label> 142 <div class="col-sm-8"> 143 <select class="form-control" 144 id="inpplat" 145 name="inpplat" 146 ng-model="currentData.data.selected.PlatformId" 147 ng-options="plat.Id as plat.Name for plat in platforms.arr"></select> 148 </div> 149 150 </div> 151 <!--ALGO CLASS--> 152 <div class="form-group" 153 style="padding-top:30px" 154 ng-if="currentData.type === 'ALG'"> 155 <label for="inpplat" 156 class="col-sm-3 control-label"> 157 Algorithm Class 158 </label> 159 <div class="col-sm-8"> 160 <select class="form-control" 161 id="inpplat" 162 name="inpplat" 163 ng-model="currentData.data.selected.AlgorithmClassId" 164 ng-options="alg.Id as alg.Name for alg in algoclass.arr"></select> 165 </div> 166 167 </div> 168 <!--PROBLEM CLASS--> 169 <div class="form-group" 170 style="padding-top:30px" 171 ng-if="currentData.type === 'PROB'"> 172 <label for="inpplat" 173 class="col-sm-3 control-label"> 174 Problem Class 175 </label> 176 <div class="col-sm-8"> 177 <select class="form-control" 178 id="inpplat" 179 name="inpplat" 180 ng-model="currentData.data.selected.ProblemClassId" 181 ng-options="prob.Id as prob.Name for prob in probclass.arr"></select> 182 </div> 183 184 </div> 185 <!--DATA TYPE--> 186 187 </div> 188 <div class="panel-body" 189 ng-if="currentData.data.selected.Id != -1"> 190 <div class="row" ng-if="currentData.type != 'ND'" style="padding:20px;padding-top:0"> 191 <h3>Data type</h3> 192 <div class="form-group" 193 style="padding-top:10px"> 194 <label class="col-sm-3 control-label"> 195 Name 196 </label> 197 <div class="col-sm-8"> 198 <input type="text" 199 class="form-control" 200 disabled 201 ng-model="currentData.data.selected.DataTypeName"> 202 </div> 203 204 </div> 205 <div class="form-group" 206 style="padding-top:30px"> 207 <label class="col-sm-3 control-label"> 208 Type Name 209 </label> 210 <div class="col-sm-8"> 211 <input type="text" 212 class="form-control" 213 disabled 214 ng-model="currentData.data.selected.DataTypeTypeName"> 215 </div> 216 217 </div> 218 </div> 219 <form method="post" 220 asp-action="Uploader" 221 asp-controller="OkbManagement" enctype="multipart/form-data"> 222 <input onchange="printFile()" 223 type="file" 224 id="fileupl" 225 name="fileupl" 226 accept=".hl" 227 style="display:none" /> 228 <div onclick="firefilebutton()" 229 class="btn btn-info" 230 id="uplbutt" 231 style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 232 text-shadow:1px 1px black;"> 233 <i class="fa fa-folder-open-o"></i> Choose new file 234 </div> 235 236 <input type="submit" class="btn btn-primary" id="upl" disabled value="Upload" /> 237 <input type="text" 238 id="name" 239 name="name" 240 value="{{currentData.name }}" 241 style="display:none" /> 242 <input type="text" 243 id="id" 244 name="id" 245 value="{{currentData.data.selected.Id }}" 246 style="display:none" /> 247 <script type="text/javascript"> 248 function firefilebutton() { 249 document.getElementById("fileupl").click(); 250 251 252 } 253 function printFile() { 254 var files = document.getElementById("fileupl").files; 255 if (files.length > 0) { 256 document.getElementById("upl").disabled = false; 257 258 for (var i = 0; i < files.length; i++) { 259 document.getElementById("uplbutt").innerHTML = files[i].name + " selected"; 260 } 261 } 262 } 263 264 265 </script> 266 </form> 267 </div> 268 <div class="panel-footer" style="height:60px"> 269 <div class="col-sm-3"> 270 <a class="btn btn-success btn-block" 271 style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 272 text-shadow:2px 2px black;" 273 ng-if="currentData.data.selected.Id != -1" 274 ng-click="saveCurrent()"> 275 <i class="fa fa-save"></i> Save 276 </a> 277 <a class="btn btn-success btn-block" 278 style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 279 text-shadow:2px 2px black;" 280 ng-if="currentData.data.selected.Id === -1" 281 ng-click="saveCurrent()"> 282 <i class="fa fa-plus-circle"></i> Add 283 </a> 284 </div> 285 <div class="col-sm-offset-6 col-sm-3"> 286 <a class="btn btn-danger btn-block" 287 style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 288 text-shadow:2px 2px black;" 289 ng-if="currentData.data.selected.Id != -1" 290 ng-click="deleteCurrent()"> 291 <i class="fa fa-trash-o"></i> Delete 292 </a> 293 </div> 294 </div> 295 296 297 298 </div> 299 </div> 300 301 </div> 47 302 48 303 <script type="text/javascript"> -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Query/Index.cshtml
r13860 r13871 39 39 {{item.Label}} 40 40 </p> 41 <span ng-if="item.CompareType != 'HeuristicLab.Clients.OKB.Query.EqualityComparison'" >41 <span ng-if="item.CompareType != 'HeuristicLab.Clients.OKB.Query.EqualityComparison'" style="margin-left:10px"> 42 42 <select class="col-md-2" 43 43 name="comparisonSelect" … … 50 50 </option> 51 51 </select> 52 <select class="col-md-4 " ng-if="item.AvailableValues != undefined" name="Values" ng-model="item.Value">52 <select class="col-md-4 col-sm-10" ng-if="item.AvailableValues != undefined" name="Values" ng-model="item.Value" style="margin-left:10px"> 53 53 <option ng-repeat="val in item.AvailableValues" value="{{val}}">{{val}}</option> 54 54 </select> -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/hubs/okbmanagerhubber.js
r13862 r13871 22 22 var vm = $scope; 23 23 var hubber = $.connection.okbManagerHub; 24 vm.currentData = {'name' : '', 'data' : null} 24 $("#success-alert").hide(); 25 26 vm.currentData = {'name' : '','type': '' , 'data' : null} 25 27 26 28 vm.init = function () { … … 29 31 $.connection.hub.qs = { 'userid': uid }; 30 32 //Connection string set to identify the unique session ID for the user 31 $.connection.hub.start().done(function () { 32 // hubber.server.requestInfo();//initial data request 33 }); 34 hubber.client.processData = function (filters) { 35 33 $.connection.hub.start().done(); 34 hubber.client.deleteComplete = function (text) { 35 vm.notify(text); 36 $scope.$apply(); 36 37 }; 38 hubber.client.saveComplete = function (text) { 39 vm.notify(text); 40 $scope.$apply(); 41 } 42 hubber.client.refreshData = function ( name, json) { 43 vm.initData(JSON.parse(json), name); 44 vm.selectDataCat(name); 45 $scope.$apply(); 46 } 37 47 38 48 } … … 41 51 switch (name) { 42 52 case "platforms": 43 vm.platforms = {'selected' : null, 'arr' : coll} 53 vm.platforms = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 54 vm.platforms.selected = vm.platforms.new; 44 55 break; 45 56 case "algoclass": 46 vm.algoclass = { 'selected': null, 'arr': coll } 57 vm.algoclass = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 58 vm.algoclass.selected = vm.algoclass.new; 47 59 break; 48 60 case "algos": 49 vm.algos = { 'selected': null, 'arr': coll } 61 vm.algos = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 62 vm.algos.selected = vm.algos.new; 50 63 break; 51 64 case "probclass": 52 vm.probclass = { 'selected': null, 'arr': coll } 65 vm.probclass = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 66 vm.probclass.selected = vm.probclass.new; 53 67 break; 54 68 case "problems": 55 vm.problems = { 'selected': null, 'arr': coll } 69 vm.problems = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll } 70 vm.problems.selected = vm.problems.new; 56 71 break; 57 72 … … 63 78 case "platforms": 64 79 vm.currentData.name = "Platforms"; 80 vm.currentData.type = "ND"; 65 81 vm.currentData.data = vm.platforms; 66 82 break; 67 83 case "algoclass": 68 84 vm.currentData.name = "Algorithm classes"; 85 vm.currentData.type = "ND"; 69 86 vm.currentData.data = vm.algoclass; 70 87 break; 71 88 case "algos": 72 89 vm.currentData.name = "Algorithms"; 90 vm.currentData.type = "ALG"; 73 91 vm.currentData.data = vm.algos; 74 92 break; 75 93 case "probclass": 76 94 vm.currentData.name = "Problem classes"; 95 vm.currentData.type = "ND"; 77 96 vm.currentData.data = vm.probclass; 78 97 break; 79 98 case "problems": 80 99 vm.currentData.name = "Problems"; 100 vm.currentData.type = "PROB" 81 101 vm.currentData.data = vm.problems; 82 102 break; … … 84 104 } 85 105 } 106 vm.selectDataMember = function (index) { 107 if (index === null) 108 vm.currentData.data.selected = vm.currentData.data.new; 109 else { 110 vm.currentData.data.selected = vm.currentData.data.arr[index]; 111 } 112 } 113 vm.saveCurrent = function () { 114 hubber.server.save(JSON.stringify(vm.currentData.data.selected), vm.currentData.name); 115 } 116 vm.deleteCurrent = function () { 117 hubber.server.delete(vm.currentData.data.selected.Id, vm.currentData.name); 118 } 119 vm.notify = function (text) { 120 $("#succText").html(text); 121 $("#success-alert").alert(); 122 $("#success-alert").fadeTo(2000, 500).slideUp(500, function () { 123 $("#success-alert").hide(); 124 }); 125 } 86 126 }); -
branches/WebJobManager/HeuristicLab.Clients.Hive/3.3/Util/PersistenceUtil.cs
r12012 r13871 20 20 #endregion 21 21 22 using HeuristicLab.Persistence.Core; 23 using HeuristicLab.Persistence.Default.Xml; 22 24 using System; 23 25 using System.Collections.Generic; 24 26 using System.IO; 25 using HeuristicLab.Persistence.Core;26 using HeuristicLab.Persistence.Default.Xml;27 27 28 namespace HeuristicLab.Clients.Hive { 29 public static class PersistenceUtil { 30 public static byte[] Serialize(object obj, out IEnumerable<Type> types) { 31 using (MemoryStream memStream = new MemoryStream()) { 32 XmlGenerator.Serialize(obj, memStream, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, out types); 33 byte[] jobByteArray = memStream.ToArray(); 34 return jobByteArray; 35 } 28 namespace HeuristicLab.Clients.Hive 29 { 30 public static class PersistenceUtil 31 { 32 public static byte[] Serialize(object obj, out IEnumerable<Type> types) 33 { 34 using (MemoryStream memStream = new MemoryStream()) 35 { 36 XmlGenerator.Serialize(obj, memStream, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, out types); 37 byte[] jobByteArray = memStream.ToArray(); 38 return jobByteArray; 39 } 40 } 41 42 public static byte[] Serialize(object obj) 43 { 44 using (MemoryStream memStream = new MemoryStream()) 45 { 46 XmlGenerator.Serialize(obj, memStream); 47 byte[] jobByteArray = memStream.ToArray(); 48 return jobByteArray; 49 } 50 } 51 52 public static T Deserialize<T>(byte[] sjob) 53 { 54 using (MemoryStream memStream = new MemoryStream(sjob)) 55 { 56 T job = XmlParser.Deserialize<T>(memStream, CompressionType.Zip); 57 return job; 58 } 59 } 36 60 } 37 38 public static byte[] Serialize(object obj) {39 using (MemoryStream memStream = new MemoryStream()) {40 XmlGenerator.Serialize(obj, memStream);41 byte[] jobByteArray = memStream.ToArray();42 return jobByteArray;43 }44 }45 46 public static T Deserialize<T>(byte[] sjob) {47 using (MemoryStream memStream = new MemoryStream(sjob)) {48 T job = XmlParser.Deserialize<T>(memStream);49 return job;50 }51 }52 }53 61 }
Note: See TracChangeset
for help on using the changeset viewer.