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
22c9575a
Unverified
Commit
22c9575a
authored
Aug 29, 2019
by
kay delaney
Committed by
GitHub
Aug 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Going to Explore from a panel with mixed data sources now works (#18784)
Closes #18597
parent
a75850a2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
23 deletions
+11
-23
public/app/core/services/keybindingSrv.ts
+1
-1
public/app/core/utils/explore.ts
+9
-21
public/app/features/panel/metrics_panel_ctrl.ts
+1
-1
No files found.
public/app/core/services/keybindingSrv.ts
View file @
22c9575a
...
...
@@ -199,7 +199,7 @@ export class KeybindingSrv {
if
(
dashboard
.
meta
.
focusPanelId
)
{
const
panel
=
dashboard
.
getPanelById
(
dashboard
.
meta
.
focusPanelId
);
const
datasource
=
await
this
.
datasourceSrv
.
get
(
panel
.
datasource
);
const
url
=
await
getExploreUrl
(
panel
,
panel
.
targets
,
datasource
,
this
.
datasourceSrv
,
this
.
timeSrv
);
const
url
=
await
getExploreUrl
(
panel
.
targets
,
datasource
,
this
.
datasourceSrv
,
this
.
timeSrv
);
if
(
url
)
{
this
.
$timeout
(()
=>
this
.
$location
.
url
(
url
));
}
...
...
public/app/core/utils/explore.ts
View file @
22c9575a
...
...
@@ -65,37 +65,25 @@ export const lastUsedDatasourceKeyForOrgId = (orgId: number) => `${LAST_USED_DAT
* @param datasourceSrv Datasource service to query other datasources in case the panel datasource is mixed
* @param timeSrv Time service to get the current dashboard range from
*/
export
async
function
getExploreUrl
(
panel
:
any
,
panelTargets
:
any
[],
panelDatasource
:
any
,
datasourceSrv
:
any
,
timeSrv
:
any
)
{
export
async
function
getExploreUrl
(
panelTargets
:
any
[],
panelDatasource
:
any
,
datasourceSrv
:
any
,
timeSrv
:
any
)
{
let
exploreDatasource
=
panelDatasource
;
let
exploreTargets
:
DataQuery
[]
=
panelTargets
;
let
url
:
string
;
// Mixed datasources need to choose only one datasource
if
(
panelDatasource
.
meta
.
id
===
'mixed'
&&
panel
Targets
)
{
if
(
panelDatasource
.
meta
.
id
===
'mixed'
&&
explore
Targets
)
{
// Find first explore datasource among targets
let
mixedExploreDatasource
:
any
;
for
(
const
t
of
panel
.
targets
)
{
for
(
const
t
of
exploreTargets
)
{
const
datasource
=
await
datasourceSrv
.
get
(
t
.
datasource
);
if
(
datasource
&&
datasource
.
meta
.
explore
)
{
mixedExploreDatasource
=
datasource
;
if
(
datasource
)
{
exploreDatasource
=
datasource
;
exploreTargets
=
panelTargets
.
filter
(
t
=>
t
.
datasource
===
datasource
.
name
);
break
;
}
}
// Add all its targets
if
(
mixedExploreDatasource
)
{
exploreDatasource
=
mixedExploreDatasource
;
exploreTargets
=
panelTargets
.
filter
(
t
=>
t
.
datasource
===
mixedExploreDatasource
.
name
);
}
}
if
(
panel
Datasource
)
{
if
(
explore
Datasource
)
{
const
range
=
timeSrv
.
timeRangeForUrl
();
let
state
:
Partial
<
ExploreUrlState
>
=
{
range
};
if
(
exploreDatasource
.
getExploreState
)
{
...
...
@@ -103,8 +91,8 @@ export async function getExploreUrl(
}
else
{
state
=
{
...
state
,
datasource
:
panel
Datasource
.
name
,
queries
:
exploreTargets
.
map
(
t
=>
({
...
t
,
datasource
:
panel
Datasource
.
name
})),
datasource
:
explore
Datasource
.
name
,
queries
:
exploreTargets
.
map
(
t
=>
({
...
t
,
datasource
:
explore
Datasource
.
name
})),
};
}
...
...
public/app/features/panel/metrics_panel_ctrl.ts
View file @
22c9575a
...
...
@@ -253,7 +253,7 @@ class MetricsPanelCtrl extends PanelCtrl {
}
async
explore
()
{
const
url
=
await
getExploreUrl
(
this
.
panel
,
this
.
panel
.
targets
,
this
.
datasource
,
this
.
datasourceSrv
,
this
.
timeSrv
);
const
url
=
await
getExploreUrl
(
this
.
panel
.
targets
,
this
.
datasource
,
this
.
datasourceSrv
,
this
.
timeSrv
);
if
(
url
)
{
this
.
$timeout
(()
=>
this
.
$location
.
url
(
url
));
}
...
...
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