mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
plugibs: expose more to plugins
This commit is contained in:
parent
a365719d3f
commit
4c4564b138
@ -77,7 +77,6 @@
|
||||
"postcss-reporter": "^5.0.0",
|
||||
"prettier": "1.7.3",
|
||||
"react-test-renderer": "^16.0.0",
|
||||
"rxjs": "^5.4.3",
|
||||
"sass-lint": "^1.10.2",
|
||||
"sass-loader": "^6.0.6",
|
||||
"sinon": "1.17.6",
|
||||
@ -119,6 +118,7 @@
|
||||
"mousetrap": "^1.6.0",
|
||||
"ngreact": "^0.4.1",
|
||||
"react": "^16.0.0",
|
||||
"rxjs": "^5.4.3",
|
||||
"react-dom": "^16.0.0",
|
||||
"remarkable": "^1.7.1",
|
||||
"tether": "^1.4.0",
|
||||
|
@ -1,5 +1,3 @@
|
||||
///<reference path="../../headers/common.d.ts" />
|
||||
|
||||
import _ from 'lodash';
|
||||
import config from 'app/core/config';
|
||||
|
||||
|
47
public/app/features/plugins/buit_in_plugins.ts
Normal file
47
public/app/features/plugins/buit_in_plugins.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import * as graphitePlugin from 'app/plugins/datasource/graphite/module';
|
||||
import * as cloudwatchPlugin from 'app/plugins/datasource/cloudwatch/module';
|
||||
import * as elasticsearchPlugin from 'app/plugins/datasource/elasticsearch/module';
|
||||
import * as opentsdbPlugin from 'app/plugins/datasource/opentsdb/module';
|
||||
import * as grafanaPlugin from 'app/plugins/datasource/grafana/module';
|
||||
import * as influxdbPlugin from 'app/plugins/datasource/influxdb/module';
|
||||
import * as mixedPlugin from 'app/plugins/datasource/mixed/module';
|
||||
import * as mysqlPlugin from 'app/plugins/datasource/mysql/module';
|
||||
import * as prometheusPlugin from 'app/plugins/datasource/prometheus/module';
|
||||
|
||||
import * as textPanel from 'app/plugins/panel/text/module';
|
||||
import * as graphPanel from 'app/plugins/panel/graph/module';
|
||||
import * as dashListPanel from 'app/plugins/panel/dashlist/module';
|
||||
import * as pluginsListPanel from 'app/plugins/panel/pluginlist/module';
|
||||
import * as alertListPanel from 'app/plugins/panel/alertlist/module';
|
||||
import * as heatmapPanel from 'app/plugins/panel/heatmap/module';
|
||||
import * as tablePanel from 'app/plugins/panel/table/module';
|
||||
import * as singlestatPanel from 'app/plugins/panel/singlestat/module';
|
||||
import * as gettingStartedPanel from 'app/plugins/panel/gettingstarted/module';
|
||||
import * as testDataAppPlugin from 'app/plugins/app/testdata/module';
|
||||
import * as testDataDSPlugin from 'app/plugins/app/testdata/datasource/module';
|
||||
|
||||
const builtInPlugins = {
|
||||
"app/plugins/datasource/graphite/module": graphitePlugin,
|
||||
"app/plugins/datasource/cloudwatch/module": cloudwatchPlugin,
|
||||
"app/plugins/datasource/elasticsearch/module": elasticsearchPlugin,
|
||||
"app/plugins/datasource/opentsdb/module": opentsdbPlugin,
|
||||
"app/plugins/datasource/grafana/module": grafanaPlugin,
|
||||
"app/plugins/datasource/influxdb/module": influxdbPlugin,
|
||||
"app/plugins/datasource/mixed/module": mixedPlugin,
|
||||
"app/plugins/datasource/mysql/module": mysqlPlugin,
|
||||
"app/plugins/datasource/prometheus/module": prometheusPlugin,
|
||||
"app/plugins/app/testdata/module": testDataAppPlugin,
|
||||
"app/plugins/app/testdata/datasource/module": testDataDSPlugin,
|
||||
|
||||
"app/plugins/panel/text/module": textPanel,
|
||||
"app/plugins/panel/graph/module": graphPanel,
|
||||
"app/plugins/panel/dashlist/module": dashListPanel,
|
||||
"app/plugins/panel/pluginlist/module": pluginsListPanel,
|
||||
"app/plugins/panel/alertlist/module": alertListPanel,
|
||||
"app/plugins/panel/heatmap/module": heatmapPanel,
|
||||
"app/plugins/panel/table/module": tablePanel,
|
||||
"app/plugins/panel/singlestat/module": singlestatPanel,
|
||||
"app/plugins/panel/gettingstarted/module": gettingStartedPanel,
|
||||
};
|
||||
|
||||
export default builtInPlugins;
|
@ -7,53 +7,11 @@ import angular from 'angular';
|
||||
import jquery from 'jquery';
|
||||
import config from 'app/core/config';
|
||||
import TimeSeries from 'app/core/time_series2';
|
||||
import TableModel from 'app/core/table_model';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Subject} from 'rxjs/Subject';
|
||||
import * as datemath from 'app/core/utils/datemath';
|
||||
|
||||
import * as graphitePlugin from 'app/plugins/datasource/graphite/module';
|
||||
import * as cloudwatchPlugin from 'app/plugins/datasource/cloudwatch/module';
|
||||
import * as elasticsearchPlugin from 'app/plugins/datasource/elasticsearch/module';
|
||||
import * as opentsdbPlugin from 'app/plugins/datasource/opentsdb/module';
|
||||
import * as grafanaPlugin from 'app/plugins/datasource/grafana/module';
|
||||
import * as influxdbPlugin from 'app/plugins/datasource/influxdb/module';
|
||||
import * as mixedPlugin from 'app/plugins/datasource/mixed/module';
|
||||
import * as mysqlPlugin from 'app/plugins/datasource/mysql/module';
|
||||
import * as prometheusPlugin from 'app/plugins/datasource/prometheus/module';
|
||||
|
||||
import * as textPanel from 'app/plugins/panel/text/module';
|
||||
import * as graphPanel from 'app/plugins/panel/graph/module';
|
||||
import * as dashListPanel from 'app/plugins/panel/dashlist/module';
|
||||
import * as pluginsListPanel from 'app/plugins/panel/pluginlist/module';
|
||||
import * as alertListPanel from 'app/plugins/panel/alertlist/module';
|
||||
import * as heatmapPanel from 'app/plugins/panel/heatmap/module';
|
||||
import * as tablePanel from 'app/plugins/panel/table/module';
|
||||
import * as singlestatPanel from 'app/plugins/panel/singlestat/module';
|
||||
import * as gettingStartedPanel from 'app/plugins/panel/gettingstarted/module';
|
||||
import * as testDataAppPlugin from 'app/plugins/app/testdata/module';
|
||||
import * as testDataDSPlugin from 'app/plugins/app/testdata/datasource/module';
|
||||
|
||||
let builtInPlugins = {
|
||||
"app/plugins/datasource/graphite/module": graphitePlugin,
|
||||
"app/plugins/datasource/cloudwatch/module": cloudwatchPlugin,
|
||||
"app/plugins/datasource/elasticsearch/module": elasticsearchPlugin,
|
||||
"app/plugins/datasource/opentsdb/module": opentsdbPlugin,
|
||||
"app/plugins/datasource/grafana/module": grafanaPlugin,
|
||||
"app/plugins/datasource/influxdb/module": influxdbPlugin,
|
||||
"app/plugins/datasource/mixed/module": mixedPlugin,
|
||||
"app/plugins/datasource/mysql/module": mysqlPlugin,
|
||||
"app/plugins/datasource/prometheus/module": prometheusPlugin,
|
||||
"app/plugins/app/testdata/module": testDataAppPlugin,
|
||||
"app/plugins/app/testdata/datasource/module": testDataDSPlugin,
|
||||
|
||||
"app/plugins/panel/text/module": textPanel,
|
||||
"app/plugins/panel/graph/module": graphPanel,
|
||||
"app/plugins/panel/dashlist/module": dashListPanel,
|
||||
"app/plugins/panel/pluginlist/module": pluginsListPanel,
|
||||
"app/plugins/panel/alertlist/module": alertListPanel,
|
||||
"app/plugins/panel/heatmap/module": heatmapPanel,
|
||||
"app/plugins/panel/table/module": tablePanel,
|
||||
"app/plugins/panel/singlestat/module": singlestatPanel,
|
||||
"app/plugins/panel/gettingstarted/module": gettingStartedPanel,
|
||||
};
|
||||
import builtInPlugins from './buit_in_plugins';
|
||||
|
||||
System.config({
|
||||
baseURL: 'public',
|
||||
@ -89,12 +47,16 @@ exposeToPlugin('lodash', _);
|
||||
exposeToPlugin('moment', moment);
|
||||
exposeToPlugin('jquery', jquery);
|
||||
exposeToPlugin('angular', angular);
|
||||
exposeToPlugin('rxjs/Subject', Subject);
|
||||
exposeToPlugin('rxjs/Observable', Observable);
|
||||
|
||||
exposeToPlugin('app/plugins/sdk', sdk);
|
||||
exposeToPlugin('app/core/utils/datemath', datemath);
|
||||
exposeToPlugin('app/core/utils/kbn', kbn);
|
||||
exposeToPlugin('app/core/config', config);
|
||||
exposeToPlugin('app/core/time_series', TimeSeries);
|
||||
exposeToPlugin('app/core/time_series2', TimeSeries);
|
||||
exposeToPlugin('app/core/table_model', TableModel);
|
||||
|
||||
import 'vendor/flot/jquery.flot';
|
||||
import 'vendor/flot/jquery.flot.selection';
|
||||
@ -107,7 +69,7 @@ import 'vendor/flot/jquery.flot.crosshair';
|
||||
import 'vendor/flot/jquery.flot.dashes';
|
||||
|
||||
for (let flotDep of ['jquery.flot', 'jquery.flot.pie', 'jquery.flot.time']) {
|
||||
System.registerDynamic(flotDep, [], true, function(require, exports, module) { module.exports = {fakeDep: 1}; });
|
||||
exposeToPlugin(flotDep, {fakeDep: 1});
|
||||
}
|
||||
|
||||
export function importPluginModule(path: string): Promise<any> {
|
||||
|
14
scripts/webpack/dependencies.js
Normal file
14
scripts/webpack/dependencies.js
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
const pkg = require('../../package.json');
|
||||
const _ = require('lodash');
|
||||
|
||||
let dependencies = Object.keys(pkg.dependencies);
|
||||
// remove jquery so we can add it first
|
||||
// remove rxjs so we can only depend on parts of it in code
|
||||
_.pull(dependencies, 'jquery', 'rxjs')
|
||||
|
||||
// add jquery first
|
||||
dependencies.unshift('jquery');
|
||||
|
||||
module.exports = dependencies;
|
@ -8,16 +8,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
const WebpackCleanupPlugin = require('webpack-cleanup-plugin');
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
const pkg = require('../../package.json');
|
||||
const _ = require('lodash');
|
||||
|
||||
let dependencies = Object.keys(pkg.dependencies);
|
||||
// remove jquery
|
||||
dependencies = _.filter(dependencies, function(key) {
|
||||
return key !== 'jquery';
|
||||
});
|
||||
// add it first
|
||||
dependencies.unshift('jquery');
|
||||
|
||||
module.exports = merge(common, {
|
||||
devtool: "source-map",
|
||||
@ -25,7 +15,7 @@ module.exports = merge(common, {
|
||||
entry: {
|
||||
dark: './public/sass/grafana.dark.scss',
|
||||
light: './public/sass/grafana.light.scss',
|
||||
vendor: dependencies,
|
||||
vendor: require('./dependencies'),
|
||||
},
|
||||
|
||||
module: {
|
||||
@ -55,8 +45,8 @@ module.exports = merge(common, {
|
||||
names: ['vendor', 'manifest'],
|
||||
}),
|
||||
new WebpackCleanupPlugin(),
|
||||
// new BundleAnalyzerPlugin({
|
||||
// analyzerPort: 8889
|
||||
// })
|
||||
new BundleAnalyzerPlugin({
|
||||
analyzerPort: 8889
|
||||
})
|
||||
]
|
||||
});
|
||||
|
@ -8,8 +8,6 @@ const path = require('path');
|
||||
const ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
const pkg = require('../../package.json');
|
||||
let dependencies = Object.keys(pkg.dependencies);
|
||||
|
||||
module.exports = merge(common, {
|
||||
devtool: "source-map",
|
||||
@ -17,7 +15,7 @@ module.exports = merge(common, {
|
||||
entry: {
|
||||
dark: './public/sass/grafana.dark.scss',
|
||||
light: './public/sass/grafana.light.scss',
|
||||
vendor: dependencies,
|
||||
vendor: require('./dependencies'),
|
||||
},
|
||||
|
||||
module: {
|
||||
|
Loading…
Reference in New Issue
Block a user