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
e5280d55
Commit
e5280d55
authored
Jun 11, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make template variables work in row titles, #1956
parent
3675b3fc
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
29 deletions
+24
-29
public/app/features/dashboard/dynamicDashboardSrv.js
+2
-0
public/app/features/dashboard/rowCtrl.js
+12
-28
public/app/filters/all.js
+4
-0
public/app/partials/dashboard.html
+1
-1
public/test/specs/dynamicDashboardSrv-specs.js
+5
-0
No files found.
public/app/features/dashboard/dynamicDashboardSrv.js
View file @
e5280d55
...
@@ -105,6 +105,8 @@ function (angular, _) {
...
@@ -105,6 +105,8 @@ function (angular, _) {
_
.
each
(
selected
,
function
(
option
,
index
)
{
_
.
each
(
selected
,
function
(
option
,
index
)
{
copy
=
self
.
getRowClone
(
row
,
index
);
copy
=
self
.
getRowClone
(
row
,
index
);
copy
.
scopedVars
=
{};
copy
.
scopedVars
[
variable
.
name
]
=
option
;
for
(
i
=
0
;
i
<
copy
.
panels
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
copy
.
panels
.
length
;
i
++
)
{
panel
=
copy
.
panels
[
i
];
panel
=
copy
.
panels
[
i
];
...
...
public/app/features/dashboard/rowCtrl.js
View file @
e5280d55
...
@@ -22,7 +22,6 @@ function (angular, app, _, config) {
...
@@ -22,7 +22,6 @@ function (angular, app, _, config) {
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
$scope
.
editor
=
{
index
:
0
};
$scope
.
editor
=
{
index
:
0
};
$scope
.
reset_panel
();
};
};
$scope
.
togglePanelMenu
=
function
(
posX
)
{
$scope
.
togglePanelMenu
=
function
(
posX
)
{
...
@@ -64,8 +63,18 @@ function (angular, app, _, config) {
...
@@ -64,8 +63,18 @@ function (angular, app, _, config) {
};
};
$scope
.
add_panel_default
=
function
(
type
)
{
$scope
.
add_panel_default
=
function
(
type
)
{
$scope
.
reset_panel
(
type
);
var
defaultSpan
=
12
;
$scope
.
add_panel
(
$scope
.
panel
);
var
_as
=
12
-
$scope
.
dashboard
.
rowSpan
(
$scope
.
row
);
var
panel
=
{
title
:
config
.
new_panel_title
,
error
:
false
,
span
:
_as
<
defaultSpan
&&
_as
>
0
?
_as
:
defaultSpan
,
editable
:
true
,
type
:
type
};
$scope
.
add_panel
(
panel
);
$timeout
(
function
()
{
$timeout
(
function
()
{
$scope
.
$broadcast
(
'render'
);
$scope
.
$broadcast
(
'render'
);
...
@@ -105,31 +114,6 @@ function (angular, app, _, config) {
...
@@ -105,31 +114,6 @@ function (angular, app, _, config) {
});
});
};
};
$scope
.
reset_panel
=
function
(
type
)
{
var
defaultSpan
=
12
;
var
_as
=
12
-
$scope
.
dashboard
.
rowSpan
(
$scope
.
row
);
$scope
.
panel
=
{
title
:
config
.
new_panel_title
,
error
:
false
,
span
:
_as
<
defaultSpan
&&
_as
>
0
?
_as
:
defaultSpan
,
editable
:
true
,
type
:
type
};
function
fixRowHeight
(
height
)
{
if
(
!
height
)
{
return
'200px'
;
}
if
(
!
_
.
isString
(
height
))
{
return
height
+
'px'
;
}
return
height
;
}
$scope
.
row
.
height
=
fixRowHeight
(
$scope
.
row
.
height
);
};
$scope
.
init
();
$scope
.
init
();
});
});
...
...
public/app/filters/all.js
View file @
e5280d55
...
@@ -57,7 +57,11 @@ define(['angular', 'jquery', 'lodash', 'moment'], function (angular, $, _, momen
...
@@ -57,7 +57,11 @@ define(['angular', 'jquery', 'lodash', 'moment'], function (angular, $, _, momen
module
.
filter
(
'interpolateTemplateVars'
,
function
(
templateSrv
)
{
module
.
filter
(
'interpolateTemplateVars'
,
function
(
templateSrv
)
{
function
interpolateTemplateVars
(
text
,
scope
)
{
function
interpolateTemplateVars
(
text
,
scope
)
{
if
(
scope
.
panel
)
{
return
templateSrv
.
replaceWithText
(
text
,
scope
.
panel
.
scopedVars
);
return
templateSrv
.
replaceWithText
(
text
,
scope
.
panel
.
scopedVars
);
}
else
{
return
templateSrv
.
replaceWithText
(
text
,
scope
.
row
.
scopedVars
);
}
}
}
interpolateTemplateVars
.
$stateful
=
true
;
interpolateTemplateVars
.
$stateful
=
true
;
...
...
public/app/partials/dashboard.html
View file @
e5280d55
...
@@ -75,7 +75,7 @@
...
@@ -75,7 +75,7 @@
</div>
</div>
<div
class=
"panels-wrapper"
ng-if=
"!row.collapse"
>
<div
class=
"panels-wrapper"
ng-if=
"!row.collapse"
>
<div
class=
"row-text pointer"
ng-click=
"toggle_row(row)"
ng-if=
"row.showTitle"
ng-bind=
"row.title"
>
<div
class=
"row-text pointer"
ng-click=
"toggle_row(row)"
ng-if=
"row.showTitle"
ng-bind=
"row.title
| interpolateTemplateVars:this
"
>
</div>
</div>
<!-- Panels, draggable needs to be disabled in fullscreen because Firefox bug -->
<!-- Panels, draggable needs to be disabled in fullscreen because Firefox bug -->
...
...
public/test/specs/dynamicDashboardSrv-specs.js
View file @
e5280d55
...
@@ -135,6 +135,11 @@ define([
...
@@ -135,6 +135,11 @@ define([
expect
(
ctx
.
rows
[
1
].
repeat
).
to
.
be
(
null
);
expect
(
ctx
.
rows
[
1
].
repeat
).
to
.
be
(
null
);
});
});
it
(
'should add scopedVars to rows'
,
function
()
{
expect
(
ctx
.
rows
[
0
].
scopedVars
.
servers
.
value
).
to
.
be
(
'se1'
);
expect
(
ctx
.
rows
[
1
].
scopedVars
.
servers
.
value
).
to
.
be
(
'se2'
);
});
it
(
'should generate a repeartRowId based on repeat row index'
,
function
()
{
it
(
'should generate a repeartRowId based on repeat row index'
,
function
()
{
expect
(
ctx
.
rows
[
1
].
repeatRowId
).
to
.
be
(
1
);
expect
(
ctx
.
rows
[
1
].
repeatRowId
).
to
.
be
(
1
);
});
});
...
...
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