Changeset 11084


Ignore:
Timestamp:
07/04/14 08:59:24 (5 years ago)
Author:
mroscoe
Message:
 
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  
    102102}
    103103
     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
    104149@helper NumberPages(string records, string limit, string container, string functionName, string currentPage = null)
    105150{
     
    134179}
    135180
    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    {
    141187      @:if(@(startDate)!=null) {
    142188        @:GetRequest += "&start=" + @startDate;
    143189      @:}
    144190    }
    145     @if(endDate!=null) {
     191    @if (endDate != null)
     192    {
    146193      @:if(@(endDate)!=null) {
    147194        @:GetRequest += "&end=" + @endDate;
    148195      @:}
    149196    }
    150     @if(jobId!=null) {
     197    @if (jobId != null)
     198    {
    151199      @:if(@(jobId)!=null) {
    152200        @:GetRequest += "&jobId=" + @jobId;
    153201      @:}
    154202    }
    155     @if(taskState!=null) {
     203    @if (taskState != null)
     204    {
    156205      @:if(@(taskState)!=null) {
    157206        @:GetRequest += "&taskState=" + @taskState;
     
    161210      async: false, url: "@(new HtmlString(url))" + GetRequest, datatype: "json", success: function(result) {
    162211      if(@(userName) == null) {
    163         $("#@container").append(
     212        $("#@(destinationTag)").append(
    164213          '<section class="chartContainer">' +
    165214            '<h1 class="title">Please select a user!</h1>' +
     
    168217      }
    169218      else if(result.length==0) {
    170         $("#@container").append(
     219        $("#@(destinationTag)").append(
    171220          '<section class="chartContainer">' +
    172221            '<h1 class="title">' + @userName + ' has no tasks for the specified filters!</h1>' +
     
    182231        //Checks if multipage display, if it is then trims results to
    183232        //the results for the page to be displayed
    184         @ChartHelper.NumberPages("result",limit,container,functionName,pageNumber)
     233        @ChartHelper.NumberPages("result", limit, destinationTag, functionName, pageNumber)
    185234
    186235        //Globally accesible, for use when resizing, eliminates extra DB request
     
    188237
    189238        //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');
    191240
    192241        //For each result create a seperate collapsable section with a chart and info label
    193242        for(var i = 0; i < result.length; i++){
    194           $("#" + "@container").append(
     243          $("#" + "@(destinationTag)").append(
    195244            '<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>' +
    197246              '<button class="collapse" onclick="CollapseSection(this)">+</button>' +
    198247              '<div id="@(destinationTag)Plot' + i + '"></div>' +
     
    202251          //Re-enables the error display if any of the tasks on the page have Ids matching
    203252          //those of errors
    204           $(".errorTask","#" + "@(container)").each(function() {
     253          $(".errorTask","#" + "@(destinationTag)").each(function() {
    205254            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');
    209258              $(this).css('display','inline-block');
    210259              $(this).next().css('display','inline-block');
     
    250299          });
    251300
    252           CollapsedByDefault(document.getElementById("@(container)" + result[i].Key));
     301          CollapsedByDefault(document.getElementById("@(destinationTag)Plot" + i));
    253302        }
    254303      }
     
    257306}
    258307
    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{
    284310  <text>
    285311  //Refresh time (in millisec)
     
    307333}
    308334
    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{
    310337  <text>
    311338  //Get current time, used to create initial values
     
    352379        </text>}
    353380        min: 0,
    354         @if (maxY != null) {
     381        @if (maxY != null)
     382        {
    355383          @:max: @maxY,
    356384        }
    357         else{
     385        else
     386        {
    358387          @:max: window["@(dataName)Data" + 0][window["@(dataName)Data" + 0].length - 1][1] + upperYBuffer,
    359388        }
     
    375404}
    376405
    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{
    378408  <text>
    379409  //If the data is beyond chartSize use shift to trim one off the end
     
    406436  @(destinationTag)PlotOptions.axes.xaxis.min = window["@(dataName)Data" + 0][0][0];
    407437  @(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  {
    409440    @:@(destinationTag)PlotOptions.axes.yaxis.max = window["@(dataName)Data" + 0][window["@(dataName)Data" + 0].length - 1][1] + upperYBuffer;
    410441  }
     
    416447}
    417448
    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  {
    422455    @:if(@(startDate)!=null) {
    423       @:GetRequest += "&start=" + @startDate;
     456      @:if(GetRequest == "") {
     457        @:GetRequest += "?start=" + @startDate;
     458      @:}
     459      @:else {
     460        @:GetRequest += "&start=" + @startDate;
     461      @:}
    424462    @:}
    425463  }
    426   @if(endDate!=null) {
     464  @if (endDate != null)
     465  {
    427466    @:if(@(endDate)!=null) {
    428       @:GetRequest += "&end=" + @endDate;
     467      @:if(GetRequest == "") {
     468        @:GetRequest += "?end=" + @endDate;
     469      @:}
     470      @:else {
     471        @:GetRequest += "&end=" + @endDate;
     472      @:}
    429473    @:}
    430474  }
    431   @if (userName != null) {
     475  @if (userName != null)
     476  {
    432477    @:if(@(userName)!=null) {
    433       @:GetRequest += "&userName=" + @userName;
     478      @:if(GetRequest == "") {
     479        @:GetRequest += "?userName=" + @userName;
     480      @:}
     481      @:else {
     482        @:GetRequest += "&userName=" + @userName;
     483      @:}
    434484    @:}
    435485  }
    436   @if (slaveId != null) {
     486  @if (slaveId != null)
     487  {
    437488    @:if(@(slaveId)!=null) {
    438       @:GetRequest += "&slaveId=" + @slaveId;
     489      @:if(GetRequest == "") {
     490        @:GetRequest += "?slaveId=" + @slaveId;
     491      @:}
     492      @:else {
     493        @:GetRequest += "&slaveId=" + @slaveId;
     494      @:}
    439495    @:}
    440496  }
     
    452508
    453509    if(result.length == 0) {
     510      @if (!singleSlave) {
     511        @:$('#' + destTag).html("");
     512      }
    454513      $('#' + destTag).append(
    455514        '<section class="chartContainer">' +
     
    461520      var time = new Date();
    462521
    463       @if(!singleSlave) {
     522      @if (!singleSlave)
     523      {
    464524        @:$('#' + destTag).html("");
    465525
     
    468528        @ChartHelper.NumberPages("result", limit, destinationTag, functionName, pageNumber)
    469529      }
    470 
    471       //Globally accesible, for use when resizing, eliminates extra DB request
    472       window["numberSlaves"] = result.length;
    473530
    474531      for(i = 0; i < result.length; i++) {
     
    483540        $('#' + destTag).append(
    484541          '<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>' +
    486543            '<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>' +
    490547          '</section>');
    491548        for(j = 0; j < result[i].length; j++) {
     
    498555        }
    499556        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%%")
    503560        }
    504561        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%%")
    508565        }
    509566        for(k = 0; k < slaveChartNames.length; k++) {
    510           CollapsedByDefault(document.getElementById(slaveChartNames[k] + "Plot" + i));
     567          CollapsedByDefault(document.getElementById(destTag + slaveChartNames[k] + "Plot" + i));
    511568        }
    512569      }
     
    516573}
    517574
    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{
    554577  <text>
    555578  window[@(destinationTag) + "Plot" + @(chartId)] = $.jqplot(@(destinationTag) + "Plot" + @(chartId), @series, {
     
    562585      },
    563586      yaxis: {
    564         @if (axisYFormat != null) {
     587        @if (axisYFormat != null)
     588        {
    565589          <text>
    566590          tickOptions: {
     
    569593          </text>
    570594        }
    571         @if (minY != null) {
     595        pad: 0,
     596        @if (minY != null)
     597        {
    572598            @:min: @minY,
    573599        }
    574         @if (maxY != null) {
     600        @if (maxY != null)
     601        {
    575602            @:max: @maxY,
    576603        }
    577         pad: 0
    578604      }
    579605    },
     
    591617}
    592618
    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{
    594621  <text>
    595622  window[@(destinationTag) + "Plot" + @(chartId)] = $.jqplot(@(destinationTag) + "Plot" + @(chartId), @series, {
     
    607634      },
    608635      yaxis: {
    609         @if (axisYFormat != null) {
     636        @if (axisYFormat != null)
     637        {
    610638          <text>
    611639          tickOptions: {
     
    614642          </text>
    615643        }
    616         @if (minY != null) {
     644        pad: 0,
     645        @if (minY != null)
     646        {
    617647            @:min: @minY,
    618648        }
    619         @if (maxY != null) {
     649        @if (maxY != null)
     650        {
    620651            @:max: @maxY,
    621652        }
    622         pad: 0
    623653      }
    624654    },
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ExceptionHelper.cshtml

    r11059 r11084  
    1818 *@
    1919
    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)
    2121{
    2222  <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 {
    2630        @:GetRequest += "&userName=" + @userName;
    2731      @:}
    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 {
    3141        @:GetRequest += "&start=" + @startDate;
    3242      @:}
    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 {
    3652        @:GetRequest += "&end=" + @endDate;
    3753      @:}
    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 {
    4163        @:GetRequest += "&jobId=" + @jobId;
    4264      @:}
    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 {
    4674        @:GetRequest += "&taskState=" + @taskState;
    4775      @:}
    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>';
    62100        }
    63       }
    64     });
     101        ErrorHTML += '</section>';
     102        $("#" + "@destinationTag").append(ErrorHTML);
     103      }
     104    }
     105  });
    65106  </text>
    66107}
     
    69110  <text>
    70111    function ScrollTo(caller) {
    71       var taskErrorId = $(caller).parent().parent().attr('id') + $(caller).html();
     112      var taskErrorId = $(caller).parent().parent().attr('id') + $(caller).html() + "PlotTitle";
    72113      OpenOnError(document.getElementById(taskErrorId));
    73114      $('html, body').animate({
     
    107148}
    108149
    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  {
    113155    @: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  {
    118166    @: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  {
    123177    @:if(@(clientId)!=null) {
    124       @:GetRequest += "&clientId=" + @clientId;
     178      @:if(GetRequest == "") {
     179        @:GetRequest += "?clientId=" + @clientId;
     180      @:}
     181      @:else {
     182        @:GetRequest += "&clientId=" + @clientId;
     183      @:}
    125184    @:}
    126185  }
    127186  $.ajax({
    128187    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
    129196      for(i = 0; i < result.length; i++) {
    130197        $("#" + "@(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>' +
    133200            '<button class="collapse" onclick="CollapseSection(this)">+</button>' +
    134201            '<label id="' + result[i][0] + 'ErrorMessage">Error Message: ' + result[i][1] + '</label>' +
     
    138205          '</section>'
    139206        );
    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"));
    141221      }
    142222    }
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Content/Site.css

    r11059 r11084  
    8989  font-size: 1.3em;
    9090  color: #FF5640;
    91   display: inline-block;
     91  display: none;
    9292}
    9393
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ChartDataController.cs

    r11053 r11084  
    139139    }
    140140
    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)
    170142    {
    171143      using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString))
     
    204176    }
    205177
    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)
    207179    {
    208180      using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString))
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ExceptionDataController.cs

    r11053 r11084  
    99  public class ExceptionDataController : Controller {
    1010
    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)
    1212    {
    1313      using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) {
     
    2323          (!end.HasValue || tasks.EndTime < end) &&
    2424          (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)
    2627          select new
    2728          {
     
    2930            ErrorMessage = tasks.Exception,
    3031            StartDate = tasks.StartTime
    31           }).OrderByDescending(s => s.StartDate).Take(Convert.ToInt32(limit)).ToList();
     32          }).OrderByDescending(s => s.StartDate).ToList();
    3233
    3334        List<string> Task = new List<string>();
     
    5758           UserName = jobs.UserName,
    5859           StartDate = tasks.StartTime
    59          }).OrderByDescending(s => s.StartDate).Take(Convert.ToInt32(limit)).ToList();
     60         }).OrderByDescending(s => s.StartDate).ToList();
    6061
    6162        List<List<string>> results = new List<List<string>>();
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Scripts/CollapsingSection.js

    r11059 r11084  
    4545  var jqCaller = $(caller);
    4646  if (jqCaller.html() == "-") {
    47     jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer").hide();
     47    jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, .tabSection").hide();
    4848    jqCaller.html("+");
    4949  }
    5050  else {
    51     jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer").show();
     51    jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, .tabSection").show();
    5252    jqCaller.html("-");
    5353  }
    5454}
     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. */
     58function 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  
    122122      <label>Limit</label>
    123123      <select id="ExceptionLimit">
    124         <option>20</option>
     124        <option>2</option>
    125125        <option>50</option>
    126126        <option selected="selected">100</option>
     
    244244      }
    245245      @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")
    247247      pageNumber = null;
    248248    }
    249 
    250     @ChartHelper.ResizeTasks("Task")
    251     @ExceptionHelper.ScrollToException()
    252249
    253250    //Task Overview
     
    280277    }
    281278
    282     @ChartHelper.ResizeSlaves()
    283 
    284279    //Exceptions Overview
    285280    $("#ExceptionSlaveList").change(function () {
     
    299294        selectedSlave = $('#Slaves').val();
    300295      }
    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")
    304298    }
    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()
    306304  </script>
    307305}
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/LoginRequired/UserTask.cshtml

    r11053 r11084  
    130130      }
    131131      @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")
    133133      pageNumber = null;
    134134    }
     
    149149
    150150    TaskInformation();
    151     @ChartHelper.ResizeTasks("Task")
     151    @ChartHelper.ResizeCharts()
    152152    @ExceptionHelper.ScrollToException()
    153153  </script>
Note: See TracChangeset for help on using the changeset viewer.