Changeset 1405
- Timestamp:
- 05/19/2008 09:54:36 PM (14 months ago)
- Location:
- examples/trunk/buildbot/flex/src
- Files:
-
- 7 modified
-
org/pyamf/examples/buildbot/BuildbotBase.as (modified) (5 diffs)
-
org/pyamf/examples/buildbot/BuildbotRPC.as (modified) (4 diffs)
-
org/pyamf/examples/buildbot/Builder.as (modified) (4 diffs)
-
org/pyamf/examples/buildbot/view/CellField.as (modified) (1 diff)
-
org/pyamf/examples/buildbot/view/Waterfall.mxml (modified) (2 diffs)
-
org/pyamf/examples/buildbot/vo/BuildDetails.as (modified) (1 diff)
-
rpc.mxml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
examples/trunk/buildbot/flex/src/org/pyamf/examples/buildbot/BuildbotBase.as
r1402 r1405 10 10 import flash.events.NetStatusEvent; 11 11 12 import mx.collections.ArrayCollection; 12 13 import mx.core.Application; 13 14 import mx.utils.URLUtil; 14 15 16 import org.pyamf.examples.buildbot.events.BuildEvent; 15 17 import org.pyamf.examples.buildbot.events.BuildbotEvent; 18 import org.pyamf.examples.buildbot.events.BuilderEvent; 16 19 17 20 [Event(name="update", type="org.pyamf.examples.buildbot.events.BuildbotEvent")] … … 19 22 20 23 /** 21 * This examples shows how to communicate with Buildbot and query the build status. 24 * This examples shows how to communicate with Buildbot and query 25 * the build status. 22 26 * 23 27 * @author Thijs Triemstra (info@collab.nl) … … 33 37 public var status:String = ""; 34 38 39 /** 40 * Setup gateway url. 41 */ 35 42 public function BuildbotBase() 36 43 { … … 64 71 } 65 72 73 protected function loadComplete( event:BuilderEvent ):void 74 { 75 var rows:ArrayCollection = new ArrayCollection(event.builder.rows); 76 var columns:Array = new Array(); 77 78 for (var d:int=0;d<_builders.length;d++) 79 { 80 columns.push(_builders[d].name); 81 } 82 dispatchEvent( new BuildbotEvent(BuildbotEvent.UPDATE, rows, columns) ); 83 } 84 85 protected function addBuilders(result:*): void 86 { 87 if (result != null) 88 { 89 for (var d:int=0;d<result.length;d++) 90 { 91 var builder:Builder = new Builder(result[d]); 92 builder.addEventListener(BuilderEvent.STATUS, getBuilderStatus); 93 builder.addEventListener(BuilderEvent.LAST_BUILDS, getLastBuilds); 94 builder.addEventListener(BuilderEvent.LOAD_COMPLETE, loadComplete); 95 builder.addEventListener(BuildEvent.BUILD_DETAILS, getBuild); 96 builder.load(); 97 98 _builders.push( builder ); 99 } 100 status = result.length + " builder(s) loaded."; 101 } 102 else 103 { 104 var columns:Array = new Array(); 105 var rows:ArrayCollection = new ArrayCollection(); 106 107 status = "No builders available."; 108 dispatchEvent( new BuildbotEvent(BuildbotEvent.UPDATE) ); 109 } 110 } 111 112 public function getBuilderStatus(event:BuilderEvent): void 113 { 114 } 115 116 public function getLastBuilds(event:BuilderEvent): void 117 { 118 } 119 120 public function getBuild(event:BuildEvent): void 121 { 122 } 123 66 124 protected function onNetstatusError(event:NetStatusEvent): void 67 125 { … … 74 132 } 75 133 134 /** 135 * Notify the user of the problem. 136 * 137 * @param error 138 */ 76 139 protected function onFault( error:* ): void 77 140 { 78 // notify the user of the problem79 141 var errorStr:String = ""; 80 142 for (var d:String in error) { -
examples/trunk/buildbot/flex/src/org/pyamf/examples/buildbot/BuildbotRPC.as
r1403 r1405 11 11 import flash.net.Responder; 12 12 13 import mx.collections.ArrayCollection; 14 15 import org.pyamf.examples.buildbot.events.*; 16 import org.pyamf.examples.buildbot.Builder; 13 import org.pyamf.examples.buildbot.events.BuildEvent; 14 import org.pyamf.examples.buildbot.events.BuilderEvent; 17 15 18 16 /** 19 * This examples shows how to communicate with the AMF gateway for Buildbot that can20 * be used to query the build status.17 * This examples shows how to communicate with the AMF gateway for 18 * Buildbot that can be used to query the build status. 21 19 * 22 20 * @author Thijs Triemstra (info@collab.nl) … … 34 32 private static const GETALLBUILDSINTERVAL:String = "buildbot.getAllBuildsInInterval"; 35 33 34 /** 35 * Create AMF connection. 36 */ 36 37 public function BuildbotRPC() 37 38 { … … 40 41 _builders = new Array(); 41 42 42 // setup connection43 43 _gateway = new NetConnection(); 44 44 _gateway.addEventListener(NetStatusEvent.NET_STATUS, onNetstatusError); … … 46 46 } 47 47 48 /** 49 * Connect to gateway and get builders. 50 * 51 * @param gatewayUrl AMF gateway of the buildbot 52 */ 48 53 public function connect(gatewayUrl:String=undefined): void 49 54 { 50 55 status = "Loading..."; 51 56 52 // Setup url53 57 if (gatewayUrl != null) { 54 58 _url = gatewayUrl; 55 59 } 56 60 57 // Connect to gateway58 61 _gateway.connect(_url); 59 62 60 // Get builders61 63 getBuilders(); 62 64 } 63 65 64 private function addBuilders(result:*): void 65 { 66 if (result != null) 67 { 68 for (var d:int=0;d<result.length;d++) 69 { 70 var builder:Builder = new Builder(result[d]); 71 builder.addEventListener(BuilderEvent.STATUS, getBuilderStatus); 72 builder.addEventListener(BuilderEvent.LAST_BUILDS, getLastBuilds); 73 builder.addEventListener(BuilderEvent.LOAD_COMPLETE, loadComplete); 74 builder.addEventListener(BuildEvent.BUILD_DETAILS, getBuild); 75 builder.load(); 76 _builders.push( builder ); 77 } 78 79 status = result.length + " builder(s) loaded."; 80 } 81 else 82 { 83 var columns:Array = new Array(); 84 var rows:ArrayCollection = new ArrayCollection(); 85 86 status = "No builder available."; 87 dispatchEvent( new BuildbotEvent(BuildbotEvent.UPDATE) ); 88 } 89 } 90 91 private function loadComplete( event:BuilderEvent ):void 92 { 93 var rows:ArrayCollection = new ArrayCollection(event.builder.builds); 94 var columns:Array = new Array(); 95 96 for (var d:int=0;d<_builders.length;d++) 97 { 98 columns.push(_builders[d].name); 99 } 100 101 dispatchEvent( new BuildbotEvent(BuildbotEvent.UPDATE, rows, columns) ); 102 } 103 66 /** 67 * Call remote service to fetch a list of all builder names. 68 */ 104 69 private function getBuilders():void 105 70 { 106 // Set responder property to the object and methods that will receive the107 // result or fault condition that the service returns.108 71 var responder:Responder = new Responder( addBuilders, onFault ); 109 72 110 // Call remote service to fetch a list of all builder names.111 73 _gateway.call( GETALLBUILDERS, responder); 112 74 } 113 75 114 private function getBuilderStatus( event:BuilderEvent ):void 76 /** 77 * Call remote service to fetch the result of the last build for the 78 * given builder. 79 * 80 * @param event 81 */ 82 override public function getBuilderStatus( event:BuilderEvent ):void 115 83 { 116 84 var builder:Builder = event.builder; 117 118 // Set responder property to the object and methods that will receive the119 // result or fault condition that the service returns.120 85 var responder:Responder = new Responder( builder.setStatus, onFault ); 121 86 122 // Call remote service to fetch the result of the last build for the given builder.123 87 _gateway.call( GETSTATUS, responder, builder.name ); 124 88 } 125 89 126 private function getLastBuilds( event:BuilderEvent ):void 90 /** 91 * Call remote service to fetch the result of the last build for the 92 * given builder. 93 * 94 * @param event 95 */ 96 override public function getLastBuilds( event:BuilderEvent ):void 127 97 { 128 98 var builder:Builder = event.builder; 129 130 // Set responder property to the object and methods that will receive the131 // result or fault condition that the service returns.132 99 var responder:Responder = new Responder( builder.addBuilds, onFault ); 133 100 134 // Call remote service to fetch the result of the last build for the given builder.135 101 _gateway.call( GETLASTBUILDS, responder, builder.name, _totalBuilds ); 136 102 } 137 103 138 private function getBuild( event:BuildEvent ):void 104 /** 105 * Call remote service to fetch information about a specific build. 106 * 107 * @param event 108 */ 109 override public function getBuild( event:BuildEvent ):void 139 110 { 140 111 var builder:Builder = event.build.builder; 141 142 // Set responder property to the object and methods that will receive the143 // result or fault condition that the service returns.144 112 var responder:Responder = new Responder( builder.setBuild, onFault ); 145 113 146 // Call remote service to fetch information about a specific build.147 114 _gateway.call( GETBUILD, responder, builder.name, event.build.number ); 148 115 } 149 116 150 // not used atm 151 private function getAllBuildsInInterval( event:BuilderEvent ):void 117 /** 118 * Call remote service to fetch a list of builds that have completed after 119 * the 'start' timestamp and before the 'stop' timestamp. This looks at 120 * all builders. 121 * 122 * Note: not being used in this app. 123 * 124 * @param event 125 */ 126 internal function getAllBuildsInInterval( event:BuilderEvent ):void 152 127 { 153 var builder:Builder = event.builder;154 128 var start:int = 1000; 155 129 var stop:int = 2000; 156 157 // Set responder property to the object and methods that will receive the 158 // result or fault condition that the service returns. 130 var builder:Builder = event.builder; 159 131 var responder:Responder = new Responder( builder.addBuilds, onFault ); 160 132 161 // Call remote service to fetch a list of builds that have completed162 // after the 'start' timestamp and before the 'stop' timestamp. This looks163 // at all builders.164 133 _gateway.call( GETALLBUILDSINTERVAL, responder, start, stop ); 165 134 } -
examples/trunk/buildbot/flex/src/org/pyamf/examples/buildbot/Builder.as
r1403 r1405 10 10 import org.pyamf.examples.buildbot.events.BuildEvent; 11 11 import org.pyamf.examples.buildbot.events.BuilderEvent; 12 import org.pyamf.examples.buildbot.vo.BuildDetails; 12 13 import org.pyamf.examples.buildbot.vo.BuildInfo; 13 import org.pyamf.examples.buildbot.vo.BuildDetails;14 14 15 15 [Event(name="status", type="org.pyamf.examples.buildbot.events.BuilderEvent")] … … 28 28 private var _lastBuildSuccess: Boolean; 29 29 private var _builds: Array = new Array(); 30 private var _rows: Array = new Array(); 30 31 private var _buildDetails: Array = new Array(); 31 32 32 33 public static const SUCCESS:String = "success"; 33 34 public static const FAILED:String = "failed"; 35 36 public function Builder(name:String="") 37 { 38 _name = name; 39 } 34 40 35 41 public function get name():String … … 43 49 } 44 50 45 public function Builder( name:String="" )51 public function get rows():Array 46 52 { 47 _name = name; 53 return _buildDetails; 54 } 55 56 public function get lastBuildSuccess():Boolean 57 { 58 return _lastBuildSuccess; 48 59 } 49 60 … … 90 101 if (_buildDetails.length == _builds.length) 91 102 { 92 //Alert.show(_builds[0].toString() + " : " + _buildDetails[0].builder_name); 103 var tmp:Array = new Array(); 104 for (var s:int=0;s<_builds.length;s++) { 105 _buildDetails[s].number = _builds[s].number; 106 _buildDetails[s].revision = _builds[s].revision; 107 } 108 93 109 loadComplete(); 94 110 } -
examples/trunk/buildbot/flex/src/org/pyamf/examples/buildbot/view/CellField.as
r1403 r1405 40 40 { 41 41 text = value[DataGridListData(listData).dataField]; 42 if (Number(text) > 100)42 if (Number(text) == 0) 43 43 { 44 44 setStyle("backgroundColor", 0xFF0000); -
examples/trunk/buildbot/flex/src/org/pyamf/examples/buildbot/view/Waterfall.mxml
r1403 r1405 4 4 <mx:Script> 5 5 <![CDATA[ 6 import mx.charts.events.ChartItemEvent; 6 7 import mx.controls.dataGridClasses.DataGridColumn; 7 8 import mx.collections.ArrayCollection; … … 23 24 } 24 25 25 dg.columns = dgColumns;26 dg.dataProvider = results;26 //dg.columns = dgColumns; 27 chart.dataProvider = results; 27 28 this.status = status; 28 29 } 30 31 private function zoomIntoSeries(e:Event):void 32 { 33 } 29 34 ]]> 30 35 </mx:Script> 31 36 32 <mx:DataGrid width="100%" height="100%" 33 horizontalScrollPolicy="on" 34 variableRowHeight="true" 35 id="dg" verticalGridLines="false" 36 horizontalGridLines="false" 37 alternatingItemColors="white"/> 38 37 <mx:SeriesSlide id="slideIn" duration="1000" direction="down"/> 38 <mx:SeriesSlide id="slideOut" duration="1000" direction="up"/> 39 40 <mx:ColumnChart id="chart" 41 showDataTips="true" width="100%" height="100%" 42 itemClick="zoomIntoSeries(event)"> 43 <mx:series> 44 <mx:ColumnSeries id="cs1" 45 displayName="Warning" 46 yField="start" 47 xField="number" 48 hideDataEffect="slideOut" 49 showDataEffect="slideIn"/> 50 51 <mx:ColumnSeries id="s2" 52 displayName="Success" 53 yField="" 54 xField="end" 55 click="zoomIntoSeries(event)" 56 /> 57 </mx:series> 58 59 <mx:verticalAxis> 60 <mx:DateTimeAxis title="Date" dataUnits="hours"/> 61 </mx:verticalAxis> 62 </mx:ColumnChart> 63 39 64 </mx:Panel> -
examples/trunk/buildbot/flex/src/org/pyamf/examples/buildbot/vo/BuildDetails.as
r1403 r1405 13 13 public class BuildDetails 14 14 { 15 [Transient] 16 public var number:int; 17 18 [Transient] 19 public var revision:int; 20 15 21 public var builder_name:String; 16 22 public var url:String; -
examples/trunk/buildbot/flex/src/rpc.mxml
r1403 r1405 17 17 private function creationComplete():void 18 18 { 19 buildbot = new BuildbotRPC();20 buildbot.totalBuilds = 10;19 buildbot = new BuildbotRPC(); 20 buildbot.totalBuilds = 20; 21 21 buildbot.addEventListener(BuildbotEvent.UPDATE, onUpdate); 22 22 buildbot.addEventListener(BuildbotEvent.ERROR, onError); 23 buildbot.connect("http:// buildbot.pyamf.org/amf");23 buildbot.connect("http://localhost:8010/amf"); 24 24 25 25 waterfall.title = "Buildbot: PyAMF";
