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
00769f19
Unverified
Commit
00769f19
authored
Aug 06, 2020
by
Torkel Ödegaard
Committed by
GitHub
Aug 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E: Adding globals variables and interpolation format gdev test dashboard and e2e test (#26827)
parent
5a58f2b4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
0 deletions
+165
-0
devenv/dev-dashboards/feature-templating/global-variables-and-interpolation.json
+110
-0
e2e/suite1/specs/dashboard-templating.spec.ts
+50
-0
public/app/features/templating/template_srv.test.ts
+5
-0
No files found.
devenv/dev-dashboards/feature-templating/global-variables-and-interpolation.json
0 → 100644
View file @
00769f19
{
"annotations"
:
{
"list"
:
[
{
"builtIn"
:
1
,
"datasource"
:
"-- Grafana --"
,
"enable"
:
true
,
"hide"
:
true
,
"iconColor"
:
"rgba(0, 211, 255, 1)"
,
"name"
:
"Annotations & Alerts"
,
"type"
:
"dashboard"
}
]
},
"editable"
:
true
,
"gnetId"
:
null
,
"graphTooltip"
:
0
,
"iteration"
:
1596705352582
,
"links"
:
[],
"panels"
:
[
{
"datasource"
:
null
,
"fieldConfig"
:
{
"defaults"
:
{
"custom"
:
{}
},
"overrides"
:
[]
},
"gridPos"
:
{
"h"
:
16
,
"w"
:
24
,
"x"
:
0
,
"y"
:
0
},
"id"
:
11
,
"options"
:
{
"content"
:
"## Global variables
\n\n
* `__dashboard` = ${__dashboard}
\n
* `__dashboard.name` = ${__dashboard.name}
\n
* `__dashboard.uid` = ${__dashboard.uid}
\n
* `__org.name` = ${__org.name}
\n
* `__org.id` = ${__org.id}
\n
* `__user.id` = ${__user.id}
\n
* `__user.login` = ${__user.login}
\n
\n
## Formats
\n\n
* `Server:raw` = ${Server:raw}
\n
* `Server:regex` = ${Server:regex}
\n
* `Server:lucene` = ${Server:lucene}
\n
* `Server:glob` = ${Server:glob}
\n
* `Server:pipe` = ${Server:pipe}
\n
* `Server:distributed` = ${Server:distributed}
\n
* `Server:csv` = ${Server:csv}
\n
* `Server:html` = ${Server:html}
\n
* `Server:json` = ${Server:json}
\n
* `Server:percentencode` = ${Server:percentencode}
\n
* `Server:singlequote` = ${Server:singlequote}
\n
* `Server:doublequote` = ${Server:doublequote}
\n
* `Server:sqlstring` = ${Server:sqlstring}
\n
* `Server:date` = ${Server:date}
\n\n
"
,
"mode"
:
"markdown"
},
"pluginVersion"
:
"7.1.0"
,
"targets"
:
[
{
"refId"
:
"A"
,
"scenarioId"
:
"random_walk"
}
],
"timeFrom"
:
null
,
"timeShift"
:
null
,
"title"
:
"Variable interpolation"
,
"type"
:
"text"
}
],
"schemaVersion"
:
26
,
"style"
:
"dark"
,
"tags"
:
[
"gdev"
,
"templating"
],
"templating"
:
{
"list"
:
[
{
"allValue"
:
null
,
"current"
:
{
"selected"
:
true
,
"text"
:
"All"
,
"value"
:
[
"$__all"
]
},
"hide"
:
0
,
"includeAll"
:
true
,
"label"
:
null
,
"multi"
:
true
,
"name"
:
"Server"
,
"options"
:
[
{
"selected"
:
true
,
"text"
:
"All"
,
"value"
:
"$__all"
},
{
"selected"
:
false
,
"text"
:
"A'A
\"
A"
,
"value"
:
"A'A
\"
A"
},
{
"selected"
:
false
,
"text"
:
"BB
\\
B"
,
"value"
:
"BB
\\
B"
},
{
"selected"
:
false
,
"text"
:
"CCC"
,
"value"
:
"CCC"
}
],
"query"
:
"A'A
\"
A,BB
\\
B,CCC"
,
"queryValue"
:
""
,
"skipUrlSync"
:
false
,
"type"
:
"custom"
}
]
},
"time"
:
{
"from"
:
"now-6h"
,
"to"
:
"now"
},
"timepicker"
:
{
"refresh_intervals"
:
[
"5s"
,
"10s"
,
"30s"
,
"1m"
,
"5m"
,
"15m"
,
"30m"
,
"1h"
,
"2h"
,
"1d"
]
},
"timezone"
:
""
,
"title"
:
"Global variables and interpolation"
,
"uid"
:
"HYaGDGIMk"
,
"version"
:
3
}
e2e/suite1/specs/dashboard-templating.spec.ts
0 → 100644
View file @
00769f19
import
{
e2e
}
from
'@grafana/e2e'
;
e2e
.
scenario
({
describeName
:
'Dashboard templating'
,
itName
:
'Verify variable interpolation works'
,
addScenarioDataSource
:
false
,
addScenarioDashBoard
:
false
,
skipScenario
:
false
,
scenario
:
()
=>
{
// Open dashboard global variables and interpolation
e2e
.
flows
.
openDashboard
({
uid
:
'HYaGDGIMk'
});
const
items
:
any
=
[];
const
expectedItems
:
string
[]
=
[
'__dashboard = Global variables and interpolation'
,
'__dashboard.name = Global variables and interpolation'
,
'__dashboard.uid = HYaGDGIMk'
,
'__org.name = Main Org.'
,
'__org.id = 1'
,
'__user.id = 1'
,
'__user.login = admin'
,
`Server:raw = A'A"A,BB\\B,CCC`
,
`Server:regex = (A'A"A|BB\\\\B|CCC)`
,
`Server:lucene = ("A'A\\"A" OR "BB\\\\B" OR "CCC")`
,
`Server:glob = {A'A"A,BB\\B,CCC}`
,
`Server:pipe = A'A"A|BB\\B|CCC`
,
`Server:distributed = A'A"A,Server=BB\\B,Server=CCC`
,
`Server:csv = A'A"A,BB\\B,CCC`
,
`Server:html = A'A"A, BB\\B, CCC`
,
`Server:json = ["A'A\\"A","BB\\\\B","CCC"]`
,
`Server:percentencode = %7BA%27A%22A%2CBB%5CB%2CCCC%7D`
,
`Server:singlequote = 'A\\'A"A','BB\\B','CCC'`
,
`Server:doublequote = "A'A\\"A","BB\\B","CCC"`
,
`Server:sqlstring = 'A''A"A','BB\\\B','CCC'`
,
`Server:date = null`
,
];
e2e
()
.
get
(
'.markdown-html li'
)
.
should
(
'have.length'
,
21
)
.
each
(
element
=>
{
items
.
push
(
element
.
text
());
})
.
then
(()
=>
{
expectedItems
.
forEach
((
expected
,
index
)
=>
{
expect
(
items
[
index
]).
to
.
equal
(
expected
);
});
});
},
});
public/app/features/templating/template_srv.test.ts
View file @
00769f19
...
...
@@ -375,6 +375,11 @@ describe('templateSrv', () => {
const
result
=
_templateSrv
.
formatValue
([
'test'
,
"test'value2"
],
'sqlstring'
);
expect
(
result
).
toBe
(
`'test','test''value2'`
);
});
it
(
'raw format should leave value intact and do no escaping'
,
()
=>
{
const
result
=
_templateSrv
.
formatValue
(
"'test
\
n"
,
'raw'
);
expect
(
result
).
toBe
(
"'test
\
n"
);
});
});
describe
(
'can check if variable exists'
,
()
=>
{
...
...
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