-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
160 lines (157 loc) · 7.54 KB
/
index.php
File metadata and controls
160 lines (157 loc) · 7.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>HPC Disk Statistics</title>
<?php require_once("include_php/css.php"); ?>
<?php require_once("include_php/leading_js.php"); ?>
<script>
var tableApp = angular.module('tableApp', ['ui.bootstrap','angular-humanize']);
tableApp.controller('tableCtrl', function($scope, $http, $location) {
// Show loading spinners until AJAX returns
$scope.tableloading = true;
$scope.progressbarloading = true;
// Pull URL from user's browser to determine how to query database (useful for SSH tunneling through localhost)
var site = $location.protocol() + "://" + $location.host() + ":" + $location.port();
// Determine if we're running development or production version
if ($location.absUrl().indexOf('diskstatsdev') === -1) {
var path = "/diskstats/";
} else {
var path = "/diskstatsdev/";
}
var sumPage = path + "summary_backend.php";
var filesysPage = path + "helper_php/filesys.php";
console.log("Loading data from: " + site + path);
$scope.filesys = [];
$scope.result = [];
$scope.numfs = 0;
$scope.returnedfs = 0;
// Set the default sorting type
$scope.sortType = "File_System";
// Set the default sorting order
$scope.sortReverse = false;
$scope.sortChanged = function(key) {
$scope.sortType = key;
$scope.sortReverse = !$scope.sortReverse;
}
$scope.query = function() {
$scope.tableloading = true;
$scope.result = [];
// Get list of file systems
$http.get(site + filesysPage).then(function (response) {
// Successful HTTP GET
$scope.filesys = response.data;
$scope.numfs = response.data.length;
$scope.progressbarloading = false;
console.log($scope.filesys);
for (var i = 0; i < $scope.filesys.length; i++) {
// Query for each file system's data
$http.get(site + sumPage + "?fs=" + $scope.filesys[i]).then(function (response) {
// Successful HTTP GET
$scope.result.push(response.data[0]);
// Store length of resulting list to determine number of pages
}, function (response) {
// Failed HTTP GET
console.log("Failed to load page");
}).finally(function() {
// Upon success or failure
$scope.returnedfs++;
$scope.tableloading = false;
if ($scope.returnedfs == $scope.numfs) {
$scope.progressbarloading = true;
console.log($scope.result);
}
});
}
}, function (response) {
// Failed HTTP GET
console.log("Failed to load page");
}).finally(function() {
// Upon success or failure
});
}
$scope.query();
});
</script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body ng-app="tableApp" ng-controller="tableCtrl">
<?php require_once("include_php/navbar.php"); ?>
<div class="container-fluid ng-cloak">
<div class="row" ng-hide="progressbarloading">
<div class="col-md-3"></div>
<div class="col-md-6">
<uib-progressbar class="progress-striped active" max="numfs" value="returnedfs">{{returnedfs}}/{{numfs}} File Systems</uib-progressbar>
</div>
<div class="col-md-3"></div>
</div>
<div class="row" ng-hide="tableloading">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr class="active">
<th ng-repeat="(key,value) in result[0]" style="word-wrap: break-word">
<a href="#" ng-click='sortChanged(key)'>
{{ key }}
<span ng-show="sortType == key && sortReverse" class="caret"></span>
<span class="dropup"><span ng-show="sortType == key && !sortReverse" class="caret"></span></span>
</a>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in result | orderBy:sortType:sortReverse">
<td class="text-nowrap"><div class="text-nowrap limit-cell">{{ row.File_System }}</td>
<td class="text-nowrap"><div class="text-nowrap limit-cell">{{ row.Number_of_Users | humanizeInt}}</td>
<td class="text-nowrap"><div class="text-nowrap limit-cell">{{ row.Total_Space | humanizeFilesize}}</td>
<td class="text-nowrap"><div class="text-nowrap limit-cell">{{ row.Used_Space | humanizeFilesize}}</td>
<td class="text-nowrap"><div class="text-nowrap limit-cell">{{ row.Available_Space | humanizeFilesize}}</td>
<td class="text-nowrap"><div class="text-nowrap limit-cell">{{ row.Number_of_Files | humanizeInt}}</td>
<td class="text-nowrap"><div class="text-nowrap limit-cell">{{ row.Size_of_Old_Files | humanizeFilesize }}</td>
<td class="text-nowrap"><div class="text-nowrap limit-cell">{{ row.Number_of_Old_Files | humanizeInt}}</td>
<td class="text-nowrap"><div class="text-nowrap limit-cell">{{ row.Percent_Old_Space }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row vertical-align" ng-hide="tableloading">
<div class="col-md-12">
<div class="pull-right">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".info-modal">
<i class="fa fa-info-circle fa-lg"></i> Info
</button>
<div class="modal fade info-modal" tabindex="-1" role="dialog" aria-labelledby="infoModalLabel">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">About This Page</h4>
</div>
<div class="modal-body">
<ul>
<li>The data in the table can be sorted by clicking on each column header.</li>
<li>An "old" file has not been read in the past 6 months. <b>The HPC strives to have no data older than 6 months old on these file systems.</b></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php require_once("include_php/footer.php"); ?>
<?php require_once("include_php/trailing_js.php"); ?>
</body>
</html>