grafana / worldmap-panel

Worldmap panel plugin for Grafana 3.0 that can be overlaid with circles for data points.
MIT License
306 stars 200 forks source link

[Question] Adding esri-leaflet functionality to the worldmap panel #125

Open minebogy opened 6 years ago

minebogy commented 6 years ago

Greetings,

I'm trying to incorporate some esri-leaflet functionality into the worldmap panel. Set up esri-leaflet as an external library, making the proper changes to the gruntfile and runing grunt.

Everything goes well till I restart Grafana and get this error for the worldmap panel:

Cannot read property 'L' of undefined Evaluating
http://localhost:3000/public/plugins/grafana-worldmap-panel/external/esri-leaflet.js Evaluating http://localhost:3000/public/plugins/grafana-worldmap-panel/worldmap.js Evaluating http://localhost:3000/public/plugins/grafana-worldmap-panel/map_renderer.js Evaluating http://localhost:3000/public/plugins/grafana-worldmap-panel/worldmap_ctrl.js Evaluating http://localhost:3000/public/plugins/grafana-worldmap-panel/module.js Loading plugins/grafana-worldmap-panel/module

And I didn't even include any of the esri-leaflet functionality into the code.

My worlmap.js header looks like this:

import _ from 'lodash';
import L from './libs/leaflet';
import * as esri from './external/esri-leaflet';

Gruntfile just in case:

module.exports = (grunt) => {
require('load-grunt-tasks')(grunt);

grunt.loadNpmTasks('grunt-execute');
grunt.loadNpmTasks('grunt-contrib-clean');

grunt.initConfig({

clean: ['dist'],

copy: {
src_to_dist: {
cwd: 'src',
expand: true,
src: ['**/*.css', '**/*.html', '**/*.json', '!**/*.js', '!**/*.scss'],
dest: 'dist'
},
externals: {
cwd: 'src',
expand: true,
src: ['**/external/*'],
dest: 'dist'
},
pluginDef: {
expand: true,
src: [ 'README.md', 'CHANGELOG.md' ],
dest: 'dist',
},
img_to_dist: {
cwd: 'src/images',
expand: true,
flatten: true,
src: ['*.*'],
dest: 'dist/images/'
},
},

babel: {
options: {
sourceMap: true,
presets: ['es2015'],
plugins: ['transform-es2015-modules-systemjs', 'transform-es2015-for-of'],
},
dist: {
files: [{
cwd: 'src',
expand: true,
src: ['**/*.js'],
dest: 'dist',
ext: '.js'
}]
},
},

});

grunt.registerTask('default', ['copy:src_to_dist', 'copy:pluginDef', 'copy:img_to_dist', 'copy:externals', 'babel']);
};
amar0k commented 6 years ago

Fix is just to remove esri-leaflet from the src/libs folder before compiling and inserting into the dist as the standard minified version from git.