urlRoot : '/dashboards'
# graph_ids : null
- graphs : null
+ graphs : null
# tabs : null
initialize: ->
BaseModel::initialize ...
- @getGraphs null, ~> @triggerReady
+ @getGraphs()
defaults: ->
name : null
# addGraph: (graph, tabName) ->
# ...
-
- nest : (cb, records) ->
- console.log('[nest]\tentering')
- # console.log('[nest]\torig:')
- # console.log(records)
- graph_map = d3.nest()
- .key (graph_rec) ->
- graph_rec[0]
- .rollup (arr) ->
- arr[0][1]
- .map(records)
- # console.log('[nest]\tnew:')
- # console.log(graph_map)
- cb null graph_map
-
+
show : (cb, obj) ->
console.log('[show]')
console.log(obj)
(err, elem) ->
arr.push elem
cb null
-
- getGraphs : (err, cb) ->
+
+ getGraphs : ->
console.log('[getGraphs]\tentering')
# consolidate graph_ids to one array
graph_ids = _(@tabs).chain().values().map((tab_obj) -> tab_obj.graph_ids).flatten().value()
# next null
# .parEach_ @show
.unflatten()
- .seq_ (next, graph_tuples) ->
- # console.log('[setter]\tgraph_tuples:')
- # console.log(graph_tuples)
+ .seq_ (next, graph_tuples) ~>
@graphs = _.generate graph_tuples
- # console.log('[setter]\t@graphs:')
- # console.log(@graphs)
- cb null
- # .parEach_ @show
-
+ console.log('[setter]\tcalling ready')
+ @triggerReady()
+ this
# }}}
\ No newline at end of file
* @class
*/
DashboardView = exports.DashboardView = BaseView.extend do # {{{
- __bind__ : <[ ]>
+ __bind__ : <[ addTab ]>
tagName : 'section'
className : 'dashboard'
template : require 'kraken/template/dashboard/dashboard'
BaseView::initialize ...
# @graphs.on 'add', @attachGraphs, this
# @graphs.on 'add', @attachGraph, this
- console.log('[dashboard-view::initialize]\tentering')
@model.on('ready', @load, this)
# TODO:
# - only render graph when scrolling makes it visible
load: ->
- console.log('[dashboard-view::load]\tentering')
_.map(@model.tabs, @addTab)
addTab: (tab) ->
- console.log('[dashboard-view::addTab]\tentering')
self = this
- graphs = _(tab.graph_ids).map((graph_id) -> @model.graphs[graph_id])
+ graphs = _(tab.graph_ids).map((graph_id) ~> @model.graphs[graph_id])
Seq(graphs)
.parMap (graph) ->
self.graphs.add graph