@@ -26,6 +26,7 @@ import cx from 'classnames';
2626import Levenshtein from 'levenshtein' ;
2727import mousetrap from 'mousetrap' ;
2828import assign from 'object-assign' ;
29+ import NProgress from 'nprogress' ;
2930
3031import UnitAPI from 'api/UnitAPI' ;
3132import cookie from 'utils/cookie' ;
@@ -51,6 +52,10 @@ import ReactEditor from './index';
5152// be the actual entry point, entirely superseding the `app` module.
5253PTL . reactEditor = ReactEditor ;
5354
55+ NProgress . configure ( {
56+ parent : '#body' ,
57+ showSpinner : false ,
58+ } ) ;
5459
5560const CTX_STEP = 1 ;
5661
@@ -135,7 +140,6 @@ PTL.editor = {
135140
136141 /* Cached elements */
137142 this . backToBrowserEl = q ( '.js-back-to-browser' ) ;
138- this . $editorActivity = $ ( '#js-editor-act' ) ;
139143 this . $editorBody = $ ( '.js-editor-body' ) ;
140144 this . editorTableEl = q ( '.js-editor-table' ) ;
141145 this . $filterStatus = $ ( '#js-filter-status' ) ;
@@ -166,8 +170,8 @@ PTL.editor = {
166170
167171 this . isUnitDirty = false ;
168172
169- this . isLoading = true ;
170173 this . showActivity ( ) ;
174+ this . isLoading = true ;
171175
172176 this . fetchingOffsets = [ ] ;
173177
@@ -405,9 +409,7 @@ PTL.editor = {
405409 return ;
406410 }
407411
408- this . delayedActivityTimer = setTimeout ( ( ) => {
409- this . showActivity ( ) ;
410- } , 3000 ) ;
412+ this . showActivity ( ) ;
411413 } ) ;
412414 $ ( document ) . ajaxStop ( ( ) => {
413415 clearTimeout ( this . delayedActivityTimer ) ;
@@ -642,7 +644,6 @@ PTL.editor = {
642644 this . isUnitDirty = false ;
643645 this . keepState = false ;
644646 this . isLoading = false ;
645- this . hideActivity ( ) ;
646647 } ,
647648
648649 /* Things to do when no results are returned */
@@ -1028,11 +1029,18 @@ PTL.editor = {
10281029
10291030 showActivity ( ) {
10301031 this . hideMsg ( ) ;
1031- this . $editorActivity . spin ( ) . fadeIn ( 300 ) ;
1032+ if ( this . isLoading ) {
1033+ return ;
1034+ }
1035+ clearTimeout ( this . delayedActivityTimer ) ;
1036+ this . delayedActivityTimer = setTimeout ( ( ) => NProgress . start ( ) , 3000 ) ;
10321037 } ,
10331038
10341039 hideActivity ( ) {
1035- this . $editorActivity . spin ( false ) . fadeOut ( 300 ) ;
1040+ if ( ! this . isLoading ) {
1041+ clearTimeout ( this . delayedActivityTimer ) ;
1042+ NProgress . done ( ) ;
1043+ }
10361044 } ,
10371045
10381046 /* Displays an informative message */
0 commit comments