Changeset 11030 for branches/HiveStatistics
- Timestamp:
- 06/20/14 16:20:02 (10 years ago)
- Location:
- branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/AdminHelper.cshtml
r11020 r11030 37 37 } 38 38 39 @helper UserTaskStats(string destinationTag, string overallUrl, string userUrl, string userName, string start, string end)39 @helper UserTaskStats(string destinationTag, string url, string userName, string start, string end) 40 40 { 41 if (userName!="") {41 if (userName != "" || userName != null) { 42 42 <text> 43 43 $.ajax({ 44 url: "@(new HtmlString( overallUrl))?start=" + @start + "&end=" + @end, datatype: "json", success: function (overallResult) {44 url: "@(new HtmlString(url))?start=" + @start + "&end=" + @end, datatype: "json", success: function (overallResult) { 45 45 $.ajax({ 46 url: "@(new HtmlString(u serUrl))?userName=" + @userName + "&start=" + @start + "&end=" + @end, datatype: "json", success: function (userResult) {46 url: "@(new HtmlString(url))?start=" + @start + "&end=" + @end + "&userName=" + @userName, datatype: "json", success: function (userResult) { 47 47 $("#" + "@destinationTag").html(""); 48 48 for (var i = 0; i < userResult.length; i++) { 49 49 $("#" + "@destinationTag").append('<label class="barLabel">' + userResult[i].Key + '</label>'); 50 $("#" + "@destinationTag").append('<div class="outerBar"><div class="innerBar" id="InnerBar' + i + '"><p class="innerBarText">' + +userResult[i].Value.toFixed(4) + '</p></div><p class="outerBarText" id="OuterText' + i + '">' + +overallResult[i].toFixed(4) + '</p></div>'); 51 $("#InnerBar" + i).css('width',((userResult[i].Value/overallResult[i])*100).toFixed(2) + '%'); 52 $("#OuterText" + i).css('width',(98 - ((userResult[i].Value/overallResult[i])*100)).toFixed(2) + '%'); 50 $("#" + "@destinationTag").append('<div class="outerBar"><div class="innerBar" id="InnerBar' + i + '"><label class="innerBarText">' + +userResult[i].Value.toFixed(4) + '</label></div></div><label class="outerBarText" id="OuterText' + i + '">' + +overallResult[i].Value.toFixed(4) + '</label>'); 51 $("#InnerBar" + i).css('width',((userResult[i].Value/overallResult[i].Value)*100).toFixed(2) + '%'); 53 52 } 54 53 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ChartHelper.cshtml
r11020 r11030 110 110 } 111 111 112 @helper TasksForUser(string container, string destinationTag, string url, string userName, string startDate = null, string endDate = null) 113 { 114 <text> 115 $.ajax({url: "@(new HtmlString(url))?userName=" + @(userName) + "&start=" + @startDate + "&end=" + @endDate, datatype: "json", success: function(result) { 116 $("#@container").html(""); 117 if(result[0].length==0) { 112 @helper TasksForUser(string container, string destinationTag, string pageUrl, string taskUrl, string functionName, string userName, string limit, string startDate = null, string endDate = null, string jobId=null, string taskState=null, string pageNumber=null) 113 { 114 <text> 115 var GetRequest = "?userName=" + @(userName) + "&limit=" + @(limit); 116 @if(startDate!=null) { 117 @:if(@(startDate)!=null) { 118 @:GetRequest += "&start=" + @startDate; 119 @:} 120 } 121 @if(endDate!=null) { 122 @:if(@(endDate)!=null) { 123 @:GetRequest += "&end=" + @endDate; 124 @:} 125 } 126 @if(jobId!=null) { 127 @:if(@(jobId)!=null) { 128 @:GetRequest += "&jobId=" + @jobId; 129 @:} 130 } 131 @if(taskState!=null) { 132 @:if(@(taskState)!=null) { 133 @:GetRequest += "&taskState=" + @taskState; 134 @:} 135 } 136 $.ajax({async: false, url: "@(new HtmlString(pageUrl))" + GetRequest, datatype: "json", success: function(result) { 137 if(result > 1) { 138 $("#@container").append('<label class="pageTitle">Page: </label>') 139 for(var i=0; i < result; i++) { 140 $("#" + "@container").append('<a id="Page' + (i + 1) + '" class="page">' + (i + 1) + '</a>') 141 } 142 if(@pageNumber != null) { 143 $("#Page" + @pageNumber).css('color','#F7921D'); 144 } 145 else { 146 $("#Page1").css('color','#F7921D'); 147 } 148 } 149 }}); 150 @if(pageNumber!=null) { 151 @:if(@(pageNumber)!=null) { 152 @:GetRequest += "¤tPage=" + @pageNumber; 153 @:} 154 } 155 $.ajax({url: "@(new HtmlString(taskUrl))" + GetRequest, datatype: "json", success: function(result) { 156 if(result.Key.length==0) { 118 157 $("#@container").append( 119 '<section class="chartContainer"><h1 class="title">' + @userName + ' has no tasks for the given time period!</h1></section>'158 '<section class="chartContainer"><h1 class="title">' + @userName + ' has no tasks for the specified filters!</h1></section>' 120 159 ) 121 160 } … … 126 165 127 166 //Globally accesible, for use when resizing, eliminates extra DB request 128 window["numberTasks"] = result[0].length; 167 window["numberTasks"] = result.Key.length; 168 169 //Set display of all errors to none, errors matching the tasks will be reset below 170 $(".errorContainer, .errorTitle, .errorTask, .errorMessage").css('display','none'); 129 171 130 172 //For each result create a seperate collapsable section with a chart and info label 131 for(var i = 0; i < result [0].length; i++){173 for(var i = 0; i < result.Key.length; i++){ 132 174 $("#" + "@container").append( 133 '<section class="chartContainer"><h1 class="title" >Task ' + (i + 1)+134 '</h1><button class="collapse" onclick="collapseSection(this)"> -</button><div id="@(destinationTag)' + i +175 '<section class="chartContainer"><h1 class="title" id="' + result.Key[i] + '">Task ' + result.Key[i] + 176 '</h1><button class="collapse" onclick="collapseSection(this)">+</button><div id="@(destinationTag)' + i + 135 177 '"></div><label id="@(destinationTag)' + i + 'Info"></label></section>' 136 178 ) 137 waitTime = [result[0][i]]; 138 transferTime = [result[1][i]]; 139 runTime = [result[2][i]]; 179 $(".errorTask").each(function() { 180 if($(this).html()==result.Key[i]) { 181 $("#" + result.Key[i]).css("color","red"); 182 $("#" + result.Key[i]).append(" - ERROR"); 183 $(".errorContainer, .errorTitle, .underline").css('display','inline-block'); 184 $(this).css('display','inline-block'); 185 $(this).next().css('display','inline-block'); 186 } 187 }); 188 waitTime = [result.Value[0][i]]; 189 transferTime = [result.Value[1][i]]; 190 runTime = [result.Value[2][i]]; 140 191 window["@(destinationTag)Plot" + i] = $.jqplot("@destinationTag" + i, [waitTime,transferTime,runTime], { 141 //stackSeries: true,142 192 seriesDefaults:{ 143 193 renderer:$.jqplot.BarRenderer, 144 194 shadowAngle: 135, 145 //rendererOptions: {146 // barDirection: 'horizontal'147 //},148 195 pointLabels: {show: true, formatString: '%.3f'} 149 196 }, … … 176 223 $("#" + "@(destinationTag)" + i).bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data) { 177 224 $("#" + $(this).attr('id') + "Info").html(seriesDescriptions[seriesIndex] + ': ' + data[1]); 178 }); 225 }); 226 227 window["@(destinationTag)Plot" + i].replot({ resetAxes: true }); 228 229 $('#@destinationTag' + i).contextmenu(function() { 230 window["@(destinationTag)Plot" + i].resetZoom(); 231 window["@(destinationTag)Plot" + i].replot({ resetAxes: true }); 232 return false; 233 }); 234 235 collapsedByDefault(document.getElementById("@(destinationTag)" + i)); 179 236 } 180 237 }}); 238 239 $(".page").click(function () { 240 pageNumber = $(this).html(); 241 @(functionName)(); 242 }); 181 243 </text> 182 244 } … … 187 249 $(window).resize(function() { 188 250 for(var i = 0; i < numberTasks; i++) { 189 window[ "@(destinationTag)Plot" + i].replot({ resetAxes: true }); 251 $.each(window[ "@(destinationTag)Plot" + i].series, function(index, series) { 252 series.barWidth = undefined; 253 }); 254 window["@(destinationTag)Plot" + i].replot({ resetAxes: true }); 190 255 } 191 256 }); 192 257 </text> 193 258 } 194 195 @* OLD SMOOTHIE CHART FUNCTIONS *@196 @*@helper CreateSmoothieChart(string destinationTag, string stroke, string fill, string label)197 {198 <text>199 var @(destinationTag)Smoothie = new SmoothieChart({200 grid: {201 strokeStyle: '@stroke', fillStyle: '@fill',202 lineWidth: 1, millisPerLine: 450, verticalSections: 4,203 },204 labels: {205 fillStyle: '@label'206 }207 });208 209 var @(destinationTag)TimeSeries = new Array()210 </text>211 }212 213 @helper SetSmoothieCanvas(string destinationTag, string delay)214 {215 <text>216 @(destinationTag)Smoothie.streamTo(document.getElementById("@destinationTag"), @delay);217 </text>218 }219 220 @helper AssignTimeSeries(string seriesName, string destinationTag, string stroke, string fill)221 {222 <text>223 var @(seriesName)TS = new TimeSeries();224 @(destinationTag)Smoothie.addTimeSeries(@(seriesName)TS, { strokeStyle: '@stroke', fillStyle: '@fill', lineWidth: 3 });225 @(destinationTag)TimeSeries.push(@(seriesName)TS);226 </text>227 }228 229 @helper UpdateChartData(string destinationTag, string url)230 {231 <text>232 $.ajax({233 url: '@(url)', datatype: "json", success: function (result) {234 var i235 for (i = 0; i < @(destinationTag)TimeSeries.length; i++) {236 @(destinationTag)TimeSeries[i].append(new Date().getTime(), result[i]);237 }238 }239 });240 </text>241 }*@242 259 243 260 @helper SetStreamingProperties(int refresh, int chartLength, int upperY) { … … 376 393 </text> 377 394 } 378 379 @helper MakeCollapsable()380 {381 <text>382 $(document).ready(function() {383 $(".collapse").click(function () {384 if ($(this).html() == "-") {385 $(this).parent().children("canvas, div, fieldset, label").fadeOut();386 $(this).html("+");387 }388 else {389 $(this).parent().children("canvas, div, fieldset, label").fadeIn();390 $(this).html("-");391 }392 });393 });394 </text>395 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Content/Site.css
r11020 r11030 39 39 body > div { 40 40 max-width: 1000px; 41 min-width: 680px; 41 42 margin: 0 auto; 42 43 padding: 0; … … 44 45 border-radius: 8px; 45 46 box-shadow: 1px 1px 5px 1px rgba(0, 0, 0, 0.35); 47 } 48 49 #ui-datepicker-div { 50 min-width: 0px; 46 51 } 47 52 … … 61 66 } 62 67 68 /* Error container styles */ 69 .errorContainer { 70 width: 95%; 71 margin: 1% 0% 2% 2%; 72 -webkit-border-radius: 10px; 73 border-radius: 10px; 74 border: 3px solid #FF270A; 75 display: none; 76 } 77 78 .errorTitle { 79 width: 100%; 80 padding-left: 2%; 81 margin-bottom: 0%; 82 color: #FF5640; 83 font-size: 1.4em; 84 } 85 86 .errorTask, .errorMessage { 87 width: 40%; 88 margin: 0% 0% 1% 0%; 89 font-size: 1.3em; 90 color: #FF5640; 91 display: inline-block; 92 } 93 94 .errorTask { 95 margin-left: 2%; 96 } 97 98 a.errorTask { 99 cursor: pointer; 100 } 101 102 .underline { 103 text-decoration: underline; 104 margin-top: 1.5%; 105 } 106 107 #ScrollTop { 108 width: 40px; 109 height: 40px; 110 position: absolute; 111 right: 20px; 112 top: 20px; 113 background: none; 114 color: #F7921D; 115 -webkit-border-radius: 3px; 116 -moz-border-radius: 3px; 117 border-radius: 3px; 118 border: 2px solid #F7921D; 119 text-align: center; 120 font-size: 14pt; 121 display: none; 122 } 123 124 #ScrollTop:hover { 125 background-color: rgba(247,146,29,0.42); 126 } 127 63 128 /* Progress bar styles */ 64 129 .barLabel { … … 72 137 .outerBar { 73 138 height: 25px; 74 width: 80%;139 width: 75%; 75 140 margin-left: 10%; 76 141 border: 2px outset grey; 142 display: inline-block; 77 143 } 78 144 … … 109 175 110 176 .outerBarText { 111 text-align: right; 177 width: 5%; 178 text-align: left; 179 } 180 181 /* Tabular Diplay Styles */ 182 .tabButton { 183 margin: 3% 0% 0% 0%; 184 background: none; 185 color: #707070; 186 font-size: 1.4em; 187 -webkit-border-radius: 0 3px 0 0; 188 border-radius: 0 5px 0 0; 189 border: 1px solid #8297F5; 190 text-align: center; 191 z-index: 3; 192 } 193 194 .tabButton:hover { 195 background-color: #D1D9FF; 196 } 197 198 .tabButton:focus { 199 -webkit-border-radius: 0 3px 0 0; 200 border-radius: 0 5px 0 0; 201 border-bottom: 1px solid #FAFAFA; 202 } 203 204 .tabSection { 205 width: 90%; 206 padding: 1%; 207 margin: 0% 0% 3% 3%; 208 -webkit-border-radius: 0 15px 15px 15px; 209 border-radius: 0 15px 15px 15px; 210 -webkit-box-shadow: 5px 5px 3px #A3A3A2; 211 box-shadow: 5px 5px 3px #A3A3A2; 212 border: 1px solid #8297F5; 213 display: none; 214 } 215 216 .tabDataContainer { 217 width: 99%; 218 display: inline-block; 219 } 220 221 .taskOverview { 222 width: 70%; 223 } 224 225 .tabButton:first-of-type { 226 border-bottom: 1px solid #E0E6FF; 227 background-color: #E0E6FF; 228 margin-left: 3%; 229 } 230 231 .tabSection:first-of-type { 232 display: block; 233 } 234 235 /* Multi-page Task Styles */ 236 .pageTitle, .page { 237 margin-right: 1%; 238 font-size: 1.8em; 239 color: #6B6B6B; 240 } 241 242 .pageTitle { 243 margin-left: 2%; 244 } 245 246 .page { 247 text-decoration: underline; 248 cursor: pointer; 249 } 250 251 .page:hover { 252 color: #F7921D; 112 253 } 113 254 … … 316 457 } 317 458 /* User Page Styles*/ 318 # tasksContainer div[id^="Task"] {459 #TasksContainer div[id^="Task"] { 319 460 margin: 2% 0%; 320 461 } 321 462 322 # tasksContainer .jqplot-xaxis {463 #TasksContainer .jqplot-xaxis { 323 464 display: none; 324 465 } … … 330 471 } 331 472 332 #filters { 473 #FilterChoices { 474 width: 15%; 475 padding: 0% 2% 1% 2%; 476 vertical-align: top; 477 } 478 479 #FilterChoices label { 480 width: 75%; 481 } 482 483 #FilterChoices label:last-of-type { 484 width: 50%; 485 } 486 487 #FilterChoices input[type="checkbox"] { 488 margin: .4em; 489 } 490 491 #FilterChoices input[type="checkbox"], #FilterChoices label, #Filters label, #Filters input { 492 font-size: 1.5em; 493 display: inline-block; 494 } 495 496 #FilterChoices legend, #Filters legend { 497 font-size: 1.5em; 498 } 499 500 #Filters, #FilterChoices{ 333 501 margin: 2% 2% 3% 2%; 334 } 335 336 #filters legend, #filters label, #filters input { 337 font-size: 1.6em; 502 display: inline-block; 503 } 504 505 #Filters { 506 width: 71%; 507 margin: 2% 0% 2% 0%; 508 } 509 510 #TaskOverviewFilterFirst { 511 margin-top: 0%; 512 } 513 514 .filterContainer { 515 width: 28%; 516 margin: 0% 0% 1% 1%; 517 vertical-align: top; 518 display: none; 519 } 520 521 .filterContainer:first-of-type { 522 margin-left: 2%; 523 display: inline-block; 524 } 525 526 .filterContainer input, .filterContainer select, .filterContainer label { 527 width: 90%; 528 margin-left: 5%; 529 } 530 531 #Filters button{ 532 margin: 1% 0% 1% 2%; 533 display: block; 338 534 } 339 535 340 536 /* Admin Page Styles */ 341 [id$="OverviewButton"] { 342 margin: 3% 0% 0% 0%; 343 background: none; 344 color: #707070; 345 font-size: 1.4em; 346 -webkit-border-radius: 0 3px 0 0; 347 border-radius: 0 5px 0 0; 348 border: 1px solid #8297F5; 349 text-align: center; 350 z-index: 3; 351 } 352 353 #UserOverviewButton { 354 border-bottom: 1px solid #E0E6FF; 355 background-color: #E0E6FF; 356 margin-left: 3%; 357 } 358 359 [id$="OverviewButton"]:hover { 360 background-color: #D1D9FF; 361 } 362 363 [id$="OverviewButton"]:focus { 364 -webkit-border-radius: 0 3px 0 0; 365 border-radius: 0 5px 0 0; 366 border-bottom: 1px solid #FAFAFA; 367 } 368 369 [id$="OverviewTab"] { 370 width: 90%; 371 padding: 1%; 372 margin: 0% 0% 3% 3%; 373 -webkit-border-radius: 0 15px 15px 15px; 374 border-radius: 0 15px 15px 15px; 375 -webkit-box-shadow: 5px 5px 3px #A3A3A2; 376 box-shadow: 5px 5px 3px #A3A3A2; 377 border: 1px solid #8297F5; 378 display: none; 379 } 380 381 #UserOverviewTab { 382 display: block; 537 .usersField #FilterChoices { 538 width: 92%; 539 margin: 1% 0% 1% 2%; 540 } 541 542 .usersField #FilterChoices legend { 543 font-size: 1em; 544 padding-top: 6%; 545 } 546 547 .usersField #FilterChoices label { 548 font-size: 1em; 549 width: 60%; 550 margin: 0% 0% 0% 10%; 551 } 552 553 .usersField #FilterChoices label:last-of-type { 554 width: 42%; 555 } 556 557 .usersField #FilterChoices label:last-of-type { 558 margin-bottom: 8%; 559 } 560 561 .usersField #FilterChoices input[type="checkbox"] { 562 margin: .3em; 563 } 564 565 #UserOverviewTab #Filters { 566 width: 67%; 567 margin: 1% 0% 0% 2%; 568 } 569 570 .tabSection .filterContainer { 571 width: 27%; 383 572 } 384 573 … … 402 591 margin-top: 1em; 403 592 } 404 405 .adminDataContainer {406 width: 70%;407 padding-left: 1%;408 display: inline-block;409 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/AdminDataController.cs
r11020 r11030 24 24 } 25 25 26 public JsonResult UserTaskStats(string userName, DateTime start, DateTime end)26 public JsonResult TaskStats(DateTime start, DateTime end, string userName=null) 27 27 { 28 28 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) … … 31 31 join jobs in db.DimJobs 32 32 on tasks.JobId equals jobs.JobId 33 where jobs.UserName == userName&&34 tasks. StartTime >= start&&35 tasks.EndTime < end33 where tasks.StartTime >= start && 34 tasks.EndTime < end && 35 (string.IsNullOrEmpty(userName) || jobs.UserName == userName) 36 36 select new { tasks.TotalWaitingTime, tasks.TotalTransferTime, tasks.TotalRuntime, tasks.NumCalculationRuns, 37 37 tasks.CoresRequired, tasks.MemoryRequired, tasks.TaskSize, tasks.ResultSize}) … … 51 51 } 52 52 } 53 54 public JsonResult AllTaskStats(DateTime start, DateTime end)55 {56 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString))57 {58 var taskStats = (from tasks in db.FactTasks59 where tasks.StartTime >= start &&60 tasks.EndTime < end61 select new62 {63 tasks.TotalWaitingTime,64 tasks.TotalTransferTime,65 tasks.TotalRuntime,66 tasks.NumCalculationRuns,67 tasks.CoresRequired,68 tasks.MemoryRequired,69 tasks.TaskSize,70 tasks.ResultSize71 })72 .ToList();73 74 List<double> FullStats = new List<double>();75 FullStats.Add(taskStats.Sum(w => w.TotalWaitingTime));76 FullStats.Add(taskStats.Sum(t => t.TotalTransferTime));77 FullStats.Add(taskStats.Sum(r => r.TotalRuntime));78 FullStats.Add(taskStats.Sum(n => n.NumCalculationRuns));79 FullStats.Add(taskStats.Sum(c => c.CoresRequired));80 FullStats.Add(taskStats.Sum(m => m.MemoryRequired));81 FullStats.Add(taskStats.Sum(ts => ts.TaskSize));82 FullStats.Add(taskStats.Sum(rs => Convert.ToDouble(rs.ResultSize)));83 84 return Json(FullStats, JsonRequestBehavior.AllowGet);85 }86 }87 53 } 88 54 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ChartDataController.cs
r11020 r11030 139 139 } 140 140 141 public JsonResult GetUserTask(string userName, DateTime? start = null, DateTime? end = null) 142 { 143 start = start ?? DateTime.Now - DefaultDuration; 144 end = end ?? DateTime.Now; 145 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) 146 { 147 var data = 141 public JsonResult NumberPages(string userName, string limit, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState = null) 142 { 143 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) 144 { 145 TaskState state = GetTaskState(taskState); 146 var numberRecords = 148 147 (from tasks in db.FactTasks 149 join jobs in db.DimJobs 150 on tasks.JobId equals jobs.JobId 151 where jobs.UserName == userName && 152 tasks.StartTime >= start && 153 tasks.EndTime < end 154 select new 155 { 156 TotalWaiting = tasks.TotalWaitingTime, 157 TotalTransfer = tasks.TotalTransferTime, 158 TotalRuntime = tasks.TotalRuntime 159 }).ToList(); 160 161 List<List<double>> overallResult = new List<List<double>>(); 148 join jobs in db.DimJobs 149 on tasks.JobId equals jobs.JobId 150 where jobs.UserName == userName && 151 (!start.HasValue || tasks.StartTime >= start) && 152 (!end.HasValue || tasks.EndTime < end) && 153 (string.IsNullOrEmpty(jobId) || tasks.JobId.ToString() == jobId) && 154 (string.IsNullOrEmpty(taskState) || tasks.TaskState == state) 155 select new 156 { 157 TaskID = tasks.TaskId, 158 TotalWaiting = tasks.TotalWaitingTime, 159 TotalTransfer = tasks.TotalTransferTime, 160 TotalRuntime = tasks.TotalRuntime, 161 StartDate = tasks.StartTime 162 }).OrderByDescending(s => s.StartDate).ToList().Count; 163 164 var numberPages = numberRecords / Convert.ToDecimal(limit); 165 numberPages = Decimal.Truncate(numberPages); 166 numberPages += 1; 167 168 return Json(numberPages, JsonRequestBehavior.AllowGet); 169 } 170 } 171 172 public JsonResult GetUserTask(string userName, string limit, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState=null, string currentPage=null) 173 { 174 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) 175 { 176 TaskState state = GetTaskState(taskState); 177 var data = 178 (from tasks in db.FactTasks 179 join jobs in db.DimJobs 180 on tasks.JobId equals jobs.JobId 181 where jobs.UserName == userName && 182 (!start.HasValue || tasks.StartTime >= start) && 183 (!end.HasValue || tasks.EndTime < end) && 184 (string.IsNullOrEmpty(jobId) || tasks.JobId.ToString() == jobId) && 185 (string.IsNullOrEmpty(taskState) || tasks.TaskState == state) 186 select new 187 { 188 TaskID = tasks.TaskId, 189 TotalWaiting = tasks.TotalWaitingTime, 190 TotalTransfer = tasks.TotalTransferTime, 191 TotalRuntime = tasks.TotalRuntime, 192 StartDate = tasks.StartTime 193 }).OrderByDescending(s => s.StartDate).ToList(); 194 195 if (currentPage != null) { 196 data.RemoveRange(0, (Convert.ToInt32(currentPage) - 1) * Convert.ToInt32(limit)); 197 if (data.Count > Convert.ToInt32(limit)) { 198 data.RemoveRange(Convert.ToInt32(limit), data.Count - Convert.ToInt32(limit)); 199 } 200 } 201 else if (data.Count > Convert.ToInt32(limit)) 202 { 203 data.RemoveRange(Convert.ToInt32(limit), data.Count - Convert.ToInt32(limit)); 204 } 205 206 List<string> id = new List<string>(); 162 207 List<double> wait = new List<double>(); 163 208 List<double> transfer = new List<double>(); 164 209 List<double> run = new List<double>(); 210 data.ForEach(i => id.Add(i.TaskID.ToString())); 165 211 data.ForEach(w => wait.Add(w.TotalWaiting)); 166 212 data.ForEach(t => transfer.Add(t.TotalTransfer)); 167 213 data.ForEach(r => run.Add(r.TotalRuntime)); 168 overallResult.Add(wait); 169 overallResult.Add(transfer); 170 overallResult.Add(run); 171 172 return Json(overallResult,JsonRequestBehavior.AllowGet); 173 } 214 215 List<List<double>> taskStats = new List<List<double>>(); 216 taskStats.Add(wait); 217 taskStats.Add(transfer); 218 taskStats.Add(run); 219 220 return Json(new KeyValuePair<List<string>, List<List<double>>>(id, taskStats), JsonRequestBehavior.AllowGet); 221 } 222 } 223 224 private static TaskState GetTaskState(string taskState) { 225 TaskState state = TaskState.Finished; 226 switch (taskState) 227 { 228 case "Aborted": 229 state = TaskState.Aborted; 230 break; 231 case "Calculating": 232 state = TaskState.Calculating; 233 break; 234 case "Failed": 235 state = TaskState.Failed; 236 break; 237 case "Finished": 238 state = TaskState.Finished; 239 break; 240 case "Offline": 241 state = TaskState.Offline; 242 break; 243 case "Paused": 244 state = TaskState.Paused; 245 break; 246 case "Transferring": 247 state = TaskState.Transferring; 248 break; 249 case "Waiting": 250 state = TaskState.Waiting; 251 break; 252 } 253 return state; 174 254 } 175 255 -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/LoginRequiredController.cs
r11020 r11030 5 5 using System.Web.Mvc; 6 6 using HeuristicLab.Services.Hive.Statistics.Models; 7 using HeuristicLab.Services.Hive.DataAccess; 7 8 8 9 namespace HeuristicLab.Services.Hive.Statistics.Controllers { … … 14 15 UserName = User.Identity.Name 15 16 }; 17 18 //Initialize drop down list values 19 var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString); 20 ViewBag.JobNames = new SelectList(db.DimJobs, "JobId", "JobName"); 21 var TaskStateList = (from task in db.FactTasks 22 select task.TaskState).Distinct(); 23 ViewBag.TaskStates = new SelectList(TaskStateList); 24 16 25 return View(result); 17 26 } … … 25 34 if (User.IsInRole("Hive Administrator")) { 26 35 result.IsAdmin = true; 36 37 //Initialize drop down list values 38 var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString); 39 ViewBag.JobNames = new SelectList(db.DimJobs, "JobId", "JobName"); 40 var TaskStateList = (from task in db.FactTasks 41 select task.TaskState).Distinct(); 42 ViewBag.TaskStates = new SelectList(TaskStateList); 27 43 } 28 44 -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/HeuristicLab.Services.Hive.Statistics-3.3.csproj
r11020 r11030 110 110 <Compile Include="Controllers\AdminDataController.cs" /> 111 111 <Compile Include="Controllers\ChartDataController.cs" /> 112 <Compile Include="Controllers\ExceptionDataController.cs" /> 112 113 <Compile Include="Controllers\HomeController.cs" /> 113 114 <Compile Include="Controllers\LoginRequiredController.cs" /> … … 123 124 <Content Include="App_Code\ChartHelper.cshtml" /> 124 125 <Content Include="App_Code\AdminHelper.cshtml" /> 126 <Content Include="App_Code\ExceptionHelper.cshtml" /> 125 127 <None Include="Properties\AssemblyInfo.cs.frame" /> 126 128 <Content Include="Scripts\CollapsingSection.js" /> 129 <Content Include="Scripts\jquery.scrollstop.js" /> 127 130 <Content Include="Scripts\SmoothieChartResize.js" /> 128 131 <Content Include="Views\LoginRequired\UserTask.cshtml" /> -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Scripts/CollapsingSection.js
r11020 r11030 26 26 } 27 27 } 28 29 /* Passed the interior div this fucntion is used to create an automatically collapsed 30 section */ 31 function collapsedByDefault(caller) { 32 $(caller).parent().children("canvas, div, fieldset, label").css("display","none"); 33 } 34 35 /* Used when scrolling to a task by error, opens the container before task is scrolled to */ 36 function openOnError(caller) { 37 var jqCaller = $(caller); 38 jqCaller.parent().children("canvas, div, fieldset, label").fadeIn(); 39 jqCaller.parent().children("button").html("-"); 40 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/LoginRequired/Admin.cshtml
r11020 r11030 25 25 <select id="UserList" class="usersList"> 26 26 </select> 27 <label>Start</label> 28 @Html.TextBox("UserStart", (DateTime.Now - new TimeSpan(8, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 29 <label>End</label> 30 @Html.TextBox("UserEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 27 <fieldset id="FilterChoices"> 28 <legend>Filter by</legend> 29 <label>Date</label> 30 <input type="checkbox" name="filterChoice" value="Date" checked="checked"> 31 <label>Job Name</label> 32 <input type="checkbox" name="filterChoice" value="JobName"> 33 <label>Task State</label> 34 <input type="checkbox" name="filterChoice" value="TaskState"> 35 <label>Limit</label> 36 <select id="Limit"> 37 <option>20</option> 38 <option>50</option> 39 <option selected="selected">100</option> 40 <option>200</option> 41 </select> 42 </fieldset> 31 43 </fieldset> 32 <section id="TasksContainer" class="adminDataContainer"></section> 44 <fieldset id="Filters"> 45 <legend>Filters</legend> 46 <fieldset id="FilterDate" class="filterContainer"> 47 <legend>Date</legend> 48 <label>Start</label> 49 @Html.TextBox("UserStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 50 <label>End</label> 51 @Html.TextBox("UserEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 52 </fieldset> 53 <fieldset id="FilterJobName" class="filterContainer"> 54 <legend>Job Name</legend> 55 @Html.DropDownList("JobNames") 56 </fieldset> 57 <fieldset id="FilterTaskState" class="filterContainer"> 58 <legend>Task State</legend> 59 @Html.DropDownList("TaskStates") 60 </fieldset> 61 <button id="Apply">Apply</button> 62 </fieldset> 63 <button id="ScrollTop">^</button> 64 <section id="TasksContainer" class="tabDataContainer"></section> 33 65 </section> 34 66 //Task overview … … 39 71 </select> 40 72 <label>Start</label> 41 @Html.TextBox("TaskStart", (DateTime.Now - new TimeSpan( 8, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })73 @Html.TextBox("TaskStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 42 74 <label>End</label> 43 75 @Html.TextBox("TaskEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 44 76 </fieldset> 45 <section id="TaskStatsContainer" class=" adminDataContainer"></section>77 <section id="TaskStatsContainer" class="tabDataContainer taskOverview"></section> 46 78 </section> 47 79 } … … 55 87 @Scripts.Render("~/bundles/jqueryui") 56 88 @Scripts.Render("~/Scripts/CollapsingSection.js") 89 @Scripts.Render("~/Scripts/jquery.scrollstop.js") 57 90 @Scripts.Render("~/Scripts/jqPlot/jquery.jqplot") 58 91 @Scripts.Render("~/Scripts/jqPlot/plugins/jqplot.barRenderer.min.js") … … 67 100 var endDate; 68 101 var selectedUser; 102 var limit; 103 var pageNumber; 69 104 70 105 $(document).ready(function () { … … 73 108 onSelect: function () { RefreshUser(); } 74 109 }); 110 $("#TaskStart, #TaskEnd").datepicker({ 111 dateFormat: "yy-mm-dd", 112 onSelect: function () { RefreshTask(); } 113 }); 114 }); 115 116 $("#Apply").button({ 117 icons: { 118 primary: "ui-icon-refresh" 119 } 120 }); 121 122 $("#Apply").click(function () { 123 RefreshUser(); 75 124 }); 76 125 … … 79 128 }); 80 129 81 function RefreshUser () { 130 $("[name='filterChoice']").click(function () { 131 var filterName = $(this).val(); 132 if ($(this).is(':checked')) { 133 $("#Filter" + filterName).css("display", "inline-block"); 134 } 135 else { 136 $("#Filter" + filterName).css("display", "none"); 137 } 138 }); 139 140 function RefreshUser() { 82 141 selectedUser = $("#UserList").val(); 83 startDate = $('#UserStart').val(); 84 endDate = $('#UserEnd').val(); 85 @ChartHelper.TasksForUser("TasksContainer", "Task", Url.Action("GetUserTask", "ChartData"),"selectedUser","startDate","endDate") 86 @ChartHelper.ResizeTasks("Task") 142 limit = $("#Limit").val(); 143 startDate = null; 144 endDate = null; 145 jobId = null; 146 taskState = null; 147 if ($("[value='Date']").is(":checked")) { 148 startDate = $('#UserStart').val(); 149 endDate = $('#UserEnd').val(); 150 } 151 if ($("[value='JobName']").is(':checked')) { 152 jobId = $('#JobNames').val(); 153 } 154 if ($("[value='TaskState']").is(':checked')) { 155 taskState = $('#TaskState').val(); 156 } 157 @ExceptionHelper.UserExceptions("TasksContainer",Url.Action("TaskExceptions", "ExceptionData"),"selectedUser","limit","startDate","endDate","jobId","taskState") 158 @ChartHelper.TasksForUser("TasksContainer","Task",Url.Action("NumberPages", "ChartData"),Url.Action("GetUserTask", "ChartData"),"RefreshUser","selectedUser","limit","startDate","endDate","jobId","taskState","pageNumber") 87 159 } 88 160 89 $(document).ready(function () { 90 $("#TaskStart, #TaskEnd").datepicker({ 91 dateFormat: "yy-mm-dd", 92 onSelect: function () { RefreshTask(); } 93 }); 94 }); 161 @ChartHelper.ResizeTasks("Task") 162 @ExceptionHelper.ScrollToException() 95 163 96 164 $("#TaskUserList").change(function () { … … 102 170 startDate = $('#TaskStart').val(); 103 171 endDate = $('#TaskEnd').val(); 104 @AdminHelper.UserTaskStats("TaskStatsContainer",Url.Action(" AllTaskStats", "AdminData"),Url.Action("UserTaskStats", "AdminData"),"selectedUser","startDate","endDate")172 @AdminHelper.UserTaskStats("TaskStatsContainer",Url.Action("TaskStats", "AdminData"),"selectedUser","startDate","endDate") 105 173 } 106 174 -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/LoginRequired/UserTask.cshtml
r11020 r11030 6 6 7 7 <h1>Task Information for User: @Model.UserName</h1> 8 <section> 9 <fieldset id="filters"> 8 <button id="TaskInformationButton" class="tabButton">Task Information</button> 9 <button id="TaskOverviewButton" class="tabButton">Task Overview</button> 10 <section id="TaskInformationTab" class="tabSection"> 11 <fieldset id="FilterChoices"> 12 <legend>Filter by</legend> 13 <label>Date</label> 14 <input type="checkbox" name="filterChoice" value="Date" checked="checked"> 15 <label>Job Name</label> 16 <input type="checkbox" name="filterChoice" value="JobName"> 17 <label>Task State</label> 18 <input type="checkbox" name="filterChoice" value="TaskState"> 19 <label>Limit</label> 20 <select id="Limit"> 21 <option>10</option> 22 <option>50</option> 23 <option selected="selected">100</option> 24 <option>200</option> 25 </select> 26 </fieldset> 27 <fieldset id="Filters"> 10 28 <legend>Filters</legend> 11 <label>Start</label> 12 @Html.TextBox("Start", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 13 <label>End</label> 14 @Html.TextBox("End", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 29 <fieldset id="FilterDate" class="filterContainer"> 30 <legend>Date</legend> 31 <label>Start</label> 32 @Html.TextBox("InfoStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 33 <label>End</label> 34 @Html.TextBox("InfoEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 35 </fieldset> 36 <fieldset id="FilterJobName" class="filterContainer"> 37 <legend>Job Name</legend> 38 @Html.DropDownList("JobNames") 39 </fieldset> 40 <fieldset id="FilterTaskState" class="filterContainer"> 41 <legend>Task State</legend> 42 @Html.DropDownList("TaskStates") 43 </fieldset> 15 44 <button id="Apply">Apply</button> 16 45 </fieldset> 46 <button id="ScrollTop">^</button> 47 <section id="TasksContainer" class="tabDataContainer"></section> 17 48 </section> 18 <section id="TasksContainer"> 49 <section id="TaskOverviewTab" class="tabSection"> 50 <fieldset id="TaskOverviewFilter" class="usersField"> 51 <legend>Filters</legend> 52 <label id="TaskOverviewFilterFirst">Start</label> 53 @Html.TextBox("OverviewStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 54 <label>End</label> 55 @Html.TextBox("OverviewEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" }) 56 </fieldset> 57 <section id="TaskStatsContainer" class="tabDataContainer taskOverview"></section> 19 58 </section> 20 59 … … 27 66 @Scripts.Render("~/bundles/jqueryui") 28 67 @Scripts.Render("~/Scripts/CollapsingSection.js") 68 @Scripts.Render("~/Scripts/jquery.scrollstop.js") 29 69 @Scripts.Render("~/Scripts/jqPlot/jquery.jqplot") 30 70 @Scripts.Render("~/Scripts/jqPlot/plugins/jqplot.barRenderer.min.js") … … 40 80 } 41 81 }); 82 $("#Apply").click(function () { 83 TaskInformation(); 84 }); 85 42 86 $(document).ready(function () { 43 $(" .date").datepicker({87 $("#InfoStart, #InfoEnd").datepicker({ 44 88 dateFormat: "yy-mm-dd", 45 onSelect: function () { filterTasks(); } 89 onSelect: function () { TaskInformation(); } 90 }); 91 $("#OverviewStart, #OverviewEnd").datepicker({ 92 dateFormat: "yy-mm-dd", 93 onSelect: function () { TaskOverview(); } 46 94 }); 47 95 }); 48 $("#Apply").click(function () { 49 filterTasks(); 96 97 $("[name='filterChoice']").click(function () { 98 var filterName = $(this).val(); 99 if ($(this).is(':checked')) { 100 $("#Filter" + filterName).css("display", "inline-block"); 101 } 102 else { 103 $("#Filter" + filterName).css("display", "none"); 104 } 50 105 }); 51 106 52 function filterTasks() { 53 startDate = $('#Start').val(); 54 endDate = $('#End').val(); 107 var userName = "@Model.UserName"; 108 var limit = $('#Limit').val(); 109 var startDate = $('#InfoStart').val(); 110 var endDate = $('#InfoEnd').val(); 111 var jobId; 112 var taskState; 113 var pageNumber; 55 114 56 @ChartHelper.TasksForUser("TasksContainer","Task",Url.Action("GetUserTask", "ChartData"),"userName","startDate","endDate") 57 @ChartHelper.ResizeTasks("Task") 115 function TaskInformation() { 116 limit = $('#Limit').val(); 117 startDate = null; 118 endDate = null; 119 jobId = null; 120 taskState = null; 121 if ($("[value='Date']").is(":checked")) { 122 startDate = $('#InfoStart').val(); 123 endDate = $('#InfoEnd').val(); 124 } 125 if ($("[value='JobName']").is(':checked')) { 126 jobId = $('#JobNames').val(); 127 } 128 if ($("[value='TaskState']").is(':checked')) { 129 taskState = $('#TaskState').val(); 130 } 131 @ExceptionHelper.UserExceptions("TasksContainer",Url.Action("TaskExceptions", "ExceptionData"),"userName","limit","startDate","endDate","jobId","taskState") 132 @ChartHelper.TasksForUser("TasksContainer","Task",Url.Action("NumberPages", "ChartData"),Url.Action("GetUserTask", "ChartData"),"TaskInformation","userName","limit","startDate","endDate","jobId","taskState","pageNumber") 133 pageNumber = null; 58 134 } 59 135 60 var userName = "@Model.UserName"; 61 var startDate = $('#Start').val(); 62 var endDate = $('#End').val(); 136 function TaskOverview() { 137 startDate = $('#OverviewStart').val(); 138 endDate = $('#OverviewEnd').val(); 139 @AdminHelper.UserTaskStats("TaskStatsContainer",Url.Action("TaskStats", "AdminData"),"userName","startDate","endDate") 140 } 63 141 64 @ChartHelper.TasksForUser("TasksContainer","Task",Url.Action("GetUserTask", "ChartData"),"userName","startDate","endDate") 142 $(".tabButton").click(function () { 143 var sender = $(this).attr('id'); 144 $(".tabButton").css({ 'border-bottom': '1px solid #8297F5', 'background': 'none' }); 145 $(this).css({ 'border-bottom': '1px solid #E0E6FF', 'background-color': '#E0E6FF' }); 146 $(".tabSection").css('display', 'none'); 147 $("#" + sender.slice(0, -6) + "Tab").css('display', 'block'); 148 }) 149 150 TaskInformation(); 65 151 @ChartHelper.ResizeTasks("Task") 152 @ExceptionHelper.ScrollToException() 66 153 </script> 67 68 154 }
Note: See TracChangeset
for help on using the changeset viewer.