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
Hide 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> {
...
@@ -897,6 +897,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
onRemoveQueryRow=
{
this
.
onRemoveQueryRow
}
onRemoveQueryRow=
{
this
.
onRemoveQueryRow
}
transactions=
{
queryTransactions
}
transactions=
{
queryTransactions
}
exploreEvents=
{
this
.
exploreEvents
}
exploreEvents=
{
this
.
exploreEvents
}
range=
{
range
}
/>
/>
<
main
className=
"m-t-2"
>
<
main
className=
"m-t-2"
>
<
ErrorBoundary
>
<
ErrorBoundary
>
...
...
public/app/features/explore/QueryEditor.tsx
View file @
5e7d4bea
import
React
,
{
PureComponent
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
{
getAngularLoader
,
AngularComponent
}
from
'app/core/services/AngularLoader'
;
import
{
getAngularLoader
,
AngularComponent
}
from
'app/core/services/AngularLoader'
;
import
{
Emitter
}
from
'app/core/utils/emitter'
;
import
{
Emitter
}
from
'app/core/utils/emitter'
;
import
{
getIntervals
}
from
'app/core/utils/explore'
;
import
{
DataQuery
}
from
'app/types'
;
import
{
DataQuery
}
from
'app/types'
;
import
{
RawTimeRange
}
from
'app/types/series'
;
import
'app/features/plugins/plugin_loader'
;
import
'app/features/plugins/plugin_loader'
;
import
{
getTimeSrv
}
from
'app/features/dashboard/time_srv'
;
interface
QueryEditorProps
{
interface
QueryEditorProps
{
datasource
:
any
;
datasource
:
any
;
...
@@ -11,6 +14,7 @@ interface QueryEditorProps {
...
@@ -11,6 +14,7 @@ interface QueryEditorProps {
onQueryChange
?:
(
value
:
DataQuery
,
override
?:
boolean
)
=>
void
;
onQueryChange
?:
(
value
:
DataQuery
,
override
?:
boolean
)
=>
void
;
initialQuery
:
DataQuery
;
initialQuery
:
DataQuery
;
exploreEvents
:
Emitter
;
exploreEvents
:
Emitter
;
range
:
RawTimeRange
;
}
}
export
default
class
QueryEditor
extends
PureComponent
<
QueryEditorProps
,
any
>
{
export
default
class
QueryEditor
extends
PureComponent
<
QueryEditorProps
,
any
>
{
...
@@ -22,7 +26,9 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
...
@@ -22,7 +26,9 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
return
;
return
;
}
}
const
{
datasource
,
initialQuery
,
exploreEvents
}
=
this
.
props
;
const
{
datasource
,
initialQuery
,
exploreEvents
,
range
}
=
this
.
props
;
this
.
initTimeSrv
(
range
);
const
loader
=
getAngularLoader
();
const
loader
=
getAngularLoader
();
const
template
=
'<plugin-component type="query-ctrl"> </plugin-component>'
;
const
template
=
'<plugin-component type="query-ctrl"> </plugin-component>'
;
const
target
=
{
datasource
:
datasource
.
name
,
...
initialQuery
};
const
target
=
{
datasource
:
datasource
.
name
,
...
initialQuery
};
...
@@ -42,8 +48,7 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
...
@@ -42,8 +48,7 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
getNextQueryLetter
:
x
=>
''
,
getNextQueryLetter
:
x
=>
''
,
},
},
hideEditorRowActions
:
true
,
hideEditorRowActions
:
true
,
interval
:
'1m'
,
...
getIntervals
(
range
,
datasource
,
null
),
// Possible to get resolution?
intervalMs
:
60000
,
},
},
};
};
...
@@ -56,6 +61,16 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
...
@@ -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
()
{
render
()
{
return
<
div
ref=
{
element
=>
(
this
.
element
=
element
)
}
style=
{
{
width
:
'100%'
}
}
/>;
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';
...
@@ -7,6 +7,7 @@ import { Emitter } from 'app/core/utils/emitter';
import
QueryEditor
from
'./QueryEditor'
;
import
QueryEditor
from
'./QueryEditor'
;
import
QueryTransactionStatus
from
'./QueryTransactionStatus'
;
import
QueryTransactionStatus
from
'./QueryTransactionStatus'
;
import
{
DataSource
,
DataQuery
}
from
'app/types'
;
import
{
DataSource
,
DataQuery
}
from
'app/types'
;
import
{
RawTimeRange
}
from
'app/types/series'
;
function
getFirstHintFromTransactions
(
transactions
:
QueryTransaction
[]):
QueryHint
{
function
getFirstHintFromTransactions
(
transactions
:
QueryTransaction
[]):
QueryHint
{
const
transaction
=
transactions
.
find
(
qt
=>
qt
.
hints
&&
qt
.
hints
.
length
>
0
);
const
transaction
=
transactions
.
find
(
qt
=>
qt
.
hints
&&
qt
.
hints
.
length
>
0
);
...
@@ -30,6 +31,7 @@ interface QueryRowCommonProps {
...
@@ -30,6 +31,7 @@ interface QueryRowCommonProps {
history
:
HistoryItem
[];
history
:
HistoryItem
[];
transactions
:
QueryTransaction
[];
transactions
:
QueryTransaction
[];
exploreEvents
:
Emitter
;
exploreEvents
:
Emitter
;
range
:
RawTimeRange
;
}
}
type
QueryRowProps
=
QueryRowCommonProps
&
type
QueryRowProps
=
QueryRowCommonProps
&
...
@@ -84,7 +86,7 @@ class QueryRow extends PureComponent<QueryRowProps> {
...
@@ -84,7 +86,7 @@ class QueryRow extends PureComponent<QueryRowProps> {
};
};
render
()
{
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
transactionWithError
=
transactions
.
find
(
t
=>
t
.
error
!==
undefined
);
const
hint
=
getFirstHintFromTransactions
(
transactions
);
const
hint
=
getFirstHintFromTransactions
(
transactions
);
const
queryError
=
transactionWithError
?
transactionWithError
.
error
:
null
;
const
queryError
=
transactionWithError
?
transactionWithError
.
error
:
null
;
...
@@ -116,6 +118,7 @@ class QueryRow extends PureComponent<QueryRowProps> {
...
@@ -116,6 +118,7 @@ class QueryRow extends PureComponent<QueryRowProps> {
onExecuteQuery=
{
this
.
onExecuteQuery
}
onExecuteQuery=
{
this
.
onExecuteQuery
}
initialQuery=
{
initialQuery
}
initialQuery=
{
initialQuery
}
exploreEvents=
{
exploreEvents
}
exploreEvents=
{
exploreEvents
}
range=
{
range
}
/>
/>
)
}
)
}
</
div
>
</
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