File tree Expand file tree Collapse file tree 3 files changed +28
-18
lines changed Expand file tree Collapse file tree 3 files changed +28
-18
lines changed Original file line number Diff line number Diff line change 5050
5151 initialize : function ( options ) {
5252
53- // model initialization:
54- this . model . fetch ( {
55- error :function ( m , r , o ) {
56- console . error ( "Failed to fetch the ingestion scenarios!" ) ;
57- console . error ( m ) ;
58- console . error ( r ) ;
59- console . error ( o ) ;
60- }
61- } ) ;
62-
6353 // register events the component is listenning to:
6454 this . listenTo ( Communicator . mediator , "dialog:open:ingestionAdminT5" , this . onIngestionAdminOpen ) ;
6555 this . listenTo ( Communicator . mediator , "dialog:close:ingestionAdminT5" , this . onIngestionAdminClose ) ;
Original file line number Diff line number Diff line change 1616 config_src . ingestionEngineT5 . listScenario ;
1717 var IngestionAdminT5Model = Backbone . Model . extend (
1818 {
19+ failure : false ,
1920 url : url_src ,
2021 ToI :{ } , // Time of Interest
2122 AoI :[ ] , // Area of Interest
22- scenarios : [ ] // Defined Scenarios
23+ scenarios : null // Defined Scenarios
2324 }
2425 ) ;
2526
Original file line number Diff line number Diff line change 6161 is_showing : false ,
6262 change_pending : false ,
6363
64+ fetch_model : function ( ) {
65+ var that = this ;
66+ this . model . fetch ( {
67+ suppressErrors : that . model . get ( 'failure' ) ,
68+ error : function ( ) {
69+ that . model . set ( {
70+ 'failure' : true ,
71+ 'scenarios' : null
72+ } ) ;
73+ } ,
74+ success : function ( ) {
75+ that . model . set ( { 'failure' : false } ) ;
76+ }
77+ } ) ;
78+ } ,
79+
6480 get_scenario_st : function ( that , sc_id , ncn_id ) {
6581 var scenarios = that . model . get ( 'scenarios' ) ;
6682 for ( var i = 0 ; i < scenarios . length ; i ++ )
151167 alertMessage = "No ingestion scenario defined. Create a new one by clicking on the Create Scenario button below." ;
152168 }
153169 } else {
154- alertMessage = "Failed to fetch scenarios from the Ingestion Engine!" ;
170+ if ( that . model . get ( 'failure' ) ) {
171+ alertMessage = "Failed to fetch scenarios from the Ingestion Engine!" ;
172+ } else {
173+ alertMessage = "Fetching the scenarios ..." ;
174+ }
155175 }
156176
157177 that . $ ( '#ingestion-alert' ) . html ( alertMessage ) ;
219239 console . log ( 'IngAdmT5: ' + ncn_id + ' ajax ' + op + ' ' + errorThrown ) ;
220240 } , this ) ) ;
221241
222- var idel ;
223- idel = setInterval ( _ . bind ( function ( ) {
242+ var idel = setInterval ( _ . bind ( function ( ) {
224243 if ( this . change_pending ) {
225- this . model . fetch ( ) ;
244+ this . fetch_model ( ) ;
226245 } else {
227246 clearInterval ( idel ) ;
228247 }
252271
253272 this . $ ( '#ingestion-alert' ) . html ( "Loading scenarios from the Ingestion Engine ..." ) ;
254273
255- this . updater . i = setInterval ( _ . bind ( function ( ) { this . model . fetch ( ) ; } , this ) , 2250 ) ;
274+ this . updater . i = setInterval ( _ . bind ( function ( ) { this . fetch_model ( ) ; } , this ) , 2250 ) ;
256275
257276 this . $el . draggable (
258277 {
378397
379398 onTest : function ( )
380399 {
381- this . model . fetch ( ) ;
400+ this . fetch_model ( ) ;
382401
383402 this . updater . i = setInterval ( _ . bind ( function ( ) {
384- this . model . fetch ( ) ;
403+ this . fetch_model ( ) ;
385404 } ,
386405 this ) ,
387406 1250 ) ;
You can’t perform that action at this time.
0 commit comments