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
f8393fb3
Unverified
Commit
f8393fb3
authored
May 06, 2019
by
Torkel Ödegaard
Committed by
GitHub
May 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PanelModel: Clear queryRunner on destroy (#16906)
* PanelModel: Clear queryRunner on destroy * fix test asumptions
parent
48ae9304
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
public/app/features/dashboard/state/PanelModel.test.ts
+13
-7
public/app/features/dashboard/state/PanelModel.ts
+1
-0
public/app/features/dashboard/state/PanelQueryState.ts
+1
-1
No files found.
public/app/features/dashboard/state/PanelModel.test.ts
View file @
f8393fb3
...
@@ -87,10 +87,7 @@ describe('PanelModel', () => {
...
@@ -87,10 +87,7 @@ describe('PanelModel', () => {
});
});
describe
(
'when changing panel type'
,
()
=>
{
describe
(
'when changing panel type'
,
()
=>
{
let
panelQueryRunner
:
any
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
panelQueryRunner
=
model
.
getQueryRunner
();
model
.
changePlugin
(
getPanelPlugin
({
id
:
'graph'
}));
model
.
changePlugin
(
getPanelPlugin
({
id
:
'graph'
}));
model
.
alert
=
{
id
:
2
};
model
.
alert
=
{
id
:
2
};
});
});
...
@@ -109,9 +106,9 @@ describe('PanelModel', () => {
...
@@ -109,9 +106,9 @@ describe('PanelModel', () => {
expect
(
model
.
alert
).
toBe
(
undefined
);
expect
(
model
.
alert
).
toBe
(
undefined
);
});
});
it
(
'
getQueryRunner() should return same instance after plugin change
'
,
()
=>
{
it
(
'
panelQueryRunner should be cleared
'
,
()
=>
{
const
sameQueryRunner
=
model
.
getQueryRunner
()
;
const
panelQueryRunner
=
(
model
as
any
).
queryRunner
;
expect
(
panelQueryRunner
).
toBe
(
sameQueryRunner
);
expect
(
panelQueryRunner
).
toBe
Falsy
(
);
});
});
});
});
...
@@ -131,12 +128,15 @@ describe('PanelModel', () => {
...
@@ -131,12 +128,15 @@ describe('PanelModel', () => {
});
});
});
});
describe
(
'when changing to react panel'
,
()
=>
{
describe
(
'when changing to react panel from angular panel'
,
()
=>
{
let
panelQueryRunner
:
any
;
const
onPanelTypeChanged
=
jest
.
fn
();
const
onPanelTypeChanged
=
jest
.
fn
();
const
reactPlugin
=
getPanelPlugin
({
id
:
'react'
}).
setPanelChangeHandler
(
onPanelTypeChanged
as
any
);
const
reactPlugin
=
getPanelPlugin
({
id
:
'react'
}).
setPanelChangeHandler
(
onPanelTypeChanged
as
any
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
model
.
changePlugin
(
reactPlugin
);
model
.
changePlugin
(
reactPlugin
);
panelQueryRunner
=
model
.
getQueryRunner
();
});
});
it
(
'should call react onPanelTypeChanged'
,
()
=>
{
it
(
'should call react onPanelTypeChanged'
,
()
=>
{
...
@@ -144,6 +144,12 @@ describe('PanelModel', () => {
...
@@ -144,6 +144,12 @@ describe('PanelModel', () => {
expect
(
onPanelTypeChanged
.
mock
.
calls
[
0
][
1
]).
toBe
(
'table'
);
expect
(
onPanelTypeChanged
.
mock
.
calls
[
0
][
1
]).
toBe
(
'table'
);
expect
(
onPanelTypeChanged
.
mock
.
calls
[
0
][
2
].
thresholds
).
toBeDefined
();
expect
(
onPanelTypeChanged
.
mock
.
calls
[
0
][
2
].
thresholds
).
toBeDefined
();
});
});
it
(
'getQueryRunner() should return same instance after changing to another react panel'
,
()
=>
{
model
.
changePlugin
(
getPanelPlugin
({
id
:
'react2'
}));
const
sameQueryRunner
=
model
.
getQueryRunner
();
expect
(
panelQueryRunner
).
toBe
(
sameQueryRunner
);
});
});
});
describe
(
'get panel options'
,
()
=>
{
describe
(
'get panel options'
,
()
=>
{
...
...
public/app/features/dashboard/state/PanelModel.ts
View file @
f8393fb3
...
@@ -336,6 +336,7 @@ export class PanelModel {
...
@@ -336,6 +336,7 @@ export class PanelModel {
if
(
this
.
queryRunner
)
{
if
(
this
.
queryRunner
)
{
this
.
queryRunner
.
destroy
();
this
.
queryRunner
.
destroy
();
this
.
queryRunner
=
null
;
}
}
}
}
}
}
...
...
public/app/features/dashboard/state/PanelQueryState.ts
View file @
f8393fb3
...
@@ -41,7 +41,7 @@ export class PanelQueryState {
...
@@ -41,7 +41,7 @@ export class PanelQueryState {
sendLegacy
=
false
;
sendLegacy
=
false
;
// A promise for the running query
// A promise for the running query
private
executor
?:
Promise
<
PanelData
>
;
private
executor
?:
Promise
<
PanelData
>
=
null
;
private
rejector
=
(
reason
?:
any
)
=>
{};
private
rejector
=
(
reason
?:
any
)
=>
{};
private
datasource
:
DataSourceApi
=
{}
as
any
;
private
datasource
:
DataSourceApi
=
{}
as
any
;
...
...
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