public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $metricsMap = array();
     foreach (Metric::get() as $metric) {
         $metricsMap[$metric->ID] = $metric->Name;
     }
     $metricsField = \ListboxField::create('Metrics', 'Metrics')->setMultiple(true)->setSource($metricsMap);
     $fields->addFieldToTab('Root.Main', $metricsField);
     return $fields;
 }
 /**
  * Output current data for a given metric
  * @param int $metric The metric to return data for
  * @todo  Clean this up _significantly_
  */
 public function getData($metricID)
 {
     $ago = intval($this->getRequest()->getVar("timeago"));
     if (!is_numeric($ago) || !in_array($ago, array(1, 2, 4, 8, 12, 24, 48))) {
         $ago = 1;
     }
     $startTime = "-" . $ago . "hour";
     $metric = Metric::get()->byId($metricID);
     $project = $this->getCurrentProject();
     // If we are on the metrics root page, grab prod data
     $env = $this->getCurrentEnvironment($project);
     return $metric->query($env->RFCluster, $env->RFStack, $env->RFEnvironment, $startTime);
 }