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
4e4f69b5
Commit
4e4f69b5
authored
Mar 18, 2020
by
Marcus Efraimsson
Committed by
Arve Knudsen
Mar 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
@grafana/runtime: Add cancellation of queries to DataSourceWithBackend (#22818)
(cherry picked from commit
eb96a8fc
)
parent
a4b7209e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
packages/grafana-runtime/src/utils/DataSourceWithBackend.ts
+9
-7
No files found.
packages/grafana-runtime/src/utils/DataSourceWithBackend.ts
View file @
4e4f69b5
...
...
@@ -37,13 +37,10 @@ export class DataSourceWithBackend<
* Ideally final -- any other implementation may not work as expected
*/
query
(
request
:
DataQueryRequest
):
Observable
<
DataQueryResponse
>
{
const
{
targets
,
intervalMs
,
maxDataPoints
,
range
}
=
request
;
let
expressionCount
=
0
;
const
{
targets
,
intervalMs
,
maxDataPoints
,
range
,
requestId
}
=
request
;
const
orgId
=
config
.
bootData
.
user
.
orgId
;
const
queries
=
targets
.
map
(
q
=>
{
if
(
q
.
datasource
===
ExpressionDatasourceID
)
{
expressionCount
++
;
return
{
...
q
,
datasourceId
:
this
.
id
,
...
...
@@ -65,7 +62,6 @@ export class DataSourceWithBackend<
});
const
body
:
any
=
{
expressionCount
,
queries
,
};
if
(
range
)
{
...
...
@@ -75,10 +71,16 @@ export class DataSourceWithBackend<
}
const
req
:
Promise
<
DataQueryResponse
>
=
getBackendSrv
()
.
post
(
'/api/ds/query'
,
body
)
.
datasourceRequest
({
url
:
'/api/ds/query'
,
method
:
'POST'
,
data
:
body
,
requestId
,
})
.
then
((
rsp
:
any
)
=>
{
return
this
.
toDataQueryResponse
(
rsp
);
return
this
.
toDataQueryResponse
(
rsp
?.
data
);
});
return
from
(
req
);
}
...
...
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