Skip to content
This repository
Newer
Older
100644 156 lines (147 sloc) 5.443 kb
eab1d256 »
2010-11-24 Add mobile view
1 <?php
2
6e09f293 »
2011-03-17 rename to eval_conf.php to match conf.php. all files which included c…
3 include_once("./eval_conf.php");
eab1d256 »
2010-11-24 Add mobile view
4 include_once("./functions.php");
5
74513cca »
2011-10-11 Break off aggregate graph composition to a function.
6 retrieve_metrics_cache();
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
7
8 /////////////////////////////////////////////////////////////////////////////
9 // With Mobile view we are gonna utilize the capability of putting in
10 // multiple pages in the same payload so that we avoid HTTP round trips
11 /////////////////////////////////////////////////////////////////////////////
eab1d256 »
2010-11-24 Add mobile view
12 ?>
13 <!DOCTYPE html>
14 <html>
15 <head>
16 <title>Ganglia Mobile</title>
5d8ede4f »
2011-09-11 Fix viewport so it scales to the width of the device
17 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
3f4cd61e »
2011-12-12 Upgrade Jquery Mobile to 1.0 released
18 <link rel="stylesheet" href="css/jquery.mobile-1.0.min.css" />
16287c59 »
2011-11-23 Upgrade to jquery 1.7.1
19 <script src="js/jquery-1.7.1.min.js"></script>
3f4cd61e »
2011-12-12 Upgrade Jquery Mobile to 1.0 released
20 <script src="js/jquery.mobile-1.0.min.js"></script>
c89029b7 »
2012-07-01 Rename liveSearch.js -> livesearch.min.js and update references to it
21 <script type="text/javascript" src="js/jquery.livesearch.min.js"></script>
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
22 <link type="text/css" href="css/jquery.liveSearch.css" rel="stylesheet" />
eab1d256 »
2010-11-24 Add mobile view
23 <style>
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
24 .ui-mobile .ganglia-mobile { background: #e5e5e5 top center repeat-x; }
eab1d256 »
2010-11-24 Add mobile view
25 h2 { margin-top:1.5em; }
26 p code { font-size:1.2em; font-weight:bold; }
27 dt { font-weight: bold; margin: 2em 0 .5em; }
28 dt code, dd code { font-size:1.3em; line-height:150%; }
29 </style>
30 </head>
31 <body>
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
32 <?php
33 // Build cluster array. So we know if there is more than 1
34 foreach ( $index_array['cluster'] as $hostname => $clustername ) {
35 $cluster_array[$clustername][] = $hostname;
36 }
37
38 $cluster_names = array_keys($cluster_array);
39
40 $available_views = get_available_views();
eab1d256 »
2010-11-24 Add mobile view
41
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
42 ?>
43 <div data-role="page" class="ganglia-mobile" id="mobile-home">
eab1d256 »
2010-11-24 Add mobile view
44 <div data-role="header">
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
45 <h1>Ganglia Mobile</h1>
46 </div>
47 <div data-role="content">
48 Please select a category:<p>
49 <ul data-role="listview" data-theme="g">
50 <li><a href="#views">Views</a><span class="ui-li-count"><?php print sizeof($available_views); ?></span></li>
51 <?php
52 if ( sizeof($cluster_names) == 1) {
53 print '<li><a href="#cluster-' . str_replace(" ", "_", $clustername) . '">Clusters</a><span class="ui-li-count">1</span></li>';
54 } else {
55 ?>
56 <li><a href="#clusters">Clusters</a><span class="ui-li-count"><?php print sizeof($cluster_names); ?></span></li>
57 <?php
58 }
59 ?>
60 <li><a href="#search">Search</a></li>
61 </ul>
62 </div><!-- /content -->
63 </div><!-- /page -->
64 <?php
65 if ( sizeof($cluster_names) > 1 ) {
66 ?>
67 <div data-role="page" class="ganglia-mobile" id="clusters">
68 <div data-role="header">
69 <h1>Ganglia Clusters</h1>
70 </div>
eab1d256 »
2010-11-24 Add mobile view
71 <div data-role="content">
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
72 <ul data-role="listview" data-theme="g">
73 <?php
74 // List all clusters
75 foreach ( $cluster_names as $index => $clustername ) {
76 print '<li><a href="#cluster-' . str_replace(" ", "_", $clustername) . '">' . $clustername . '</a><span class="ui-li-count">' . sizeof($cluster_array[$clustername]) . '</span></li>';
77 }
78 ?>
79 </ul>
80 </div><!-- /content -->
eab1d256 »
2010-11-24 Add mobile view
81 </div><!-- /page -->
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
82 <?php
83 } // end of if (sizeof(cluster_names))
eab1d256 »
2010-11-24 Add mobile view
84
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
85 ///////////////////////////////////////////////////////////////////////////////
86 // Create a sub-page for every cluster
87 ///////////////////////////////////////////////////////////////////////////////
88 foreach ( $cluster_names as $index => $clustername ) {
89 ?>
90 <div data-role="page" class="ganglia-mobile" id="cluster-<?php print str_replace(" ", "_", $clustername); ?>">
91 <div data-role="header">
92 <h1>Cluster <?php print $clustername; ?></h1>
93 </div>
94 <div data-role="content">
95 <ul data-role="listview" data-filter="true" data-theme="g">
96 <?php
4b2a53b9 »
2011-03-12 convert mobile.php to use $conf
97 print '<li><a href="mobile_helper.php?show_cluster_metrics=1&c=' . $clustername . '&r=' . $conf['default_time_range'] . '&cs=&ce=">Cluster Summary</a></li>';
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
98 // List all hosts in the cluster
99 asort($cluster_array[$clustername]);
100 foreach ( $cluster_array[$clustername] as $index => $hostname ) {
4b2a53b9 »
2011-03-12 convert mobile.php to use $conf
101 print '<li><a href="mobile_helper.php?show_host_metrics=1&h=' . $hostname . '&c=' . $clustername . '&r=' . $conf['default_time_range'] . '&cs=&ce=">' . strip_domainname($hostname) . '</a></li>';
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
102 }
103 ?>
104 </ul>
105 </div><!-- /content -->
106 </div><!-- /page -->
107 <?php
108 }
109 ///////////////////////////////////////////////////////////////////////////////
110 // Views
111 ///////////////////////////////////////////////////////////////////////////////
112 ?>
113 <div data-role="page" class="ganglia-mobile" id="views">
114 <div data-role="header">
115 <h1>Ganglia Views</h1>
116 </div>
117 <div data-role="content">
118 <ul data-role="listview" data-filter="true" data-theme="g">
119 <?php
120 // List all the available views
121 foreach ( $available_views as $view_id => $view ) {
122 $v = $view['view_name'];
4b2a53b9 »
2011-03-12 convert mobile.php to use $conf
123 print '<li><a href="mobile_helper.php?view_name=' . $v . '&r=' . $conf['default_time_range'] . '&cs=&ce=">' . $v . '</a></li>';
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
124 }
125 ?>
eab1d256 »
2010-11-24 Add mobile view
126 </ul>
0c0d0039 »
2011-01-16 Sync from Ganglia SVN
127 </div><!-- /content -->
128 </div><!-- /page -->
129 <?php
130 ///////////////////////////////////////////////////////////////////////////////
131 // Search
132 ///////////////////////////////////////////////////////////////////////////////
133 ?>
134 <script>
135 $(function(){
136 jQuery('#search input[name="q"]').liveSearch({url: 'search.php?mobile=1&q=', typeDelay: 1000});
137 });
138
139 </script>
140 <div data-role="page" class="ganglia-mobile" id="search">
141 <div data-role="header">
142 <h1>Search</h1>
143 </div>
144 <div data-role="content">
145 <p>
146 <label>
147 Search for host or a metric: <br />
148 <input type="text" name="q" id="search-field-q" on size=40 />
149 </label>
150 </p>
151 </div>
152 </div><!-- /content -->
eab1d256 »
2010-11-24 Add mobile view
153 </div><!-- /page -->
154 </body>
155 </html>
Something went wrong with that request. Please try again.