Skip to content

Commit d3495ff

Browse files
committed
allow loading of panels and dashboards from subfolders
every . in their name is mapped to a /
1 parent 2b9a8a0 commit d3495ff

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

src/app/controllers/dash.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function (angular, config, _) {
7070

7171
$scope.edit_path = function(type) {
7272
if(type) {
73-
return 'app/panels/'+type+'/editor.html';
73+
return 'app/panels/'+type.replace(".","/")+'/editor.html';
7474
} else {
7575
return false;
7676
}

src/app/directives/addPanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function (angular, app, _) {
1717
$scope.reset_panel(_type);
1818
if(!_.isUndefined($scope.panel.type)) {
1919
$scope.panel.loadingEditor = true;
20-
$scope.require(['panels/'+$scope.panel.type+'/module'], function () {
20+
$scope.require(['panels/'+$scope.panel.type.replace(".","/") +'/module'], function () {
2121
var template = '<div ng-controller="'+$scope.panel.type+'" ng-include="\'app/partials/paneladd.html\'"></div>';
2222
elem.html($compile(angular.element(template))($scope));
2323
$scope.panel.loadingEditor = false;

src/app/directives/kibanaPanel.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ function (angular) {
7575
$scope.$watch(attr.type, function (name) {
7676
elem.addClass("ng-cloak");
7777
// load the panels module file, then render it in the dom.
78+
var nameAsPath = name.replace(".", "/");
7879
$scope.require([
7980
'jquery',
80-
'text!panels/'+name+'/module.html'
81+
'text!panels/'+nameAsPath+'/module.html'
8182
], function ($, moduleTemplate) {
8283
var $module = $(moduleTemplate);
8384
// top level controllers
@@ -88,7 +89,7 @@ function (angular) {
8889
if ($controllers.length) {
8990
$controllers.first().prepend(editorTemplate);
9091
$scope.require([
91-
'panels/'+name+'/module'
92+
'panels/'+nameAsPath+'/module'
9293
], function() {
9394
loadModule($module);
9495
});

src/app/directives/kibanaSimplePanel.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ function (angular, _) {
3232
function loadController(name) {
3333
elem.addClass("ng-cloak");
3434
// load the panels module file, then render it in the dom.
35-
35+
var nameAsPath = name.replace(".", "/");
3636
$scope.require([
3737
'jquery',
38-
'text!panels/'+name+'/module.html'
38+
'text!panels/'+nameAsPath+'/module.html'
3939
], function ($, moduleTemplate) {
4040
var $module = $(moduleTemplate);
4141
// top level controllers
@@ -46,7 +46,7 @@ function (angular, _) {
4646
if ($controllers.length) {
4747
$controllers.first().prepend(panelLoading);
4848
$scope.require([
49-
'panels/'+name+'/module'
49+
'panels/'+nameAsPath+'/module'
5050
], function() {
5151
loadModule($module);
5252
});

src/app/services/dashboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
274274

275275
this.file_load = function(file) {
276276
return $http({
277-
url: "app/dashboards/"+file+'?' + new Date().getTime(),
277+
url: "app/dashboards/"+file.replace(".","/")+'?' + new Date().getTime(),
278278
method: "GET",
279279
transformResponse: function(response) {
280280
return renderTemplate(response,$routeParams);
@@ -314,7 +314,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
314314

315315
this.script_load = function(file) {
316316
return $http({
317-
url: "app/dashboards/"+file,
317+
url: "app/dashboards/"+file.replace(".","/"),
318318
method: "GET",
319319
transformResponse: function(response) {
320320
/*jshint -W054 */

0 commit comments

Comments
 (0)