Skip to content

Commit

Permalink
fixes initial render failure, and adds more debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
samhatchett committed Nov 7, 2017
1 parent 5ee83ae commit b8aeaac
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 8 deletions.
12 changes: 10 additions & 2 deletions dist/geoloop_ctrl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/geoloop_ctrl.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/map_renderer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/map_renderer.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions src/geoloop_ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export default class GeoLoopCtrl extends MetricsPanelCtrl {
constructor($scope, $injector, contextSrv) {
super($scope, $injector);

console.log('initializing geoloop control');

this.dataCharacteristics = {};

this.opts = {
Expand Down Expand Up @@ -124,6 +126,7 @@ export default class GeoLoopCtrl extends MetricsPanelCtrl {
_.defaults(this.panel, panelDefaults.colorRamp);
_.defaults(this.panel, panelDefaults.sizeRamp);
_.defaults(this.panel, panelDefaults.geo);

this.setMapProviderOpts();

this.dataFormatter = new DataFormatter(this, kbn);
Expand All @@ -133,7 +136,8 @@ export default class GeoLoopCtrl extends MetricsPanelCtrl {
this.events.on('panel-teardown', this.onPanelTeardown.bind(this));
this.events.on('data-snapshot-load', this.onDataSnapshotLoad.bind(this));

this.loadGeo();
console.log('control constructor loading geo:');
this.loadGeo(true);
this.lonLatStr = this.panel.mapCenterLongitude + ',' + this.panel.mapCenterLatitude;

//$scope.$root.onAppEvent('show-dash-editor', this.doMapResize());
Expand Down Expand Up @@ -280,6 +284,7 @@ export default class GeoLoopCtrl extends MetricsPanelCtrl {
}

updateGeoDataFeatures() {
console.log('updating geo features');
if (!this.geo || !this.geo.features) {
console.log('no geo or no features');
return;
Expand All @@ -288,7 +293,10 @@ export default class GeoLoopCtrl extends MetricsPanelCtrl {
// console.log('geojson source found. removing...');
this.map.map.removeSource('geo');
}

if (!this.dataCharacteristics || !this.dataCharacteristics.timeValues) {
console.log('no data yet...');
return;
}
// clear timeseries data from geojson data
this.dataCharacteristics.timeValues.forEach((tv) => {
this.geo.features.forEach((feature) => {
Expand Down Expand Up @@ -374,6 +382,7 @@ export default class GeoLoopCtrl extends MetricsPanelCtrl {
link(scope, elem, attrs, ctrl) {
mapRenderer(scope, elem, attrs, ctrl);
}

}

GeoLoopCtrl.templateUrl = 'module.html';
3 changes: 2 additions & 1 deletion src/map_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import GeoLoop from './geoloop';

export default function link(scope, elem, attrs, ctrl) {
const mapContainer = elem.find('.mapcontainer');
// console.log('found: ', mapContainer);
console.log('initialized map renderer');

ctrl.events.on('render', () => {
render();
Expand All @@ -15,6 +15,7 @@ export default function link(scope, elem, attrs, ctrl) {
});

function render() {
console.log("called into RENDER");
if (!ctrl.map) {
// console.log('creating new map');
ctrl.map = new GeoLoop(ctrl, mapContainer[0]);
Expand Down

0 comments on commit b8aeaac

Please sign in to comment.