From: David Schoonover Date: Thu, 7 Jun 2012 05:19:06 +0000 (-0700) Subject: Guards callout against null data. Re-enables Dashboard. X-Git-Url: http://git.less.ly:3516/?a=commitdiff_plain;h=e56c512d1efe1ccd02451a8fc9ac58b45dff7bf8;p=kraken-ui.git Guards callout against null data. Re-enables Dashboard. --- diff --git a/lib/data/datasource-model.co b/lib/data/datasource-model.co index 490ede7..1d9dea2 100644 --- a/lib/data/datasource-model.co +++ b/lib/data/datasource-model.co @@ -139,13 +139,13 @@ DataSource = exports.DataSource = BaseModel.extend do # {{{ getDateColumn: -> - @data.dateColumn + @data?.dateColumn getData: -> - @data.toJSON?() or @data + @data?.toJSON?() or @data getColumn: (idx) -> - @data.columns[idx] + @data?.columns[idx] getColumnName: (idx) -> @get('metrics')?[idx]?.label diff --git a/lib/graph/graph-model.co b/lib/graph/graph-model.co index f27bb2e..20893e0 100644 --- a/lib/graph/graph-model.co +++ b/lib/graph/graph-model.co @@ -230,10 +230,9 @@ Graph = exports.Graph = BaseModel.extend do # {{{ getCalloutData: -> # For now, always operate on the first Metric - return unless m = @dataset.metrics.at 0 - - data = m.getData() - dates = m.getDateColumn() + return unless (m = @dataset.metrics.at 0) and + (data = m.getData()) and + (dates = m.getDateColumn()) # trim cols to match the right timespan len = Math.min data.length, dates.length diff --git a/lib/server/server.co b/lib/server/server.co index f7a4fc2..8f90ffd 100755 --- a/lib/server/server.co +++ b/lib/server/server.co @@ -182,8 +182,8 @@ app.controller require './controllers/datasource' app.get '/', (req, res) -> ### XXX: Temporary, while I implement backwards compat with the old data format - # res.render 'dashboard' - res.redirect '/graphs/ohai/edit' + res.render 'dashboard' + # res.redirect '/graphs/ohai/edit' app.get '/geo', (req, res) -> res.render 'geo'