@@ -167,72 +167,60 @@ var bootcampData = {
167167
168168var projectsData = { "All projects" : [ "awesome-devsecops" , "controlplane" , "heroes" , "raindance" , "radar" , "assumer" , "playbook" , "devsecops" , "forecast" , "firebolt" , "weatherman" , "foghorn" , "experiments" , "catv" , "science" , "aws-policies" , "ssl_checks" ] } ;
169169app . controller ( 'MainCtrl' , [ '$scope' , 'filterFilter' , '$anchorScroll' ,
170- function ( $scope , filterFilter , $anchorScroll ) {
171- var self = this ;
172- self . projects = projectsData ;
173- self . bootcamp = bootcampData ;
170+ function ( $scope , filterFilter , $anchorScroll ) {
171+ var self = this ;
172+ self . projects = projectsData ;
173+ self . bootcamp = bootcampData ;
174174
175- $ . ajax ( {
176- url : 'https://raw.githubusercontent.com/devsecops/devsecops.github.io/master/data/bootcamp .json' ,
177- dataType : 'jsonp ' ,
178- jsonpCallback : 'JSON_CALLBACK' ,
179- success : function ( data ) {
180- var projects = data [ 0 ] . Bootcamp ;
181- $scope . currentPage = 1 ; //current page
182- $scope . maxSize = 5 ; //pagination max size
183- $scope . entryLimit = 36 ; //max rows for data table
175+ $ . ajax ( {
176+ url : 'https://raw.githubusercontent.com/devsecops/devsecops.github.io/master/data/projects .json' ,
177+ dataType : 'json ' ,
178+ // jsonpCallback: 'JSON_CALLBACK',
179+ success : function ( data ) {
180+ var projects = data . AllProjects ;
181+ $scope . currentPage = 1 ; //current page
182+ $scope . maxSize = 5 ; //pagination max size
183+ $scope . entryLimit = 36 ; //max rows for data table
184184
185- /* init pagination with $scope.list */
186- $scope . noOfRepos = projects . length ;
187- $scope . noOfPages = Math . ceil ( $scope . noOfRepos / $scope . entryLimit ) ;
188- $scope . resultsSectionTitle = 'All Repos' ;
189- $scope . pageChanged = function ( ) {
190- $anchorScroll ( ) ;
191- } ;
185+ /* init pagination with $scope.list */
186+ $scope . noOfRepos = projects . length ;
187+ $scope . noOfPages = Math . ceil ( $scope . noOfRepos / $scope . entryLimit ) ;
188+ $scope . resultsSectionTitle = 'All Repos' ;
189+ $scope . pageChanged = function ( ) {
190+ $anchorScroll ( ) ;
191+ } ;
192192
193- $scope . $watch ( 'searchText' , function ( term ) {
194- // Create $scope.filtered and then calculate $scope.noOfPages, no racing!
195- $scope . filtered = filterFilter ( projects , term ) ;
196- $scope . noOfRepos = $scope . filtered . length ;
197- $scope . noOfPages = Math . ceil ( $scope . noOfRepos / $scope . entryLimit ) ;
198- $scope . resultsSectionTitle = ( ! term ) ? 'All Repos' : ( ( $scope . noOfRepos === 0 ) ? 'Search results' : ( $scope . noOfRepos + ' repositories found' ) ) ;
199- } ) ;
200-
201- var featuredProjects = new Array ( ) ;
193+ $scope . $watch ( 'searchText' , function ( term ) {
194+ // Create $scope.filtered and then calculate $scope.noOfPages, no racing!
195+ $scope . filtered = filterFilter ( projects , term ) ;
196+ $scope . noOfRepos = $scope . filtered . length ;
197+ $scope . noOfPages = Math . ceil ( $scope . noOfRepos / $scope . entryLimit ) ;
198+ $scope . resultsSectionTitle = ( ! term ) ? 'All Repos' : ( ( $scope . noOfRepos === 0 ) ? 'Search results' : ( $scope . noOfRepos + ' repositories found' ) ) ;
199+ } ) ;
202200
203- self . featured . forEach ( function ( name ) {
204- for ( var i = 0 ; i < projects . length ; i ++ ) {
205- var project = projects [ i ] ;
206- if ( project . Name == name ) {
207- featuredProjects . push ( project ) ;
208- return ;
201+ self . projects = projects ;
202+ self . featuredProjects = featuredProjects ;
203+ $scope . $apply ( ) ;
204+ }
205+ } ) ;
206+ $ . ajax ( {
207+ url : 'https://popularrepostg.blob.core.windows.net/popularrepos/projectssummary.json' ,
208+ dataType : 'jsonp' ,
209+ jsonpCallback : 'JSON_CALLBACK' ,
210+ success : function ( stats ) {
211+ if ( stats !== null ) {
212+ $scope . overAllStats = stats [ 0 ] ;
209213 }
210214 }
211215 } ) ;
212-
213- self . projects = projects ;
214- self . featuredProjects = featuredProjects ;
215- $scope . $apply ( ) ;
216216 }
217- } ) ;
218- $ . ajax ( {
219- url : 'https://popularrepostg.blob.core.windows.net/popularrepos/projectssummary.json' ,
220- dataType : 'jsonp' ,
221- jsonpCallback : 'JSON_CALLBACK' ,
222- success : function ( stats ) {
223- if ( stats !== null ) {
224- $scope . overAllStats = stats [ 0 ] ;
217+ ] )
218+ . filter ( 'startFrom' , function ( ) {
219+ return function ( input , start ) {
220+ if ( input ) {
221+ start = + start ; //parse to int
222+ return input . slice ( start ) ;
225223 }
226- }
224+ return [ ] ;
225+ } ;
227226 } ) ;
228- }
229- ] )
230- . filter ( 'startFrom' , function ( ) {
231- return function ( input , start ) {
232- if ( input ) {
233- start = + start ; //parse to int
234- return input . slice ( start ) ;
235- }
236- return [ ] ;
237- } ;
238- } ) ;
0 commit comments