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
5a207824
Unverified
Commit
5a207824
authored
May 04, 2020
by
Torkel Ödegaard
Committed by
GitHub
May 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NewPanelEdit: Fixes issue with angular panel clean up, and cleanup after leaving edit mode (#24224)
parent
5f621a73
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
public/app/features/dashboard/components/PanelEditor/state/actions.test.ts
+6
-3
public/app/features/dashboard/state/DashboardModel.ts
+1
-0
public/app/features/panel/panel_directive.ts
+3
-0
No files found.
public/app/features/dashboard/components/PanelEditor/state/actions.test.ts
View file @
5a207824
...
@@ -33,7 +33,7 @@ describe('panelEditor actions', () => {
...
@@ -33,7 +33,7 @@ describe('panelEditor actions', () => {
panels
:
[{
id
:
12
,
type
:
'graph'
}],
panels
:
[{
id
:
12
,
type
:
'graph'
}],
});
});
const
panel
=
sourcePanel
.
getEditClone
(
);
const
panel
=
dashboard
.
initEditPanel
(
sourcePanel
);
panel
.
updateOptions
({
prop
:
true
});
panel
.
updateOptions
({
prop
:
true
});
const
state
:
PanelEditorState
=
{
const
state
:
PanelEditorState
=
{
...
@@ -65,7 +65,7 @@ describe('panelEditor actions', () => {
...
@@ -65,7 +65,7 @@ describe('panelEditor actions', () => {
panels
:
[{
id
:
12
,
type
:
'graph'
}],
panels
:
[{
id
:
12
,
type
:
'graph'
}],
});
});
const
panel
=
sourcePanel
.
getEditClone
(
);
const
panel
=
dashboard
.
initEditPanel
(
sourcePanel
);
panel
.
type
=
'table'
;
panel
.
type
=
'table'
;
panel
.
plugin
=
getPanelPlugin
({
id
:
'table'
});
panel
.
plugin
=
getPanelPlugin
({
id
:
'table'
});
panel
.
updateOptions
({
prop
:
true
});
panel
.
updateOptions
({
prop
:
true
});
...
@@ -77,6 +77,8 @@ describe('panelEditor actions', () => {
...
@@ -77,6 +77,8 @@ describe('panelEditor actions', () => {
querySubscription
:
{
unsubscribe
:
jest
.
fn
()
},
querySubscription
:
{
unsubscribe
:
jest
.
fn
()
},
};
};
const
panelDestroy
=
(
panel
.
destroy
=
jest
.
fn
());
const
dispatchedActions
=
await
thunkTester
({
const
dispatchedActions
=
await
thunkTester
({
panelEditor
:
state
,
panelEditor
:
state
,
dashboard
:
{
dashboard
:
{
...
@@ -89,6 +91,7 @@ describe('panelEditor actions', () => {
...
@@ -89,6 +91,7 @@ describe('panelEditor actions', () => {
expect
(
dispatchedActions
.
length
).
toBe
(
3
);
expect
(
dispatchedActions
.
length
).
toBe
(
3
);
expect
(
dispatchedActions
[
0
].
type
).
toBe
(
panelModelAndPluginReady
.
type
);
expect
(
dispatchedActions
[
0
].
type
).
toBe
(
panelModelAndPluginReady
.
type
);
expect
(
sourcePanel
.
plugin
).
toEqual
(
panel
.
plugin
);
expect
(
sourcePanel
.
plugin
).
toEqual
(
panel
.
plugin
);
expect
(
panelDestroy
.
mock
.
calls
.
length
).
toEqual
(
1
);
});
});
it
(
'should discard changes when shouldDiscardChanges is true'
,
async
()
=>
{
it
(
'should discard changes when shouldDiscardChanges is true'
,
async
()
=>
{
...
@@ -101,7 +104,7 @@ describe('panelEditor actions', () => {
...
@@ -101,7 +104,7 @@ describe('panelEditor actions', () => {
panels
:
[{
id
:
12
,
type
:
'graph'
}],
panels
:
[{
id
:
12
,
type
:
'graph'
}],
});
});
const
panel
=
sourcePanel
.
getEditClone
(
);
const
panel
=
dashboard
.
initEditPanel
(
sourcePanel
);
panel
.
updateOptions
({
prop
:
true
});
panel
.
updateOptions
({
prop
:
true
});
const
state
:
PanelEditorState
=
{
const
state
:
PanelEditorState
=
{
...
...
public/app/features/dashboard/state/DashboardModel.ts
View file @
5a207824
...
@@ -341,6 +341,7 @@ export class DashboardModel {
...
@@ -341,6 +341,7 @@ export class DashboardModel {
}
}
exitPanelEditor
()
{
exitPanelEditor
()
{
this
.
panelInEdit
.
destroy
();
this
.
panelInEdit
=
undefined
;
this
.
panelInEdit
=
undefined
;
}
}
...
...
public/app/features/panel/panel_directive.ts
View file @
5a207824
...
@@ -82,6 +82,9 @@ module.directive('grafanaPanel', ($rootScope, $document, $timeout) => {
...
@@ -82,6 +82,9 @@ module.directive('grafanaPanel', ($rootScope, $document, $timeout) => {
scope
.
$on
(
'$destroy'
,
()
=>
{
scope
.
$on
(
'$destroy'
,
()
=>
{
elem
.
off
();
elem
.
off
();
panel
.
events
.
emit
(
PanelEvents
.
panelTeardown
);
panel
.
events
.
removeAllListeners
();
if
(
panelScrollbar
)
{
if
(
panelScrollbar
)
{
panelScrollbar
.
dispose
();
panelScrollbar
.
dispose
();
}
}
...
...
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