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
cb8b0387
Commit
cb8b0387
authored
Feb 29, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(templating): progress on templating rethink
parent
078e69d0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
21 deletions
+25
-21
public/app/core/directives/value_select_dropdown.js
+4
-0
public/app/features/dashboard/partials/import.html
+5
-7
public/app/features/templating/templateSrv.js
+7
-2
public/app/features/templating/templateValuesSrv.js
+8
-11
public/app/plugins/datasource/influxdb/datasource.ts
+1
-1
No files found.
public/app/core/directives/value_select_dropdown.js
View file @
cb8b0387
...
...
@@ -179,6 +179,10 @@ function (angular, _, coreModule) {
vm
.
variable
.
current
.
text
=
_
.
pluck
(
vm
.
selectedValues
,
'text'
).
join
(
' + '
);
vm
.
variable
.
current
.
tags
=
vm
.
selectedTags
;
if
(
!
vm
.
variable
.
multi
)
{
vm
.
variable
.
current
.
value
=
vm
.
selectedValues
[
0
].
value
;
}
if
(
commitChange
)
{
vm
.
commitChanges
();
}
...
...
public/app/features/dashboard/partials/import.html
View file @
cb8b0387
...
...
@@ -15,26 +15,24 @@
</form>
</div>
<h5
class=
"
page
-heading"
>
<h5
class=
"
section
-heading"
>
Migrate dashboards
<em
style=
"font-size: 14px;padding-left: 10px;"
><i
class=
"fa fa-info-circle"
></i>
Import dashboards from Elasticsearch or InfluxDB
</em>
</h5>
<div
class=
"gf-form-
group last
"
>
<div
class=
"gf-form-
inline gf-form-group
"
>
<div
class=
"gf-form"
>
<div
class=
"gf-form-label"
>
Dashboard source
</div>
<div>
<div
class=
"gf-form-select-wrapper"
>
<select
class=
"gf-form-input gf-size-auto"
ng-model=
"sourceName"
ng-options=
"f for f in datasources"
></select>
</div>
</div>
<div
class=
"gf-form-btn"
>
<button
class=
"btn btn-success"
ng-click=
"startImport()"
>
Import
</button>
</div>
<div
class=
"gf-form"
>
<button
class=
"btn btn-success gf-form-btn"
ng-click=
"startImport()"
>
Import
</button>
</div>
</div>
<h5
class=
"
page
-heading"
ng-if=
"importing"
>
{{infoText}}
</h5>
<h5
class=
"
section
-heading"
ng-if=
"importing"
>
{{infoText}}
</h5>
<div
class=
"editor-row"
ng-if=
"importing"
>
<div
class=
"editor-row row"
>
<table
class=
"grafana-options-table span5"
>
...
...
public/app/features/templating/templateSrv.js
View file @
cb8b0387
...
...
@@ -31,13 +31,18 @@ function (angular, _) {
},
this
);
};
this
.
regexEscape
=
function
(
value
)
{
return
value
.
replace
(
/
[
-[
\]
{}()*+!<=:?.
\/\\
^$|#
\s
,
]
/g
,
'
\\
$&'
);
};
this
.
formatValue
=
function
(
value
,
format
)
{
if
(
_
.
isString
(
value
))
{
return
value
;
}
else
{
switch
(
format
)
{
case
"regex values"
:
{
return
'('
+
value
.
join
(
'|'
)
+
')'
;
case
"regex"
:
{
var
escapedValues
=
_
.
map
(
value
,
this
.
regexEscape
);
return
'('
+
escapedValues
.
join
(
'|'
)
+
')'
;
}
case
"lucene"
:
{
var
quotedValues
=
_
.
map
(
value
,
function
(
val
)
{
...
...
public/app/features/templating/templateValuesSrv.js
View file @
cb8b0387
...
...
@@ -226,22 +226,19 @@ function (angular, _, kbn) {
return
_
.
map
(
_
.
keys
(
options
).
sort
(),
function
(
key
)
{
var
option
=
{
text
:
key
,
value
:
key
};
// check if values need to be regex escaped
if
(
self
.
shouldRegexEscape
(
variable
))
{
option
.
value
=
self
.
regexEscape
(
option
.
value
);
}
//
//
check if values need to be regex escaped
//
if (self.shouldRegexEscape(variable)) {
//
option.value = self.regexEscape(option.value);
//
}
return
option
;
});
};
this
.
shouldRegexEscape
=
function
(
variable
)
{
return
(
variable
.
includeAll
||
variable
.
multi
)
&&
variable
.
allFormat
.
indexOf
(
'regex'
)
!==
-
1
;
};
this
.
regexEscape
=
function
(
value
)
{
return
value
.
replace
(
/
[
-[
\]
{}()*+!<=:?.
\/\\
^$|#
\s
,
]
/g
,
'
\\
$&'
);
};
// this.shouldRegexEscape = function(variable) {
// return (variable.includeAll || variable.multi) && variable.allFormat.indexOf('regex') !== -1;
// };
//
this
.
addAllOption
=
function
(
variable
)
{
// var allValue = '';
...
...
public/app/plugins/datasource/influxdb/datasource.ts
View file @
cb8b0387
...
...
@@ -45,7 +45,7 @@ export function InfluxDatasource(instanceSettings, $q, backendSrv, templateSrv)
allQueries
=
allQueries
.
replace
(
/
\$
timeFilter/g
,
timeFilter
);
// replace templated variables
allQueries
=
templateSrv
.
replace
(
allQueries
,
options
.
scopedVars
);
allQueries
=
templateSrv
.
replace
(
allQueries
,
options
.
scopedVars
,
'regex'
);
return
this
.
_seriesQuery
(
allQueries
).
then
(
function
(
data
):
any
{
if
(
!
data
||
!
data
.
results
)
{
...
...
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