Commits

ben...@benoit.arnhem.aet  committed 46179bf Draft

Replace tabs with space and Add fetching of slaves

  • Participants
  • Parent commits e85f089

Comments (0)

Files changed (1)

 
 BuildBot.BuildersRoute = Ember.Route.extend({
     model: function() {
-	var content = [];
-	
-	$.ajax({
-	    url: server_url+'builders',
-	    dataType: 'json',
-	    success: function(data) {
-		// Turn JSON objects into bindable Ember
-		// objects.
-		for (name in data){
-		    data[name].name = name
-		    content.pushObject(BuildBot.Builder.create(data[name]));
-		}
-	    },
-	});
-	return content;
+        var content = [];
+        
+        $.ajax({
+            url: server_url+'builders',
+            dataType: 'json',
+            success: function(data) {
+                // Turn JSON objects into bindable Ember
+                // objects.
+                for (name in data){
+                    data[name].name = name
+                    content.pushObject(BuildBot.Builder.create(data[name]));
+                }
+            },
+        });
+        console.log('Builders');
+        return content;
+    }, 
+});
+
+
+BuildBot.SlavesRoute = Ember.Route.extend({
+    model: function() {
+        var content = [];
+        
+        $.ajax({
+            url: server_url+'slaves',
+            dataType: 'json',
+            success: function(data) {
+                // Turn JSON objects into bindable Ember
+                // objects.
+                for (name in data){
+                    content.pushObject(BuildBot.Slave.create(data[name]));
+                }
+            },
+        });
+        console.log('Slaves');
+        return content;
     }, 
 });
 
     name: null,
     state: null,
     isIdle: function(){
-	return this.get('state') == 'idle';
+        return this.get('state') === 'idle';
     }.property('state'),
 });
 
 });
 
 BuildBot.BuildersController = Ember.ArrayController.extend({
-
+	needs: ['slaves'],
     busyCount: function() {
-	var busys = this.filter(function(builder) {
-	    return ! builder.get('isIdle');
-	});
-	return busys.get('length');
+        var busys = this.filter(function(builder) {
+            return ! builder.get('isIdle');
+        });
+        return busys.get('length');
     }.property('content.@each'),
 });