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
d1ab29c3
Commit
d1ab29c3
authored
Jun 04, 2019
by
Marcus Efraimsson
Committed by
Hugo Häggmark
Jun 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: Makes it possible to use a different query field per mode (#17395)
parent
1e76f1a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
packages/grafana-ui/src/types/datasource.ts
+12
-0
public/app/features/explore/QueryRow.tsx
+14
-2
No files found.
packages/grafana-ui/src/types/datasource.ts
View file @
d1ab29c3
...
...
@@ -50,6 +50,16 @@ export class DataSourcePlugin<
return
this
;
}
setExploreMetricsQueryField
(
ExploreQueryField
:
ComponentClass
<
ExploreQueryFieldProps
<
DSType
,
TQuery
,
TOptions
>>
)
{
this
.
components
.
ExploreMetricsQueryField
=
ExploreQueryField
;
return
this
;
}
setExploreLogsQueryField
(
ExploreQueryField
:
ComponentClass
<
ExploreQueryFieldProps
<
DSType
,
TQuery
,
TOptions
>>
)
{
this
.
components
.
ExploreLogsQueryField
=
ExploreQueryField
;
return
this
;
}
setExploreStartPage
(
ExploreStartPage
:
ComponentClass
<
ExploreStartPageProps
>
)
{
this
.
components
.
ExploreStartPage
=
ExploreStartPage
;
return
this
;
...
...
@@ -109,6 +119,8 @@ export interface DataSourcePluginComponents<
VariableQueryEditor
?:
any
;
QueryEditor
?:
ComponentType
<
QueryEditorProps
<
DSType
,
TQuery
,
TOptions
>>
;
ExploreQueryField
?:
ComponentClass
<
ExploreQueryFieldProps
<
DSType
,
TQuery
,
TOptions
>>
;
ExploreMetricsQueryField
?:
ComponentClass
<
ExploreQueryFieldProps
<
DSType
,
TQuery
,
TOptions
>>
;
ExploreLogsQueryField
?:
ComponentClass
<
ExploreQueryFieldProps
<
DSType
,
TQuery
,
TOptions
>>
;
ExploreStartPage
?:
ComponentClass
<
ExploreStartPageProps
>
;
ConfigEditor
?:
ComponentType
<
DataSourcePluginOptionsEditorProps
<
DataSourceSettings
<
TOptions
>>>
;
}
...
...
public/app/features/explore/QueryRow.tsx
View file @
d1ab29c3
...
...
@@ -22,7 +22,7 @@ import {
PanelData
,
DataQueryError
,
}
from
'@grafana/ui'
;
import
{
HistoryItem
,
ExploreItemState
,
ExploreId
}
from
'app/types/explore'
;
import
{
HistoryItem
,
ExploreItemState
,
ExploreId
,
ExploreMode
}
from
'app/types/explore'
;
import
{
Emitter
}
from
'app/core/utils/emitter'
;
import
{
highlightLogsExpressionAction
,
removeQueryRowAction
}
from
'./state/actionTypes'
;
import
QueryStatus
from
'./QueryStatus'
;
...
...
@@ -50,6 +50,7 @@ interface QueryRowProps extends PropsFromParent {
queryResponse
:
PanelData
;
latency
:
number
;
queryErrors
:
DataQueryError
[];
mode
:
ExploreMode
;
}
export
class
QueryRow
extends
PureComponent
<
QueryRowProps
>
{
...
...
@@ -114,8 +115,17 @@ export class QueryRow extends PureComponent<QueryRowProps> {
queryResponse
,
latency
,
queryErrors
,
mode
,
}
=
this
.
props
;
const
QueryField
=
datasourceInstance
.
components
.
ExploreQueryField
;
let
QueryField
;
if
(
mode
===
ExploreMode
.
Metrics
&&
datasourceInstance
.
components
.
ExploreMetricsQueryField
)
{
QueryField
=
datasourceInstance
.
components
.
ExploreMetricsQueryField
;
}
else
if
(
mode
===
ExploreMode
.
Logs
&&
datasourceInstance
.
components
.
ExploreLogsQueryField
)
{
QueryField
=
datasourceInstance
.
components
.
ExploreLogsQueryField
;
}
else
{
QueryField
=
datasourceInstance
.
components
.
ExploreQueryField
;
}
return
(
<
div
className=
"query-row"
>
...
...
@@ -182,6 +192,7 @@ function mapStateToProps(state: StoreState, { exploreId, index }: QueryRowProps)
loadingState
,
latency
,
queryErrors
,
mode
,
}
=
item
;
const
query
=
queries
[
index
];
const
datasourceStatus
=
datasourceError
?
DataSourceStatus
.
Disconnected
:
DataSourceStatus
.
Connected
;
...
...
@@ -202,6 +213,7 @@ function mapStateToProps(state: StoreState, { exploreId, index }: QueryRowProps)
queryResponse
,
latency
,
queryErrors
,
mode
,
};
}
...
...
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