Changeset 44c7512efb0f985d57abe91e6418b6ffaf43b462

Show
Ignore:
Timestamp:
07/02/09 20:53:42 (5 years ago)
Author:
Umar Farooq <umar@omniti.com>
git-committer:
Umar Farooq <umar@omniti.com> 1246568022 +0000
git-parent:

[e50a22b4595a5a3d46a41b97c7a602e31e063deb]

git-author:
Umar Farooq <umar@omniti.com> 1246568022 +0000
Message:

adding some ui code for composite datasets, we can add a composite dataset and name it, add expressions, but they are ignored for now.
will need to do the actual function evaluation in ReconGraph?.
refs #121

Files:

Legend:

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

    r41084bb r44c7512  
    169169  } 
    170170} 
     171function gtool_add_composite() { 
     172  var d ={}; 
     173  d.metric_type = 'composite'; 
     174  graphinfo.datapoints.push(d); 
     175  gtool_add_datapoint(d); 
     176  update_current_graph(true); 
     177} 
    171178function gtool_add_guide() { 
    172179  var d = {}; 
     
    181188  if(d.metric_type == 'guide') { 
    182189    o = $("#guideeditor").clone(); 
     190  } 
     191  else if(d.metric_type == 'composite') { 
     192    o = $("#compositeeditor").clone(); 
    183193  } 
    184194  else { 
     
    542552          } 
    543553        }); 
     554        $(".addComposite").click(function() { 
     555          if(!locked){ 
     556            gtool_add_composite(); 
     557          } 
     558        }) 
    544559 
    545560        $("span.blankGraph").click(function() { 
     
    612627<div><span class="editStacks">Add Stack Set</span></div> 
    613628<div style="float:right"><span class="addGuide">Add Guide</span></div> 
     629<div style="float:right"><span class="addComposite">Add Composite</span></div> 
    614630<br style="clear:right" /> 
    615631<div class="error"><p class="error" id="gtool-error"></p></div> 
     
    650666                <div> 
    651667                        <label for="math">Percentile</label> <input name="math2" type="text" value="" style="width:380px;" /> 
     668                </div> 
     669                </td> 
     670        </tr> 
     671        </tbody> 
     672        <tbody id="compositeeditor"> 
     673        <tr>             
     674                <td><input name="view" type="checkbox" value="1" /></td> 
     675                <td class="data datatitle"></td> 
     676                <td><div class="colorPicker"><div class="colorSelector"><div style="background-color: #fff"></div></div><div class="colorPickerHolder"></div></div></td> 
     677                <td></td> 
     678                <td><span class="axis axisl"> L</span> <span class="axis axisr"> R</span></td> 
     679                <td><a href="#" class="deletedatapoint"><span>delete</span></a></td> 
     680                <td class="math">math</td> 
     681        </tr> 
     682        <tr class="mathbox"> 
     683                <td colspan="7"> 
     684                <div> 
     685                        <label for="math">Display Math</label> <input name="math1" type="text" value="" style="width:380px;" /> 
     686                </div> 
     687                <div> 
     688                        <label for="math">Function</label> <input name="math2" type="text" value="" style="width:380px;" /> 
    652689                </div> 
    653690                </td> 
  • ui/web/htdocs/js/recon.js

    r41084bb r44c7512  
    375375          return this; 
    376376        }, 
     377      make_composite_data: 
     378        function (i, data) { 
     379          //      console.log("ok with expr", data[i].reconnoiter_source_expression); 
     380        }, 
    377381      plot: 
    378382        function (r, redraw) { 
     383 
    379384          var title = this.ReconGraphMacro(r.title, r.data); 
    380385          this.find(".graphTitle").html(title); 
     
    395400              r.data[i].dataManip = rpn_magic(r.data[i].reconnoiter_display_expression); 
    396401          } 
     402 
    397403          ddata = r.data;           
    398404 
     
    511517              ReconGraphPrepareStream: ReconGraph.PrepareStream, 
    512518              ReconGraphAddPoint: ReconGraph.AddPoint, 
    513               ReconGraphPlotPoints: ReconGraph.PlotPoints 
     519              ReconGraphPlotPoints: ReconGraph.PlotPoints, 
     520              ReconGraphMakeCompositeData: ReconGraph.make_composite_data 
    514521              }); 
    515522  })(jQuery); 
     
    795802 
    796803        //we could set a polltime for each dataset, but for now we make them the same 
     804        //we assume we never give datasets we dont want to graph sids, like composites 
    797805        for(var i=0; i<g.datapoints.length; i++) { 
    798806          if(g.datapoints[i].sid) { 
     
    803811          sids+= "/"+sid+"@"+sidneed[sid]; 
    804812        } 
    805         //     console.log("sids request: http://" +recon_realtime_hostname+"/data"+sids); 
     813        //console.log("sids request: http://" +recon_realtime_hostname+"/data"+sids); 
    806814        streambox.html('<iframe src="http://' + recon_realtime_hostname + '/data'+sids+'"></iframe>'); 
    807815     }); 
  • ui/web/htdocs/json_graph_flot.php

    r0dbdcdc r44c7512  
    3333    $driver->addPercentileGuide($d['name'], $d['math2'], 
    3434                                array('expression' => $d['math1'], 
     35                                      'color' => $color)); 
     36  } 
     37  else if($d['metric_type'] == 'composite') { 
     38     $color = isset($d['color']) ? $d['color'] : '#ff0000'; 
     39     $driver->addCompositeSet($d['name'],$d['math2'], 
     40                                 array('expression' => $d['math1'], 
    3541                                      'color' => $color)); 
    3642  } 
  • ui/web/lib/Reconnoiter_DataContainer.php

    re13f962 r44c7512  
    44require_once('Reconnoiter_DataSet.php'); 
    55require_once('Reconnoiter_ChangeSet.php'); 
     6require_once('Reconnoiter_CompositeSet.php'); 
    67require_once('Reconnoiter_RPN.php'); 
    78 
     
    5152    if(!isset($this->master_set)) $this->master_set = $this->sets["$uuid-$name"]; 
    5253  } 
     54 
     55  function addCompositeSet($name, $math2, $attrs = array()) { 
     56    $this->sets[ "composite-$name"] = new Reconnoiter_CompositeSet("composite", $name, $math2);     
     57    $this->sets_config[ "composite-$name"] = is_array($attrs) ? $attrs : array(); 
     58  } 
     59 
    5360  function addChangeSet($uuid, $name, $attrs = array()) { 
    5461    $attrs = $this->defaultChangeSetAttrs($uuid, $name, $derive, $attrs); 
  • ui/web/lib/Reconnoiter_flot_Driver.php

    r0dc2054 r44c7512  
    2828    foreach($this->sets as $name => $set) { 
    2929      $m_name = explode("-", $name);       
     30      $metric_type = ''; 
     31      if(get_class($set) == "Reconnoiter_ChangeSet") { 
     32         $metric_type = 'text'; 
     33      } 
     34      else if(get_class($set) == "Reconnoiter_CompositeSet") { 
     35         $metric_type = 'composite'; 
     36      } 
     37      else { 
     38         $metric_type = 'numeric'; 
     39      } 
     40          
    3041      $ds = array ( 
    3142        'reconnoiter_source_expression' => $set->expression(), 
     
    3647        'derive_val' => $set->derive_val(), 
    3748        'uuid' => $set->uuid_val(), 
    38         'metric_name' => $m_name[1], 
    39         'metric_type' => (get_class($set) == "Reconnoiter_DataSet") ? 'numeric' : 'text'
     49        'metric_name' => $m_name[1],    
     50        'metric_type' => $metric_type
    4051        'hidden' => ($this->sets_config[$name]['hidden'] == "true") ? 1: 0, 
    4152      ); 
     
    4657 
    4758      //by default, points, lines, and bars are set not to show in jquery.flot.js 
    48       //if we have a numeric metric_type, draw lines 
    49       if(get_class($set) == "Reconnoiter_DataSet") { 
     59 
     60      //if we have a numeric metric_type or a composite metric type, draw lines 
     61      if( ($metric_type == 'numeric')  || ($metric_type == 'composite') ) { 
    5062        $opacity = isset($this->sets_config[$name]['opacity']) ? 
    5163                     $this->sets_config[$name]['opacity'] : '0.3'; 
     
    5365      } 
    5466      //if we have a text metric type, draw points 
    55       else if(get_class($set) == "Reconnoiter_ChangeSet")
     67      else if($metric_type == 'text')
    5668        $ds['points'] = array ( 'show' => ($show_set) ? 1:0, 'fill' => 'false', 'lineWidth' => 1, radius => 5 ); 
    5769      }