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
5ceaa21e
Unverified
Commit
5ceaa21e
authored
Aug 30, 2018
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
when changing table, refresh panel once after columns have been changed
parent
a06a6b65
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
public/app/plugins/datasource/postgres/query_ctrl.ts
+17
-14
No files found.
public/app/plugins/datasource/postgres/query_ctrl.ts
View file @
5ceaa21e
...
@@ -201,26 +201,26 @@ export class PostgresQueryCtrl extends QueryCtrl {
...
@@ -201,26 +201,26 @@ export class PostgresQueryCtrl extends QueryCtrl {
tableChanged
()
{
tableChanged
()
{
this
.
target
.
table
=
this
.
tableSegment
.
value
;
this
.
target
.
table
=
this
.
tableSegment
.
value
;
this
.
datasource
.
metricFindQuery
(
this
.
metaBuilder
.
buildColumnQuery
(
'time'
)).
then
(
result
=>
{
let
task1
=
this
.
datasource
.
metricFindQuery
(
this
.
metaBuilder
.
buildColumnQuery
(
'time'
)).
then
(
result
=>
{
// check if time column is still valid
// check if time column is still valid
if
(
result
.
length
>
0
)
{
if
(
result
.
length
>
0
&&
!
_
.
find
(
result
,
(
r
:
any
)
=>
r
.
text
===
this
.
target
.
timeColumn
))
{
if
(
!
_
.
find
(
result
,
(
r
:
any
)
=>
r
.
text
===
this
.
target
.
timeColumn
))
{
let
segment
=
this
.
uiSegmentSrv
.
newSegment
(
result
[
0
].
text
);
let
segment
=
this
.
uiSegmentSrv
.
newSegment
(
result
[
0
].
text
);
this
.
timeColumnSegment
.
html
=
segment
.
html
;
this
.
timeColumnSegment
.
html
=
segment
.
html
;
this
.
timeColumnSegment
.
value
=
segment
.
value
;
this
.
timeColumnSegment
.
value
=
segment
.
value
;
this
.
timeColumnChanged
();
return
this
.
timeColumnChanged
(
false
);
}
}
}
});
});
let
task2
=
this
.
datasource
.
metricFindQuery
(
this
.
metaBuilder
.
buildColumnQuery
(
'value'
)).
then
(
result
=>
{
this
.
datasource
.
metricFindQuery
(
this
.
metaBuilder
.
buildColumnQuery
(
'value'
)).
then
(
result
=>
{
if
(
result
.
length
>
0
)
{
if
(
result
.
length
>
0
)
{
this
.
target
.
select
=
[[{
type
:
'column'
,
params
:
[
result
[
0
].
text
]
}]];
this
.
target
.
select
=
[[{
type
:
'column'
,
params
:
[
result
[
0
].
text
]
}]];
this
.
target
.
where
=
[];
this
.
target
.
where
=
[];
this
.
target
.
group
=
[];
this
.
target
.
group
=
[];
}
}
this
.
updateProjection
();
this
.
updateProjection
();
});
this
.
$q
.
all
([
task1
,
task2
]).
then
(()
=>
{
this
.
panelCtrl
.
refresh
();
this
.
panelCtrl
.
refresh
();
});
});
}
}
...
@@ -232,9 +232,9 @@ export class PostgresQueryCtrl extends QueryCtrl {
...
@@ -232,9 +232,9 @@ export class PostgresQueryCtrl extends QueryCtrl {
.
catch
(
this
.
handleQueryError
.
bind
(
this
));
.
catch
(
this
.
handleQueryError
.
bind
(
this
));
}
}
timeColumnChanged
()
{
timeColumnChanged
(
refresh
?:
boolean
)
{
this
.
target
.
timeColumn
=
this
.
timeColumnSegment
.
value
;
this
.
target
.
timeColumn
=
this
.
timeColumnSegment
.
value
;
this
.
datasource
.
metricFindQuery
(
this
.
metaBuilder
.
buildDatatypeQuery
(
this
.
target
.
timeColumn
)).
then
(
result
=>
{
return
this
.
datasource
.
metricFindQuery
(
this
.
metaBuilder
.
buildDatatypeQuery
(
this
.
target
.
timeColumn
)).
then
(
result
=>
{
if
(
result
.
length
===
1
)
{
if
(
result
.
length
===
1
)
{
if
(
this
.
target
.
timeColumnType
!==
result
[
0
].
text
)
{
if
(
this
.
target
.
timeColumnType
!==
result
[
0
].
text
)
{
this
.
target
.
timeColumnType
=
result
[
0
].
text
;
this
.
target
.
timeColumnType
=
result
[
0
].
text
;
...
@@ -253,9 +253,12 @@ export class PostgresQueryCtrl extends QueryCtrl {
...
@@ -253,9 +253,12 @@ export class PostgresQueryCtrl extends QueryCtrl {
}
}
}
}
}
}
this
.
updatePersistedParts
();
if
(
refresh
!==
false
)
{
this
.
panelCtrl
.
refresh
();
}
});
});
this
.
updatePersistedParts
();
this
.
panelCtrl
.
refresh
();
}
}
getMetricColumnSegments
()
{
getMetricColumnSegments
()
{
...
...
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