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
e591fbc3
Commit
e591fbc3
authored
Feb 19, 2020
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LinkSrv: Add newlines so I can read code
parent
33fae878
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
public/app/features/panel/panellinks/link_srv.ts
+14
-0
No files found.
public/app/features/panel/panellinks/link_srv.ts
View file @
e591fbc3
...
...
@@ -129,21 +129,26 @@ const getDataFrameVars = (dataFrames: DataFrame[]) => {
let
title
:
Field
=
undefined
;
const
suggestions
:
VariableSuggestion
[]
=
[];
const
keys
:
KeyValue
<
true
>
=
{};
for
(
const
df
of
dataFrames
)
{
for
(
const
f
of
df
.
fields
)
{
if
(
keys
[
f
.
name
])
{
continue
;
}
suggestions
.
push
({
value
:
`__data.fields[
${
f
.
name
}
]`
,
label
:
`
${
f
.
name
}
`
,
documentation
:
`Formatted value for
${
f
.
name
}
on the same row`
,
origin
:
VariableOrigin
.
Fields
,
});
keys
[
f
.
name
]
=
true
;
if
(
!
numeric
&&
f
.
type
===
FieldType
.
number
)
{
numeric
=
f
;
}
if
(
!
title
&&
f
.
config
.
title
&&
f
.
config
.
title
!==
f
.
name
)
{
title
=
f
;
}
...
...
@@ -158,6 +163,7 @@ const getDataFrameVars = (dataFrames: DataFrame[]) => {
origin
:
VariableOrigin
.
Fields
,
});
}
if
(
numeric
)
{
suggestions
.
push
({
value
:
`__data.fields[
${
numeric
.
name
}
].numeric`
,
...
...
@@ -172,6 +178,7 @@ const getDataFrameVars = (dataFrames: DataFrame[]) => {
origin
:
VariableOrigin
.
Fields
,
});
}
if
(
title
)
{
suggestions
.
push
({
value
:
`__data.fields[
${
title
.
config
.
title
}
]`
,
...
...
@@ -180,6 +187,7 @@ const getDataFrameVars = (dataFrames: DataFrame[]) => {
origin
:
VariableOrigin
.
Fields
,
});
}
return
suggestions
;
};
...
...
@@ -264,6 +272,7 @@ export class LinkSrv implements LinkService {
const
timeRangeUrl
=
toUrlParams
(
this
.
timeSrv
.
timeRangeForUrl
());
let
href
=
link
.
url
;
if
(
link
.
onBuildUrl
)
{
href
=
link
.
onBuildUrl
({
origin
,
...
...
@@ -272,6 +281,7 @@ export class LinkSrv implements LinkService {
}
let
onClick
:
(
e
:
any
)
=>
void
=
undefined
;
if
(
link
.
onClick
)
{
onClick
=
(
e
:
any
)
=>
{
link
.
onClick
({
...
...
@@ -289,9 +299,11 @@ export class LinkSrv implements LinkService {
origin
,
onClick
,
};
this
.
templateSrv
.
fillVariableValuesForUrl
(
params
,
scopedVars
);
const
variablesQuery
=
toUrlParams
(
params
);
info
.
href
=
this
.
templateSrv
.
replace
(
info
.
href
,
{
...
scopedVars
,
[
DataLinkBuiltInVars
.
keepTime
]:
{
...
...
@@ -303,7 +315,9 @@ export class LinkSrv implements LinkService {
value
:
variablesQuery
,
},
});
info
.
href
=
getConfig
().
disableSanitizeHtml
?
info
.
href
:
sanitizeUrl
(
info
.
href
);
return
info
;
};
...
...
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