rubyneat_dashboard 0.4.0.alpha.4.pre.1 → 0.4.0.alpha.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,17 @@
1
- @PopulationController = ($scope, populationService) ->
1
+ @PopulationController = ($scope, $timeout, populationHistoryService) ->
2
2
  $scope.init = ->
3
3
  $scope.entry = {}
4
- $scope.entries = []
5
- populationService.getMessages (message) ->
6
- $scope.$apply ->
4
+ populationHistoryService.getMessages (message) ->
5
+ $timeout ->
7
6
  p = message.payload
7
+
8
8
  $scope.entry = {
9
9
  generation: p.generation
10
+ pop_name: p.pop_name
10
11
  best: p.fitness.best
12
+ best_name: p.fitness.best_name
11
13
  overall: p.fitness.overall
12
14
  worst: p.fitness.worst
15
+ worst_name: p.fitness.worst_name
13
16
  }
14
- $scope.entries.push $scope.entry
17
+ , 0, true
@@ -1,4 +1,4 @@
1
- @DashboardApp.directive 'critter-genotype-topology', ->
1
+ @DashboardApp.directive 'critterGenotypeTopology', ->
2
2
  link = (scope, element, attr) ->
3
3
 
4
4
  # put D3 code here
@@ -0,0 +1,5 @@
1
+ @DashboardApp.directive 'critterIce', ->
2
+ link: (scope, element, attr) ->
3
+ # code begin
4
+ # code end
5
+ restrict: "E"
@@ -1,4 +1,4 @@
1
- @DashboardApp.directive 'critter-phenotype-topology', ->
1
+ @DashboardApp.directive 'critterPhenotypeTopology', ->
2
2
  link = (scope, element, attr) ->
3
3
 
4
4
  # put D3 code here
@@ -0,0 +1,5 @@
1
+ @DashboardApp.directive 'critterSandbox', ->
2
+ link: (scope, element, attr) ->
3
+ # code begin
4
+ # code end
5
+ restrict: "E"
@@ -0,0 +1,65 @@
1
+ @DashboardApp.directive 'populationBrigade', ->
2
+ link: (scope, el, attr) ->
3
+ # link code begin
4
+ margin =
5
+ top: 5
6
+ right: 10
7
+ bottom: 5
8
+ left: 10
9
+
10
+ box =
11
+ height: h = scope.height || 160
12
+ width: w = scope.width || 900
13
+ inner_height: h - margin.top - margin.bottom
14
+ inner_width: w - margin.right - margin.left
15
+
16
+
17
+ config =
18
+ numOfPops: scope.numberOfPops || 10
19
+
20
+ icon =
21
+ uri: "/images/population_sprite.050.png"
22
+ width: 50
23
+ height: 148
24
+ bottom: 10
25
+
26
+ range =
27
+ x: d3.scale.linear().range([ box.width, 0]).domain([0, config.numOfPops])
28
+ y: d3.scale.linear().range([ box.height, 0 ])
29
+
30
+ svg = d3.select(el[0]).append('svg')
31
+ .attr('width', box.width).attr('height', box.height)
32
+ .append('g')
33
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")")
34
+
35
+ popboxes = []
36
+
37
+ update_brigade = (tick) ->
38
+ console.log tick
39
+
40
+ new_popbox = (i, name) ->
41
+ g = svg.append("g")
42
+ .attr("transform", "translate(#{range.x(i)}, #{0})")
43
+
44
+ g.append("image")
45
+ .attr("xlink:href", icon.uri)
46
+ .attr("width", icon.width)
47
+ .attr("height", icon.height)
48
+ g.append("text").text(name)
49
+ .attr("transform", "translate(#{icon.width / 2}, #{icon.height - icon.bottom}) rotate(-90)")
50
+ g
51
+
52
+ popboxes.push new_popbox(0, "many")
53
+ popboxes.push new_popbox(1, "moe")
54
+ popboxes.push new_popbox(2, "jack")
55
+
56
+ scope.$watch 'tickSource', (tick) ->
57
+ update_brigade tick
58
+
59
+ # link code end
60
+ restrict: "E"
61
+ scope:
62
+ width: '='
63
+ height: '='
64
+ tickSource: '='
65
+ numberOfPops: '='
@@ -7,6 +7,7 @@
7
7
  basis = scope.basis || 'generation'
