예제 #1
0
파일: graph.py 프로젝트: kberg/dviz
  def get(self, names):
    template_values = {
      'user': users.get_current_user(),
      'series': names
    }
    # only get first. will need to get them all, later.
    latest = data.get_latest_value(names.split(',')[0])
    if latest:
      template_values['latest_val'] = latest.value
      template_values['latest_ts'] = latest.timestamp
    else:
      template_values['latest_val'] = 'NaN'
      template_values['latest_ts'] = 'NaN'

    self.render('graph.html', template_values)
예제 #2
0
파일: detail.py 프로젝트: mote/dviz
  def get(self, timerange, names):
    template_values = {
      'user': users.get_current_user(),
      'timerange': timerange,
      'series': names,
      'all_timeranges': ['hour', 'day', 'week', 'month', 'year', 'all'],
    }
    # only get first. will need to get them all, later.
    latest = data.get_latest_value(names.split(',')[0])
    if latest:
      template_values['latest_val'] = latest.value
      template_values['latest_ts'] = latest.timestamp
    else:
      template_values['latest_val'] = 'NaN'
      template_values['latest_ts'] = 'NaN'

    self.render('detail.html', template_values)