@@ -97,6 +97,8 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
97
97
chrome : WorldmapChrome ;
98
98
errors : ErrorManager ;
99
99
100
+ initializing : boolean ;
101
+
100
102
/** @ngInject **/
101
103
constructor ( $scope , $injector , $element , $document , contextSrv , templateSrv , $location ) {
102
104
super ( $scope , $injector ) ;
@@ -105,6 +107,8 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
105
107
this . $document = $document ;
106
108
this . contextSrv = contextSrv ;
107
109
110
+ this . initializing = true ;
111
+
108
112
this . errors = new ErrorManager ( ) ;
109
113
this . errors . registerDomains ( 'data' , 'location' ) ;
110
114
@@ -236,17 +240,17 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
236
240
/*
237
241
* Conditionally refresh the plugin, but not if it's still loading.
238
242
*/
239
- const loading = this . loading != false ;
240
- console . log ( 'Still loading:' , loading ) ;
241
- if ( ! loading ) {
243
+ console . log ( 'Still initializing:' , this . initializing ) ;
244
+ if ( ! this . initializing ) {
242
245
this . refresh ( ) ;
243
246
}
244
247
}
245
248
246
249
onRefresh ( ) {
247
- console . info ( 'Refreshing panel' ) ;
250
+ console . info ( 'Refreshing panel. initializing=' , this . initializing ) ;
248
251
this . errors . reset ( 'data' ) ;
249
- if ( _ . isEmpty ( this . locations ) && _ . isEmpty ( this . panel . snapshotLocationData ) ) {
252
+
253
+ if ( ! this . loading && ! this . initializing && ( _ . isEmpty ( this . locations ) && _ . isEmpty ( this . panel . snapshotLocationData ) ) ) {
250
254
this . loadLocationData ( true ) ;
251
255
}
252
256
}
@@ -264,6 +268,9 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
264
268
265
269
console . info ( 'Data received:' , dataList ) ;
266
270
271
+ // Is this the right place to indicate the plugin has been initialized?
272
+ this . initializing = false ;
273
+
267
274
try {
268
275
this . processData ( dataList ) ;
269
276
0 commit comments