Skip to content

Commit 8b63ca8

Browse files
committed
got graph panel to load
1 parent ed89329 commit 8b63ca8

File tree

5 files changed

+48
-17
lines changed

5 files changed

+48
-17
lines changed

public/app/features/panel/panelDirective.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,38 @@ function (angular, $, config) {
1414
link: function(scope, elem, attr) {
1515
var getter = $parse(attr.type), panelType = getter(scope);
1616
var panelPath = config.panels[panelType].path;
17-
18-
scope.require([panelPath + "/module"], function () {
17+
var doneFn = function() {
1918
var panelEl = angular.element(document.createElement('grafana-panel-' + panelType));
2019
elem.append(panelEl);
21-
$compile(panelEl)(scope);
22-
});
20+
21+
scope.$apply(function() {
22+
$compile(panelEl)(scope);
23+
});
24+
};
25+
26+
switch(panelType) {
27+
case 'graph': {
28+
require.ensure([], function() {
29+
require('../../panels/graph/module');
30+
doneFn();
31+
});
32+
break;
33+
}
34+
case 'text': {
35+
require.ensure([], function() {
36+
require('../../panels/text/module');
37+
doneFn();
38+
});
39+
break;
40+
}
41+
case 'dashlist': {
42+
require.ensure([], function() {
43+
require('../../panels/text/module');
44+
doneFn();
45+
});
46+
break;
47+
}
48+
}
2349
}
2450
};
2551
});

public/app/panels/graph/legend.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
define([
22
'angular',
3-
'app',
43
'lodash',
54
'kbn',
65
'jquery',
76
'jquery.flot',
87
'jquery.flot.time',
98
],
10-
function (angular, app, _, kbn, $) {
9+
function (angular, _, kbn, $) {
1110
'use strict';
1211

13-
var module = angular.module('grafana.panels.graph');
12+
var module = angular.module('grafana.directives');
1413

1514
module.directive('graphLegend', function(popoverSrv) {
1615

public/app/panels/graph/module.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
define([
22
'angular',
3-
'app',
43
'jquery',
54
'lodash',
65
'kbn',
76
'moment',
8-
'components/timeSeries',
9-
'components/panelmeta',
7+
'../../components/timeSeries',
8+
'../../components/panelmeta',
109
'./seriesOverridesCtrl',
1110
'./graph',
1211
'./legend',
1312
],
14-
function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
13+
function (angular, $, _, kbn, moment, TimeSeries, PanelMeta) {
1514
'use strict';
1615

17-
var module = angular.module('grafana.panels.graph');
16+
var module = angular.module('grafana.controllers');
1817

1918
module.directive('grafanaPanelGraph', function() {
2019
return {

public/app/panels/graph/seriesOverridesCtrl.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
define([
22
'angular',
33
'jquery',
4-
'app',
54
'lodash',
6-
], function(angular, jquery, app, _) {
5+
], function(angular, jquery, _) {
76
'use strict';
87

9-
var module = angular.module('grafana.panels.graph', []);
10-
app.useModule(module);
8+
var module = angular.module('grafana.controllers');
9+
//app.useModule(module);
1110

1211
module.controller('SeriesOverridesCtrl', function($scope, $element, popoverSrv) {
1312
$scope.overrideMenu = [];

webpack.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var webpackConfig = {
4343
/\.d\.ts/,
4444
/\.map/,
4545
/cloudwatch/,
46-
/app\/panels/,
46+
/app\/panels\/text/,
4747
/\.json/,
4848
/moment\.js/
4949
],
@@ -81,6 +81,14 @@ var webpackConfig = {
8181
"spectrum": absDir('/vendor/spectrum.js'),
8282
"lodash-src": absDir('/vendor/lodash.js'),
8383
"bindonce": absDir('/vendor/angular-bindonce/bindonce.js'),
84+
"jquery.flot": absDir('/vendor/flot/jquery.flot.js'),
85+
"jquery.flot.crosshair": absDir('/vendor/flot/jquery.flot.crosshair.js'),
86+
"jquery.flot.events": absDir('/vendor/flot/jquery.flot.events.js'),
87+
"jquery.flot.fillbelow": absDir('/vendor/flot/jquery.flot.fillbelow.js'),
88+
"jquery.flot.selection": absDir('/vendor/flot/jquery.flot.selection.js'),
89+
"jquery.flot.stack": absDir('/vendor/flot/jquery.flot.stack.js'),
90+
"jquery.flot.stackpercent": absDir('/vendor/flot/jquery.flot.stackpercent.js'),
91+
"jquery.flot.time": absDir('/vendor/flot/jquery.flot.time.js'),
8492
},
8593
root: [
8694
__dirname + '/public_gen',

0 commit comments

Comments
 (0)