Changeset 11030 for branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code
- Timestamp:
- 06/20/14 16:20:02 (11 years ago)
- Location:
- branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/AdminHelper.cshtml
r11020 r11030 37 37 } 38 38 39 @helper UserTaskStats(string destinationTag, string overallUrl, string userUrl, string userName, string start, string end)39 @helper UserTaskStats(string destinationTag, string url, string userName, string start, string end) 40 40 { 41 if (userName!="") {41 if (userName != "" || userName != null) { 42 42 <text> 43 43 $.ajax({ 44 url: "@(new HtmlString( overallUrl))?start=" + @start + "&end=" + @end, datatype: "json", success: function (overallResult) {44 url: "@(new HtmlString(url))?start=" + @start + "&end=" + @end, datatype: "json", success: function (overallResult) { 45 45 $.ajax({ 46 url: "@(new HtmlString(u serUrl))?userName=" + @userName + "&start=" + @start + "&end=" + @end, datatype: "json", success: function (userResult) {46 url: "@(new HtmlString(url))?start=" + @start + "&end=" + @end + "&userName=" + @userName, datatype: "json", success: function (userResult) { 47 47 $("#" + "@destinationTag").html(""); 48 48 for (var i = 0; i < userResult.length; i++) { 49 49 $("#" + "@destinationTag").append('<label class="barLabel">' + userResult[i].Key + '</label>'); 50 $("#" + "@destinationTag").append('<div class="outerBar"><div class="innerBar" id="InnerBar' + i + '"><p class="innerBarText">' + +userResult[i].Value.toFixed(4) + '</p></div><p class="outerBarText" id="OuterText' + i + '">' + +overallResult[i].toFixed(4) + '</p></div>'); 51 $("#InnerBar" + i).css('width',((userResult[i].Value/overallResult[i])*100).toFixed(2) + '%'); 52 $("#OuterText" + i).css('width',(98 - ((userResult[i].Value/overallResult[i])*100)).toFixed(2) + '%'); 50 $("#" + "@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>'); 51 $("#InnerBar" + i).css('width',((userResult[i].Value/overallResult[i].Value)*100).toFixed(2) + '%'); 53 52 } 54 53 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ChartHelper.cshtml
r11020 r11030 110 110 } 111 111 112 @helper TasksForUser(string container, string destinationTag, string url, string userName, string startDate = null, string endDate = null) 113 { 114 <text> 115 $.ajax({url: "@(new HtmlString(url))?userName=" + @(userName) + "&start=" + @startDate + "&end=" + @endDate, datatype: "json", success: function(result) { 116 $("#@container").html(""); 117 if(result[0].length==0) { 112 @helper TasksForUser(string container, string destinationTag, string pageUrl, string taskUrl, string functionName, string userName, string limit, string startDate = null, string endDate = null, string jobId=null, string taskState=null, string pageNumber=null) 113 { 114 <text> 115 var GetRequest = "?userName=" + @(userName) + "&limit=" + @(limit); 116 @if(startDate!=null) { 117 @:if(@(startDate)!=null) { 118 @:GetRequest += "&start=" + @startDate; 119 @:} 120 } 121 @if(endDate!=null) { 122 @:if(@(endDate)!=null) { 123 @:GetRequest += "&end=" + @endDate; 124 @:} 125 } 126 @if(jobId!=null) { 127 @:if(@(jobId)!=null) { 128 @:GetRequest += "&jobId=" + @jobId; 129 @:} 130 } 131 @if(taskState!=null) { 132 @:if(@(taskState)!=null) { 133 @:GetRequest += "&taskState=" + @taskState; 134 @:} 135 } 136 $.ajax({async: false, url: "@(new HtmlString(pageUrl))" + GetRequest, datatype: "json", success: function(result) { 137 if(result > 1) { 138 $("#@container").append('<label class="pageTitle">Page: </label>') 139 for(var i=0; i < result; i++) { 140 $("#" + "@container").append('<a id="Page' + (i + 1) + '" class="page">' + (i + 1) + '</a>') 141 } 142 if(@pageNumber != null) { 143 $("#Page" + @pageNumber).css('color','#F7921D'); 144 } 145 else { 146 $("#Page1").css('color','#F7921D'); 147 } 148 } 149 }}); 150 @if(pageNumber!=null) { 151 @:if(@(pageNumber)!=null) { 152 @:GetRequest += "¤tPage=" + @pageNumber; 153 @:} 154 } 155 $.ajax({url: "@(new HtmlString(taskUrl))" + GetRequest, datatype: "json", success: function(result) { 156 if(result.Key.length==0) { 118 157 $("#@container").append( 119 '<section class="chartContainer"><h1 class="title">' + @userName + ' has no tasks for the given time period!</h1></section>'158 '<section class="chartContainer"><h1 class="title">' + @userName + ' has no tasks for the specified filters!</h1></section>' 120 159 ) 121 160 } … … 126 165 127 166 //Globally accesible, for use when resizing, eliminates extra DB request 128 window["numberTasks"] = result[0].length; 167 window["numberTasks"] = result.Key.length; 168 169 //Set display of all errors to none, errors matching the tasks will be reset below 170 $(".errorContainer, .errorTitle, .errorTask, .errorMessage").css('display','none'); 129 171 130 172 //For each result create a seperate collapsable section with a chart and info label 131 for(var i = 0; i < result [0].length; i++){173 for(var i = 0; i < result.Key.length; i++){ 132 174 $("#" + "@container").append( 133 '<section class="chartContainer"><h1 class="title" >Task ' + (i + 1)+134 '</h1><button class="collapse" onclick="collapseSection(this)"> -</button><div id="@(destinationTag)' + i +175 '<section class="chartContainer"><h1 class="title" id="' + result.Key[i] + '">Task ' + result.Key[i] + 176 '</h1><button class="collapse" onclick="collapseSection(this)">+</button><div id="@(destinationTag)' + i + 135 177 '"></div><label id="@(destinationTag)' + i + 'Info"></label></section>' 136 178 ) 137 waitTime = [result[0][i]]; 138 transferTime = [result[1][i]]; 139 runTime = [result[2][i]]; 179 $(".errorTask").each(function() { 180 if($(this).html()==result.Key[i]) { 181 $("#" + result.Key[i]).css("color","red"); 182 $("#" + result.Key[i]).append(" - ERROR"); 183 $(".errorContainer, .errorTitle, .underline").css('display','inline-block'); 184 $(this).css('display','inline-block'); 185 $(this).next().css('display','inline-block'); 186 } 187 }); 188 waitTime = [result.Value[0][i]]; 189 transferTime = [result.Value[1][i]]; 190 runTime = [result.Value[2][i]]; 140 191 window["@(destinationTag)Plot" + i] = $.jqplot("@destinationTag" + i, [waitTime,transferTime,runTime], { 141 //stackSeries: true,142 192 seriesDefaults:{ 143 193 renderer:$.jqplot.BarRenderer, 144 194 shadowAngle: 135, 145 //rendererOptions: {146 // barDirection: 'horizontal'147 //},148 195 pointLabels: {show: true, formatString: '%.3f'} 149 196 }, … … 176 223 $("#" + "@(destinationTag)" + i).bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data) { 177 224 $("#" + $(this).attr('id') + "Info").html(seriesDescriptions[seriesIndex] + ': ' + data[1]); 178 }); 225 }); 226 227 window["@(destinationTag)Plot" + i].replot({ resetAxes: true }); 228 229 $('#@destinationTag' + i).contextmenu(function() { 230 window["@(destinationTag)Plot" + i].resetZoom(); 231 window["@(destinationTag)Plot" + i].replot({ resetAxes: true }); 232 return false; 233 }); 234 235 collapsedByDefault(document.getElementById("@(destinationTag)" + i)); 179 236 } 180 237 }}); 238 239 $(".page").click(function () { 240 pageNumber = $(this).html(); 241 @(functionName)(); 242 }); 181 243 </text> 182 244 } … … 187 249 $(window).resize(function() { 188 250 for(var i = 0; i < numberTasks; i++) { 189 window[ "@(destinationTag)Plot" + i].replot({ resetAxes: true }); 251 $.each(window[ "@(destinationTag)Plot" + i].series, function(index, series) { 252 series.barWidth = undefined; 253 }); 254 window["@(destinationTag)Plot" + i].replot({ resetAxes: true }); 190 255 } 191 256 }); 192 257 </text> 193 258 } 194 195 @* OLD SMOOTHIE CHART FUNCTIONS *@196 @*@helper CreateSmoothieChart(string destinationTag, string stroke, string fill, string label)197 {198 <text>199 var @(destinationTag)Smoothie = new SmoothieChart({200 grid: {201 strokeStyle: '@stroke', fillStyle: '@fill',202 lineWidth: 1, millisPerLine: 450, verticalSections: 4,203 },204 labels: {205 fillStyle: '@label'206 }207 });208 209 var @(destinationTag)TimeSeries = new Array()210 </text>211 }212 213 @helper SetSmoothieCanvas(string destinationTag, string delay)214 {215 <text>216 @(destinationTag)Smoothie.streamTo(document.getElementById("@destinationTag"), @delay);217 </text>218 }219 220 @helper AssignTimeSeries(string seriesName, string destinationTag, string stroke, string fill)221 {222 <text>223 var @(seriesName)TS = new TimeSeries();224 @(destinationTag)Smoothie.addTimeSeries(@(seriesName)TS, { strokeStyle: '@stroke', fillStyle: '@fill', lineWidth: 3 });225 @(destinationTag)TimeSeries.push(@(seriesName)TS);226 </text>227 }228 229 @helper UpdateChartData(string destinationTag, string url)230 {231 <text>232 $.ajax({233 url: '@(url)', datatype: "json", success: function (result) {234 var i235 for (i = 0; i < @(destinationTag)TimeSeries.length; i++) {236 @(destinationTag)TimeSeries[i].append(new Date().getTime(), result[i]);237 }238 }239 });240 </text>241 }*@242 259 243 260 @helper SetStreamingProperties(int refresh, int chartLength, int upperY) { … … 376 393 </text> 377 394 } 378 379 @helper MakeCollapsable()380 {381 <text>382 $(document).ready(function() {383 $(".collapse").click(function () {384 if ($(this).html() == "-") {385 $(this).parent().children("canvas, div, fieldset, label").fadeOut();386 $(this).html("+");387 }388 else {389 $(this).parent().children("canvas, div, fieldset, label").fadeIn();390 $(this).html("-");391 }392 });393 });394 </text>395 }
Note: See TracChangeset
for help on using the changeset viewer.