Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ExceptionHelper.cshtml @ 11030

Last change on this file since 11030 was 11030, checked in by mroscoe, 10 years ago
File size: 3.3 KB
Line 
1@* HeuristicLab
2 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
3 *
4 * This file is part of HeuristicLab.
5 *
6 * HeuristicLab is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * HeuristicLab is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
18 *@
19
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        @:}
28      }
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  }
58}
59
60@helper ScrollToException() {
61  <text>
62    function scrollTo(caller) {
63      openOnError(document.getElementById($(caller).html()));
64      $('html, body').animate({
65          scrollTop: $("#" + $(caller).html()).parent().offset().top
66      }, 2000);
67    }
68   
69    $('#ScrollTop').click(function() {
70      $('html, body').animate({
71          scrollTop: 0
72      }, 2000);
73    });
74
75    $(window).on("scrollstop",function() {
76      var newTop = $(window).scrollTop();
77      if(newTop==0) {
78        $('#ScrollTop').animate({
79          top: newTop + 20
80        }, 800, function() {
81          $('#ScrollTop').css('display','none');
82        });
83      }
84      else {
85        $('#ScrollTop').css('display','block');
86        $('#ScrollTop').animate({
87          top: newTop + 20
88        }, 800);
89      }
90    });
91  </text>
92}
Note: See TracBrowser for help on using the repository browser.