Changeset b76d645b5e2d35c8e83bfd0f5e85cb6dc9573531

Show
Ignore:
Timestamp:
03/02/09 20:45:27 (5 years ago)
Author:
Umar Farooq <umar@omniti.com>
git-committer:
Umar Farooq <umar@omniti.com> 1236026727 +0000
git-parent:

[bc313ac48822f84e27048d0227eb545033aeaa1c]

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

metrics for templates are now sorted by target, module, and name. also replaced alert with modal

Files:

Legend:

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

    r86bd53e rb76d645  
    8686     $ctext = "<form id='template-graph' name='template-graph' action=''>";      
    8787     $ctext.= "<select multiple='multiple' name='sid_select' size='5' id='sid_select' >"; 
    88      foreach($sid_list as $sid) { 
    89         $sname = $db->make_name_for_template($sid); 
    90         $ctext.="<option value='$sid'> $sname</option><br />"; 
     88     $snames = $db->make_names_for_template($sid_list); 
     89 
     90     foreach ($snames as $tuple) { 
     91        $ctext.="<option value='".$tuple['sid']."'> ".$tuple['option']."</option><br />"; 
    9192     } 
    92  
    9393     $ctext.="</select><br>Select ".$num_sids." from above.";      
    9494     $ctext .= "<br>Graph Title:"; 
     
    126126} 
    127127else { 
    128      alert("Did not specify correct number of metrics!") 
     128     modal_warning("Graph creation error", "You did not select the correct number of metrics!"); 
    129129} 
    130130} 
  • ui/web/lib/Reconnoiter_DB.php

    rf99c668 rb76d645  
    493493  } 
    494494 
    495   public function make_name_for_template($sid) { 
    496     $sql = "select m.* from stratcon.mv_loading_dock_check_s m where m.sid = ?"; 
     495  public function make_names_for_template($sid_list) { 
     496 
    497497    $binds = array(); 
    498     if($sid) { 
    499       $binds[] = $sid; 
    500       $sth = $this->db->prepare($sql); 
    501       $sth->execute($binds); 
    502       $row = $sth->fetch(); 
    503     } 
    504    return $row['target']."`".$row['module']."`".$row['name']; 
    505   } 
     498 
     499    $sql = "select m.* from stratcon.mv_loading_dock_check_s m where m.sid in ("; 
     500    for ($i =0 ; $i<count($sid_list);$i++){ 
     501      $binds[] = $sid_list[$i]; 
     502      $sql.= ($i == count($sid_list)-1) ? "?)" : "?,"; 
     503    } 
     504    $sth = $this->db->prepare($sql); 
     505    $sth->execute($binds); 
     506 
     507    $data = array(); 
     508    while($row = $sth->fetch()) { 
     509      $data[] = $row; 
     510    } 
     511 
     512    foreach ($data as $key => $rw) { 
     513      $target[$key] = $rw['target']; 
     514      $module[$key] = $rw['module']; 
     515      $name[$key] = $rw['name']; 
     516      $sid[$key] = $rw['sid']; 
     517    } 
     518    array_multisort($target, SORT_ASC, $module, SORT_ASC,$name, SORT_ASC, $data); 
     519 
     520    $rvlist = array(); 
     521    foreach($data as $row) { 
     522      error_log(" sid: ".$row['sid']." : ".$row['target']."`".$row['module']."`".$row['name']); 
     523      $rvlist[] = array( 'sid' => $row['sid'], 
     524                'option' => $row['target']."`".$row['module']."`".$row['name']); 
     525    } 
     526    return $rvlist; 
     527  } 
     528 
    506529} 
    507530