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
7c72f8e0
Commit
7c72f8e0
authored
Nov 16, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
panel options now load even when changing type
parent
f21fe65b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
25 deletions
+39
-25
public/app/features/dashboard/dashgrid/VisualizationTab.tsx
+39
-25
No files found.
public/app/features/dashboard/dashgrid/VisualizationTab.tsx
View file @
7c72f8e0
...
...
@@ -45,49 +45,63 @@ export class VisualizationTab extends PureComponent<Props> {
}
componentDidMount
()
{
this
.
loadAngularOptions
();
if
(
this
.
shouldLoadAngularOptions
())
{
this
.
loadAngularOptions
();
}
}
componentDidUpdate
(
prevProps
:
Props
)
{
console
.
log
(
'VizTab component did update'
);
// if type changed
if
(
this
.
props
.
plugin
!==
prevProps
.
plugin
)
{
this
.
cleanUpAngularOptions
();
}
if
(
this
.
shouldLoadAngularOptions
())
{
this
.
loadAngularOptions
();
}
}
componentDidUpdate
()
{
// in some cases we need to do this after mount because angularPanel was not available on mount
this
.
loadAngularOptions
();
shouldLoadAngularOptions
()
{
return
this
.
props
.
angularPanel
&&
this
.
element
&&
!
this
.
angularOptions
;
}
loadAngularOptions
()
{
const
{
angularPanel
}
=
this
.
props
;
console
.
log
(
'loadAngularOptions angularPanel='
+
angularPanel
);
const
scope
=
angularPanel
.
getScope
();
if
(
!
angularPanel
||
!
this
.
element
||
this
.
angularOptions
)
{
// When full page reloading in edit mode the angular panel has on fully compiled & instantiated yet
if
(
!
scope
.
$$childHead
)
{
setTimeout
(()
=>
{
this
.
forceUpdate
();
});
return
;
}
if
(
angularPanel
)
{
const
scope
=
angularPanel
.
getScope
();
// When full page reloading in edit mode the angular panel has on fully compiled & instantiated yet
if
(
!
scope
.
$$childHead
)
{
setTimeout
(()
=>
{
this
.
forceUpdate
();
});
return
;
}
const
panelCtrl
=
scope
.
$$childHead
.
ctrl
;
const
panelCtrl
=
scope
.
$$childHead
.
ctrl
;
let
template
=
''
;
for
(
let
i
=
0
;
i
<
panelCtrl
.
editorTabs
.
length
;
i
++
)
{
template
+=
'<panel-editor-tab editor-tab="ctrl.editorTabs['
+
i
+
']" ctrl="ctrl"></panel-editor-tab>'
;
}
let
template
=
''
;
for
(
let
i
=
0
;
i
<
panelCtrl
.
editorTabs
.
length
;
i
++
)
{
template
+=
'<panel-editor-tab editor-tab="ctrl.editorTabs['
+
i
+
']" ctrl="ctrl"></panel-editor-tab>'
;
}
const
loader
=
getAngularLoader
();
const
scopeProps
=
{
ctrl
:
panelCtrl
};
const
loader
=
getAngularLoader
();
const
scopeProps
=
{
ctrl
:
panelCtrl
};
this
.
angularOptions
=
loader
.
load
(
this
.
element
,
scopeProps
,
template
);
}
this
.
angularOptions
=
loader
.
load
(
this
.
element
,
scopeProps
,
template
);
}
componentWillUnmount
()
{
this
.
cleanUpAngularOptions
();
}
cleanUpAngularOptions
()
{
if
(
this
.
angularOptions
)
{
this
.
angularOptions
.
destroy
();
this
.
angularOptions
=
null
;
}
}
...
...
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