Changeset c2b37340f89c9d67e2d495d91a30d806bd9339dd

Show
Ignore:
Timestamp:
07/10/08 18:40:58 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1215715258 +0000
git-parent:

[e94863c5d22e2229730530ce3039661489cbbd73]

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

re-hangable treeview

Files:

Legend:

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

    r42acb3f rc2b3734  
    2020$autounits = 0; 
    2121foreach(split(";", $_GET['metric']) as $m) { 
    22   preg_match('/^(d|n|t)(l|r)(~|-)([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})-(.*)$/', $m, 
     22  preg_match('/^(d|n|t)(l|r)(~|-)(\d+)-(.*)$/', $m, 
    2323             $matches); 
    2424  $settings = $graph_settings[$i++]; 
  • ui/web/lib/Reconnoiter_DB.php

    r39d0756 rc2b3734  
    2222 
    2323  function get_data_for_window($uuid, $name, $start, $end, $expected, $derive) { 
    24     $sth = $this->db->prepare("select * from stratcon.fetch_dataset(?,?,?,?,?,?)"); 
     24    $type = preg_match('/^\d+$/', $uuid) ? '::integer' : '::uuid'; 
     25    $sth = $this->db->prepare("select * from stratcon.fetch_dataset(? $type,?,?,?,?,?)"); 
    2526    $sth->execute(array($uuid,$name,$start,$end,$expected,$derive)); 
    2627    $rv = array(); 
     
    4344    return $rv; 
    4445  } 
    45   function get_targets() { 
    46     $sth = $this->db->prepare("select distinct(target) as target from stratcon.loading_dock_check_s"); 
    47     $sth->execute(); 
     46  function get_noits() { 
     47    $sth = $this->db->prepare(" 
     48      select distinct(remote_address) as remote_address 
     49        from stratcon.loading_dock_check_s 
     50        join (   select id, max(whence) as whence 
     51                   from stratcon.loading_dock_check_s 
     52               group by id) latestrecord 
     53       USING (id,whence)"); 
     54    $rv = array(); 
     55    while($row = $sth->fetch()) { 
     56      $rv[] = $row['remote_address']; 
     57    } 
     58    return $rv; 
     59  } 
     60  function valid_source_variables() { 
     61    return array('module', 'remote_address', 'target', 'name', 'metric_name'); 
     62  } 
     63  function get_sources($want, $fixate, $active = true) { 
     64    $vars = $this->valid_source_variables(); 
     65    if(!in_array($want, $vars)) return array(); 
     66    $binds = array(); 
     67    $named_binds = array(); 
     68    $where_sql = ''; 
     69    foreach($vars as $var) { 
     70      if(isset($fixate[$var])) { 
     71        $where_sql .= " and $var = ?"; 
     72        $binds[] = $fixate[$var]; 
     73        $named_binds[$var] = $fixate[$var]; 
     74      } 
     75    } 
     76    $sql = " 
     77      select $want, min(sid) as sid, min(metric_type) as metric_type, count(1) as cnt 
     78        from stratcon.mv_loading_dock_check_s c 
     79        join stratcon.metric_name_summary m using (sid) 
     80       where active = " . ($active ? "true" : "false") . $where_sql . " 
     81    group by $want 
     82    order by $want"; 
     83    $sth = $this->db->prepare($sql); 
     84    $sth->execute($binds); 
     85    $rv = array(); 
     86    while($row = $sth->fetch()) { 
     87      $copy = $named_binds; 
     88      $copy[$want] = $row[$want]; 
     89      $copy['sid'] = $row['sid']; 
     90      $copy['id'] = 'ds'; 
     91      foreach($vars as $var) { 
     92        $copy['id'] .= "-" . $copy[$var]; 
     93      } 
     94      $copy['cnt'] = $row['cnt']; 
     95      if($copy['cnt'] == 1) 
     96        $copy['metric_type'] = $row['metric_type']; 
     97      $rv[] = $copy; 
     98    } 
     99    return $rv; 
     100  } 
     101  function get_targets($remote_address = null) { 
     102    if($remote_address) { 
     103      $sth = $this->db->prepare("select distinct(target) as target from stratcon.loading_dock_check_s where remote_address = ?"); 
     104      $sth->execute(array($remote_address)); 
     105    } 
     106    else { 
     107      $sth = $this->db->prepare("select distinct(target) as target from stratcon.loading_dock_check_s"); 
     108      $sth->execute(); 
     109    } 
    48110    $rv = array(); 
    49111    while($row = $sth->fetch()) {