Changeset 4f81059475d5c1fc94913a5cc50a4475e04d0b5c

Show
Ignore:
Timestamp:
09/23/08 14:42:18 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1222180938 +0000
git-parent:

[fd7d27d985d3f4af8965d75d9d06297805eae2d0]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1222180938 +0000
Message:

set titles and dataset titles, add 'remember graph' and fix styles, refs #22

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ui/web/htdocs/css/style.css

    r362040a r4f81059  
    199199 
    200200/* search list */ 
    201 #searchlist {overflow:auto;
     201#searchlist {overflow:auto; white-space:nowrap;
    202202#searchlist ul a {list-style:none;} 
    203 #searchlist ul li {display:block;padding:2px 0;margin-bottom:4px;} 
     203#searchlist ul li {display:block;padding:0;margin-bottom:0px;} 
    204204#searchlist ul li a {background:url(../images/icon-data.png) 0 1px no-repeat;padding-left:15px;} 
    205205#searchlist ul li.txt a {background:url(../images/icon-data-txt.png) 0 1px no-repeat;padding-left:15px;margin-bottom:6px;} 
     
    209209#browselist {overflow:auto;} 
    210210#browselist ul {list-style:none;} 
    211 #searchlist ul li {display:block;padding:2px 0;} 
     211#browselist ul li {display:block;padding:0;} 
    212212#browselist ul li span {background:url(../images/icon-min-max.png) 0 3px no-repeat;padding-left:15px;} 
    213213#browselist ul li span.numeric {background:url(../images/icon-data.png) 0 1px no-repeat;padding-left:15px;} 
     
    248248 
    249249/******* GRAPH CONTROLS *******/ 
     250 
     251span.rememberGraph {display:none;float:right;border:1px solid #ddd;padding:0 4px 0 4px;} 
    250252 
    251253div.error { width:100%; text-align:center; } 
  • ui/web/htdocs/graph_controls.inc

    r362040a r4f81059  
    11<script> 
    22<!-- 
     3var awake = {}; 
     4function amChartInited(chart_id){ 
     5 // Ugliest hack on the planet. 
     6 while(!document.getElementById(chart_id).reloadSettings) { sleep(1); } 
     7 awake[chart_id] = true; 
     8 redraw_current_graph(); 
     9} 
     10 
    311var current_graph_id = ''; 
    412var graphinfo; 
     
    1018var recurse = 0; 
    1119function redraw_current_graph() { 
     20  if(!awake.maingraph) return; 
    1221  if(graphinfo.datapoints.length > 0) { 
    1322    $("#flashcontent").slideDown("normal"); 
     
    2231  } 
    2332} 
    24 function update_current_graph(redraw) { 
     33function update_current_graph(redraw, f) { 
    2534  if(recurse > 0) return; 
    2635  var str = JSON.stringify(graphinfo); 
     
    3140           recurse++; 
    3241           graphinfo.id = d.id; 
    33            if(d.error) { 
    34              $("#gtool-error").html(d.error); 
    35              $("#gtool-error").fadeIn('fast'); 
    36            } 
     42           if(d.error) $("#gtool-error").html(d.error).fadeIn('fast'); 
     43           else $("#gtool-error").fadeOut('fast'); 
    3744           recurse--; 
    3845           //$("#payload").html(JSON.stringify(graphinfo)); 
     46           if(graphinfo.id && graphinfo.saved != true) { 
     47             $(".rememberGraph").html('"Remember" this graph.').fadeIn('slow'); 
     48             $(".rememberGraph").click(function() { 
     49               graphinfo.saved = true; 
     50               update_current_graph(false, function(r) { 
     51                 if(r.error) graphinfo.saved = false; 
     52                 else $(".rememberGraph").html('Remebered').fadeOut('slow'); 
     53               }); 
     54             }); 
     55           } 
    3956           if(redraw) redraw_current_graph(); 
     57           if(f) f(d); 
    4058         }, 'json'); 
    4159} 
    4260function graph_add_datapoint(d) { 
    4361  if(d.axis == undefined) { d.axis = 'l'; } 
    44   if(d.name == undefined) { d.name = d.metric_name; } 
     62  if(d.name == undefined) { d.name = d.target + '`' + d.metric_name; } 
    4563  graphinfo.datapoints.push(d); 
    4664  gtool_add_datapoint(d); 
     
    100118 
    101119  o.find(".datatitle").html(d.name); 
     120  o.find(".datatitle").editable(function(value, settings) { 
     121      d.name = value; 
     122      update_current_graph(true); 
     123      return(value); 
     124    }, { }); 
     125 
    102126  recurse--; 
    103127  $("#gtool #dataPoints").append(o.children()); 
     
    123147} 
    124148function fetch_graph_info(id) { 
    125  $.getJSON("graph_info.php",{id: id}, refresh_graph_from_json); 
     149 $.getJSON("json/graph/info/" + id, refresh_graph_from_json); 
    126150} 
    127151--> 
    128152</script> 
    129153<!--<p><a href="">username</a> / <a href="#">worksheet</a></p>--> 
     154<span class="rememberGraph"></span> 
    130155<h2 id="graphTitle"></h2> 
    131  
    132156<!-- date range box --> 
    133157<script type="text/javascript"> 
  • ui/web/htdocs/graph_settings.php

    r9478c46 r4f81059  
    2626  if($d['math1']) $settings['expression'] = $d['math1']; 
    2727  $settings['axis'] = ($d['axis'] == 'l') ? 'left' : 'right'; 
     28  $settings['title'] = $d['name']; 
    2829  if($d['metric_type'] == 'numeric') { 
    2930    $driver->addDataSet($d['sid'], $d['metric_name'],