Repository: flex-examples
Updated Branches:
  refs/heads/develop c65fa0c42 -> 4f15847a8


add numcomitters and numpmc


Project: http://git-wip-us.apache.org/repos/asf/flex-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-examples/commit/2eb06d6a
Tree: http://git-wip-us.apache.org/repos/asf/flex-examples/tree/2eb06d6a
Diff: http://git-wip-us.apache.org/repos/asf/flex-examples/diff/2eb06d6a

Branch: refs/heads/develop
Commit: 2eb06d6a7814566b596fe333099b9c5d23d08301
Parents: c65fa0c
Author: Alex Harui <[email protected]>
Authored: Tue Sep 15 15:17:09 2015 -0700
Committer: Alex Harui <[email protected]>
Committed: Tue Sep 15 15:17:09 2015 -0700

----------------------------------------------------------------------
 ProductDashboard/src/MyInitialView.mxml    | 18 ++++--
 ProductDashboard/src/ProjectDashboard.mxml | 23 ++-----
 ProductDashboard/src/config.json           |  4 +-
 ProductDashboard/src/main.css              | 17 ++++-
 ProductDashboard/src/models/MyModel.as     | 83 +++++++++++++++++++------
 5 files changed, 98 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-examples/blob/2eb06d6a/ProductDashboard/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/ProductDashboard/src/MyInitialView.mxml 
b/ProductDashboard/src/MyInitialView.mxml
index 84db26a..55110fd 100644
--- a/ProductDashboard/src/MyInitialView.mxml
+++ b/ProductDashboard/src/MyInitialView.mxml
@@ -54,15 +54,21 @@ limitations under the License.
         <js:Image id="projectImage" 
source="{MyModel(applicationModel).projectIcon}" />
         <js:Label id="projectName" style="fontSize:30" 
html="{MyModel(applicationModel).projectTitle}" />
     </js:HContainer>
+    <js:HContainer width="100%">
+        <js:HContainer className="statsContainer" width="48%">
+            <js:Label id="projectCommitters" 
text="{MyModel(applicationModel).numCommitters + ' Committers    '}" />
+        </js:HContainer>
+        <js:HContainer className="statsContainer" width="48%" 
style="marginLeft:10px">
+            <js:Label id="projectPMC" text="{MyModel(applicationModel).numPMC 
+ ' Project Management Committee members'}" />
+        </js:HContainer>
+    </js:HContainer>
     <js:HContainer width="100%" height="50%">
-        <js:Panel title="{MyModel(applicationModel).devListName}" width="45%" 
height="100%">
+        <js:Panel title="{MyModel(applicationModel).devListName}" width="48%" 
height="100%">
             <js:beads>
                 <js:VerticalLayout />
             </js:beads>
 <!--            <js:Label id="committers" 
text="{MyModel(applicationModel).numDevSubscribers + ' Subscribers'}" />-->
             <js:MultilineLabel id="devFolks" width="100%" text="{'This mailing 
list is for discussing the development of ' + 
MyModel(applicationModel).projectName + '.'}" /> 
-            <!--            <js:Label id="committers" 
text="{MyModel(applicationModel).numCommitters + ' Committers, of which'}" />
-            <js:Label id="pmc" text="{MyModel(applicationModel).numPMC + ' are 
Project Management Committee members.'}" />-->
             <js:Container className="buttonAndLabel">
                 <js:beads>
                     <js:OneFlexibleChildHorizontalLayout 
flexibleChild="subLabel" />
@@ -86,7 +92,7 @@ limitations under the License.
                 <js:MultilineLabel id="sendLabel" text="May be delayed waiting 
for moderator approval if you aren't subscribed." />
             </js:Container> 
         </js:Panel>
-        <js:Panel title="{MyModel(applicationModel).usersListName}" 
width="45%" height="100%" style="marginLeft:10px">
+        <js:Panel title="{MyModel(applicationModel).usersListName}" 
width="48%" height="100%" style="marginLeft:10px">
             <js:beads>
                 <js:VerticalLayout />
             </js:beads>
@@ -117,7 +123,7 @@ limitations under the License.
         </js:Panel>
     </js:HContainer>
     <js:HContainer width="100%" height="30%" style="marginTop:10px">
-        <js:Panel title="Releases" width="45%"  height="100%">
+        <js:Panel title="Releases" width="48%"  height="100%">
             <js:beads>
                 <js:VerticalLayout />
                 <js:LayoutChangeNotifier id="lcn" 
watchedProperty="{releaseDownloadButton.visible}" />
@@ -135,7 +141,7 @@ limitations under the License.
             <js:TextButton className="releaseDownloadButton" 
