forked from sh2/dstat2graphs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
153 lines (145 loc) · 5.31 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>dstat2graphs</title>
<link href="css/bootstrap.min.css" rel="stylesheet" />
<style type="text/css">
body {
padding-top: 20px;
padding-bottom: 20px;
}
.hero-unit {
padding: 24px;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="hero-unit">
<h1>dstat2graphs</h1>
<p>It works only for 'dstat -tvfn --output log.csv 1'.</p>
</div>
<form action="dstat2graphs.php" method="post" enctype="multipart/form-data" class="form-horizontal">
<fieldset>
<legend>CSV File</legend>
<div class="control-group">
<label class="control-label">CSV File</label>
<div class="controls">
<!-- <input type="hidden" name="MAX_FILE_SIZE" value="4194304" /> -->
<input type="file" name="csv_file" size="50" class="validate-file" />
<span class="help-inline"></span>
</div>
</div>
</fieldset>
<fieldset>
<legend>Graph Size</legend>
<div class="control-group">
<label class="control-label">Width</label>
<div class="controls">
<input type="text" name="width" value="512" class="span1 validate-size" /> (pixels)
<span class="help-inline"></span>
</div>
</div>
<div class="control-group">
<label class="control-label">Height</label>
<div class="controls">
<input type="text" name="height" value="192" class="span1 validate-size" /> (pixels)
<span class="help-inline"></span>
</div>
</div>
</fieldset>
<fieldset>
<legend>Upper Limits</legend>
<div class="control-group">
<label class="control-label">Disk I/O</label>
<div class="controls">
<input type="text" name="disk_limit" value="0" class="span2 validate-natural" /> (Bytes/second)
<span class="help-inline"></span>
</div>
</div>
<div class="control-group">
<label class="control-label">Network I/O</label>
<div class="controls">
<input type="text" name="net_limit" value="0" class="span2 validate-natural" /> (Bytes/second)
<span class="help-inline"></span>
</div>
</div>
</fieldset>
<fieldset>
<legend>Time Range</legend>
<div class="control-group">
<label class="control-label">Offset</label>
<div class="controls">
<input type="text" name="offset" value="0" class="span2 validate-natural" /> (seconds)
<span class="help-inline"></span>
</div>
</div>
<div class="control-group">
<label class="control-label">Duration</label>
<div class="controls">
<input type="text" name="duration" value="0" class="span2 validate-natural" /> (seconds)
<span class="help-inline"></span>
</div>
</div>
</fieldset>
<div class="control-group">
<div class="controls">
<input type="submit" value="Upload" class="btn span3" />
<input type="reset" value="Reset" class="btn span2" />
</div>
</div>
</form>
<hr />
<div class="footer">
(c) 2012-2014, Sadao Hiratsuka.
</div>
</div>
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(function() {
$(window).unload(function() {});
$(':submit').removeAttr('disabled');
$(':reset').removeAttr('disabled');
$('form').submit(function() {
var isValid = true;
$('input').each(function() {
var value = $(this).val();
var control = $(this).closest('.control-group');
var help = $(this).next('.help-inline');
control.removeClass('error');
help.text('');
if ($(this).hasClass('validate-file')) {
if (value == '') {
control.addClass('error');
help.text('Please select a file.');
isValid = false;
}
} else if ($(this).hasClass('validate-size')) {
if (!value.match(/^-?\d+$/) || (value < 64) || (1024 < value)) {
control.addClass('error');
help.text('Please enter a value between 64 and 1024.');
isValid = false;
}
} else if ($(this).hasClass('validate-natural')) {
if (!value.match(/^-?\d+$/) || (value < 0)) {
control.addClass('error');
help.text('Please enter a value greater than or equal to 0.');
isValid = false;
}
}
});
if (isValid) {
$(':submit').attr('disabled', 'disabled');
$(':reset').attr('disabled', 'disabled');
}
return isValid;
});
$(':reset').click(function() {
$('.control-group').removeClass('error');
$('.help-inline').text('');
});
});
</script>
</body>
</html>