Changeset 11084
- Timestamp:
- 07/04/14 08:59:24 (10 years ago)
- Location:
- branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ChartHelper.cshtml
r11059 r11084 102 102 } 103 103 104 @helper ResizeCharts() 105 { 106 <text> 107 function resizeCharts(caller) { 108 //If current plot is collapsed 109 if($(caller).css("display") == "none") { 110 //Display the contents of chartContainer 111 ResizeOpenClose($(caller).siblings(".collapse")); 112 //Reset barWidth for bar charts 113 $.each(window[caller.id].series, function(index, series) { 114 series.barWidth = undefined; 115 }); 116 //Replot the chart with same name as element id 117 window[caller.id].replot({ resetAxes: false }); 118 //Hide the contents of the current div 119 ResizeOpenClose($(caller).siblings(".collapse")); 120 } 121 //Current plot is expanded 122 else { 123 //Reset barWidth for bar charts 124 $.each(window[caller.id].series, function(index, series) { 125 series.barWidth = undefined; 126 }); 127 //Replot the chart with same name as element id 128 window[caller.id].replot({ resetAxes: false }); 129 } 130 } 131 132 $(window).resize(function() { 133 $("div.jqplot-target",".chartContainer").each(function() { 134 var potentialTab = $(this).parent().parent().parent(); 135 //If the section is tabular and currently hidden 136 if(potentialTab.hasClass("tabSection") && potentialTab.css("display") == "none") { 137 ResizeOpenCloseTabular(potentialTab); 138 resizeCharts(this); 139 ResizeOpenCloseTabular(potentialTab); 140 } 141 else { 142 resizeCharts(this); 143 } 144 }); 145 }); 146 </text> 147 } 148 104 149 @helper NumberPages(string records, string limit, string container, string functionName, string currentPage = null) 105 150 { … … 134 179 } 135 180 136 @helper TasksForUser(string container, string destinationTag, string url, string functionName, string userName, string limit, string startDate = null, string endDate = null, string jobId=null, string taskState=null, string pageNumber=null) 137 { 138 <text> 139 var GetRequest = "?userName=" + @(userName) + "&limit=" + @(limit); 140 @if(startDate!=null) { 181 @helper TasksForUser(string destinationTag, string url, string functionName, string userName, string limit, string startDate = null, string endDate = null, string jobId = null, string taskState = null, string pageNumber = null) 182 { 183 <text> 184 var GetRequest = "?userName=" + @(userName); 185 @if (startDate != null) 186 { 141 187 @:if(@(startDate)!=null) { 142 188 @:GetRequest += "&start=" + @startDate; 143 189 @:} 144 190 } 145 @if(endDate!=null) { 191 @if (endDate != null) 192 { 146 193 @:if(@(endDate)!=null) { 147 194 @:GetRequest += "&end=" + @endDate; 148 195 @:} 149 196 } 150 @if(jobId!=null) { 197 @if (jobId != null) 198 { 151 199 @:if(@(jobId)!=null) { 152 200 @:GetRequest += "&jobId=" + @jobId; 153 201 @:} 154 202 } 155 @if(taskState!=null) { 203 @if (taskState != null) 204 { 156 205 @:if(@(taskState)!=null) { 157 206 @:GetRequest += "&taskState=" + @taskState; … … 161 210 async: false, url: "@(new HtmlString(url))" + GetRequest, datatype: "json", success: function(result) { 162 211 if(@(userName) == null) { 163 $("#@ container").append(212 $("#@(destinationTag)").append( 164 213 '<section class="chartContainer">' + 165 214 '<h1 class="title">Please select a user!</h1>' + … … 168 217 } 169 218 else if(result.length==0) { 170 $("#@ container").append(219 $("#@(destinationTag)").append( 171 220 '<section class="chartContainer">' + 172 221 '<h1 class="title">' + @userName + ' has no tasks for the specified filters!</h1>' + … … 182 231 //Checks if multipage display, if it is then trims results to 183 232 //the results for the page to be displayed 184 @ChartHelper.NumberPages("result", limit,container,functionName,pageNumber)233 @ChartHelper.NumberPages("result", limit, destinationTag, functionName, pageNumber) 185 234 186 235 //Globally accesible, for use when resizing, eliminates extra DB request … … 188 237 189 238 //Set display of all errors to none, errors matching the tasks will be reset below 190 $("#@( container)").find(".errorContainer, .errorTitle, .errorTask, .errorMessage").css('display','none');239 $("#@(destinationTag)").find(".errorContainer, .errorTitle, .errorTask, .errorMessage").css('display','none'); 191 240 192 241 //For each result create a seperate collapsable section with a chart and info label 193 242 for(var i = 0; i < result.length; i++){ 194 $("#" + "@ container").append(243 $("#" + "@(destinationTag)").append( 195 244 '<section class="chartContainer">' + 196 '<h1 class="title" id="@( container)' + result[i].Key + '">Task ' + result[i].Key + '</h1>' +245 '<h1 class="title" id="@(destinationTag)' + result[i].Key + 'PlotTitle">Task ' + result[i].Key + '</h1>' + 197 246 '<button class="collapse" onclick="CollapseSection(this)">+</button>' + 198 247 '<div id="@(destinationTag)Plot' + i + '"></div>' + … … 202 251 //Re-enables the error display if any of the tasks on the page have Ids matching 203 252 //those of errors 204 $(".errorTask","#" + "@( container)").each(function() {253 $(".errorTask","#" + "@(destinationTag)").each(function() { 205 254 if($(this).html()==result[i].Key) { 206 $("#@( container)" + result[i].Key).css("color","red");207 $("#@( container)" + result[i].Key).append(" - ERROR");208 $(".errorContainer, .errorTitle, .underline" ).css('display','inline-block');255 $("#@(destinationTag)" + result[i].Key + "PlotTitle").css("color","red"); 256 $("#@(destinationTag)" + result[i].Key + "PlotTitle").append(" - ERROR"); 257 $(".errorContainer, .errorTitle, .underline","#@(destinationTag)").css('display','inline-block'); 209 258 $(this).css('display','inline-block'); 210 259 $(this).next().css('display','inline-block'); … … 250 299 }); 251 300 252 CollapsedByDefault(document.getElementById("@( container)" + result[i].Key));301 CollapsedByDefault(document.getElementById("@(destinationTag)Plot" + i)); 253 302 } 254 303 } … … 257 306 } 258 307 259 @helper ResizeTasks(string destinationTag) 260 { 261 <text> 262 //Resize event, resets bar width for task charts and replots them 263 $(window).resize(function() { 264 if(typeof numberTasks !== 'undefined') { 265 for(var i = 0; i < numberTasks; i++) { 266 $.each(window[ "@(destinationTag)Plot" + i].series, function(index, series) { 267 series.barWidth = undefined; 268 }); 269 if($("#@(destinationTag)Plot" + i).css("display") == "none") { 270 ResizeOpenClose($("#@(destinationTag)Plot" + i).siblings(".collapse")); 271 window["@(destinationTag)Plot" + i].replot({ resetAxes: true }); 272 ResizeOpenClose($("#@(destinationTag)Plot" + i).siblings(".collapse")); 273 } 274 else { 275 window["@(destinationTag)Plot" + i].replot({ resetAxes: true }); 276 } 277 } 278 } 279 }); 280 </text> 281 } 282 283 @helper SetStreamingProperties(int refresh, int chartLength, int upperY) { 308 @helper SetStreamingProperties(int refresh, int chartLength, int upperY) 309 { 284 310 <text> 285 311 //Refresh time (in millisec) … … 307 333 } 308 334 309 @helper CreateStreamChart(string dataName, string destinationTag, string url, string title, string format = null, double? maxY = null) { 335 @helper CreateStreamChart(string dataName, string destinationTag, string url, string title, string format = null, double? maxY = null) 336 { 310 337 <text> 311 338 //Get current time, used to create initial values … … 352 379 </text>} 353 380 min: 0, 354 @if (maxY != null) { 381 @if (maxY != null) 382 { 355 383 @:max: @maxY, 356 384 } 357 else{ 385 else 386 { 358 387 @:max: window["@(dataName)Data" + 0][window["@(dataName)Data" + 0].length - 1][1] + upperYBuffer, 359 388 } … … 375 404 } 376 405 377 @helper UpdateStreamChart(string dataName, string destinationTag, string url, string fixedY = null) { 406 @helper UpdateStreamChart(string dataName, string destinationTag, string url, string fixedY = null) 407 { 378 408 <text> 379 409 //If the data is beyond chartSize use shift to trim one off the end … … 406 436 @(destinationTag)PlotOptions.axes.xaxis.min = window["@(dataName)Data" + 0][0][0]; 407 437 @(destinationTag)PlotOptions.axes.xaxis.max = window["@(dataName)Data" + 0][window["@(dataName)Data" + 0].length - 1][0]; 408 @if (fixedY == null) { 438 @if (fixedY == null) 439 { 409 440 @:@(destinationTag)PlotOptions.axes.yaxis.max = window["@(dataName)Data" + 0][window["@(dataName)Data" + 0].length - 1][1] + upperYBuffer; 410 441 } … … 416 447 } 417 448 418 @helper SlaveInfoChart(string destinationTag, string url, string limit, bool singleSlave, string startDate=null, string endDate=null, string userName=null, string functionName=null, string pageNumber=null, string slaveId=null) { 419 <text> 420 var GetRequest = "?limit=" + @(limit); 421 @if(startDate!=null) { 449 @helper SlaveInfoChart(string destinationTag, string url, string limit, bool singleSlave, string startDate = null, string endDate = null, string userName = null, string functionName = null, string pageNumber = null, string slaveId = null) 450 { 451 <text> 452 var GetRequest = ""; 453 @if (startDate != null) 454 { 422 455 @:if(@(startDate)!=null) { 423 @:GetRequest += "&start=" + @startDate; 456 @:if(GetRequest == "") { 457 @:GetRequest += "?start=" + @startDate; 458 @:} 459 @:else { 460 @:GetRequest += "&start=" + @startDate; 461 @:} 424 462 @:} 425 463 } 426 @if(endDate!=null) { 464 @if (endDate != null) 465 { 427 466 @:if(@(endDate)!=null) { 428 @:GetRequest += "&end=" + @endDate; 467 @:if(GetRequest == "") { 468 @:GetRequest += "?end=" + @endDate; 469 @:} 470 @:else { 471 @:GetRequest += "&end=" + @endDate; 472 @:} 429 473 @:} 430 474 } 431 @if (userName != null) { 475 @if (userName != null) 476 { 432 477 @:if(@(userName)!=null) { 433 @:GetRequest += "&userName=" + @userName; 478 @:if(GetRequest == "") { 479 @:GetRequest += "?userName=" + @userName; 480 @:} 481 @:else { 482 @:GetRequest += "&userName=" + @userName; 483 @:} 434 484 @:} 435 485 } 436 @if (slaveId != null) { 486 @if (slaveId != null) 487 { 437 488 @:if(@(slaveId)!=null) { 438 @:GetRequest += "&slaveId=" + @slaveId; 489 @:if(GetRequest == "") { 490 @:GetRequest += "?slaveId=" + @slaveId; 491 @:} 492 @:else { 493 @:GetRequest += "&slaveId=" + @slaveId; 494 @:} 439 495 @:} 440 496 } … … 452 508 453 509 if(result.length == 0) { 510 @if (!singleSlave) { 511 @:$('#' + destTag).html(""); 512 } 454 513 $('#' + destTag).append( 455 514 '<section class="chartContainer">' + … … 461 520 var time = new Date(); 462 521 463 @if(!singleSlave) { 522 @if (!singleSlave) 523 { 464 524 @:$('#' + destTag).html(""); 465 525 … … 468 528 @ChartHelper.NumberPages("result", limit, destinationTag, functionName, pageNumber) 469 529 } 470 471 //Globally accesible, for use when resizing, eliminates extra DB request472 window["numberSlaves"] = result.length;473 530 474 531 for(i = 0; i < result.length; i++) { … … 483 540 $('#' + destTag).append( 484 541 '<section class="chartContainer">' + 485 '<h1 class="title" id="' + result[i][0].SlaveID + '">Slave ' + result[i][0].SlaveID + '</h1>' +542 '<h1 class="title" id="' + destTag + result[i][0].SlaveID + 'PlotTitle">Slave ' + result[i][0].SlaveID + '</h1>' + 486 543 '<button class="collapse" onclick="CollapseSection(this)">+</button>' + 487 '<div id="' + slaveChartNames[0] + 'Plot' + i + '"></div>' +488 '<div id="' + slaveChartNames[1] + 'Plot' + i + '"></div>' +489 '<div id="' + slaveChartNames[2] + 'Plot' + i + '"></div>' +544 '<div id="' + destTag + slaveChartNames[0] + 'Plot' + i + '"></div>' + 545 '<div id="' + destTag + slaveChartNames[1] + 'Plot' + i + '"></div>' + 546 '<div id="' + destTag + slaveChartNames[2] + 'Plot' + i + '"></div>' + 490 547 '</section>'); 491 548 for(j = 0; j < result[i].length; j++) { … … 498 555 } 499 556 if(result[i].length > 1) { 500 @ChartHelper.LineChartGivenSeries(" slaveChartNames[0]","i","coreSeries","Total/Used Cores")501 @ChartHelper.LineChartGivenSeries(" slaveChartNames[1]","i","memorySeries","Total/Used Memory",0)502 @ChartHelper.LineChartGivenSeries(" slaveChartNames[2]","i","cpuSeries","CPU Utilization",0,100,"%.1f%%")557 @ChartHelper.LineChartGivenSeries("destTag + slaveChartNames[0]", "i", "coreSeries", "Total/Used Cores") 558 @ChartHelper.LineChartGivenSeries("destTag + slaveChartNames[1]", "i", "memorySeries", "Total/Used Memory", 0) 559 @ChartHelper.LineChartGivenSeries("destTag + slaveChartNames[2]", "i", "cpuSeries", "CPU Utilization", 0, 100, "%.1f%%") 503 560 } 504 561 else { 505 @ChartHelper.BarChartGivenSeries(" slaveChartNames[0]","i","coreSeries","Total/Used Cores")506 @ChartHelper.BarChartGivenSeries(" slaveChartNames[1]","i","memorySeries","Total/Used Memory",0)507 @ChartHelper.BarChartGivenSeries(" slaveChartNames[2]","i","cpuSeries","CPU Utilization",0,100,"%.1f%%")562 @ChartHelper.BarChartGivenSeries("destTag + slaveChartNames[0]", "i", "coreSeries", "Total/Used Cores") 563 @ChartHelper.BarChartGivenSeries("destTag + slaveChartNames[1]", "i", "memorySeries", "Total/Used Memory", 0) 564 @ChartHelper.BarChartGivenSeries("destTag + slaveChartNames[2]", "i", "cpuSeries", "CPU Utilization", 0, 100, "%.1f%%") 508 565 } 509 566 for(k = 0; k < slaveChartNames.length; k++) { 510 CollapsedByDefault(document.getElementById( slaveChartNames[k] + "Plot" + i));567 CollapsedByDefault(document.getElementById(destTag + slaveChartNames[k] + "Plot" + i)); 511 568 } 512 569 } … … 516 573 } 517 574 518 @helper ResizeSlaves() { 519 <text> 520 //Resize event, resets bar width for slave charts and replots them 521 $(window).resize(function() { 522 if(typeof numberSlaves !== 'undefined') { 523 524 //Set chart names for use in creation below, must be set identically in 525 //SlaveInfoChart 526 var slaveChartNames = ["TotalUsedCores","TotalUsedMemory","CPUUtilization"]; 527 528 for(i = 0; i < numberSlaves; i++) { 529 if($("#" + slaveChartNames[0] + "Plot" + i).css("display") == "none") { 530 ResizeOpenClose($("#" + slaveChartNames[0] + "Plot" + i).siblings(".collapse")); 531 for(j = 0; j < slaveChartNames.length; j++) { 532 $.each(window[slaveChartNames[j] + "Plot" + i].series, function(index, series) { 533 series.barWidth = undefined; 534 }); 535 window[slaveChartNames[j] + "Plot" + i].replot({ resetAxes: true }); 536 } 537 ResizeOpenClose($("#" + slaveChartNames[0] + "Plot" + i).siblings(".collapse")); 538 } 539 else { 540 for(j = 0; j < slaveChartNames.length; j++) { 541 $.each(window[slaveChartNames[j] + "Plot" + i].series, function(index, series) { 542 series.barWidth = undefined; 543 }); 544 window[slaveChartNames[j] + "Plot" + i].replot({ resetAxes: true }); 545 } 546 } 547 } 548 } 549 }); 550 </text> 551 } 552 553 @helper LineChartGivenSeries(string destinationTag, string chartId, string series, string title, double? minY = null, double? maxY = null, string axisYFormat = null) { 575 @helper LineChartGivenSeries(string destinationTag, string chartId, string series, string title, double? minY = null, double? maxY = null, string axisYFormat = null) 576 { 554 577 <text> 555 578 window[@(destinationTag) + "Plot" + @(chartId)] = $.jqplot(@(destinationTag) + "Plot" + @(chartId), @series, { … … 562 585 }, 563 586 yaxis: { 564 @if (axisYFormat != null) { 587 @if (axisYFormat != null) 588 { 565 589 <text> 566 590 tickOptions: { … … 569 593 </text> 570 594 } 571 @if (minY != null) { 595 pad: 0, 596 @if (minY != null) 597 { 572 598 @:min: @minY, 573 599 } 574 @if (maxY != null) { 600 @if (maxY != null) 601 { 575 602 @:max: @maxY, 576 603 } 577 pad: 0578 604 } 579 605 }, … … 591 617 } 592 618 593 @helper BarChartGivenSeries(string destinationTag, string chartId, string series, string title, double? minY = null, double? maxY = null, string axisYFormat = null) { 619 @helper BarChartGivenSeries(string destinationTag, string chartId, string series, string title, double? minY = null, double? maxY = null, string axisYFormat = null) 620 { 594 621 <text> 595 622 window[@(destinationTag) + "Plot" + @(chartId)] = $.jqplot(@(destinationTag) + "Plot" + @(chartId), @series, { … … 607 634 }, 608 635 yaxis: { 609 @if (axisYFormat != null) { 636 @if (axisYFormat != null) 637 { 610 638 <text> 611 639 tickOptions: { … … 614 642 </text> 615 643 } 616 @if (minY != null) { 644 pad: 0, 645 @if (minY != null) 646 { 617 647 @:min: @minY, 618 648 } 619 @if (maxY != null) { 649 @if (maxY != null) 650 { 620 651 @:max: @maxY, 621 652 } 622 pad: 0623 653 } 624 654 }, -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ExceptionHelper.cshtml
r11059 r11084 18 18 *@ 19 19 20 @helper UserExceptions(string destinationTag, string url, string limit, string userName = null, string startDate = null, string endDate = null, string jobId = null, string taskState = null )20 @helper UserExceptions(string destinationTag, string url, string limit, string userName = null, string startDate = null, string endDate = null, string jobId = null, string taskState = null, string slaveId=null) 21 21 { 22 22 <text> 23 var GetRequest = "?limit=" + @(limit); 24 @if (userName != null) { 25 @:if(@(userName)!=null) { 23 var GetRequest = ""; 24 @if (userName != null) { 25 @:if(@(userName)!=null) { 26 @:if(GetRequest == "") { 27 @:GetRequest += "?userName=" + @userName; 28 @:} 29 @:else { 26 30 @:GetRequest += "&userName=" + @userName; 27 31 @:} 28 } 29 @if(startDate!=null) { 30 @:if(@(startDate)!=null) { 32 @:} 33 } 34 @if (startDate != null) 35 { 36 @:if(@(startDate)!=null) { 37 @:if(GetRequest == "") { 38 @:GetRequest += "?start=" + @startDate; 39 @:} 40 @:else { 31 41 @:GetRequest += "&start=" + @startDate; 32 42 @:} 33 } 34 @if(endDate!=null) { 35 @:if(@(endDate)!=null) { 43 @:} 44 } 45 @if (endDate != null) 46 { 47 @:if(@(endDate)!=null) { 48 @:if(GetRequest == "") { 49 @:GetRequest += "?end=" + @endDate; 50 @:} 51 @:else { 36 52 @:GetRequest += "&end=" + @endDate; 37 53 @:} 38 } 39 @if(jobId!=null) { 40 @:if(@(jobId)!=null) { 54 @:} 55 } 56 @if (jobId != null) 57 { 58 @:if(@(jobId)!=null) { 59 @:if(GetRequest == "") { 60 @:GetRequest += "?jobId=" + @jobId; 61 @:} 62 @:else { 41 63 @:GetRequest += "&jobId=" + @jobId; 42 64 @:} 43 } 44 @if(taskState!=null) { 45 @:if(@(taskState)==null) { 65 @:} 66 } 67 @if (taskState != null) 68 { 69 @:if(@(taskState)!=null) { 70 @:if(GetRequest == "") { 71 @:GetRequest += "?taskState=" + @taskState; 72 @:} 73 @:else { 46 74 @:GetRequest += "&taskState=" + @taskState; 47 75 @:} 48 } 49 $.ajax({async: false, url: "@(new HtmlString(url))" + GetRequest, datatype: "json", success: function(result) { 50 $("#" + "@destinationTag").html(""); 51 if(result.Key.length > 0) { 52 var ErrorHTML = '<section class="errorContainer">' + 53 '<p class="errorTitle">Some tasks were found in error state!</p>' + 54 '<label class="errorTask underline">Task</label>' + 55 '<label class="errorMessage underline">Error</label>'; 56 for (var i = 0; i < result.Key.length; i++) { 57 ErrorHTML += '<a class="errorTask" onclick="ScrollTo(this)">' + result.Key[i] + '</a>' + 58 '<label class="errorMessage">' + result.Value[i] + '</label>'; 59 } 60 ErrorHTML += '</section>'; 61 $("#" + "@destinationTag").append(ErrorHTML); 76 @:} 77 } 78 @if (slaveId != null) 79 { 80 @:if(@(slaveId)!=null) { 81 @:if(GetRequest == "") { 82 @:GetRequest += "?slaveId=" + @slaveId; 83 @:} 84 @:else { 85 @:GetRequest += "&slaveId=" + @slaveId; 86 @:} 87 @:} 88 } 89 90 $.ajax({async: false, url: "@(new HtmlString(url))" + GetRequest, datatype: "json", success: function(result) { 91 $("#" + "@destinationTag").html(""); 92 if(result.Key.length > 0) { 93 var ErrorHTML = '<section class="errorContainer">' + 94 '<p class="errorTitle">Some tasks were found in error state!</p>' + 95 '<label class="errorTask underline">Task</label>' + 96 '<label class="errorMessage underline">Error</label>'; 97 for (var i = 0; i < result.Key.length; i++) { 98 ErrorHTML += '<a class="errorTask" onclick="ScrollTo(this)">' + result.Key[i] + '</a>' + 99 '<label class="errorMessage">' + result.Value[i] + '</label>'; 62 100 } 63 } 64 }); 101 ErrorHTML += '</section>'; 102 $("#" + "@destinationTag").append(ErrorHTML); 103 } 104 } 105 }); 65 106 </text> 66 107 } … … 69 110 <text> 70 111 function ScrollTo(caller) { 71 var taskErrorId = $(caller).parent().parent().attr('id') + $(caller).html() ;112 var taskErrorId = $(caller).parent().parent().attr('id') + $(caller).html() + "PlotTitle"; 72 113 OpenOnError(document.getElementById(taskErrorId)); 73 114 $('html, body').animate({ … … 107 148 } 108 149 109 @helper ErrorsOnSlaves(string destinationTag, string url, string limit, string startDate = null, string endDate = null, string clientId=null) { 110 <text> 111 var GetRequest = "?limit=" + @(limit); 112 @if(startDate!=null) { 150 @helper ErrorsOnSlaves(string destinationTag, string url, string limit, string startDate = null, string endDate = null, string clientId=null, string functionName=null, string pageNumber=null) { 151 <text> 152 var GetRequest = ""; 153 @if (startDate != null) 154 { 113 155 @:if(@(startDate)!=null) { 114 @:GetRequest += "&start=" + @startDate; 115 @:} 116 } 117 @if(endDate!=null) { 156 @:if(GetRequest == "") { 157 @:GetRequest += "?start=" + @startDate; 158 @:} 159 @:else { 160 @:GetRequest += "&start=" + @startDate; 161 @:} 162 @:} 163 } 164 @if (endDate != null) 165 { 118 166 @:if(@(endDate)!=null) { 119 @:GetRequest += "&end=" + @endDate; 120 @:} 121 } 122 @if (clientId != null) { 167 @:if(GetRequest == "") { 168 @:GetRequest += "?end=" + @endDate; 169 @:} 170 @:else { 171 @:GetRequest += "&end=" + @endDate; 172 @:} 173 @:} 174 } 175 @if (clientId != null) 176 { 123 177 @:if(@(clientId)!=null) { 124 @:GetRequest += "&clientId=" + @clientId; 178 @:if(GetRequest == "") { 179 @:GetRequest += "?clientId=" + @clientId; 180 @:} 181 @:else { 182 @:GetRequest += "&clientId=" + @clientId; 183 @:} 125 184 @:} 126 185 } 127 186 $.ajax({ 128 187 async: false, url: "@(new HtmlString(url))" + GetRequest, datatype: "json", success: function(result) { 188 189 //Checks if multipage display, if it is then trims results to 190 //the results for the page to be displayed 191 @ChartHelper.NumberPages("result",limit,destinationTag,functionName,pageNumber) 192 193 //Set display of all errors to none, errors matching the tasks will be reset below 194 $("#" + "@(destinationTag)").find(".errorContainer, .errorTitle, .errorTask, .errorMessage").css('display','none'); 195 129 196 for(i = 0; i < result.length; i++) { 130 197 $("#" + "@(destinationTag)").append( 131 '<section id=" ' + result[i][0] + 'Container" class="chartContainer">' +132 '<h1 class="title" id="@(destinationTag)' + result[i][0] + ' ">Task ' + result[i][0] + '</h1>' +198 '<section id="@(destinationTag)' + result[i][0] + '" class="chartContainer">' + 199 '<h1 class="title" id="@(destinationTag)' + result[i][0] + 'PlotTitle">Task ' + result[i][0] + '</h1>' + 133 200 '<button class="collapse" onclick="CollapseSection(this)">+</button>' + 134 201 '<label id="' + result[i][0] + 'ErrorMessage">Error Message: ' + result[i][1] + '</label>' + … … 138 205 '</section>' 139 206 ); 140 CollapsedByDefault(document.getElementById("@(destinationTag)" + result[i][0])); 207 208 //Re-enables the error display if any of the sections on the page have Ids matching 209 //those of errors 210 $(".errorTask","#" + "@(destinationTag)").each(function() { 211 if($(this).html()==result[i][0]) { 212 $("#@(destinationTag)" + result[i][0] + "PlotTitle").css("color","red"); 213 $("#@(destinationTag)" + result[i][0] + "PlotTitle").append(" - ERROR"); 214 $('.errorContainer, .errorTitle, .underline','#@(destinationTag)').css('display','inline-block'); 215 $(this).css('display','inline-block'); 216 $(this).next().css('display','inline-block'); 217 } 218 }); 219 220 CollapsedByDefault(document.getElementById("@(destinationTag)" + result[i][0] + "PlotTitle")); 141 221 } 142 222 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Content/Site.css
r11059 r11084 89 89 font-size: 1.3em; 90 90 color: #FF5640; 91 display: inline-block;91 display: none; 92 92 } 93 93 -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ChartDataController.cs
r11053 r11084 139 139 } 140 140 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 = 147 (from tasks in db.FactTasks 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 StartDate = tasks.StartTime 159 }).OrderByDescending(s => s.StartDate).ToList().Count; 160 161 var numberPages = numberRecords / Convert.ToDecimal(limit); 162 numberPages = Decimal.Truncate(numberPages); 163 numberPages += 1; 164 165 return Json(numberPages, JsonRequestBehavior.AllowGet); 166 } 167 } 168 169 public JsonResult UserTask(string userName, string limit, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState=null) 141 public JsonResult UserTask(string userName, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState=null) 170 142 { 171 143 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) … … 204 176 } 205 177 206 public JsonResult SlaveInfo( string limit,DateTime? start = null, DateTime? end = null, string userName = null, string slaveId=null)178 public JsonResult SlaveInfo(DateTime? start = null, DateTime? end = null, string userName = null, string slaveId=null) 207 179 { 208 180 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ExceptionDataController.cs
r11053 r11084 9 9 public class ExceptionDataController : Controller { 10 10 11 public JsonResult TaskExceptions(string limit, string userName, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState= null)11 public JsonResult TaskExceptions(string userName, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState = null, string slaveId = null) 12 12 { 13 13 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) { … … 23 23 (!end.HasValue || tasks.EndTime < end) && 24 24 (string.IsNullOrEmpty(jobId) || tasks.JobId.ToString() == jobId) && 25 (string.IsNullOrEmpty(taskState) || tasks.TaskState == state) 25 (string.IsNullOrEmpty(taskState) || tasks.TaskState == state) && 26 (string.IsNullOrEmpty(slaveId) || tasks.LastClientId.ToString() == slaveId) 26 27 select new 27 28 { … … 29 30 ErrorMessage = tasks.Exception, 30 31 StartDate = tasks.StartTime 31 }).OrderByDescending(s => s.StartDate).T ake(Convert.ToInt32(limit)).ToList();32 }).OrderByDescending(s => s.StartDate).ToList(); 32 33 33 34 List<string> Task = new List<string>(); … … 57 58 UserName = jobs.UserName, 58 59 StartDate = tasks.StartTime 59 }).OrderByDescending(s => s.StartDate).T ake(Convert.ToInt32(limit)).ToList();60 }).OrderByDescending(s => s.StartDate).ToList(); 60 61 61 62 List<List<string>> results = new List<List<string>>(); -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Scripts/CollapsingSection.js
r11059 r11084 45 45 var jqCaller = $(caller); 46 46 if (jqCaller.html() == "-") { 47 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer ").hide();47 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, .tabSection").hide(); 48 48 jqCaller.html("+"); 49 49 } 50 50 else { 51 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer ").show();51 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, .tabSection").show(); 52 52 jqCaller.html("-"); 53 53 } 54 54 } 55 56 /* Because some chart sections are collapsed(display=none) on resize the charts will not chart 57 properly unless they are opened, them updated, then closed again. */ 58 function ResizeOpenCloseTabular(caller) { 59 var jqCaller = $(caller); 60 if (jqCaller.css("display") != "none") { 61 jqCaller.hide(); 62 } 63 else { 64 jqCaller.show(); 65 } 66 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/LoginRequired/Admin.cshtml
r11059 r11084 122 122 <label>Limit</label> 123 123 <select id="ExceptionLimit"> 124 <option>2 0</option>124 <option>2</option> 125 125 <option>50</option> 126 126 <option selected="selected">100</option> … … 244 244 } 245 245 @ExceptionHelper.UserExceptions("TasksContainer", Url.Action("TaskExceptions", "ExceptionData"), "limit", "selectedUser", "startDate", "endDate", "jobId", "taskState") 246 @ChartHelper.TasksForUser("TasksContainer", "Task",Url.Action("UserTask", "ChartData"), "RefreshUser", "selectedUser", "limit", "startDate", "endDate", "jobId", "taskState", "pageNumber")246 @ChartHelper.TasksForUser("TasksContainer",Url.Action("UserTask", "ChartData"), "RefreshUser", "selectedUser", "limit", "startDate", "endDate", "jobId", "taskState", "pageNumber") 247 247 pageNumber = null; 248 248 } 249 250 @ChartHelper.ResizeTasks("Task")251 @ExceptionHelper.ScrollToException()252 249 253 250 //Task Overview … … 280 277 } 281 278 282 @ChartHelper.ResizeSlaves()283 284 279 //Exceptions Overview 285 280 $("#ExceptionSlaveList").change(function () { … … 299 294 selectedSlave = $('#Slaves').val(); 300 295 } 301 @ExceptionHelper.UserExceptions("ExceptionContainer", Url.Action("TaskExceptions", "ExceptionData"), "limit", null, "startDate", "endDate", null, null) 302 @ExceptionHelper.ShowErrors("ExceptionContainer") 303 @ExceptionHelper.ErrorsOnSlaves("ExceptionContainer",Url.Action("SlaveExceptions", "ExceptionData"),"limit","startDate", "endDate","selectedSlave") 296 @ExceptionHelper.UserExceptions("ExceptionContainer",Url.Action("TaskExceptions","ExceptionData"),"limit",null,"startDate","endDate",null,null,"selectedSlave") 297 @ExceptionHelper.ErrorsOnSlaves("ExceptionContainer",Url.Action("SlaveExceptions","ExceptionData"),"limit","startDate","endDate","selectedSlave","RefreshException","pageNumber") 304 298 } 305 @ExceptionHelper.ShowSlaveInfo(Url.Action("SlaveInfo", "ChartData"),"limit","startDate","endDate") 299 @ExceptionHelper.ShowSlaveInfo(Url.Action("SlaveInfo","ChartData"),"limit","startDate","endDate") 300 301 //General Chart Methods 302 @ChartHelper.ResizeCharts() 303 @ExceptionHelper.ScrollToException() 306 304 </script> 307 305 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/LoginRequired/UserTask.cshtml
r11053 r11084 130 130 } 131 131 @ExceptionHelper.UserExceptions("TasksContainer",Url.Action("TaskExceptions", "ExceptionData"),"limit","userName","startDate","endDate","jobId","taskState") 132 @ChartHelper.TasksForUser("TasksContainer", "Task",Url.Action("UserTask", "ChartData"),"TaskInformation","userName","limit","startDate","endDate","jobId","taskState","pageNumber")132 @ChartHelper.TasksForUser("TasksContainer",Url.Action("UserTask", "ChartData"),"TaskInformation","userName","limit","startDate","endDate","jobId","taskState","pageNumber") 133 133 pageNumber = null; 134 134 } … … 149 149 150 150 TaskInformation(); 151 @ChartHelper.Resize Tasks("Task")151 @ChartHelper.ResizeCharts() 152 152 @ExceptionHelper.ScrollToException() 153 153 </script>
Note: See TracChangeset
for help on using the changeset viewer.