8
8
  xname = scope.xaxisName || '**Generations**'
9
9
  yname = scope.yaxisName || '**Fitness**'
10
+ data = scope.data || []
10
11
 
11
12
  margin =
12
13
  top: 20
@@ -64,8 +65,8 @@
64
65
  scope.fitness
65
66
 
66
67
  update_domains = (fitness) ->
67
- x.domain d3.extent data, (d) ->
68
- d[basis]
68
+ x.domain d3.extent fitness[labels[0]].values, (d) ->
69
+ d.gen
69
70
 
70
71
  y.domain [ d3.min(labels, (c) ->
71
72
  d3.min fitness[c].values, (v) ->
@@ -155,7 +156,7 @@
155
156
  render_tick(tick) if tick.generation
156
157
  , true
157
158
 
158
- datamessage scope.data
159
+ datamessage data
159
160
 
160
161
  link: link
161
162
  restrict: 'E'
@@ -0,0 +1,5 @@
1
+ @DashboardApp.directive 'populationWindow', ->
2
+ link: (scope, element, attr) ->
3
+ # code begin
4
+ # code end
5
+ restrict: "E"
@@ -1,5 +1,20 @@
1
1
  @DashboardApp.factory 'populationService', () ->
2
2
  source = new EventSource('/population')
3
+ receivers = []
3
4
  getMessages: (receiver) ->
5
+ receivers.push receiver
4
6
  source.onmessage = (event) ->
7
+ receivers.forEach (receiver) ->
5
8
  receiver(JSON.parse(event.data))
9
+
10
+ @DashboardApp.factory 'populationHistoryService', (populationService) ->
11
+ history = []
12
+ populationService.getMessages (message) ->
13
+ history.push message
14
+
15
+ getMessages: (receiver) ->
16
+ history.forEach (message) ->
17
+ receiver(message)
18
+ populationService.getMessages (message) ->
19
+ receiver(message)
20
+
@@ -27,14 +27,15 @@ module Dashboard
27
27
  register BowerDSL
28
28
 
29
29
  configure do
30
- set port: 3912
30
+ set port: 3912 #TODO: Make this configurable from the DSL
31
31
  set static: true
32
- set :bind, '0.0.0.0' #all interfaces
32
+ set :bind, '0.0.0.0' #TODO: Make this configurable from the DSL
33
33
  use Rack::CommonLogger, $log = ::Logger.new(::File.new('log/dashboard.log', 'a+'))
34
34
  $log.debug "Started Dashboard at #{Time.now}"
35
35
  Barista.add_preamble do |location|
36
36
  %{
37
- /* DO NOT MODIFY -- compiled from #{location}
37
+ /* RubyNEAT Dashboard Generated -- compiled from #{location}
38
+ * DO NOT MODIFY
38
39
  */
39
40
  }
40
41
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: rubyneat_dashboard 0.4.0.alpha.4.pre.1 ruby lib
5
+ # stub: rubyneat_dashboard 0.4.0.alpha.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "rubyneat_dashboard"
9
- s.version = "0.4.0.alpha.4.pre.1"
9
+ s.version = "0.4.0.alpha.6"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Fred Mitchell"]
14
- s.date = "2014-08-03"
14
+ s.date = "2014-08-09"
15
15
  s.description = "\n A web-based Dashboard for your RubyNEAT development,\n http://localhost:3912\n "
16
16
  s.email = "lordalveric@yahoo.com"
17
17
  s.extra_rdoc_files = [
@@ -39,6 +39,11 @@ Gem::Specification.new do |s|
39
39
  "app/css/vendor/normalize.css",
40
40
  "app/images/RubyNEAT_Dashboard_logo_full.xcf",
41
41
  "app/images/logo.png",
42
+ "app/images/population_sprite.050.png",
43
+ "app/images/population_sprite.100.png",
44
+ "app/images/population_sprite.200.png",
45
+ "app/images/population_sprite.svg",
46
+ "app/images/rubyneat_icon.svg",
42
47
  "app/js/dashboard.coffee",
43
48
  "app/js/dashboard/controllers/critters_controller.coffee",
44
49
  "app/js/dashboard/controllers/dashboard_controller.coffee",
@@ -46,9 +51,13 @@ Gem::Specification.new do |s|
46
51
  "app/js/dashboard/controllers/overview_controller.coffee",
47
52
  "app/js/dashboard/controllers/population_controller.coffee",
48
53
  "app/js/dashboard/directives/critter_genotype_topology.coffee",
54
+ "app/js/dashboard/directives/critter_ice.coffee",
49
55
  "app/js/dashboard/directives/critter_phenotype_topology.coffee",
56
+ "app/js/dashboard/directives/critter_sandbox.coffee",
50
57
  "app/js/dashboard/directives/pie.coffee",
58
+ "app/js/dashboard/directives/population_brigade.coffee",
51
59
  "app/js/dashboard/directives/population_progress_chart.coffee",
60
+ "app/js/dashboard/directives/population_window.coffee",
52
61
  "app/js/dashboard/services/population_service.coffee",
53
62
  "bower_components/angular-animate.css/.bower.json",
54
63
  "bower_components/angular-animate.css/README.md",
@@ -1278,6 +1287,8 @@ Gem::Specification.new do |s|
1278
1287
 
1279
1288
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
1280
1289
  s.add_runtime_dependency(%q<sinatra>, ["~> 1"])
1290
+ s.add_runtime_dependency(%q<sinatra-assetpack>, [">= 0"])
1291
+ s.add_runtime_dependency(%q<sinatra-contrib>, [">= 0"])
1281
1292
  s.add_runtime_dependency(%q<thin>, [">= 0"])
1282
1293
  s.add_runtime_dependency(%q<haml>, ["~> 4"])
1283
1294
  s.add_runtime_dependency(%q<sass>, ["~> 3"])
@@ -1285,9 +1296,9 @@ Gem::Specification.new do |s|
1285
1296
  s.add_runtime_dependency(%q<json-stream>, ["~> 0"])
1286
1297
  s.add_runtime_dependency(%q<compass>, [">= 0"])
1287
1298
  s.add_runtime_dependency(%q<barista>, [">= 0"])
1288
- s.add_runtime_dependency(%q<sinatra-assetpack>, [">= 0"])
1289
1299
  s.add_runtime_dependency(%q<eventmachine>, [">= 0"])
1290
1300
  s.add_runtime_dependency(%q<queue_ding>, [">= 0"])
1301
+ s.add_runtime_dependency(%q<rubyneat>, [">= 0"])
1291
1302
  s.add_development_dependency(%q<rspec>, ["~> 2"])
1292
1303
  s.add_development_dependency(%q<yard>, ["~> 0"])
1293
1304
  s.add_development_dependency(%q<rdoc>, ["~> 3"])
@@ -1297,6 +1308,8 @@ Gem::Specification.new do |s|
1297
1308
  s.add_development_dependency(%q<semver>, ["~> 1"])
1298
1309
  else
1299
1310
  s.add_dependency(%q<sinatra>, ["~> 1"])
1311
+ s.add_dependency(%q<sinatra-assetpack>, [">= 0"])
1312
+ s.add_dependency(%q<sinatra-contrib>, [">= 0"])
1300
1313
  s.add_dependency(%q<thin>, [">= 0"])
1301
1314
  s.add_dependency(%q<haml>, ["~> 4"])
1302
1315
  s.add_dependency(%q<sass>, ["~> 3"])
@@ -1304,9 +1317,9 @@ Gem::Specification.new do |s|
1304
1317
  s.add_dependency(%q<json-stream>, ["~> 0"])
1305
1318
  s.add_dependency(%q<compass>, [">= 0"])
1306
1319
  s.add_dependency(%q<barista>, [">= 0"])
1307
- s.add_dependency(%q<sinatra-assetpack>, [">= 0"])
1308
1320
  s.add_dependency(%q<eventmachine>, [">= 0"])
1309
1321
  s.add_dependency(%q<queue_ding>, [">= 0"])
1322
+ s.add_dependency(%q<rubyneat>, [">= 0"])
1310
1323
  s.add_dependency(%q<rspec>, ["~> 2"])
1311
1324
  s.add_dependency(%q<yard>, ["~> 0"])
1312
1325
  s.add_dependency(%q<rdoc>, ["~> 3"])
@@ -1317,6 +1330,8 @@ Gem::Specification.new do |s|
1317
1330
  end
1318
1331
  else
1319
1332
  s.add_dependency(%q<sinatra>, ["~> 1"])
1333
+ s.add_dependency(%q<sinatra-assetpack>, [">= 0"])
1334
+ s.add_dependency(%q<sinatra-contrib>, [">= 0"])
1320
1335
  s.add_dependency(%q<thin>, [">= 0"])
1321
1336
  s.add_dependency(%q<haml>, ["~> 4"])
1322
1337
  s.add_dependency(%q<sass>, ["~> 3"])
@@ -1324,9 +1339,9 @@ Gem::Specification.new do |s|
1324
1339
  s.add_dependency(%q<json-stream>, ["~> 0"])
1325
1340
  s.add_dependency(%q<compass>, [">= 0"])
1326
1341
  s.add_dependency(%q<barista>, [">= 0"])
1327
- s.add_dependency(%q<sinatra-assetpack>, [">= 0"])
1328
1342
  s.add_dependency(%q<eventmachine>, [">= 0"])
1329
1343
  s.add_dependency(%q<queue_ding>, [">= 0"])
1344
+ s.add_dependency(%q<rubyneat>, [">= 0"])
1330
1345
  s.add_dependency(%q<rspec>, ["~> 2"])
1331
1346
  s.add_dependency(%q<yard>, ["~> 0"])
1332
1347
  s.add_dependency(%q<rdoc>, ["~> 3"])
data/views/overview.haml CHANGED
@@ -1,6 +1,31 @@
1
- %h1 Overview
2
-
3
- %pie(data = "[2,1,6,4]")
4
- Wheeeee!
5
-
6
-
1
+ %h3 Population Progress Overview
2
+ .pop(ng-controller = 'PopulationController' ng-init = "init()")
3
+ .charting
4
+ %population-progress-chart(labels = "['best', 'worst', 'overall']"
5
+ basis = "'generation'"
6
+ width = "900"
7
+ height = "400"
8
+ xaxis-name = "Generation"
9
+ yaxis-name = "Fitness"
10
+ tick-source = "entry"
11
+ )
12
+ .current
13
+ %h3 Realtime Status
14
+ .realtime
15
+ %table
16
+ %tr
17
+ %td generation
18
+ %td {{ entry.generation | number:0 }}
19
+ %td {{ entry.pop_name }}
20
+ %tr
21
+ %td best
22
+ %td {{ entry.best | number:4 }}
23
+ %td {{ entry.best_name }}
24
+ %tr
25
+ %td worst
26
+ %td {{ entry.worst | number:4 }}
27
+ %td {{ entry.worst_name }}
28
+ %tr
29
+ %td overall
30
+ %td {{ entry.overall | number:4 }}
31
+ %td
@@ -1,28 +1,10 @@
1
- %h1 Population Home
1
+ %h3 Population Drilldown
2
2
  .pop(ng-controller = 'PopulationController' ng-init = "init()")
3
- .charting
4
- %population-progress-chart(labels = "['best', 'worst', 'overall']"
5
- basis = "'generation'"
6
- width = "900"
7
- height = "400"
8
- xaxis-name = "Generation"
9
- yaxis-name = "Fitness"
10
- data = "entries"
11
- tick-source = "entry"
12
- )
13
- .current
14
- %h2 Realtime Status
15
- %table
16
- %tr
17
- %td generation
18
- %td {{ entry.generation }}
19
- %tr
20
- %td best
21
- %td {{ entry.best }}
22
- %tr
23
- %td worst
24
- %td {{ entry.worst }}
25
- %tr
26
- %td overall
27
- %td {{ entry.overall }}
3
+ .pop-brigade
4
+ %population-brigade(tick-source = "entry" number-of-pops = "20")
5
+ Wheeeee!
6
+ .pop-window
7
+ %population-window()
28
8
 
9
+ .pop-sandbox
10
+ %critterSandbox()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyneat_dashboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.alpha.4.pre.1
4
+ version: 0.4.0.alpha.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Mitchell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-03 00:00:00.000000000 Z
11
+ date: 2014-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra-assetpack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sinatra-contrib
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: thin
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +151,7 @@ dependencies:
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
- name: sinatra-assetpack
154
+ name: eventmachine
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
157
  - - ">="
@@ -137,7 +165,7 @@ dependencies:
137
165
  - !ruby/object:Gem::Version
138
166
  version: '0'
139
167
  - !ruby/object:Gem::Dependency
140
- name: eventmachine
168
+ name: queue_ding
141
169
  requirement: !ruby/object:Gem::Requirement
142
170
  requirements:
143
171
  - - ">="
@@ -151,7 +179,7 @@ dependencies:
151
179
  - !ruby/object:Gem::Version
152
180
  version: '0'
153
181
  - !ruby/object:Gem::Dependency
154
- name: queue_ding
182
+ name: rubyneat
155
183
  requirement: !ruby/object:Gem::Requirement
156
184
  requirements:
157
185
  - - ">="
@@ -291,6 +319,11 @@ files:
291
319
  - app/css/vendor/normalize.css
292
320
  - app/images/RubyNEAT_Dashboard_logo_full.xcf
293
321
  - app/images/logo.png
322
+ - app/images/population_sprite.050.png
323
+ - app/images/population_sprite.100.png
324
+ - app/images/population_sprite.200.png
325
+ - app/images/population_sprite.svg
326
+ - app/images/rubyneat_icon.svg
294
327
  - app/js/dashboard.coffee
295
328
  - app/js/dashboard/controllers/critters_controller.coffee
296
329
  - app/js/dashboard/controllers/dashboard_controller.coffee
@@ -298,9 +331,13 @@ files:
298
331
  - app/js/dashboard/controllers/overview_controller.coffee
299
332
  - app/js/dashboard/controllers/population_controller.coffee
300
333
  - app/js/dashboard/directives/critter_genotype_topology.coffee
334
+ - app/js/dashboard/directives/critter_ice.coffee
301
335
  - app/js/dashboard/directives/critter_phenotype_topology.coffee
336
+ - app/js/dashboard/directives/critter_sandbox.coffee
302
337
  - app/js/dashboard/directives/pie.coffee
338
+ - app/js/dashboard/directives/population_brigade.coffee
303
339
  - app/js/dashboard/directives/population_progress_chart.coffee
340
+ - app/js/dashboard/directives/population_window.coffee
304
341
  - app/js/dashboard/services/population_service.coffee
305
342
  - bower_components/angular-animate.css/.bower.json
306
343
  - bower_components/angular-animate.css/README.md