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 | for (var i = 0; i < userResult.length; i++) {
|
---|
53 | $("#" + "@destinationTag").append('<label class="barLabel">' + userResult[i].Key + '</label>');
|
---|
54 | $("#" + "@destinationTag").append('<div class="outerBar"><div class="innerBar" id="InnerBar' + i + '"><label class="innerBarText">' + +userResult[i].Value.toFixed(4) + '</label></div></div><label class="outerBarText" id="OuterText' + i + '">' + +overallResult[i].Value.toFixed(4) + '</label>');
|
---|
55 | $("#InnerBar" + i).css('width',((userResult[i].Value/overallResult[i].Value)*100).toFixed(2) + '%');
|
---|
56 | }
|
---|
57 | }
|
---|
58 | });
|
---|
59 | }
|
---|
60 | });
|
---|
61 | </text>
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | @helper MoreTaskInfo(string url)
|
---|
66 | {
|
---|
67 | <text>
|
---|
68 | function MoreTaskInfo(caller) {
|
---|
69 | if($(caller).siblings('.moreInfoTable').length == 0) {
|
---|
70 | var taskId = $(caller).attr('id');
|
---|
71 | $.ajax({
|
---|
72 | url: "@(new HtmlString(url))?taskId=" + taskId, datatype: "json", success: function (result) {
|
---|
73 | var appendString = '<table class="moreInfoTable"><tr>';
|
---|
74 | for (var i = 0; i < result.length; i++) {
|
---|
75 | if(i % 2 == 0 && i != 0) {
|
---|
76 | appendString += '</tr><tr>';
|
---|
77 | }
|
---|
78 | appendString += '<td class="taskInfoCell"><label class="taskInfoKey">' + result[i].Key + '</label>';
|
---|
79 | appendString += '<label class="taskInfoValue">' + +result[i].Value.toFixed(4) + '</label></td>';
|
---|
80 | }
|
---|
81 | appendString += '</tr></table>'
|
---|
82 | $(caller).parent().append(appendString);
|
---|
83 | }
|
---|
84 | });
|
---|
85 | $(caller).html("Less Info");
|
---|
86 | }
|
---|
87 | else {
|
---|
88 | $(caller).siblings('.moreInfoTable').remove();
|
---|
89 | $(caller).html("More Info");
|
---|
90 | }
|
---|
91 | }
|
---|
92 | </text>
|
---|
93 | }
|
---|
94 |
|
---|
95 | @helper MoreSlaveInfo(string url)
|
---|
96 | {
|
---|
97 | <text>
|
---|
98 | function MoreSlaveInfo(caller) {
|
---|
99 | if($(caller).siblings('.moreInfoTable').length == 0) {
|
---|
100 | var slaveId = $(caller).attr('id');
|
---|
101 | $.ajax({
|
---|
102 | url: "@(new HtmlString(url))?slaveId=" + slaveId, datatype: "json", success: function (result) {
|
---|
103 | var appendString = '<table class="moreInfoTable"><tr>';
|
---|
104 | for (var i = 0; i < result[0].length; i++) {
|
---|
105 | appendString += '<th class="slaveInfoHeader">' + result[0][i].Key + '</th>'
|
---|
106 | }
|
---|
107 | appendString += '</tr>';
|
---|
108 | for (var j = 0; j < result.length; j++) {
|
---|
109 | appendString += '<tr>';
|
---|
110 | for (var k = 0; k < result[j].length; k++) {
|
---|
111 | appendString += '<td class="slaveInfoCell"><label class="slaveInfoValue">' + result[j][k].Value + '</label></td>';
|
---|
112 | }
|
---|
113 | appendString += '</tr>';
|
---|
114 | }
|
---|
115 | appendString += '</table>'
|
---|
116 | $(caller).parent().append(appendString);
|
---|
117 | }
|
---|
118 | });
|
---|
119 | $(caller).html("Less Info");
|
---|
120 | }
|
---|
121 | else {
|
---|
122 | $(caller).siblings('.moreInfoTable').remove();
|
---|
123 | $(caller).html("More Info");
|
---|
124 | }
|
---|
125 | }
|
---|
126 | </text>
|
---|
127 | } |
---|