Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/27/14 16:39:43 (10 years ago)
Author:
mroscoe
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ExceptionHelper.cshtml

    r11030 r11053  
    1818 *@
    1919
    20 @helper UserExceptions(string destinationTag, string url, string userName, string limit, string startDate = null, string endDate = null, string jobId = null, string taskState = null) {
    21   if(userName!="" || userName!=null) {
    22     <text>
    23       var GetRequest = "?userName=" + @(userName) + "&limit=" + @(limit);
    24       @if(startDate!=null) {
    25         @:if(@(startDate)!=null) {
    26           @:GetRequest += "&start=" + @startDate;
    27         @:}
     20@helper UserExceptions(string destinationTag, string url, string limit, string userName = null, string startDate = null, string endDate = null, string jobId = null, string taskState = null)
     21{
     22  <text>
     23    var GetRequest = "?limit=" + @(limit);
     24    @if (userName != null) {
     25      @:if(@(userName)!=null) {
     26        @:GetRequest += "&userName=" + @userName;
     27      @:}
     28    }
     29    @if(startDate!=null) {
     30      @:if(@(startDate)!=null) {
     31        @:GetRequest += "&start=" + @startDate;
     32      @:}
     33    }
     34    @if(endDate!=null) {
     35      @:if(@(endDate)!=null) {
     36        @:GetRequest += "&end=" + @endDate;
     37      @:}
     38    }
     39    @if(jobId!=null) {
     40      @:if(@(jobId)!=null) {
     41        @:GetRequest += "&jobId=" + @jobId;
     42      @:}
     43    }
     44    @if(taskState!=null) {
     45      @:if(@(taskState)==null) {
     46        @:GetRequest += "&taskState=" + @taskState;
     47      @:}
     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);
     62        }
    2863      }
    29       @if(endDate!=null) {
    30         @:if(@(endDate)!=null) {
    31           @:GetRequest += "&end=" + @endDate;
    32         @:}
    33       }
    34       @if(jobId!=null) {
    35         @:if(@(jobId)!=null) {
    36           @:GetRequest += "&jobId=" + @jobId;
    37         @:}
    38       }
    39       @if(taskState!=null) {
    40         @:if(@(taskState)==null) {
    41           @:GetRequest += "&taskState=" + @taskState;
    42         @:}
    43       }
    44       $.ajax({async: false, url: "@(new HtmlString(url))" + GetRequest, datatype: "json", success: function(result) {
    45           $("#" + "@destinationTag").html("");
    46           if(result.Key.length > 0) {
    47             var ErrorHTML = '<section class="errorContainer"><p class="errorTitle">Some tasks were found in error state!</p><label class="errorTask underline">Task</label><label class="errorMessage underline">Error</label>';
    48             for (var i = 0; i < result.Key.length; i++) {
    49               ErrorHTML += '<a class="errorTask" onclick="scrollTo(this)">' + result.Key[i] + '</a><label class="errorMessage">' + result.Value[i] + '</label>';
    50             }
    51             ErrorHTML += '</section>';
    52             $("#" + "@destinationTag").append(ErrorHTML);
    53           }
    54         }
    55       });
    56     </text>
    57   }
     64    });
     65  </text>
    5866}
    5967
    6068@helper ScrollToException() {
    6169  <text>
    62     function scrollTo(caller) {
    63       openOnError(document.getElementById($(caller).html()));
     70    function ScrollTo(caller) {
     71      var taskErrorId = $(caller).parent().parent().attr('id') + $(caller).html();
     72      OpenOnError(document.getElementById(taskErrorId));
    6473      $('html, body').animate({
    65           scrollTop: $("#" + $(caller).html()).parent().offset().top
     74          scrollTop: $("#" + taskErrorId).parent().offset().top
    6675      }, 2000);
    6776    }
     
    91100  </text>
    92101}
     102
     103@helper ShowErrors(string destinationTag) {
     104  <text>
     105  $("#@(destinationTag)").children(".errorContainer, .errorTitle, .errorTask, .errorMessage").css('display','inline-block');
     106  </text>
     107}
     108
     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) {
     113    @:if(@(startDate)!=null) {
     114      @:GetRequest += "&start=" + @startDate;
     115    @:}
     116  }
     117  @if(endDate!=null) {
     118    @:if(@(endDate)!=null) {
     119      @:GetRequest += "&end=" + @endDate;
     120    @:}
     121  }
     122  @if (clientId != null) {
     123    @:if(@(clientId)!=null) {
     124      @:GetRequest += "&clientId=" + @clientId;
     125    @:}
     126  }
     127  $.ajax({
     128    async: false, url: "@(new HtmlString(url))" + GetRequest, datatype: "json", success: function(result) {
     129      for(i = 0; i < result.length; i++) {
     130        $("#" + "@(destinationTag)").append(
     131          '<section class="chartContainer">' +
     132            '<h1 class="title" id="@(destinationTag)' + result[i][0] + '">Task ' + result[i][0] + '</h1>' +
     133            '<button class="collapse" onclick="CollapseSection(this)">+</button>' +
     134            '<label id="' + result[i][0] + 'ErrorMessage">Error Message: ' + result[i][1] + '</label>' +
     135            '<label id="' + result[i][0] + 'Client">Slave: <a onclick="ShowSlaveInfo(this)">' + result[i][2] + '</a></label>' +
     136            '<label id="' + result[i][0] + 'User">User Name: ' + result[i][3] + '</label>' +
     137            '<label id="' + result[i][0] + 'Date">Date/Time: ' + result[i][4] + '</label>' +
     138          '</section>'
     139        );
     140        CollapsedByDefault(document.getElementById("@(destinationTag)" + result[i][0]));
     141      }
     142    }
     143  });
     144  </text>
     145}
     146
     147@helper ShowSlaveInfo(string url, string limit, string startDate=null, string endDate=null) {
     148  <text>
     149  //Opens a sub-container with slave information
     150  function ShowSlaveInfo(caller) {
     151    @*@ChartHelper.SlaveInfoChart("",url,limit,startDate,endDate,"null","NotApplicable","null","$(caller).html()")*@
     152  }
     153  </text>
     154}
Note: See TracChangeset for help on using the changeset viewer.