source: branches/0.4/web/addons/job_monarch/dwoo/compiled/compiled/templates/job_monarch/host_view.tpl.d17.php @ 755

Last change on this file since 755 was 755, checked in by ramonb, 11 years ago
  • add Dwoo
  • Property svn:executable set to *
File size: 15.2 KB
Line 
1<?php
2/* template head */
3if (function_exists('Dwoo_Plugin_include')===false)
4        $this->getLoader()->loadPlugin('include');
5if (function_exists('Dwoo_Plugin_regex_replace')===false)
6        $this->getLoader()->loadPlugin('regex_replace');
7/* end template head */ ob_start(); /* template body */ ?><!-- Begin host_view.tpl -->
8<style type="text/css">
9/* don't display legends for these small graphs */
10.flotlegend, .flotlegendtoplabel {
11  display: none !important;
12}
13.flotheader {
14  margin-top: 2em;
15}
16.flottitle {
17  padding-right: 4em;
18  font-weight: bold;
19}
20.img_view {
21  float: left;
22  margin: 0 0 10px 10px;
23}
24</style>
25<script type="text/javascript">
26var SEPARATOR = "_|_";
27var ALL_GROUPS = "ALLGROUPS";
28var NO_GROUPS = "NOGROUPS";
29// Map metric group id to name
30var g_mgMap = new Object();
31
32function clearStoredMetricGroups() {
33  var stored_groups = $('input[name="metric_group"]');
34  stored_groups.val(NO_GROUPS);
35}
36
37function selectAllMetricGroups() {
38  var stored_groups = $('input[name="metric_group"]');
39  stored_groups.val(ALL_GROUPS);
40}
41
42function addMetricGroup(mgName) {
43  var stored_groups = $('input[name="metric_group"]');
44
45  var open_groups = stored_groups.val();
46  if (open_groups == ALL_GROUPS)
47    return; // no exceptions
48
49  var groups = open_groups.split(SEPARATOR);
50  switch (groups[0]) {
51    case ALL_GROUPS:
52      // Remove from except list
53      for (var i = 1; i < groups.length; i++) {
54        if (groups[i] == mgName) {
55          groups.splice(i, 1);
56          break;
57        }
58      }
59      open_groups = groups.join(SEPARATOR);
60    break;
61    case NO_GROUPS:
62      // Add to list if not already there
63      var inList = false;
64      for (var i = 1; i < groups.length; i++) {
65         if (groups[i] == mgName) {
66           inList = true;
67           break;
68         }
69      }
70      if (!inList) {
71        open_groups += SEPARATOR;
72        open_groups += mgName;
73      }
74    break;
75    default:
76      alert("Unrecognized group option - " + groups[0]);
77  }
78  stored_groups.val(open_groups);
79}
80
81function removeMetricGroup(mgName) {
82  var stored_groups = $('input[name="metric_group"]');
83
84  var open_groups = stored_groups.val();
85  if (open_groups == NO_GROUPS)
86    return; // no exceptions
87
88  var groups = open_groups.split(SEPARATOR);
89  switch (groups[0]) {
90    case ALL_GROUPS:
91      var inList = false;
92      for (var i = 1; i < groups.length; i++) {
93        if (groups[i] == mgName) {
94          inList = true;
95          break;
96        }
97      }
98      if (!inList) {
99        open_groups += SEPARATOR;
100        open_groups += mgName;
101      }
102    break;
103    case NO_GROUPS:
104      for (var i = 1; i < groups.length; i++) {
105        if (groups[i] == mgName) {
106          groups.splice(i, 1);
107          break;
108        }
109      }
110      open_groups = groups.join(SEPARATOR);
111    break;
112    default:
113      alert("Unrecognized group option - " + groups[0]);
114  }
115  stored_groups.val(open_groups);
116}
117
118function toggleMetricGroup(mgId, mgDiv) {
119  var mgName = g_mgMap[mgId];
120  if (mgDiv.is(":visible"))
121    // metric group is being closed
122    removeMetricGroup(mgName);
123  else
124    addMetricGroup(mgName);
125  document.ganglia_form.submit();
126}
127
128function jumpToMetricGroup(mgId) {
129  //alert("jumping to " + mgId);
130  $.scrollTo($('#' + mgId));
131}
132
133function refreshHostView() {
134  $.get('host_overview.php?h=<?php echo $this->scope["hostname"];?>&c=<?php echo $this->scope["cluster"];?>', function(data) {
135    $('#host_overview_div').html(data);
136  });
137
138  $("#optional_graphs img").each(function (index) {
139    var src = $(this).attr("src");
140    if ((src.indexOf("graph.php") == 0) ||
141        (src.indexOf("./graph.php") == 0)) {
142      var d = new Date();
143      $(this).attr("src", jQuery.param.querystring(src, "&_=" + d.getTime()));
144    }   
145  });
146
147  $("#metrics img").each(function (index) {
148    var src = $(this).attr("src");
149    if ((src.indexOf("graph.php") == 0)  ||
150        (src.indexOf("./graph.php") == 0)) {
151      var d = new Date();
152      $(this).attr("src", jQuery.param.querystring(src, "&_=" + d.getTime()));
153    }   
154  });
155}
156
157$(function() {
158  var stored_groups = $('input[name="metric_group"]');
159  stored_groups.val("<?php echo $this->scope["g_open_metric_groups"];?>");
160 
161  $("#edit_optional_graphs").dialog({ autoOpen: false, minWidth: 550,
162    beforeClose: function(event, ui) { location.reload(true); } });
163
164  $("#close_edit_optional_graphs_link").button();
165  $("#popup-dialog").dialog({ autoOpen: false, minWidth: 850 });
166
167  $("#edit_optional_graphs_button").button();
168  $("#edit_optional_graphs_button").click(function(event) {
169    $("#edit_optional_graphs").dialog('open');
170    $('#edit_optional_graphs_content').html('<img src="img/spinner.gif" />');
171    $.get('edit_optional_graphs.php', "hostname=<?php echo $this->scope["hostname"];?>", function(data) {
172      $('#edit_optional_graphs_content').html(data);
173    })
174    return false;
175  });
176
177  $("#save_optional_graphs_button").button();
178  $("#save_optional_graphs_button").click(function(event) {
179    $.get('edit_optional_graphs.php', $("#edit_optional_reports_form").serialize(), function(data) {
180      $('#edit_optional_graphs_content').html(data);
181      $("#save_optional_graphs_button").hide();
182    });
183    return false;
184  });
185
186  $("#expand_all_metric_groups").button();
187  $("#expand_all_metric_groups").click(function(event) {
188    selectAllMetricGroups();
189    document.ganglia_form.submit();
190    return false;
191  });
192
193  $("#collapse_all_metric_groups").button();
194  $("#collapse_all_metric_groups").click(function(event) {
195    clearStoredMetricGroups();
196    document.ganglia_form.submit();
197    return false;
198  });
199
200  $("#host_overview").button();
201  $('#host_overview').click(function() {
202    var options = { to: { width: 200, height: 60 } };
203    $("#host_overview_div").toggle("blind", options, 500);
204    return false;
205  });
206
207  $('.metric-group').each(function() {
208    $(this).button();
209    $(this).click(function() {
210      var id = $(this).attr('id');
211      toggleMetricGroup(id, $("#"+id+"_div"));
212    });
213  });
214});
215</script>
216
217<?php if ((isset($this->scope["graph_engine"]) ? $this->scope["graph_engine"] : null) == "flot") {
218?>
219<script language="javascript" type="text/javascript" src="js/jquery.flot.min.js"></script>
220<script type="text/javascript" src="js/create-flot-graphs.js"></script>
221<style type="text/css">
222.flotgraph2 {
223  height: <?php echo $this->scope["graph_height"];?>px;
224  width:  <?php echo $this->scope["graph_width"];?>px;
225}
226</style>
227<?php 
228}?>
229
230
231<style type="text/css">
232  .toggler { width: 500px; height: 200px; }
233  #effect { width: 240px; height: 135px; padding: 0.4em; position: relative; }
234  #effect h3 { margin: 0; padding: 0.4em; text-align: center; }
235</style>
236
237<div id="metric-actions-dialog" title="Metric Actions">
238  <div id="metric-actions-dialog-content">
239        Available Metric actions.
240  </div>
241</div>
242<div id="popup-dialog" title="Inspect Graph">
243  <div id="popup-dialog-navigation"></div>
244  <div id="popup-dialog-content">
245  </div>
246</div>
247
248<div>
249<button id="host_overview" class="button">Host Overview</button>
250</div>
251
252<div style="display: none;" id="host_overview_div">
253<?php echo Dwoo_Plugin_include($this, 'host_overview.tpl', null, null, null, '_root', null);?>
254
255</div>
256
257<div id="edit_optional_graphs">
258  <div style="text-align:center">
259    <button id="save_optional_graphs_button">Save</button>
260  </div>
261  <div id="edit_optional_graphs_content" style="padding: .4em 1em .4em 10px;">Empty</div>
262</div>
263
264<div id="optional_graphs" style="padding-top:5px;">
265<?php echo $this->scope["optional_reports"];?>
266
267<div style='clear: left'></div>
268<?php if ((isset($this->scope["may_edit_cluster"]) ? $this->scope["may_edit_cluster"] : null)) {
269?>
270<div style="text-align:center"><button id="edit_optional_graphs_button">Edit Optional Graphs</button></div>
271<?php 
272}?>
273
274</div>
275
276<div id="sort_column_dropdowns" style="padding-top:5px;">
277<table border="0" width="100%">
278<tr>
279  <td style="text-align:center;background-color:rgb(238,238,238);">
280  <?php echo $this->scope["host"];?> <strong>graphs</strong> (<?php echo $this->scope["host_metrics_count"];?>)
281  last <strong><?php echo $this->scope["range"];?></strong>
282  sorted <strong><?php echo $this->scope["sort"];?></strong>
283<?php if (((isset($this->scope["columns_dropdown"]) ? $this->scope["columns_dropdown"] : null) !== null)) {
284?>
285  <font>
286    Columns&nbsp;&nbsp;<?php echo $this->scope["metric_cols_menu"];?>
287
288    Size&nbsp;&nbsp;<?php echo $this->scope["size_menu"];?>
289
290  </font>
291<?php 
292}?>
293
294  </td>
295</tr>
296</table>
297
298</div>
299
300<div id=metrics style="padding-top:5px">
301<center>
302<div style="padding-bottom:5px;">
303<button id="expand_all_metric_groups">Expand All Metric Groups</button>
304<button id="collapse_all_metric_groups">Collapse All Metric Groups</button>
305<input title="Time Shift Overlay - overlays previous period on all graphs" type="checkbox" id="timeshift_overlay" onclick="showTimeshiftOverlay(this.checked)"/><label for="timeshift_overlay">Timeshift Overlay</label>
306<select id="jump_to_metric_group" class="ui-corner-all" onchange="jumpToMetricGroup(this.options[this.selectedIndex].value);">
307<option disabled="disabled" selected="selected">Jump To Metric Group...</option>
308<?php 
309$_fh0_data = (isset($this->scope["g_metrics_group_data"]) ? $this->scope["g_metrics_group_data"] : null);
310if ($this->isTraversable($_fh0_data) == true)
311{
312        foreach ($_fh0_data as $this->scope['group']=>$this->scope['g_metrics'])
313        {
314/* -- foreach start output */
315?>
316<?php $this->scope["mgId"]="mg_";
317$this->scope["mgId"].=Dwoo_Plugin_regex_replace($this, (isset($this->scope["group"]) ? $this->scope["group"] : null), '/[^a-zA-Z0-9_]/', '_')?>
318
319<option value="<?php echo $this->scope["mgId"];?>"><?php echo $this->scope["group"];?></a>
320<?php 
321/* -- foreach end output */
322        }
323}?>
324
325</select>
326</div>
327<table>
328<tr>
329 <td>
330
331<?php 
332$_fh2_data = (isset($this->scope["g_metrics_group_data"]) ? $this->scope["g_metrics_group_data"] : null);
333if ($this->isTraversable($_fh2_data) == true)
334{
335        foreach ($_fh2_data as $this->scope['group']=>$this->scope['g_metrics'])
336        {
337/* -- foreach start output */
338?>
339<?php $this->scope["mgId"]="mg_";
340$this->scope["mgId"].=Dwoo_Plugin_regex_replace($this, (isset($this->scope["group"]) ? $this->scope["group"] : null), '/[^a-zA-Z0-9_]/', '_')?>
341
342<table border="0" width="100%">
343<tr>
344  <td class="metric">
345  <button id="<?php echo $this->scope["mgId"];?>" class="metric-group" title="Toggle <?php echo $this->scope["group"];?> metrics group on/off"><?php echo $this->scope["group"];?> metrics (<?php echo $this->scope["g_metrics"]["group_metric_count"];?>)</button>
346<script type="text/javascript">$(function() {
347g_mgMap["<?php echo $this->scope["mgId"];?>"] = "<?php echo $this->scope["group"];?>";
348})</script>
349  </td>
350</tr>
351</table>
352
353<?php if ((isset($this->scope["g_metrics"]["visible"]) ? $this->scope["g_metrics"]["visible"]:null)) {
354?>
355<div id="<?php echo $this->scope["mgId"];?>_div">
356<?php 
357}
358else {
359?>
360<div id="<?php echo $this->scope["mgId"];?>_div" class="ui-helper-hidden">
361<?php 
362}?>
363
364<?php if ((isset($this->scope["g_metrics"]["visible"]) ? $this->scope["g_metrics"]["visible"]:null)) {
365?>
366<table><tr>
367<?php $this->scope["i"]=0?>
368
369<?php 
370$_fh1_data = (isset($this->scope["g_metrics"]["metrics"]) ? $this->scope["g_metrics"]["metrics"]:null);
371if ($this->isTraversable($_fh1_data) == true)
372{
373        foreach ($_fh1_data as $this->scope['g_metric'])
374        {
375/* -- foreach start output */
376?>
377<td>
378<font style="font-size: 8px"><?php echo $this->scope["g_metric"]["metric_name"];?> <?php if ((isset($this->scope["g_metric"]["title"]) ? $this->scope["g_metric"]["title"]:null) != '' && (isset($this->scope["g_metric"]["title"]) ? $this->scope["g_metric"]["title"]:null) != (isset($this->scope["g_metric"]["metric_name"]) ? $this->scope["g_metric"]["metric_name"]:null)) {
379?>- <?php echo $this->scope["g_metric"]["title"];
380
381}?></font><br>
382<?php if ((isset($this->scope["may_edit_views"]) ? $this->scope["may_edit_views"] : null)) {
383?>
384<?php $this->scope["graph_args"]="&amp;";
385$this->scope["graph_args"].=(isset($this->scope["g_metric"]["graphargs"]) ? $this->scope["g_metric"]["graphargs"]:null)?>
386
387<button class="cupid-green" title="Metric Actions - Add to View, etc" onclick="metricActions('<?php echo $this->scope["g_metric"]["host_name"];?>','<?php echo $this->scope["g_metric"]["metric_name"];?>', 'metric', '<?php echo $this->scope["graph_args"];?>'); return false;">+</button>
388<?php 
389}?>
390
391<button title="Export to CSV" class="cupid-green" onClick="javascript:location.href='./graph.php?<?php echo $this->scope["g_metric"]["graphargs"];?>&amp;csv=1';return false;">CSV</button>
392<button title="Export to JSON" class="cupid-green" onClick="javascript:location.href='./graph.php?<?php echo $this->scope["g_metric"]["graphargs"];?>&amp;json=1';return false;">JSON</button>
393<button title="Inspect Graph" onClick="inspectGraph('<?php echo $this->scope["g_metric"]["graphargs"];?>'); return false;" class="shiny-blue">Inspect</button>
394<button title="6 month trend" onClick="drawTrendGraph('./graph.php?<?php echo $this->scope["g_metric"]["graphargs"];?>&amp;trend=1&amp;z=xlarge'); return false;" class="shiny-blue">Trend</button>
395
396<?php if ((isset($this->scope["graph_engine"]) ? $this->scope["graph_engine"] : null) == "flot") {
397?>
398<br>
399<div id="placeholder_<?php echo $this->scope["g_metric"]["graphargs"];?>" class="flotgraph2 img_view"></div>
400<div id="placeholder_<?php echo $this->scope["g_metric"]["graphargs"];?>_legend" class="flotlegend"></div>
401<?php 
402}
403else {
404?>
405<?php $this->scope["graphId"]=((isset($this->scope["GRAPH_BASE_ID"]) ? $this->scope["GRAPH_BASE_ID"] : null)).((isset($this->scope["mgId"]) ? $this->scope["mgId"] : null)).((isset($this->scope["i"]) ? $this->scope["i"] : null))?>
406
407<?php $this->scope["showEventsId"]=((isset($this->scope["SHOW_EVENTS_BASE_ID"]) ? $this->scope["SHOW_EVENTS_BASE_ID"] : null)).((isset($this->scope["mgId"]) ? $this->scope["mgId"] : null)).((isset($this->scope["i"]) ? $this->scope["i"] : null))?>
408
409<input title="Hide/Show Events" type="checkbox" id="<?php echo $this->scope["showEventsId"];?>" onclick="showEvents('<?php echo $this->scope["graphId"];?>', this.checked)"/><label class="show_event_text" for="<?php echo $this->scope["showEventsId"];?>">Hide/Show Events</label>
410<?php $this->scope["timeShiftId"]=((isset($this->scope["TIME_SHIFT_BASE_ID"]) ? $this->scope["TIME_SHIFT_BASE_ID"] : null)).((isset($this->scope["mgId"]) ? $this->scope["mgId"] : null)).((isset($this->scope["i"]) ? $this->scope["i"] : null))?>
411
412<input title="Timeshift Overlay" type="checkbox" id="<?php echo $this->scope["timeShiftId"];?>" onclick="showTimeShift('<?php echo $this->scope["graphId"];?>', this.checked)"/><label class="show_timeshift_text" for="<?php echo $this->scope["timeShiftId"];?>">Timeshift</label>
413<br>
414<a href="./graph_all_periods.php?<?php echo $this->scope["g_metric"]["graphargs"];?>&amp;z=large">
415<img id="<?php echo $this->scope["graphId"];?>" class="noborder <?php echo $this->scope["additional_host_img_css_classes"];?>" style="margin:5px;" alt="<?php echo $this->scope["g_metric"]["alt"];?>" src="./graph.php?<?php echo $this->scope["g_metric"]["graphargs"];?>" title="<?php echo $this->scope["g_metric"]["desc"];?>" />
416</A>
417<?php 
418}?>
419
420</td>
421<?php echo $this->scope["g_metric"]["new_row"];?>
422
423<?php echo ($this->assignInScope((isset($this->scope["i"]) ? $this->scope["i"] : null) + 1, 'i'));?>
424
425<?php 
426/* -- foreach end output */
427        }
428}?>
429
430</tr>
431</table>
432<?php 
433}?>
434
435</div>
436<?php 
437/* -- foreach end output */
438        }
439}?>
440
441 </td>
442</tr>
443</table>
444</center>
445</div>
446<input type="hidden" name="metric_group" value="">
447<!-- End host_view.tpl -->
448<?php  /* end template body */
449return $this->buffer . ob_get_clean();
450?>
Note: See TracBrowser for help on using the repository browser.