@@ -173,11 +173,11 @@ function processUserConnections(user)
173173{
174174 return new Promise ( function ( resolve , reject )
175175 {
176-
177176 processConnections ( user , API_FOLLOWING , 1 ) . then ( function ( )
178177 {
179178 processConnections ( user , API_FOLLOWERS , 1 ) . then ( function ( )
180179 {
180+ updateProgress ( ) ;
181181 resolve ( ) ;
182182 } )
183183 } )
@@ -213,26 +213,6 @@ function createConnections()
213213}
214214
215215
216- var total = 1 ;
217- var indexed = 0 ;
218- var progressID ;
219-
220-
221- function updateProgress ( )
222- {
223- indexed ++ ;
224-
225- var percent = parseInt ( ( indexed / total ) * 100 ) ;
226-
227- $ ( "#" + progressID ) . html ( "<div class=\"progress\">\n" +
228- " <div class=\"progress-bar progress-bar-striped progress-bar-animated\" role=\"progressbar\" style=\"width: " + percent + "%\" aria-valuenow=\"" + percent + "\" aria-valuemin=\"0\" aria-valuemax=\"100\"></div>\n" +
229- "</div>" ) ;
230-
231- console . log ( ) ;
232- }
233-
234-
235-
236216function bringUpProfileView ( id )
237217{
238218 for ( var i = 0 ; i < nodes . length ; i ++ )
@@ -285,6 +265,7 @@ function addOrgUsers(orgname, page)
285265 }
286266 else
287267 {
268+ total = 2 * ( data . length + ( page * 30 ) ) ;
288269 resolve ( ) ;
289270 }
290271
@@ -307,6 +288,23 @@ function bringUpProfileView(id)
307288 }
308289}
309290
291+
292+ var total = 1 ;
293+ var indexed = 0 ;
294+
295+ function updateProgress ( )
296+ {
297+ indexed ++ ;
298+
299+ var percent = parseInt ( ( indexed / total ) * 100 ) ;
300+
301+ $ ( "#graphLoading" ) . html ( "<div class=\"progress\">\n" +
302+ " <div class=\"progress-bar progress-bar-striped progress-bar-animated\" role=\"progressbar\" style=\"width: " + percent + "%\" aria-valuenow=\"" + percent + "\" aria-valuemin=\"0\" aria-valuemax=\"100\"></div>\n" +
303+ "</div>" ) ;
304+
305+ console . log ( ) ;
306+ }
307+
310308/**
311309 * Creates a graph
312310 * @param username
@@ -322,7 +320,6 @@ function createOrgRepoGraph(orgname, containerName, graphsTitle)
322320
323321 addOrgUsers ( orgname , 1 ) . then ( function ( )
324322 {
325- $ ( "#" + progressID ) . html ( "" ) ;
326323
327324 createConnections ( ) . then ( ( ) => {
328325 var container = document . getElementById ( containerName ) ;
@@ -331,13 +328,14 @@ function createOrgRepoGraph(orgname, containerName, graphsTitle)
331328 edges : edges
332329 } ;
333330 var network = new vis . Network ( container , data , options ) ;
334-
335331 network . on ( "click" , function ( params ) {
336332 params . event = "[original event]" ;
337333 if ( Number ( this . getNodeAt ( params . pointer . DOM ) ) !== NaN ) {
338334 bringUpProfileView ( Number ( this . getNodeAt ( params . pointer . DOM ) ) ) ;
339335 }
340336 } ) ;
337+
338+ $ ( "#graphLoading" ) . html ( "" ) ;
341339 } ) ;
342340 } ) . catch ( function ( error ) {
343341 alert ( "Invalid Organization" ) ;
0 commit comments