Changeset fb2f0f75ce45f4bf8e9bf60cb6cf505976bca9ff

Show
Ignore:
Timestamp:
10/06/08 18:51:41 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1223319101 +0000
git-parent:

[646f05152343c6ecf678db40bf4debef24b65815]

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

more progress... worksheet prototyping, no data backend yet, refs #22

Files:

Legend:

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

    r648b048 rfb2f0f7  
    33RewriteRule ^json/ds/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ datapoint_browse_json.php?l1=$1&l2=$2&l3=$3&l4=$4 [PT,QSA] 
    44RewriteRule ^json/ds/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ datapoint_browse_json.php?l1=$1&l2=$2&l3=$3&l4=$4&l5=$5 [PT,QSA] 
     5RewriteRule ^json/worksheet/info/([^/]*)$ worksheet_info.php?id=$1 [PT,QSA] 
    56RewriteRule ^json/graph/info/([^/]*)$ graph_info.php?id=$1 [PT,QSA] 
    67RewriteRule ^json/graph/store$ graph_store.php [PT,QSA] 
  • ui/web/htdocs/css/style.css

    r90b4360 rfb2f0f7  
    4343z-index:200; 
    4444}  
    45 #container{position:absolute;top:38px;left:0;overflow:auto;width:100%;z-index:100;} 
     45#container{position:absolute;top:38px;left:0px;padding:1em;overflow:auto;z-index:100;} 
    4646#content { 
    4747background:#FFF; 
     
    248248#graphlist ul li ul li a em{color:#82787b;padding-left:3px;} 
    249249 
     250div.plot-area { height: 180px; width: 380px; } 
     251div.plot-area div.centered{ 
     252  height: 180px; width: 380px; 
     253  display: table-cell;vertical-align:middle;text-align:center; 
     254} 
     255div.plot-area div.centered .loading { 
     256  background:url(../images/jquery-ajax-loader.gif) top center no-repeat; 
     257  height:25px;width:380px; 
     258} 
     259 
     260div.plot-legend table { height: 4em; } 
     261div.plot-legend td.legendLabel { padding: 0 0.5em; } 
     262 
    250263/* worksheet list */ 
    251264#worksheetlist {height:450px;overflow:auto;} 
     
    254267#worksheetlist ul li a {background:url(../images/icon-worksheet.png) 0 1px no-repeat;padding-left:15px;} 
    255268#worksheetlist ul li.selected {background:#e6e4e5 /*url(../images/icon-worksheet.png) 0 3px no-repeat*/;display:block;} 
     269 
     270ul#worksheet-graphs { 
     271} 
     272ul#worksheet-graphs li { 
     273  float:left; 
     274  list-style:none; 
     275  margin:1.5em 1em 0 0; 
     276} 
    256277 
    257278/******* GRAPH CONTROLS *******/ 
  • ui/web/htdocs/graph_controls.inc

    r646f051 rfb2f0f7  
    1212} 
    1313var recurse = 0; 
    14 function plot_id(r) { 
    15       var placeholder = $("#maingraph > div.plot-area"); 
     14function plot_id(r, domid) { 
     15      var placeholder = $(domid + " > div.plot-area"); 
    1616      placeholder.bind("plotselected", function (event, ranges) { 
     17        alert(ranges.xaxis.from + " -> " + ranges.xaxis.to); 
    1718        plot = $.plot(placeholder, data, 
    1819                    $.extend(true, {}, options, { 
     
    2021                             })); 
    2122      }); 
    22       r.options.legend.container = $("#maingraph div.plot-legend"); 
     23      r.options.legend.container = $(domid + " div.plot-legend"); 
     24      if(!r.options.yaxis) r.options.yaxis = {}; 
     25      if(r.options.yaxis.suffix) 
     26        r.options.yaxis.tickFormatter = function (val, axis) { 
     27          return val.toFixed(axis.tickDecimals) + r.options.yaxis.suffix; 
     28        }; 
    2329      var plot = $.plot(placeholder, r.data, r.options); 
    2430} 
    25 function redraw_current_graph() { 
     31function redraw_current_graph(domid) { 
    2632  if(graphinfo.datapoints.length > 0) { 
    27     $("#maingraph").slideDown("normal"); 
     33    $(domid).slideDown("normal"); 
    2834    var url = "flot/graph/settings/" + graphinfo.id; 
    29     $.getJSON(url, {'cnt':displayinfo.cnt, 'start':displayinfo.start, 'end':displayinfo.end}, plot_id); 
     35    $.getJSON(url, {'cnt':displayinfo.cnt, 'start':displayinfo.start, 'end':displayinfo.end}, function (r) { plot_id(r,domid); }); 
    3036  } 
    3137  else { 
    32     $("#maingraph").slideUp("normal"); 
     38    $(domid).slideUp("normal"); 
    3339  } 
    3440} 
     
    5662             }); 
    5763           } 
    58            if(redraw) redraw_current_graph(); 
     64           if(redraw) redraw_current_graph("#maingraph"); 
    5965           if(f) f(d); 
    6066         }, 'json'); 
     
    146152    gtool_add_datapoint(graphinfo.datapoints[i]); 
    147153  } 
    148   redraw_current_graph(); 
     154  redraw_current_graph("#maingraph"); 
    149155} 
    150156function fetch_graph_info(id) { 
     
    189195                displayinfo.end = ''; 
    190196                $(this).addClass("selected"); 
    191                 redraw_current_graph(); 
     197                redraw_current_graph("#maingraph"); 
    192198                return false; 
    193199        }); 
     
    207213                        displayinfo.start = start.toUTCString(); 
    208214                        displayinfo.end = end.toUTCString(); 
    209                         redraw_current_graph(); 
     215                        redraw_current_graph("#maingraph"); 
    210216                        $('#range a.btn-slide').get(0).innerHTML = formated.join(' - '); 
    211217                } 
  • ui/web/htdocs/index.php

    r646f051 rfb2f0f7  
    3939   $(".accordion span:last").slideDown(); 
    4040 
     41   $("div#container div").eq(1).slideUp(); 
     42   $("div#container div:last").slideDown(); 
     43 
    4144   $(".accordion h3").click(function(){ 
    4245       $(this).next("span").slideToggle("normal") 
     
    4447       $(this).toggleClass("active"); 
    4548       $(this).siblings("h3").removeClass("active"); 
     49       $(this).siblings("h3").each(function(e) { 
     50         $("#" + $(this).attr("id") + "_panel").slideUp("fast"); 
     51       }); 
     52       if($(this).hasClass("active")) 
     53         $("#" + $(this).attr("id") + "_panel").slideDown("fast"); 
     54       else 
     55         $("#" + $(this).attr("id") + "_panel").slideUp("fast"); 
    4656   }); 
    4757 
     
    96106<!-- alert / Remove this when new script is made --> 
    97107<script type="text/javascript"> 
    98 function disp_alert() 
    99 { 
    100 alert("display the correct graph") 
    101 } 
    102108function MM_jumpMenu(targ,selObj,restore){ //v3.0 
    103109  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); 
     
    124130<div id="container"> 
    125131        <div id="content"> 
    126                 <div id="tab_content"> 
    127                         <ul> 
    128                                 <li><a href="#" class="selected">Graph Panel</a></li> 
    129                                 <li><a href="#">Worksheet</a></li> 
    130                         </ul><div style="clear:both;"></div> 
    131                 </div> 
    132                 <!-- graph and controls --> 
    133                 <div id="main"> 
     132                <div id="worksheet_controls_panel"> 
     133                <?php include('worksheet_panel.inc') ?> 
     134                </div><!-- end main --> 
     135                <div id="graph_controls_panel"> 
    134136                <?php include('graph_controls.inc') ?> 
    135137                </div><!-- end main --> 
  • ui/web/htdocs/json_graph_flot.php

    r646f051 rfb2f0f7  
    4242$options = array( 
    4343  'xaxis' => array ( 'mode' => 'time' ), 
    44   'legend' => array ( 'noColumns' => 4, position => 'sw' ), 
     44  'yaxis' => array ( 'suffix' => $driver->autounit() . '' ), 
     45  'legend' => array ( 'noColumns' => 6, position => 'sw' ), 
    4546  'selection' => array ( 'mode' => 'x' ), 
    4647  'shadowSize' => 0, 
     
    5152  'options' => $options, 
    5253  'title' => $driver->title() . '', 
    53   'suffix' => $driver->autounit() . '' 
    5454)); 
    5555 
  • ui/web/htdocs/search_controls.inc

    r2a9ba1d rfb2f0f7  
    1                 <h3>Search Data</h3> 
     1                <h3 id="graph_controls">Graph Controls</h3> 
    22                <span class="search"> 
    33                        <div class="tabs"> 
  • ui/web/htdocs/worksheet_controls.inc

    r2a9ba1d rfb2f0f7  
    1                 <h3>Worksheet Controls</h3> 
     1                <h3 id="worksheet_controls">Worksheet Controls</h3> 
    22                <span class="worksheet"> 
    33                        <div id="searchform" style="margin:1em 0 1em 0;padding-bottom:1em;border-bottom: solid 1px #c4c4c4;"> 
  • ui/web/lib/Reconnoiter_DB.php

    r90b4360 rfb2f0f7  
    101101                           using (sid,metric_name,metric_type) 
    102102                           where ts_search_all @@ to_tsquery(query)))", 
    103       "select graphid, title, 
     103      "select graphid, title, json, 
    104104              to_char(last_update, 'YYYY/mm/dd') as last_update 
    105105         from prism.saved_graphs, 
     
    242242    return $rv; 
    243243  } 
    244   function percentile($arr, $p, $attr = 'avg_value') { 
     244  function percentile($arr, $p, $groupname = 'left', $attr = 'avg_value') { 
    245245    // This sums the sets and returns the XX percentile bucket. 
    246246    if(!is_array($arr)) return array(); 
     
    251251      $nonnull = 0; 
    252252      foreach ($arr as $sets) { 
     253        if($sets->groupname() != $groupname) continue; 
    253254        $value = $sets->data($ts, $attr); 
    254255        if($value != "") $nonnull = 1; 
  • ui/web/lib/Reconnoiter_DataContainer.php

    r72d0010 rfb2f0f7  
    4545      new Reconnoiter_DataSet($uuid, $name, $derive, $expr, 
    4646                              $this->start(), $this->end(), $this->cnt()); 
     47    $this->sets["$uuid-$name"]->groupname($attrs['axis']); 
    4748    $this->sets_config["$uuid-$name"] = is_array($attrs) ? $attrs : array(); 
    4849    if(!isset($this->master_set)) $this->master_set = $this->sets["$uuid-$name"]; 
     
    9293    switch($this->units) { 
    9394      case 0.000000001: return 'n'; 
     95      case '1.0E-6': 
    9496      case 0.000001: return 'u'; 
    9597      case 0.001: return 'm'; 
  • ui/web/lib/Reconnoiter_DataSet.php

    rdf2e366 rfb2f0f7  
    66  public $data; 
    77  protected $expr; 
     8  protected $groupname; 
    89  function __construct($uuid, $name, $derive, $expr, $start, $end, $cnt = 400) { 
    910    $db = Reconnoiter_DB::getDB(); 
    1011    $this->data = $db->get_data_for_window($uuid, $name, $start, $end, $cnt, $derive); 
    1112    $this->expr = $expr; 
     13  } 
     14  function groupname($gn = null) { 
     15    if(isset($gn)) $this->groupname = $gn; 
     16    return $this->groupname; 
    1217  } 
    1318  function points() { 
  • ui/web/lib/Reconnoiter_flot_Driver.php

    r648b048 rfb2f0f7  
    1313    return parent::defaultChangeSetAttrs($uuid, $name, $derive, $attrs); 
    1414  } 
     15  function graphcolors() { 
     16    $c = array(); 
     17    foreach($this->sets as $name => $set) { 
     18      $c[] = $this->sets_config[$name]['color']; 
     19    } 
     20    foreach($this->guides as $name => $value) { 
     21      $c[] = $this->guides_config[$name]['color']; 
     22    } 
     23    return $c; 
     24  } 
    1525  function graphdata() { 
    1626    $a = array(); 
     
    2131        'data' => $this->graphdataset($set, $this->sets_config[$name]), 
    2232        'yaxis' => ($this->sets_config[$name]['axis'] == 'right') ? 2 : 1, 
    23         'lines' => array ( 'show' => 'true', 'fill' => '0.8', 'lineWidth' => '1' ) 
     33        'lines' => array ( 'show' => 'true', 'fill' => '0.3', 'lineWidth' => '1' ) 
    2434      ); 
    2535    }