- Timestamp:
- 08/04/14 13:01:40 (10 years ago)
- Location:
- branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ChartHelper.cshtml
r11252 r11259 448 448 } 449 449 450 @helper CreateStreamChart(string dataName, string destinationTag, string url, string title, string format = null, double? maxY = null)450 @helper CreateStreamChart(string dataName, string destinationTag, string url, string title, string slaveState, string format = null, double? maxY = null) 451 451 { 452 452 <text> … … 459 459 //Get the most recent value(s) from the given URL 460 460 $.ajax({ 461 async: false, url: '@(url)', datatype: "json", success: function (result) {461 async: false, url: "@(url)?state=" + @(slaveState), datatype: "json", success: function (result) { 462 462 for(i = 0; i < result.length; i++) { 463 463 @(dataName)CurrentValue[i] = result[i]; … … 531 531 } 532 532 533 @helper UpdateStreamChart(string dataName, string destinationTag, string url, string fixedY = null)533 @helper UpdateStreamChart(string dataName, string destinationTag, string url, string slaveState, string fixedY = null) 534 534 { 535 535 <text> … … 543 543 //Get the up-to-date data, each result assigned to it's own array 544 544 $.ajax({ 545 async: false, url: '@(url)', datatype: "json", success: function (result) {545 async: false, url: "@(url)?state=" + @(slaveState), datatype: "json", success: function (result) { 546 546 for(i = 0; i < result.length; i++) { 547 547 window[ "@(dataName)Data" + i].push([(new Date()).getTime(), result[i]]); -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Content/Site.css
r11252 r11259 560 560 } 561 561 562 label.slaveStateFilter { 563 margin-left: 2%; 564 display: inline; 565 } 566 567 select.slaveStateFilter { 568 margin-top: 2%; 569 display: inline; 570 } 571 562 572 /* User Page Styles*/ 563 573 #TasksContainer div[id^="Task"] { … … 579 589 } 580 590 581 .chartContainer > label:first-of-type , .moreTaskInfo {591 .chartContainer > label:first-of-type:not(.slaveStateFilter), .moreTaskInfo { 582 592 margin-bottom: 1%; 583 593 display: block; -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ChartDataController.cs
r11255 r11259 92 92 } 93 93 94 public JsonResult CurrentCpuUtilization( )94 public JsonResult CurrentCpuUtilization(string state) 95 95 { 96 96 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) … … 102 102 on clients.ResourceId equals resource.ResourceId 103 103 where clients.ExpirationTime == null && 104 (resource.SlaveState == SlaveState.Calculating || resource.SlaveState == SlaveState.Idle) 104 (state == "All") || 105 (state == "Online") && 106 (client.SlaveState == SlaveState.Idle || client.SlaveState == SlaveState.Calculating ) || 107 (state == "Available") && 108 (client.SlaveState == SlaveState.Idle) 105 109 select new { client.ClientId, client.CpuUtilization, client.Time }) 106 110 .OrderBy(c => c.Time).GroupBy(c => c.ClientId).ToList(); … … 113 117 } 114 118 115 public JsonResult CurrentCores( )119 public JsonResult CurrentCores(string state) 116 120 { 117 121 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) … … 123 127 on clients.ResourceId equals resource.ResourceId 124 128 where clients.ExpirationTime == null && 125 (resource.SlaveState == SlaveState.Calculating || resource.SlaveState == SlaveState.Idle) 129 (state == "All") || 130 (state == "Online") && 131 (client.SlaveState == SlaveState.Idle || client.SlaveState == SlaveState.Calculating) || 132 (state == "Available") && 133 (client.SlaveState == SlaveState.Idle) 126 134 select new { client.ClientId, client.NumTotalCores, client.NumUsedCores, client.Time }) 127 135 .OrderBy(c => c.Time).GroupBy(c => c.ClientId).ToList(); … … 135 143 } 136 144 137 public JsonResult CurrentMemory( )145 public JsonResult CurrentMemory(string state) 138 146 { 139 147 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) … … 145 153 on clients.ResourceId equals resource.ResourceId 146 154 where clients.ExpirationTime == null && 147 (resource.SlaveState == SlaveState.Calculating || resource.SlaveState == SlaveState.Idle) 155 (state == "All") || 156 (state == "Online") && 157 (client.SlaveState == SlaveState.Idle || client.SlaveState == SlaveState.Calculating) || 158 (state == "Available") && 159 (client.SlaveState == SlaveState.Idle) 148 160 select new { client.ClientId, client.TotalMemory, client.UsedMemory, client.Time }) 149 161 .OrderBy(c => c.Time).GroupBy(c => c.ClientId).ToList(); -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Scripts/CollapsingSection.js
r11222 r11259 3 3 $(".collapse").click(function () { 4 4 if ($(this).html() == "-") { 5 $(this).parent().children("canvas, div, fieldset, label, .chartContainer, a, table ").fadeOut();5 $(this).parent().children("canvas, div, fieldset, label, .chartContainer, a, table, select").fadeOut(); 6 6 $(this).html("+"); 7 7 } 8 8 else { 9 $(this).parent().children("canvas, div, fieldset, label, .chartContainer, a, table ").fadeIn();9 $(this).parent().children("canvas, div, fieldset, label, .chartContainer, a, table, select").fadeIn(); 10 10 $(this).html("-"); 11 11 } … … 18 18 var jqCaller = $(caller); 19 19 if (jqCaller.html() == "-") { 20 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, a, table ").fadeOut();20 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, a, table, select").fadeOut(); 21 21 jqCaller.html("+"); 22 22 } 23 23 else { 24 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, a, table ").fadeIn();24 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, a, table, select").fadeIn(); 25 25 jqCaller.html("-"); 26 26 } … … 30 30 section */ 31 31 function CollapsedByDefault(caller) { 32 $(caller).parent().children("canvas, div, fieldset, label, .chartContainer, a, table ").hide();32 $(caller).parent().children("canvas, div, fieldset, label, .chartContainer, a, table, select").hide(); 33 33 } 34 34 … … 36 36 function OpenOnError(caller) { 37 37 var jqCaller = $(caller); 38 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, a, table ").fadeIn();38 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, a, table, select").fadeIn(); 39 39 jqCaller.parent().children("button").html("-"); 40 40 } … … 45 45 var jqCaller = $(caller); 46 46 if (jqCaller.html() == "-") { 47 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, .tabSection, a, table ").hide();47 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, .tabSection, a, table, select").hide(); 48 48 jqCaller.html("+"); 49 49 } 50 50 else { 51 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, .tabSection, a, table ").show();51 jqCaller.parent().children("canvas, div, fieldset, label, .chartContainer, .tabSection, a, table, select").show(); 52 52 jqCaller.html("-"); 53 53 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/Home/Index.cshtml
r11252 r11259 31 31 <h1 class="title">Current Hive Status</h1> 32 32 <button class="collapse">-</button> 33 <label class="slaveStateFilter">Slave State:</label> 34 <select id="SlaveState" class="slaveStateFilter"> 35 <option>All</option> 36 <option selected="selected">Online</option> 37 <option>Available</option> 38 </select> 33 39 <div id="CurrentCPUUtilization"></div> 34 40 <div id="CurrentTotalUsedCores"></div> … … 104 110 RefreshCharts(); 105 111 }); 112 113 106 114 }); 107 115 … … 116 124 117 125 $(document).ready(function () { 126 var slaveState; 127 slaveState = $("#SlaveState").val(); 128 129 $("#SlaveState").change(function () { 130 slaveState = $(this).val(); 131 }); 132 118 133 @ChartHelper.UserTasks(Url.Action("UserTasks", "ChartData"), "section.currentStats", "Calculating"); 119 134 @ChartHelper.UserTasks(Url.Action("UserTasks", "ChartData"), "section.currentStats", "Waiting"); … … 121 136 @ChartHelper.SetStreamingProperties(1000,20,5) 122 137 123 @ChartHelper.CreateStreamChart("CurrentCPU", "CurrentCPUUtilization",Url.Action("CurrentCpuUtilization","ChartData"),"Current CPU Utilization"," %.2f%%",100.00)124 @ChartHelper.CreateStreamChart("CurrentCores", "CurrentTotalUsedCores",Url.Action("CurrentCores","ChartData"),"Current Total vs. Used Cores" )125 @ChartHelper.CreateStreamChart("CurrentMemory", "CurrentTotalUsedMemory",Url.Action("CurrentMemory","ChartData"),"Current Total vs. Used Memory" )138 @ChartHelper.CreateStreamChart("CurrentCPU", "CurrentCPUUtilization",Url.Action("CurrentCpuUtilization","ChartData"),"Current CPU Utilization","slaveState","%.2f%%",100.00) 139 @ChartHelper.CreateStreamChart("CurrentCores", "CurrentTotalUsedCores",Url.Action("CurrentCores","ChartData"),"Current Total vs. Used Cores","slaveState") 140 @ChartHelper.CreateStreamChart("CurrentMemory", "CurrentTotalUsedMemory",Url.Action("CurrentMemory","ChartData"),"Current Total vs. Used Memory","slaveState") 126 141 127 142 function DoUpdate() { 128 @ChartHelper.UpdateStreamChart("CurrentCPU","CurrentCPUUtilization", Url.Action("CurrentCpuUtilization","ChartData")," FixedY")129 @ChartHelper.UpdateStreamChart("CurrentCores","CurrentTotalUsedCores", Url.Action("CurrentCores","ChartData") )130 @ChartHelper.UpdateStreamChart("CurrentMemory","CurrentTotalUsedMemory", Url.Action("CurrentMemory","ChartData") )143 @ChartHelper.UpdateStreamChart("CurrentCPU","CurrentCPUUtilization", Url.Action("CurrentCpuUtilization","ChartData"),"slaveState","FixedY") 144 @ChartHelper.UpdateStreamChart("CurrentCores","CurrentTotalUsedCores", Url.Action("CurrentCores","ChartData"),"slaveState") 145 @ChartHelper.UpdateStreamChart("CurrentMemory","CurrentTotalUsedMemory", Url.Action("CurrentMemory","ChartData"),"slaveState") 131 146 setTimeout(DoUpdate, refreshRate); 132 147 }
Note: See TracChangeset
for help on using the changeset viewer.