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 UserList(string destinationTag, string url, bool multiline)
|
---|
21 | {
|
---|
22 | <script>
|
---|
23 | $.ajax({
|
---|
24 | url: "@(new HtmlString(url))", datatype: "json", success: function (result) {
|
---|
25 | $("#" + "@destinationTag").html("");
|
---|
26 | @if (multiline)
|
---|
27 | {
|
---|
28 | @:$("#" + "@destinationTag").attr("size", result.length);
|
---|
29 | }
|
---|
30 | else
|
---|
31 | {
|
---|
32 | @:$("#" + "@destinationTag").append("<option></option>");
|
---|
33 | }
|
---|
34 | for (var i = 0; i < result.length; i++) {
|
---|
35 | $("#" + "@destinationTag").append("<option>" + result[i] + "</option>");
|
---|
36 | }
|
---|
37 | }
|
---|
38 | });
|
---|
39 | </script>
|
---|
40 | }
|
---|
41 |
|
---|
42 | @helper UserTaskStats(string destinationTag, string url, string userName, string start, string end)
|
---|
43 | {
|
---|
44 | if (userName != "" || userName != null)
|
---|
45 | {
|
---|
46 | <text>
|
---|
47 | $.ajax({
|
---|
48 | url: "@(new HtmlString(url))?start=" + @start + "&end=" + @end, datatype: "json", success: function (overallResult) {
|
---|
49 | $.ajax({
|
---|
50 | url: "@(new HtmlString(url))?start=" + @start + "&end=" + @end + "&userName=" + @userName, datatype: "json", success: function (userResult) {
|
---|
51 | $("#" + "@destinationTag").html("");
|
---|
52 | var appendUnits;
|
---|
53 | for (var i = 0; i < userResult.length; i++) {
|
---|
54 | if(userResult[i].Key == "Total Waiting Time" || userResult[i].Key == "Total Transfer Time" || userResult[i].Key == "Total Runtime") {
|
---|
55 | appendUnits = " seconds";
|
---|
56 | }
|
---|
57 | else if (userResult[i].Key == "Memory Required") {
|
---|
58 | appendUnits = " KB";
|
---|
59 | }
|
---|
60 | else {
|
---|
61 | appendUnits = "";
|
---|
62 | }
|
---|
63 | $("#" + "@destinationTag").append('<label class="barLabel">' + userResult[i].Key + '</label>');
|
---|
64 | $("#" + "@destinationTag").append(
|
---|
65 | '<div class="outerBar">' +
|
---|
66 | '<div class="innerBar" id="InnerBar' + i + '">' +
|
---|
67 | '<label class="innerBarText">' + +userResult[i].Value.toFixed(2) + appendUnits + '</label>' +
|
---|
68 | '</div>' +
|
---|
69 | '</div>' +
|
---|
70 | '<label class="outerBarText" id="OuterText' + i + '">' + +overallResult[i].Value.toFixed(2) + appendUnits + '</label>'
|
---|
71 | );
|
---|
72 | $("#InnerBar" + i).css('width',((userResult[i].Value/overallResult[i].Value)*100).toFixed(2) + '%');
|
---|
73 | }
|
---|
74 | }
|
---|
75 | });
|
---|
76 | }
|
---|
77 | });
|
---|
78 | </text>
|
---|
79 | }
|
---|
80 | }
|
---|
81 |
|
---|
82 | @helper MoreTaskInfo(string url)
|
---|
83 | {
|
---|
84 | <text>
|
---|
85 | function MoreTaskInfo(caller) {
|
---|
86 | if($(caller).siblings('.moreInfoTable').length == 0) {
|
---|
87 | var taskId = $(caller).attr('id');
|
---|
88 | $.ajax({
|
---|
89 | url: "@(new HtmlString(url))?taskId=" + taskId, datatype: "json", success: function (result) {
|
---|
90 | var appendUnits;
|
---|
91 | var appendString = '<table class="moreInfoTable"><tr>';
|
---|
92 | for (var i = 0; i < result.length; i++) {
|
---|
93 | if (result[i].Key == "Memory Required") {
|
---|
94 | appendUnits = " KB";
|
---|
95 | }
|
---|
96 | else {
|
---|
97 | appendUnits = "";
|
---|
98 | }
|
---|
99 | if(i % 2 == 0 && i != 0) {
|
---|
100 | appendString += '</tr><tr>';
|
---|
101 | }
|
---|
102 | appendString += '<td class="taskInfoCell"><label class="taskInfoKey">' + result[i].Key + '</label>';
|
---|
103 | appendString += '<label class="taskInfoValue">' + +result[i].Value.toFixed(2) + appendUnits + '</label></td>';
|
---|
104 | }
|
---|
105 | appendString += '</tr></table>'
|
---|
106 | $(caller).parent().append(appendString);
|
---|
107 | }
|
---|
108 | });
|
---|
109 | $(caller).html("Less Info");
|
---|
110 | }
|
---|
111 | else {
|
---|
112 | $(caller).siblings('.moreInfoTable').remove();
|
---|
113 | $(caller).html("More Info");
|
---|
114 | }
|
---|
115 | }
|
---|
116 | </text>
|
---|
117 | }
|
---|
118 |
|
---|
119 | @helper MoreSlaveInfo(string url, string startDate, string endDate)
|
---|
120 | {
|
---|
121 | <text>
|
---|
122 | function MoreSlaveInfo(caller) {
|
---|
123 | CheckFilters();
|
---|
124 | if($(caller).siblings('.moreInfoTable').length == 0) {
|
---|
125 | var slaveId = $(caller).attr('id');
|
---|
126 | var GetRequest = "?slaveId=" + slaveId;
|
---|
127 | @if (startDate != null) {
|
---|
128 | @:if(@(startDate)!=null) {
|
---|
129 | @:GetRequest += "&start=" + @startDate;
|
---|
130 | @:}
|
---|
131 | }
|
---|
132 | @if (endDate != null) {
|
---|
133 | @:if(@(endDate)!=null) {
|
---|
134 | @:GetRequest += "&end=" + @endDate;
|
---|
135 | @:}
|
---|
136 | }
|
---|
137 | $.ajax({
|
---|
138 | url: "@(new HtmlString(url))" + GetRequest, datatype: "json", success: function (result) {
|
---|
139 | var appendString = '<table class="moreInfoTable"><tr>';
|
---|
140 | for (var i = 0; i < result[0].length; i++) {
|
---|
141 | appendString += '<th class="slaveInfoHeader">' + result[0][i].Key + '</th>'
|
---|
142 | }
|
---|
143 | appendString += '</tr>';
|
---|
144 | for (var j = 0; j < result.length; j++) {
|
---|
145 | appendString += '<tr>';
|
---|
146 | for (var k = 0; k < result[j].length; k++) {
|
---|
147 | appendString += '<td class="slaveInfoCell"><label class="slaveInfoValue">' + result[j][k].Value + '</label></td>';
|
---|
148 | }
|
---|
149 | appendString += '</tr>';
|
---|
150 | }
|
---|
151 | appendString += '</table>'
|
---|
152 | $(caller).parent().append(appendString);
|
---|
153 | }
|
---|
154 | });
|
---|
155 | $(caller).html("Less Info");
|
---|
156 | }
|
---|
157 | else {
|
---|
158 | $(caller).siblings('.moreInfoTable').remove();
|
---|
159 | $(caller).html("More Info");
|
---|
160 | }
|
---|
161 | }
|
---|
162 | </text>
|
---|
163 | } |
---|