id="releaseDownloadButton" text="Go to Download Page" click="dispatchEvent(new 
Event(EVENT_DOWNLOAD_PRODUCT))" 
                            visible="{MyModel(applicationModel).releases != 
null}"/>
         </js:Panel>
-        <js:Panel title="Bugs and Feature Requests" width="45%" height="100%" 
style="marginLeft:10px" >
+        <js:Panel title="Bugs and Feature Requests" width="48%" height="100%" 
style="marginLeft:10px" >
             <js:beads>
                 <js:VerticalLayout />
             </js:beads>

http://git-wip-us.apache.org/repos/asf/flex-examples/blob/2eb06d6a/ProductDashboard/src/ProjectDashboard.mxml
----------------------------------------------------------------------
diff --git a/ProductDashboard/src/ProjectDashboard.mxml 
b/ProductDashboard/src/ProjectDashboard.mxml
index 5395c40..fe40e4f 100644
--- a/ProductDashboard/src/ProjectDashboard.mxml
+++ b/ProductDashboard/src/ProjectDashboard.mxml
@@ -33,7 +33,7 @@ limitations under the License.
                 issuesService.headers = [ new HTTPHeader("accept", 
"application/json") ];
                 issuesService.contentData = JSON.stringify({ jql: "project IN 
(FLEX) AND status IN (open)" });
                 issuesService.send();
-                //githubService.send();
+                peopleService.send();
             }
             
             private function issueCountArrived():void
@@ -46,21 +46,6 @@ limitations under the License.
                 MyModel(model).numOpenIssues = data.total;
             }
                         
-            private function ghDataArrived():void
-            {
-                var results:String = githubService.data;
-                var c:int = results.indexOf("(");
-                var c2:int = results.lastIndexOf(")");
-                var data:Object = JSON.parse(results.substring(c+1, c2));
-                trace("githubArrived");
-                MyModel(model).numForks = data.data.forks;
-            }
-
-            private function archiveDataArrived():void
-            {
-                var data:Object = archiveService.json;               
-                trace("archiveArrived");
-            }
         ]]>
     </fx:Script>
     <js:valuesImpl>
@@ -70,7 +55,8 @@ limitations under the License.
         <local:MyInitialView />
     </js:initialView>
     <js:model>
-        <models:MyModel configService="{configService}" 
reporterService="{reporterService}" releaseService="{releaseService}" />
+        <models:MyModel configService="{configService}" 
reporterService="{reporterService}" 
+                        releaseService="{releaseService}" 
peopleService="{peopleService}"/>
     </js:model>
     <js:controller>
         <controllers:MyController />
@@ -83,8 +69,7 @@ limitations under the License.
         <js:HTTPService id="issuesService" 
url="{MyModel(model).issueCounterURL}" method="POST" 
                         contentType="application/json"
                         complete="issueCountArrived()" />
-        <js:HTTPService id="githubService" url="{MyModel(model).githubURL}" 
complete="ghDataArrived()" />
-        <js:HTTPService id="archiveService" url="{MyModel(model).archiveURL}" 
complete="archiveDataArrived()" />
+        <js:HTTPService id="peopleService" />
         <js:HTTPService id="releaseService" />
         <js:ViewSourceContextMenuOption />
         <js:BrowserResizeHandler minWidth="1000" minHeight="600" />

http://git-wip-us.apache.org/repos/asf/flex-examples/blob/2eb06d6a/ProductDashboard/src/config.json
----------------------------------------------------------------------
diff --git a/ProductDashboard/src/config.json b/ProductDashboard/src/config.json
index c916c1d..b3dbbb2 100644
--- a/ProductDashboard/src/config.json
+++ b/ProductDashboard/src/config.json
@@ -73,5 +73,7 @@
                   "excludes" : ["http://www.apache.org/dyn/closer.cgi";, 
"?C=N;O=D", "?C=M;O=A", "?C=S;O=A", "?C=D;O=A", "/dist/flex/", "../"]
                 }
                 ],
-  "githubURL" : "https://api.github.com/repos/apache/flex-sdk?callback=foo";  
+  "committerKey" : "flex",
+  "pmcKey" : "flex-pmc",  
+  "peopleURL" : "http://people.apache.org/committers-by-project.html";  
 }

http://git-wip-us.apache.org/repos/asf/flex-examples/blob/2eb06d6a/ProductDashboard/src/main.css
----------------------------------------------------------------------
diff --git a/ProductDashboard/src/main.css b/ProductDashboard/src/main.css
index 51a823c..9ceaf4c 100644
--- a/ProductDashboard/src/main.css
+++ b/ProductDashboard/src/main.css
@@ -52,6 +52,16 @@ global {
     height:             60px;
 }
 
