Guards callout against null data. Re-enables Dashboard.
authorDavid Schoonover <dsc@wikimedia.org>
Thu, 7 Jun 2012 05:19:06 +0000 (22:19 -0700)
committerDavid Schoonover <dsc@wikimedia.org>
Thu, 7 Jun 2012 05:19:06 +0000 (22:19 -0700)
lib/data/datasource-model.co
lib/graph/graph-model.co
lib/server/server.co

index 490ede7..1d9dea2 100644 (file)
@@ -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
index f27bb2e..20893e0 100644 (file)
@@ -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
index f7a4fc2..8f90ffd 100755 (executable)
@@ -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'