Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Status/3.3/WebApp/history/historyCtrl.js @ 12551

Last change on this file since 12551 was 12551, checked in by dglaser, 9 years ago

#2388:

HeuristicLab.Services.Hive.DataAccess-3.3:

  • updated database schema
  • updated sql scripts
  • updated HiveStatisticsGenerator

HeuristicLab.Services.WebApp-3.3:

  • merged from trunk

HeuristicLab.Services.WebApp.Status-3.3:

  • updated data api controller

HeuristicLab.Services.WebApp.Statistics-3.3:

  • added exception page
  • improved jobs, clients, users and groups page
File size: 3.9 KB
Line 
1(function () {
2    var module = appStatusPlugin.getAngularModule();
3    module.controller('app.status.historyCtrl',
4        ['$scope', '$interval', 'app.status.data.service',
5        function ($scope, $interval, dataService) {
6            $scope.chartOptions = {
7                grid: {
8                    borderWidth: 1,
9                    labelMargin: 15
10                },
11                series: {
12                    shadowSize: 0
13                },
14                yaxis: {
15                    min: 0,
16                    max: 100
17                },
18                xaxis: {
19                    mode: "time",
20                    twelveHourClock: false
21                }
22            };
23
24            $scope.fillChartOptions = {
25                grid: {
26                    borderWidth: 1,
27                    labelMargin: 15
28                },
29                series: {
30                    shadowSize: 0,
31                    lines: {
32                        show: true,
33                        fill: true
34                    }
35                },
36                xaxis: {
37                    mode: "time",
38                    twelveHourClock: false
39                }
40            };
41
42
43            $scope.fromDate = new Date();
44            $scope.toDate = new Date();
45
46            $scope.fromIsOpen = false;
47            $scope.toIsOpen = false;
48
49            $scope.openFromDateSelection = function ($event) {
50                $event.preventDefault();
51                $event.stopPropagation();
52                $scope.toIsOpen = false;
53                $scope.fromIsOpen = true;
54            };
55
56            $scope.openToDateSelection = function ($event) {
57                $event.preventDefault();
58                $event.stopPropagation();
59                $scope.fromIsOpen = false;
60                $scope.toIsOpen = true;
61            };
62
63            $scope.dateOptions = {
64                formatYear: 'yy',
65                startingDay: 1
66            };
67
68            $scope.cpuSeries = [[]];
69            $scope.coreSeries = [[]];
70            $scope.memorySeries = [[]];
71
72            $scope.updateCharts = function () {
73                dataService.getStatusHistory({ start: ConvertFromDate($scope.fromDate), end: ConvertToDate($scope.toDate) }, function (status) {
74                    var noOfStatus = status.length;
75                    var cpuSeries = [];
76                    var coreSeries = [[], []];
77                    var memorySeries = [[], []];
78                    for (var i = 0; i < noOfStatus; ++i) {
79                        var curStatus = status[i];
80                        var cpuData = Math.round(curStatus.CpuUtilizationStatus.TotalCpuUtilization);
81                        cpuSeries.push([curStatus.Timestamp, cpuData]);
82                        coreSeries[0].push([curStatus.Timestamp, curStatus.CoreStatus.TotalCores]);
83                        coreSeries[1].push([curStatus.Timestamp, curStatus.CoreStatus.UsedCores]);
84                        memorySeries[0].push([curStatus.Timestamp, Math.round(curStatus.MemoryStatus.TotalMemory / 1024)]);
85                        memorySeries[1].push([curStatus.Timestamp, Math.round(curStatus.MemoryStatus.UsedMemory / 1024)]);
86                    }
87                    $scope.cpuSeries = [{ data: cpuSeries, label: "&nbsp;CPU Utilization", color: "#f7921d" }];
88                    $scope.coreSeries = [
89                        { data: coreSeries[0], label: "&nbsp;Total Cores", color: "LightGreen" },
90                        { data: coreSeries[1], label: "&nbsp;Used Cores", color: "LightPink" }
91                    ];
92                    $scope.memorySeries = [
93                        { data: memorySeries[0], label: "&nbsp;Total Memory", color: "LightGreen" },
94                        { data: memorySeries[1], label: "&nbsp;Used Memory", color: "LightPink" }
95                    ];
96                });
97            };
98            $scope.updateCharts();
99        }]
100    );
101})();
Note: See TracBrowser for help on using the repository browser.