Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9617


Ignore:
Timestamp:
06/12/13 15:10:06 (11 years ago)
Author:
pfleck
Message:

#2063:
Started integrating Hive statistics into statistics web project.
Added jqPlot library for charting.

Location:
branches/HiveStatistics/sources
Files:
161 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Start/BundleConfig.cs

    r9604 r9617  
    5454                  "~/Content/themes/base/jquery.ui.progressbar.css",
    5555                  "~/Content/themes/base/jquery.ui.theme.css"));
     56
     57      bundles.Add(new ScriptBundle("~/Scripts/jqPlot/jquery.jqplot").Include(
     58                  "~/Scripts/jqPlot/jquery.jqplot.js"));
     59
     60      bundles.Add(new StyleBundle("~/Styles/jqPlot/jquery.jqplot").Include(
     61                  "~/Scripts/jqPlot/jquery.jqplot.css"));
    5662    }
    5763  }
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/HomeController.cs

    r9604 r9617  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
     24using System.Linq;
     25using System.Web.Helpers;
    2226using System.Web.Mvc;
     27using HeuristicLab.Services.Hive.DataAccess;
     28using HeuristicLab.Services.Hive.Statistics.Models;
    2329
    2430namespace HeuristicLab.Services.Hive.Statistics.Controllers {
    2531  public class HomeController : Controller {
    2632    public ActionResult Index() {
    27       ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
     33      OverallStatus result = null;
    2834
    29       return View();
     35      using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) {
     36        var onlineSlaves = (from slave in db.Resources.OfType<Slave>()
     37                            where slave.SlaveState == SlaveState.Calculating || slave.SlaveState == SlaveState.Idle
     38                            select slave)
     39                           .ToList();
     40
     41        result = new OverallStatus {
     42          OverallCurrentlyAvailableCores = onlineSlaves.Sum(s => s.Cores ?? 0),
     43          CurrentlyAvailableCores = onlineSlaves.Where(s => s.IsAllowedToCalculate).Sum(s => s.Cores ?? 0),
     44          CurrentlyUsedCores = onlineSlaves.Sum(s => s.Cores ?? 0) - onlineSlaves.Sum(s => s.FreeCores ?? 0),
     45          CurrentlyJobsWaiting = db.Tasks.Count(x => x.State == TaskState.Waiting),
     46          OverallCpuUtilization = onlineSlaves.Any()
     47                                  ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2)
     48                                  : 0.0,
     49          AvailableCpuUtilization = onlineSlaves.Any(x => x.IsAllowedToCalculate)
     50                                    ? Math.Round(onlineSlaves.Where(x => x.IsAllowedToCalculate).Average(s => s.CpuUtilization), 2)
     51                                    : 0.0
     52        };
     53      }
     54
     55      return View(result);
    3056    }
    3157
     
    4167      return View();
    4268    }
     69
     70    public ActionResult Error() {
     71      throw new Exception();
     72    }
     73
     74    public ActionResult Test() {
     75      var data = new Dictionary<string, float>
     76        {
     77            {"test", 10.023f},
     78            {"test2", 20.020f},
     79            {"test3", 19.203f},
     80            {"test4", 4.039f},
     81            {"test5", 5.343f}
     82    };
     83
     84      var chart = new Chart(600, 400)
     85        .AddTitle("Testchart")
     86        .AddSeries(
     87          name: "13456",
     88          chartType: "Area",
     89          xValue: new[] { 1, 2, 3, 4, 5 },
     90          yValues: new[] { 10, 20, 35, 70, 50 }
     91        );
     92
     93      chart.Write("png");
     94
     95      return null;
     96    }
    4397  }
    4498}
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/HeuristicLab.Services.Hive.Statistics-3.3.csproj

    r9604 r9617  
    4242    <Reference Include="Microsoft.CSharp" />
    4343    <Reference Include="System" />
     44    <Reference Include="System.Data" />
     45    <Reference Include="System.Data.Linq" />
    4446    <Reference Include="System.Web.ApplicationServices" />
    4547    <Reference Include="System.ComponentModel.DataAnnotations" />
     
    107109    <Compile Include="Controllers\AccountController.cs" />
    108110    <Compile Include="Controllers\HomeController.cs" />
     111    <Compile Include="Models\OverallStatistics.cs" />
    109112    <Compile Include="Global.asax.cs">
    110113      <DependentUpon>Global.asax</DependentUpon>
     
    174177    <None Include="Scripts\jquery-1.8.2.intellisense.js" />
    175178    <Content Include="HeuristicLab.ico" />
     179    <Content Include="Scripts\jqPlot\changes.txt" />
     180    <Content Include="Scripts\jqPlot\copyright.txt" />
     181    <Content Include="Scripts\jqPlot\excanvas.js" />
     182    <Content Include="Scripts\jqPlot\excanvas.min.js" />
     183    <Content Include="Scripts\jqPlot\gpl-2.0.txt" />
     184    <Content Include="Scripts\jqPlot\jqPlotCssStyling.txt" />
     185    <Content Include="Scripts\jqPlot\jqPlotOptions.txt" />
     186    <Content Include="Scripts\jqPlot\jquery.jqplot.css" />
     187    <Content Include="Scripts\jqPlot\jquery.jqplot.js" />
     188    <Content Include="Scripts\jqPlot\jquery.jqplot.min.css" />
     189    <Content Include="Scripts\jqPlot\jquery.jqplot.min.js" />
     190    <Content Include="Scripts\jqPlot\jquery.js" />
     191    <Content Include="Scripts\jqPlot\jquery.min.js" />
     192    <Content Include="Scripts\jqPlot\MIT-LICENSE.txt" />
     193    <Content Include="Scripts\jqPlot\optionsTutorial.txt" />
     194    <Content Include="Scripts\jqPlot\plugins\jqplot.barRenderer.js" />
     195    <Content Include="Scripts\jqPlot\plugins\jqplot.barRenderer.min.js" />
     196    <Content Include="Scripts\jqPlot\plugins\jqplot.BezierCurveRenderer.js" />
     197    <Content Include="Scripts\jqPlot\plugins\jqplot.BezierCurveRenderer.min.js" />
     198    <Content Include="Scripts\jqPlot\plugins\jqplot.blockRenderer.js" />
     199    <Content Include="Scripts\jqPlot\plugins\jqplot.blockRenderer.min.js" />
     200    <Content Include="Scripts\jqPlot\plugins\jqplot.bubbleRenderer.js" />
     201    <Content Include="Scripts\jqPlot\plugins\jqplot.bubbleRenderer.min.js" />
     202    <Content Include="Scripts\jqPlot\plugins\jqplot.canvasAxisLabelRenderer.js" />
     203    <Content Include="Scripts\jqPlot\plugins\jqplot.canvasAxisLabelRenderer.min.js" />
     204    <Content Include="Scripts\jqPlot\plugins\jqplot.canvasAxisTickRenderer.js" />
     205    <Content Include="Scripts\jqPlot\plugins\jqplot.canvasAxisTickRenderer.min.js" />
     206    <Content Include="Scripts\jqPlot\plugins\jqplot.canvasOverlay.js" />
     207    <Content Include="Scripts\jqPlot\plugins\jqplot.canvasOverlay.min.js" />
     208    <Content Include="Scripts\jqPlot\plugins\jqplot.canvasTextRenderer.js" />
     209    <Content Include="Scripts\jqPlot\plugins\jqplot.canvasTextRenderer.min.js" />
     210    <Content Include="Scripts\jqPlot\plugins\jqplot.categoryAxisRenderer.js" />
     211    <Content Include="Scripts\jqPlot\plugins\jqplot.categoryAxisRenderer.min.js" />
     212    <Content Include="Scripts\jqPlot\plugins\jqplot.ciParser.js" />
     213    <Content Include="Scripts\jqPlot\plugins\jqplot.ciParser.min.js" />
     214    <Content Include="Scripts\jqPlot\plugins\jqplot.cursor.js" />
     215    <Content Include="Scripts\jqPlot\plugins\jqplot.cursor.min.js" />
     216    <Content Include="Scripts\jqPlot\plugins\jqplot.dateAxisRenderer.js" />
     217    <Content Include="Scripts\jqPlot\plugins\jqplot.dateAxisRenderer.min.js" />
     218    <Content Include="Scripts\jqPlot\plugins\jqplot.donutRenderer.js" />
     219    <Content Include="Scripts\jqPlot\plugins\jqplot.donutRenderer.min.js" />
     220    <Content Include="Scripts\jqPlot\plugins\jqplot.dragable.js" />
     221    <Content Include="Scripts\jqPlot\plugins\jqplot.dragable.min.js" />
     222    <Content Include="Scripts\jqPlot\plugins\jqplot.enhancedLegendRenderer.js" />
     223    <Content Include="Scripts\jqPlot\plugins\jqplot.enhancedLegendRenderer.min.js" />
     224    <Content Include="Scripts\jqPlot\plugins\jqplot.funnelRenderer.js" />
     225    <Content Include="Scripts\jqPlot\plugins\jqplot.funnelRenderer.min.js" />
     226    <Content Include="Scripts\jqPlot\plugins\jqplot.highlighter.js" />
     227    <Content Include="Scripts\jqPlot\plugins\jqplot.highlighter.min.js" />
     228    <Content Include="Scripts\jqPlot\plugins\jqplot.json2.js" />
     229    <Content Include="Scripts\jqPlot\plugins\jqplot.json2.min.js" />
     230    <Content Include="Scripts\jqPlot\plugins\jqplot.logAxisRenderer.js" />
     231    <Content Include="Scripts\jqPlot\plugins\jqplot.logAxisRenderer.min.js" />
     232    <Content Include="Scripts\jqPlot\plugins\jqplot.mekkoAxisRenderer.js" />
     233    <Content Include="Scripts\jqPlot\plugins\jqplot.mekkoAxisRenderer.min.js" />
     234    <Content Include="Scripts\jqPlot\plugins\jqplot.mekkoRenderer.js" />
     235    <Content Include="Scripts\jqPlot\plugins\jqplot.mekkoRenderer.min.js" />
     236    <Content Include="Scripts\jqPlot\plugins\jqplot.meterGaugeRenderer.js" />
     237    <Content Include="Scripts\jqPlot\plugins\jqplot.meterGaugeRenderer.min.js" />
     238    <Content Include="Scripts\jqPlot\plugins\jqplot.ohlcRenderer.js" />
     239    <Content Include="Scripts\jqPlot\plugins\jqplot.ohlcRenderer.min.js" />
     240    <Content Include="Scripts\jqPlot\plugins\jqplot.pieRenderer.js" />
     241    <Content Include="Scripts\jqPlot\plugins\jqplot.pieRenderer.min.js" />
     242    <Content Include="Scripts\jqPlot\plugins\jqplot.pointLabels.js" />
     243    <Content Include="Scripts\jqPlot\plugins\jqplot.pointLabels.min.js" />
     244    <Content Include="Scripts\jqPlot\plugins\jqplot.pyramidAxisRenderer.js" />
     245    <Content Include="Scripts\jqPlot\plugins\jqplot.pyramidAxisRenderer.min.js" />
     246    <Content Include="Scripts\jqPlot\plugins\jqplot.pyramidGridRenderer.js" />
     247    <Content Include="Scripts\jqPlot\plugins\jqplot.pyramidGridRenderer.min.js" />
     248    <Content Include="Scripts\jqPlot\plugins\jqplot.pyramidRenderer.js" />
     249    <Content Include="Scripts\jqPlot\plugins\jqplot.pyramidRenderer.min.js" />
     250    <Content Include="Scripts\jqPlot\plugins\jqplot.trendline.js" />
     251    <Content Include="Scripts\jqPlot\plugins\jqplot.trendline.min.js" />
     252    <Content Include="Scripts\jqPlot\README.txt" />
     253    <Content Include="Scripts\jqPlot\usage.txt" />
    176254    <Content Include="Scripts\jquery-1.8.2.js" />
    177255    <Content Include="Scripts\jquery-1.8.2.min.js" />
     
    211289  <ItemGroup>
    212290    <Content Include="packages.config" />
     291  </ItemGroup>
     292  <ItemGroup>
     293    <ProjectReference Include="..\..\HeuristicLab.Services.Hive.DataAccess\3.3\HeuristicLab.Services.Hive.DataAccess-3.3.csproj">
     294      <Project>{ec2c8109-6e1e-4c88-9a2b-908cff2ef4ac}</Project>
     295      <Name>HeuristicLab.Services.Hive.DataAccess-3.3</Name>
     296    </ProjectReference>
     297    <ProjectReference Include="..\..\HeuristicLab.Services.Hive\3.3\HeuristicLab.Services.Hive-3.3.csproj">
     298      <Project>{cf9da321-ac1b-4fd3-9ec3-67bc6b861bde}</Project>
     299      <Name>HeuristicLab.Services.Hive-3.3</Name>
     300    </ProjectReference>
    213301  </ItemGroup>
    214302  <PropertyGroup>
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Properties/PublishProfiles/Hive.Statistics-3.3.pubxml

    r9604 r9617  
    3434    </PublishDatabaseSettings>
    3535  </PropertyGroup>
     36  <ItemGroup>
     37    <MSDeployParameterValue Include="$(DeployParameterPrefix)HeuristicLab.Authentication-Web.config Connection String" />
     38  </ItemGroup>
    3639</Project>
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/Account/Login.cshtml

    r9604 r9617  
    3535</section>
    3636
     37@section Styles {
     38    @Styles.Render("~/Content/themes/base/css")
     39}
     40
    3741@section Scripts {
    38     @Styles.Render("~/Content/themes/base/css")
    3942    @Scripts.Render("~/bundles/jqueryui")
    4043    @Scripts.Render("~/bundles/jqueryval")
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/Home/Index.cshtml

    r9604 r9617  
    1 @{
    2     ViewBag.Title = "Home Page";
     1@model HeuristicLab.Services.Hive.Statistics.Models.OverallStatus
     2
     3@{
     4    ViewBag.Title = "Status Monitor";
    35}
    4 @*@section featured {
    5     <section class="featured">
    6         <div class="content-wrapper">
    7             <hgroup class="title">
    8                 <h1>@ViewBag.Title.</h1>
    9                 <h2>@ViewBag.Message</h2>
    10             </hgroup>
    11             <p>
    12                 To learn more about ASP.NET MVC visit
    13                 <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
    14                 The page features <mark>videos, tutorials, and samples</mark> to help you get the most from ASP.NET MVC.
    15                 If you have any questions about ASP.NET MVC visit
    16                 <a href="http://forums.asp.net/1146.aspx/1?MVC" title="ASP.NET MVC Forum">our forums</a>.
    17             </p>
    18         </div>
    19     </section>
    20 }*@
    21 <h3>We suggest the following:</h3>
    22 <ol class="round">
    23     <li class="one">
    24         <h5>Getting Started</h5>
    25         ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
    26         enables a clean separation of concerns and that gives you full control over markup
    27         for enjoyable, agile development. ASP.NET MVC includes many features that enable
    28         fast, TDD-friendly development for creating sophisticated applications that use
    29         the latest web standards.
    30         <a href="http://go.microsoft.com/fwlink/?LinkId=245151">Learn more…</a>
    31     </li>
    326
    33     <li class="two">
    34         <h5>Add NuGet packages and jump-start your coding</h5>
    35         NuGet makes it easy to install and update free libraries and tools.
    36         <a href="http://go.microsoft.com/fwlink/?LinkId=245153">Learn more…</a>
    37     </li>
     7<h1>Current Status</h1>
    388
    39     <li class="three">
    40         <h5>Find Web Hosting</h5>
    41         You can easily find a web hosting company that offers the right mix of features
    42         and price for your applications.
    43         <a href="http://go.microsoft.com/fwlink/?LinkId=245157">Learn more…</a>
    44     </li>
    45 </ol>
     9<section>
     10    <table>
     11        <tr>
     12            <td>Overall Available Cores</td>
     13            <td>@Model.OverallCurrentlyAvailableCores</td>
     14        </tr>
     15        <tr>
     16            <td>Availabe Cores (real)</td>
     17            <td>@Model.CurrentlyAvailableCores</td>
     18        </tr>
     19        <tr>
     20            <td>System-Wide Waiting Tasks</td>
     21            <td>@Model.CurrentlyJobsWaiting</td>
     22        </tr>
     23        <tr>
     24            <td>Used Cores</td>
     25            <td>@Model.CurrentlyUsedCores</td>
     26        </tr>
     27        <tr>
     28            <td>Overall Avg. CPU Utilization</td>
     29            <td>@Model.OverallCpuUtilization</td>
     30        </tr>
     31        <tr>
     32            <td>Available Avg. CPU Utilization</td>
     33            <td>@Model.AvailableCpuUtilization</td>
     34        </tr>
     35    </table>
     36</section>
     37
     38<section>
     39    <div id="chartdiv" style="height:400px;width:300px;"></div>
     40</section>
     41
     42@section Styles {
     43    @Styles.Render("~/Scripts/jqPlot/jquery.jqplot")
     44}
     45
     46@section Scripts {
     47    @Scripts.Render("~/Scripts/jqPlot/jquery.jqplot")
     48    <script>
     49        $.jqplot('chartdiv', [[[1, 2], [3, 5.12], [5, 13.1], [7, 33.6], [9, 85.9], [11, 219.9]]]);
     50    </script>
     51}
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/Shared/_Layout.cshtml

    r9604 r9617  
    99    @Styles.Render("~/Content/css")
    1010    @Scripts.Render("~/bundles/modernizr")
     11    @RenderSection("styles", required: false)
    1112</head>
    1213<body>
     
    2526            </ul>
    2627        </nav>
    27         <section id="body">
     28        <div id="body">
    2829           @RenderBody()
    29         </section>
     30        </div>
    3031        <footer>
    3132            <a href="http://heal.heuristiclab.com/" target="_blank" title="Visit the HeuristicLab website">
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/packages.config

    r9604 r9617  
    11<?xml version="1.0" encoding="utf-8"?>
    22<packages>
     3  <package id="jqPlot" version="1.0.0" targetFramework="net40" />
    34  <package id="jQuery" version="1.8.2" targetFramework="net40" />
    45  <package id="jQuery.UI.Combined" version="1.8.24" targetFramework="net40" />
Note: See TracChangeset for help on using the changeset viewer.