+.statsContainer {
+    height:             30px;
+    border-radius: 6px;
+    border-width: 2px;
+    border: 2px solid #1abc9c;
+    padding-top: 4px;
+    padding-left: 8px;
+
+}
+
 .mailButton {
     width:             190px;
 }
@@ -89,5 +99,10 @@ global {
     right:              10px;
 }
 
+#projectCommitters {
+    vertical-align: top;
+}
 
-
+#projectPMC {
+    vertical-align: top;
+}

http://git-wip-us.apache.org/repos/asf/flex-examples/blob/2eb06d6a/ProductDashboard/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/ProductDashboard/src/models/MyModel.as 
b/ProductDashboard/src/models/MyModel.as
index e0ad511..ebbe306 100644
--- a/ProductDashboard/src/models/MyModel.as
+++ b/ProductDashboard/src/models/MyModel.as
@@ -80,6 +80,21 @@ package models
             }
         }
         
+        private var _peopleService:HTTPService;
+        
+        public function get peopleService():HTTPService
+        {
+            return _peopleService;
+        }
+        
+        public function set peopleService(value:HTTPService):void
+        {
+            if (value != _peopleService)
+            {
+                _peopleService = value;
+            }
+        }
+        
                private var _projectName:String;
                
         [Bindable("projectNameChanged")]
@@ -150,20 +165,20 @@ package models
                        }
                }
                
-               private var _githubURL:String = "";
+               private var _peopleURL:String = "";
                
-               [Bindable("githubURLChanged")]
-               public function get githubURL():String
+               [Bindable("peopleURLChanged")]
+               public function get peopleURL():String
                {
-                       return _githubURL;
+                       return _peopleURL;
                }
                
-        public function set githubURL(value:String):void
+        public function set peopleURL(value:String):void
         {
-            if (value != _githubURL)
+            if (value != _peopleURL)
             {
-                _githubURL = value;
-                dispatchEvent(new Event("githubURLChanged"));
+                _peopleURL = value;
+                dispatchEvent(new Event("peopleURLChanged"));
             }
         }
                
@@ -290,14 +305,15 @@ package models
             configData = data;
             archiveURL = data['archiveURL'];
             reporterURL = data['reporterURL'];
-            githubURL = data['githubURL'];
+            peopleURL = data['peopleURL'];
             issueCounterURL = data['issueCounterURL'];
             projectName = data['projectName'];
             projectTitle = data['projectTitle'];
             projectIcon = data['projectIcon'];
             reporterKey = data['reporterKey'];
             productList = createProducts(data['products']);
-            dispatchEvent(new Event("configChanged"));            
+            dispatchEvent(new Event("configChanged"));
+            getPeopleData();
         }
 
         private var reporterKey:String;
@@ -315,25 +331,17 @@ package models
         
         private var _numPMC:int = -1;
         
-        [Bindable("reportChanged")]
+        [Bindable("peopleChanged")]
         public function get numPMC():int
         {
-            if (_numPMC < 0)
-            {
-                _numPMC = report["count"][reporterKey][0];
-            }
             return _numPMC;
         }
 
         private var _numCommitters:int = -1;
         
-        [Bindable("reportChanged")]
+        [Bindable("peopleChanged")]
         public function get numCommitters():int
         {
-            if (_numCommitters < 0)
-            {
-                _numCommitters = report["count"][reporterKey][1];
-            }
             return _numCommitters;
         }
         
@@ -559,6 +567,41 @@ package models
             releaseService.addEventListener("complete", 
archiveCompleteHandler);
             releaseService.send();
         }
+        
+        private function getPeopleData():void
+        {
+            if (peopleURL.indexOf("http") == -1)
+                peopleService.url = peopleURL + "index.html";
+            else           
+                peopleService.url = peopleURL;
+            peopleService.addEventListener("complete", peopleCompleteHandler);
+            peopleService.send();
+        }
 
+        private function peopleCompleteHandler(event:Event):void
+        {
+            var s:String = peopleService.data;
+            var c:int = s.indexOf('id="' + configData["committerKey"] + '"');
+            var c2:int = s.indexOf("</table>", c);
+            var list:String = s.substring(c, c2);
+            c = list.indexOf("<tr");
+            _numCommitters = 0;
+            while (c != -1)
+            {
+                _numCommitters++;
+                c = list.indexOf("<tr", c + 1);
+            }
+            c = s.indexOf('id="' + configData["pmcKey"] + '"');
+            c2 = s.indexOf("</table>", c);
+            list = s.substring(c, c2);
+            c = list.indexOf("<tr");
+            _numPMC = 0;
+            while (c != -1)
+            {
+                _numPMC++;
+                c = list.indexOf("<tr", c + 1);
+            }
+            dispatchEvent(new Event("peopleChanged"));
+        }
        }
 }
\ No newline at end of file

Reply via email to