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
db2a15da
Commit
db2a15da
authored
Jan 21, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed loading of default query editor
parent
96d28703
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
public/app/features/dashboard/panel_editor/QueriesTab.tsx
+1
-1
public/app/features/dashboard/panel_editor/QueryEditorRow.tsx
+8
-6
No files found.
public/app/features/dashboard/panel_editor/QueriesTab.tsx
View file @
db2a15da
...
@@ -197,7 +197,7 @@ export class QueriesTab extends PureComponent<Props, State> {
...
@@ -197,7 +197,7 @@ export class QueriesTab extends PureComponent<Props, State> {
<
div
className=
"query-editor-rows"
>
<
div
className=
"query-editor-rows"
>
{
panel
.
targets
.
map
((
query
,
index
)
=>
(
{
panel
.
targets
.
map
((
query
,
index
)
=>
(
<
QueryEditorRow
<
QueryEditorRow
data
sourceNam
e=
{
query
.
datasource
||
panel
.
datasource
}
data
SourceValu
e=
{
query
.
datasource
||
panel
.
datasource
}
key=
{
query
.
refId
}
key=
{
query
.
refId
}
panel=
{
panel
}
panel=
{
panel
}
query=
{
query
}
query=
{
query
}
...
...
public/app/features/dashboard/panel_editor/QueryEditorRow.tsx
View file @
db2a15da
...
@@ -18,11 +18,12 @@ interface Props {
...
@@ -18,11 +18,12 @@ interface Props {
onAddQuery
:
(
query
?:
DataQuery
)
=>
void
;
onAddQuery
:
(
query
?:
DataQuery
)
=>
void
;
onRemoveQuery
:
(
query
:
DataQuery
)
=>
void
;
onRemoveQuery
:
(
query
:
DataQuery
)
=>
void
;
onMoveQuery
:
(
query
:
DataQuery
,
direction
:
number
)
=>
void
;
onMoveQuery
:
(
query
:
DataQuery
,
direction
:
number
)
=>
void
;
data
sourceNam
e
:
string
|
null
;
data
SourceValu
e
:
string
|
null
;
inMixedMode
:
boolean
;
inMixedMode
:
boolean
;
}
}
interface
State
{
interface
State
{
loadedDataSourceValue
:
string
|
null
|
undefined
;
datasource
:
DataSourceApi
|
null
;
datasource
:
DataSourceApi
|
null
;
isCollapsed
:
boolean
;
isCollapsed
:
boolean
;
angularScope
:
AngularQueryComponentScope
|
null
;
angularScope
:
AngularQueryComponentScope
|
null
;
...
@@ -36,6 +37,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
...
@@ -36,6 +37,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
datasource
:
null
,
datasource
:
null
,
isCollapsed
:
false
,
isCollapsed
:
false
,
angularScope
:
null
,
angularScope
:
null
,
loadedDataSourceValue
:
undefined
,
};
};
componentDidMount
()
{
componentDidMount
()
{
...
@@ -61,14 +63,14 @@ export class QueryEditorRow extends PureComponent<Props, State> {
...
@@ -61,14 +63,14 @@ export class QueryEditorRow extends PureComponent<Props, State> {
const
dataSourceSrv
=
getDatasourceSrv
();
const
dataSourceSrv
=
getDatasourceSrv
();
const
datasource
=
await
dataSourceSrv
.
get
(
query
.
datasource
||
panel
.
datasource
);
const
datasource
=
await
dataSourceSrv
.
get
(
query
.
datasource
||
panel
.
datasource
);
this
.
setState
({
datasource
});
this
.
setState
({
datasource
,
loadedDataSourceValue
:
this
.
props
.
dataSourceValue
});
}
}
componentDidUpdate
()
{
componentDidUpdate
()
{
const
{
datasourc
e
}
=
this
.
state
;
const
{
loadedDataSourceValu
e
}
=
this
.
state
;
// check if we need to load another datasource
// check if we need to load another datasource
if
(
datasource
&&
datasource
.
name
!==
this
.
props
.
datasourceNam
e
)
{
if
(
loadedDataSourceValue
!==
this
.
props
.
dataSourceValu
e
)
{
if
(
this
.
angularQueryEditor
)
{
if
(
this
.
angularQueryEditor
)
{
this
.
angularQueryEditor
.
destroy
();
this
.
angularQueryEditor
.
destroy
();
this
.
angularQueryEditor
=
null
;
this
.
angularQueryEditor
=
null
;
...
@@ -178,7 +180,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
...
@@ -178,7 +180,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
}
}
render
()
{
render
()
{
const
{
query
,
datasourceName
,
inMixedMode
}
=
this
.
props
;
const
{
query
,
inMixedMode
}
=
this
.
props
;
const
{
datasource
,
isCollapsed
}
=
this
.
state
;
const
{
datasource
,
isCollapsed
}
=
this
.
state
;
const
isDisabled
=
query
.
hide
;
const
isDisabled
=
query
.
hide
;
...
@@ -202,7 +204,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
...
@@ -202,7 +204,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
{
isCollapsed
&&
<
i
className=
"fa fa-caret-right"
/>
}
{
isCollapsed
&&
<
i
className=
"fa fa-caret-right"
/>
}
{
!
isCollapsed
&&
<
i
className=
"fa fa-caret-down"
/>
}
{
!
isCollapsed
&&
<
i
className=
"fa fa-caret-down"
/>
}
<
span
>
{
query
.
refId
}
</
span
>
<
span
>
{
query
.
refId
}
</
span
>
{
inMixedMode
&&
<
em
className=
"query-editor-row__context-info"
>
(
{
datasource
N
ame
}
)
</
em
>
}
{
inMixedMode
&&
<
em
className=
"query-editor-row__context-info"
>
(
{
datasource
.
n
ame
}
)
</
em
>
}
{
isDisabled
&&
<
em
className=
"query-editor-row__context-info"
>
Disabled
</
em
>
}
{
isDisabled
&&
<
em
className=
"query-editor-row__context-info"
>
Disabled
</
em
>
}
</
div
>
</
div
>
<
div
className=
"query-editor-row__collapsed-text"
onClick=
{
this
.
onToggleEditMode
}
>
<
div
className=
"query-editor-row__collapsed-text"
onClick=
{
this
.
onToggleEditMode
}
>
...
...
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