forked from lensen/graphsky
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.php
147 lines (147 loc) · 5.09 KB
/
menu.php
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
<form name="opts" method="get" action="index.php">
<div id="menu">
<input id="menu-checkbox" type="checkbox"/>
<label for="menu-checkbox"></label>
<div id="overlay"></div>
<div id="top_menu">
<a href="/"><div id="menu_logo"></div></a>
<div id="selection_menu" class="left">
<?php
$environment_search = json_decode(file_get_contents($conf['graphite_search_url'] . $conf['graphite_prefix'] . "*"), TRUE);
$environments = $environment_search['results']; natsort($environments);
$environments = str_replace($conf['graphite_prefix'], "", $environments);
$cluster_search = json_decode(file_get_contents($conf['graphite_search_url'] . $conf['graphite_prefix'] . "$env.*"), TRUE);
$clusters = $cluster_search['results']; natsort($clusters);
$clusters = str_replace($conf['graphite_prefix'] . "$env.", "", $clusters);
$host_search = json_decode(file_get_contents($conf['graphite_search_url'] . $conf['graphite_prefix'] . "$env.$c.*"), TRUE);
$hosts = $host_search['results']; natsort($hosts);
$hosts = str_replace($conf['graphite_prefix'] . "$env.$c.", "", $hosts);
?>
<!-- Environments -->
<div class="selection_menu_cell">
<div class="select"><select name="env" title="Select environment" onchange="if (typeof document.opts.c != 'undefined') { document.opts.c.value = '' }; if (typeof document.opts.h != 'undefined') { document.opts.h.value = '' }; document.opts.submit()">
<?php
print print_dropdown_menus($environments, $env, "All environments");
?>
</select></div>
</div>
<!-- /Environments -->
<?php
if (isset($env)) {
?>
<!-- Clusters -->
<div class="selection_menu_cell">
<div class="select"><select name="c" title="Select cluster" onchange="if (typeof document.opts.h != 'undefined') { document.opts.h.value = '' }; document.opts.submit()">
<?php
print print_dropdown_menus($clusters, $c, "All clusters");
?>
</select></div>
</div>
<!-- /Clusters -->
<?php
}
if (isset($c)) {
?>
<!-- Hosts -->
<div class="selection_menu_cell">
<div class="select"><select name="h" title="Select host" onchange="document.opts.submit()">
<?php
print print_dropdown_menus($hosts, $h, "All hosts");
?>
</select></div>
</div>
<!-- /Hosts -->
<?php
}
?>
</div>
<div id="settings_menu" class="right">
<div class="datetime_menu_cell">
<input name="from" value="<?php print $gs; ?>" id="from_calendar"/>
</div>
<div id="datetime_sep_menu_cell"> - </div>
<div id="datetime_nm_menu_cell">to</div>
<div class="datetime_menu_cell">
<input name="until" value="<?php print $ge; ?>" id="until_calendar"/>
</div>
<div class="button_menu_cell"><button id="go_button" type="submit"></button></div>
</div>
</div>
<div id="graph_menu" class="graph_menu-down">
<div id="graph_menu_cell" class="left">
<!-- Reports -->
<?php
if (isset($m)) { $onchange = "document.opts.m.value = ''; document.opts.submit();"; }
else { $onchange = "document.opts.submit();"; }
?>
<div class="graph_menu_cell">
<div class="select_name_menu_cell">Report:</div>
<div class="select"><select name="g" title="Select graph report" onchange="<?php echo $onchange; ?>">
<?php
print print_dropdown_menus(find_dashboards($env, $c), $g, "All");
?>
</select></div>
</div>
<!-- /Reports -->
<?php
if (isset($h)) {
?>
<!-- Metrics -->
<div class="graph_menu_cell">
<div class="select_name_menu_cell">Metric:</div>
<div class="select"><select title="Jump to a metric group" onchange="location = this.options[this.selectedIndex].value;">
<option value="#reports" selected="selected">Jump to...</option>
<?php
$host_metrics=array_keys(find_metrics("$env.$c.$h", $conf['host_metric_group_depth']));
foreach ($host_metrics as $metric_group) {
print " <option value=\"#$metric_group\">$metric_group</option>\n";
}
?>
</select></div>
</div>
<!-- /Metrics -->
<?php
}
elseif (isset($c)) {
?>
<!-- Metrics -->
<div class="graph_menu_cell">
<div class="select_name_menu_cell">Metric:</div>
<div class="select"><select name="m" title="Select a single metric" onchange="document.opts.g.value = ''; document.opts.submit()">
<?php
$all_metrics=array_keys(find_metrics("$env.$c.*", "10"));
print print_dropdown_menus($all_metrics, $m, "Select...");
?>
</select></div>
</div>
<!-- /Metrics -->
<?php
}
?>
<?php
if (isset($m)) {
if ($l == "yes" ) { $checked = "checked"; } else { $checked = ""; }
?>
<div class="graph_menu_cell">
<div class="select_name_menu_cell">Scale metric graphs</div>
<div class="select"><select name="l" onchange="document.opts.submit()">
<?php
print print_dropdown_menus(array("yes"), $l, "no");
?>
</select></div>
</div>
<?php
}
?>
</div>
<div class="graph_menu_cell right">
<div class="select_name_menu_cell">Graph size:</div>
<div class="select"><select name="z" onchange="document.opts.submit()">
<?php
print print_dropdown_menus(array_keys($conf['graph_sizes']), $z, "");
?>
</select></div>
</div>
</div>
</div>
</form>