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
5e7d4bea
Commit
5e7d4bea
authored
Nov 27, 2018
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get intervals from explore function
parent
b36db6ac
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
public/app/features/explore/Explore.tsx
+1
-0
public/app/features/explore/QueryEditor.tsx
+18
-3
public/app/features/explore/QueryRows.tsx
+4
-1
No files found.
public/app/features/explore/Explore.tsx
View file @
5e7d4bea
...
...
@@ -897,6 +897,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
onRemoveQueryRow=
{
this
.
onRemoveQueryRow
}
transactions=
{
queryTransactions
}
exploreEvents=
{
this
.
exploreEvents
}
range=
{
range
}
/>
<
main
className=
"m-t-2"
>
<
ErrorBoundary
>
...
...
public/app/features/explore/QueryEditor.tsx
View file @
5e7d4bea
import
React
,
{
PureComponent
}
from
'react'
;
import
{
getAngularLoader
,
AngularComponent
}
from
'app/core/services/AngularLoader'
;
import
{
Emitter
}
from
'app/core/utils/emitter'
;
import
{
getIntervals
}
from
'app/core/utils/explore'
;
import
{
DataQuery
}
from
'app/types'
;
import
{
RawTimeRange
}
from
'app/types/series'
;
import
'app/features/plugins/plugin_loader'
;
import
{
getTimeSrv
}
from
'app/features/dashboard/time_srv'
;
interface
QueryEditorProps
{
datasource
:
any
;
...
...
@@ -11,6 +14,7 @@ interface QueryEditorProps {
onQueryChange
?:
(
value
:
DataQuery
,
override
?:
boolean
)
=>
void
;
initialQuery
:
DataQuery
;
exploreEvents
:
Emitter
;
range
:
RawTimeRange
;
}
export
default
class
QueryEditor
extends
PureComponent
<
QueryEditorProps
,
any
>
{
...
...
@@ -22,7 +26,9 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
return
;
}
const
{
datasource
,
initialQuery
,
exploreEvents
}
=
this
.
props
;
const
{
datasource
,
initialQuery
,
exploreEvents
,
range
}
=
this
.
props
;
this
.
initTimeSrv
(
range
);
const
loader
=
getAngularLoader
();
const
template
=
'<plugin-component type="query-ctrl"> </plugin-component>'
;
const
target
=
{
datasource
:
datasource
.
name
,
...
initialQuery
};
...
...
@@ -42,8 +48,7 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
getNextQueryLetter
:
x
=>
''
,
},
hideEditorRowActions
:
true
,
interval
:
'1m'
,
intervalMs
:
60000
,
...
getIntervals
(
range
,
datasource
,
null
),
// Possible to get resolution?
},
};
...
...
@@ -56,6 +61,16 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
}
}
initTimeSrv
(
range
)
{
const
timeSrv
=
getTimeSrv
();
timeSrv
.
init
({
time
:
range
,
refresh
:
false
,
getTimezone
:
()
=>
'utc'
,
timeRangeUpdated
:
()
=>
console
.
log
(
'refreshDashboard!'
),
});
}
render
()
{
return
<
div
ref=
{
element
=>
(
this
.
element
=
element
)
}
style=
{
{
width
:
'100%'
}
}
/>;
}
...
...
public/app/features/explore/QueryRows.tsx
View file @
5e7d4bea
...
...
@@ -7,6 +7,7 @@ import { Emitter } from 'app/core/utils/emitter';
import
QueryEditor
from
'./QueryEditor'
;
import
QueryTransactionStatus
from
'./QueryTransactionStatus'
;
import
{
DataSource
,
DataQuery
}
from
'app/types'
;
import
{
RawTimeRange
}
from
'app/types/series'
;
function
getFirstHintFromTransactions
(
transactions
:
QueryTransaction
[]):
QueryHint
{
const
transaction
=
transactions
.
find
(
qt
=>
qt
.
hints
&&
qt
.
hints
.
length
>
0
);
...
...
@@ -30,6 +31,7 @@ interface QueryRowCommonProps {
history
:
HistoryItem
[];
transactions
:
QueryTransaction
[];
exploreEvents
:
Emitter
;
range
:
RawTimeRange
;
}
type
QueryRowProps
=
QueryRowCommonProps
&
...
...
@@ -84,7 +86,7 @@ class QueryRow extends PureComponent<QueryRowProps> {
};
render
()
{
const
{
datasource
,
history
,
initialQuery
,
transactions
,
exploreEvents
}
=
this
.
props
;
const
{
datasource
,
history
,
initialQuery
,
transactions
,
exploreEvents
,
range
}
=
this
.
props
;
const
transactionWithError
=
transactions
.
find
(
t
=>
t
.
error
!==
undefined
);
const
hint
=
getFirstHintFromTransactions
(
transactions
);
const
queryError
=
transactionWithError
?
transactionWithError
.
error
:
null
;
...
...
@@ -116,6 +118,7 @@ class QueryRow extends PureComponent<QueryRowProps> {
onExecuteQuery=
{
this
.
onExecuteQuery
}
initialQuery=
{
initialQuery
}
exploreEvents=
{
exploreEvents
}
range=
{
range
}
/>
)
}
</
div
>
...
...
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