Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
d3495ff7
Commit
d3495ff7
authored
Nov 07, 2013
by
Boaz Leskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow loading of panels and dashboards from subfolders
every . in their name is mapped to a /
parent
2b9a8a00
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
9 deletions
+10
-9
src/app/controllers/dash.js
+1
-1
src/app/directives/addPanel.js
+1
-1
src/app/directives/kibanaPanel.js
+3
-2
src/app/directives/kibanaSimplePanel.js
+3
-3
src/app/services/dashboard.js
+2
-2
No files found.
src/app/controllers/dash.js
View file @
d3495ff7
...
@@ -70,7 +70,7 @@ function (angular, config, _) {
...
@@ -70,7 +70,7 @@ function (angular, config, _) {
$scope
.
edit_path
=
function
(
type
)
{
$scope
.
edit_path
=
function
(
type
)
{
if
(
type
)
{
if
(
type
)
{
return
'app/panels/'
+
type
+
'/editor.html'
;
return
'app/panels/'
+
type
.
replace
(
"."
,
"/"
)
+
'/editor.html'
;
}
else
{
}
else
{
return
false
;
return
false
;
}
}
...
...
src/app/directives/addPanel.js
View file @
d3495ff7
...
@@ -17,7 +17,7 @@ function (angular, app, _) {
...
@@ -17,7 +17,7 @@ function (angular, app, _) {
$scope
.
reset_panel
(
_type
);
$scope
.
reset_panel
(
_type
);
if
(
!
_
.
isUndefined
(
$scope
.
panel
.
type
))
{
if
(
!
_
.
isUndefined
(
$scope
.
panel
.
type
))
{
$scope
.
panel
.
loadingEditor
=
true
;
$scope
.
panel
.
loadingEditor
=
true
;
$scope
.
require
([
'panels/'
+
$scope
.
panel
.
type
+
'/module'
],
function
()
{
$scope
.
require
([
'panels/'
+
$scope
.
panel
.
type
.
replace
(
"."
,
"/"
)
+
'/module'
],
function
()
{
var
template
=
'<div ng-controller="'
+
$scope
.
panel
.
type
+
'" ng-include="
\'
app/partials/paneladd.html
\'
"></div>'
;
var
template
=
'<div ng-controller="'
+
$scope
.
panel
.
type
+
'" ng-include="
\'
app/partials/paneladd.html
\'
"></div>'
;
elem
.
html
(
$compile
(
angular
.
element
(
template
))(
$scope
));
elem
.
html
(
$compile
(
angular
.
element
(
template
))(
$scope
));
$scope
.
panel
.
loadingEditor
=
false
;
$scope
.
panel
.
loadingEditor
=
false
;
...
...
src/app/directives/kibanaPanel.js
View file @
d3495ff7
...
@@ -75,9 +75,10 @@ function (angular) {
...
@@ -75,9 +75,10 @@ function (angular) {
$scope
.
$watch
(
attr
.
type
,
function
(
name
)
{
$scope
.
$watch
(
attr
.
type
,
function
(
name
)
{
elem
.
addClass
(
"ng-cloak"
);
elem
.
addClass
(
"ng-cloak"
);
// load the panels module file, then render it in the dom.
// load the panels module file, then render it in the dom.
var
nameAsPath
=
name
.
replace
(
"."
,
"/"
);
$scope
.
require
([
$scope
.
require
([
'jquery'
,
'jquery'
,
'text!panels/'
+
name
+
'/module.html'
'text!panels/'
+
name
AsPath
+
'/module.html'
],
function
(
$
,
moduleTemplate
)
{
],
function
(
$
,
moduleTemplate
)
{
var
$module
=
$
(
moduleTemplate
);
var
$module
=
$
(
moduleTemplate
);
// top level controllers
// top level controllers
...
@@ -88,7 +89,7 @@ function (angular) {
...
@@ -88,7 +89,7 @@ function (angular) {
if
(
$controllers
.
length
)
{
if
(
$controllers
.
length
)
{
$controllers
.
first
().
prepend
(
editorTemplate
);
$controllers
.
first
().
prepend
(
editorTemplate
);
$scope
.
require
([
$scope
.
require
([
'panels/'
+
name
+
'/module'
'panels/'
+
name
AsPath
+
'/module'
],
function
()
{
],
function
()
{
loadModule
(
$module
);
loadModule
(
$module
);
});
});
...
...
src/app/directives/kibanaSimplePanel.js
View file @
d3495ff7
...
@@ -32,10 +32,10 @@ function (angular, _) {
...
@@ -32,10 +32,10 @@ function (angular, _) {
function
loadController
(
name
)
{
function
loadController
(
name
)
{
elem
.
addClass
(
"ng-cloak"
);
elem
.
addClass
(
"ng-cloak"
);
// load the panels module file, then render it in the dom.
// load the panels module file, then render it in the dom.
var
nameAsPath
=
name
.
replace
(
"."
,
"/"
);
$scope
.
require
([
$scope
.
require
([
'jquery'
,
'jquery'
,
'text!panels/'
+
name
+
'/module.html'
'text!panels/'
+
name
AsPath
+
'/module.html'
],
function
(
$
,
moduleTemplate
)
{
],
function
(
$
,
moduleTemplate
)
{
var
$module
=
$
(
moduleTemplate
);
var
$module
=
$
(
moduleTemplate
);
// top level controllers
// top level controllers
...
@@ -46,7 +46,7 @@ function (angular, _) {
...
@@ -46,7 +46,7 @@ function (angular, _) {
if
(
$controllers
.
length
)
{
if
(
$controllers
.
length
)
{
$controllers
.
first
().
prepend
(
panelLoading
);
$controllers
.
first
().
prepend
(
panelLoading
);
$scope
.
require
([
$scope
.
require
([
'panels/'
+
name
+
'/module'
'panels/'
+
name
AsPath
+
'/module'
],
function
()
{
],
function
()
{
loadModule
(
$module
);
loadModule
(
$module
);
});
});
...
...
src/app/services/dashboard.js
View file @
d3495ff7
...
@@ -274,7 +274,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
...
@@ -274,7 +274,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
this
.
file_load
=
function
(
file
)
{
this
.
file_load
=
function
(
file
)
{
return
$http
({
return
$http
({
url
:
"app/dashboards/"
+
file
+
'?'
+
new
Date
().
getTime
(),
url
:
"app/dashboards/"
+
file
.
replace
(
"."
,
"/"
)
+
'?'
+
new
Date
().
getTime
(),
method
:
"GET"
,
method
:
"GET"
,
transformResponse
:
function
(
response
)
{
transformResponse
:
function
(
response
)
{
return
renderTemplate
(
response
,
$routeParams
);
return
renderTemplate
(
response
,
$routeParams
);
...
@@ -314,7 +314,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
...
@@ -314,7 +314,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
this
.
script_load
=
function
(
file
)
{
this
.
script_load
=
function
(
file
)
{
return
$http
({
return
$http
({
url
:
"app/dashboards/"
+
file
,
url
:
"app/dashboards/"
+
file
.
replace
(
"."
,
"/"
)
,
method
:
"GET"
,
method
:
"GET"
,
transformResponse
:
function
(
response
)
{
transformResponse
:
function
(
response
)
{
/*jshint -W054 */
/*jshint -W054 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment