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
205e2acd
Commit
205e2acd
authored
Jan 17, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added data source type to explore state
parent
a6f6ed41
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
36 deletions
+39
-36
packages/grafana-ui/src/types/datasource.ts
+23
-1
public/app/features/datasources/settings/__snapshots__/DataSourceSettings.test.tsx.snap
+0
-0
public/app/features/explore/QueryRow.tsx
+2
-2
public/app/features/explore/state/actions.ts
+11
-7
public/app/plugins/datasource/prometheus/query_hints.ts
+1
-2
public/app/types/explore.ts
+2
-24
No files found.
packages/grafana-ui/src/types/datasource.ts
View file @
205e2acd
...
@@ -25,6 +25,24 @@ export interface DataQueryOptions {
...
@@ -25,6 +25,24 @@ export interface DataQueryOptions {
scopedVars
:
object
;
scopedVars
:
object
;
}
}
export
interface
QueryFix
{
type
:
string
;
label
:
string
;
action
?:
QueryFixAction
;
}
export
interface
QueryFixAction
{
type
:
string
;
query
?:
string
;
preventSubmit
?:
boolean
;
}
export
interface
QueryHint
{
type
:
string
;
label
:
string
;
fix
?:
QueryFix
;
}
export
interface
DataSourceApi
{
export
interface
DataSourceApi
{
name
:
string
;
name
:
string
;
meta
:
PluginMeta
;
meta
:
PluginMeta
;
...
@@ -54,6 +72,11 @@ export interface DataSourceApi {
...
@@ -54,6 +72,11 @@ export interface DataSourceApi {
* Test & verify datasource settings & connection details
* Test & verify datasource settings & connection details
*/
*/
testDatasource
():
Promise
<
any
>
;
testDatasource
():
Promise
<
any
>
;
/**
* Get hints for query improvements
*/
getQueryHints
(
query
:
DataQuery
,
results
:
any
[],
...
rest
:
any
):
QueryHint
[];
}
}
export
interface
DataSourceSettings
{
export
interface
DataSourceSettings
{
...
@@ -82,4 +105,3 @@ export interface DataSourceSelectItem {
...
@@ -82,4 +105,3 @@ export interface DataSourceSelectItem {
meta
:
PluginMeta
;
meta
:
PluginMeta
;
sort
:
string
;
sort
:
string
;
}
}
public/app/features/datasources/settings/__snapshots__/DataSourceSettings.test.tsx.snap
deleted
100644 → 0
View file @
a6f6ed41
This diff is collapsed.
Click to expand it.
public/app/features/explore/QueryRow.tsx
View file @
205e2acd
...
@@ -19,9 +19,9 @@ import {
...
@@ -19,9 +19,9 @@ import {
}
from
'./state/actions'
;
}
from
'./state/actions'
;
// Types
// Types
import
{
RawTimeRange
,
DataQuery
}
from
'@grafana/ui'
;
import
{
StoreState
}
from
'app/types'
;
import
{
StoreState
}
from
'app/types'
;
import
{
QueryTransaction
,
HistoryItem
,
QueryHint
,
ExploreItemState
,
ExploreId
}
from
'app/types/explore'
;
import
{
RawTimeRange
,
DataQuery
,
QueryHint
}
from
'@grafana/ui'
;
import
{
QueryTransaction
,
HistoryItem
,
ExploreItemState
,
ExploreId
}
from
'app/types/explore'
;
import
{
Emitter
}
from
'app/core/utils/emitter'
;
import
{
Emitter
}
from
'app/core/utils/emitter'
;
function
getFirstHintFromTransactions
(
transactions
:
QueryTransaction
[]):
QueryHint
{
function
getFirstHintFromTransactions
(
transactions
:
QueryTransaction
[]):
QueryHint
{
...
...
public/app/features/explore/state/actions.ts
View file @
205e2acd
// Libraries
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
{
ThunkAction
}
from
'redux-thunk'
;
import
{
ThunkAction
}
from
'redux-thunk'
;
import
{
RawTimeRange
,
TimeRange
}
from
'@grafana/ui'
;
// Services & Utils
import
store
from
'app/core/store'
;
import
{
import
{
LAST_USED_DATASOURCE_KEY
,
LAST_USED_DATASOURCE_KEY
,
clearQueryKeys
,
clearQueryKeys
,
...
@@ -14,10 +16,12 @@ import {
...
@@ -14,10 +16,12 @@ import {
serializeStateToUrlParam
,
serializeStateToUrlParam
,
}
from
'app/core/utils/explore'
;
}
from
'app/core/utils/explore'
;
// Actions
import
{
updateLocation
}
from
'app/core/actions'
;
import
{
updateLocation
}
from
'app/core/actions'
;
import
store
from
'app/core/store'
;
// Types
import
{
StoreState
}
from
'app/types'
;
import
{
StoreState
}
from
'app/types'
;
import
{
DataQuery
,
DataSourceSelectItem
}
from
'@grafana/ui/src/types'
;
import
{
DataQuery
,
DataSourceSelectItem
,
QueryHint
}
from
'@grafana/ui/src/types'
;
import
{
getDatasourceSrv
}
from
'app/features/plugins/datasource_srv'
;
import
{
getDatasourceSrv
}
from
'app/features/plugins/datasource_srv'
;
import
{
import
{
ExploreId
,
ExploreId
,
...
@@ -26,11 +30,10 @@ import {
...
@@ -26,11 +30,10 @@ import {
ResultType
,
ResultType
,
QueryOptions
,
QueryOptions
,
QueryTransaction
,
QueryTransaction
,
QueryHint
,
QueryHintGetter
,
}
from
'app/types/explore'
;
}
from
'app/types/explore'
;
import
{
Emitter
}
from
'app/core/core'
;
import
{
Emitter
}
from
'app/core/core'
;
import
{
RawTimeRange
,
TimeRange
}
from
'@grafana/ui'
;
import
{
import
{
Action
as
ThunkableAction
,
Action
as
ThunkableAction
,
ActionTypes
,
ActionTypes
,
...
@@ -45,6 +48,7 @@ import {
...
@@ -45,6 +48,7 @@ import {
ScanStopAction
,
ScanStopAction
,
}
from
'./actionTypes'
;
}
from
'./actionTypes'
;
type
ThunkResult
<
R
>
=
ThunkAction
<
R
,
StoreState
,
undefined
,
ThunkableAction
>
;
type
ThunkResult
<
R
>
=
ThunkAction
<
R
,
StoreState
,
undefined
,
ThunkableAction
>
;
/**
/**
...
@@ -460,7 +464,7 @@ export function queryTransactionSuccess(
...
@@ -460,7 +464,7 @@ export function queryTransactionSuccess(
// Get query hints
// Get query hints
let
hints
:
QueryHint
[];
let
hints
:
QueryHint
[];
if
(
datasourceInstance
.
getQueryHints
as
QueryHintGetter
)
{
if
(
datasourceInstance
.
getQueryHints
)
{
hints
=
datasourceInstance
.
getQueryHints
(
transaction
.
query
,
result
);
hints
=
datasourceInstance
.
getQueryHints
(
transaction
.
query
,
result
);
}
}
...
...
public/app/plugins/datasource/prometheus/query_hints.ts
View file @
205e2acd
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
{
QueryHint
}
from
'@grafana/ui/src/types'
;
import
{
QueryHint
}
from
'app/types/explore'
;
/**
/**
* Number of time series results needed before starting to suggest sum aggregation hints
* Number of time series results needed before starting to suggest sum aggregation hints
...
...
public/app/types/explore.ts
View file @
205e2acd
import
{
Value
}
from
'slate'
;
import
{
Value
}
from
'slate'
;
import
{
RawTimeRange
,
TimeRange
,
DataQuery
,
DataSourceSelectItem
}
from
'@grafana/ui'
;
import
{
RawTimeRange
,
TimeRange
,
DataQuery
,
DataSourceSelectItem
,
DataSourceApi
,
QueryHint
}
from
'@grafana/ui'
;
import
{
Emitter
}
from
'app/core/core'
;
import
{
Emitter
}
from
'app/core/core'
;
import
{
LogsModel
}
from
'app/core/logs_model'
;
import
{
LogsModel
}
from
'app/core/logs_model'
;
...
@@ -110,7 +110,7 @@ export interface ExploreItemState {
...
@@ -110,7 +110,7 @@ export interface ExploreItemState {
/**
/**
* Datasource instance that has been selected. Datasource-specific logic can be run on this object.
* Datasource instance that has been selected. Datasource-specific logic can be run on this object.
*/
*/
datasourceInstance
:
any
;
datasourceInstance
:
DataSourceApi
;
/**
/**
* Error to be shown when datasource loading or testing failed.
* Error to be shown when datasource loading or testing failed.
*/
*/
...
@@ -273,28 +273,6 @@ export interface TypeaheadOutput {
...
@@ -273,28 +273,6 @@ export interface TypeaheadOutput {
suggestions
:
CompletionItemGroup
[];
suggestions
:
CompletionItemGroup
[];
}
}
export
interface
QueryFix
{
type
:
string
;
label
:
string
;
action
?:
QueryFixAction
;
}
export
interface
QueryFixAction
{
type
:
string
;
query
?:
string
;
preventSubmit
?:
boolean
;
}
export
interface
QueryHint
{
type
:
string
;
label
:
string
;
fix
?:
QueryFix
;
}
export
interface
QueryHintGetter
{
(
query
:
DataQuery
,
results
:
any
[],
...
rest
:
any
):
QueryHint
[];
}
export
interface
QueryIntervals
{
export
interface
QueryIntervals
{
interval
:
string
;
interval
:
string
;
intervalMs
:
number
;
intervalMs
:
number
;
...
...
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